osutil

package
v0.0.0-...-d6cb8d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2015 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package osutil provides operating system-specific path information, and other utility functions.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("operation not supported")

ErrNotSupported is returned by functions (like Mkfifo and Mksocket) when the underlying operating system or environment doesn't support the operation.

Functions

func AddSecretRingFlag

func AddSecretRingFlag()

func CPUUsage

func CPUUsage() time.Duration

CPUUsage returns how much cumulative user CPU time the process has used. On unsupported operating systems, it returns zero.

func CacheDir

func CacheDir() string

func CamliBlobRoot

func CamliBlobRoot() string

func CamliConfigDir

func CamliConfigDir() string

func CamliVarDir

func CamliVarDir() string

func DefaultSecretRingFile

func DefaultSecretRingFile() string

DefaultSecretRingFile returns the path to the default GPG secret keyring. It is not influenced by any flag or CAMLI* env var.

func DefaultTLSCert

func DefaultTLSCert() string

DefaultTLSCert returns the path to the default TLS certificate file that is used (creating if necessary) when TLS is specified without the cert file.

func DefaultTLSKey

func DefaultTLSKey() string

DefaultTLSKey returns the path to the default TLS key file that is used (creating if necessary) when TLS is specified without the key file.

func DieOnParentDeath

func DieOnParentDeath()

DieOnParentDeath starts a goroutine that regularly checks that the current process can find its parent, and calls os.Exit(0) as soon as it cannot.

func DirExists

func DirExists(dir string) bool

DirExists reports whether dir exists. Errors are ignored and are reported as false.

func ExplicitSecretRingFile

func ExplicitSecretRingFile() (string, bool)

ExplicitSecretRingFile returns the path to the user's GPG secret ring file and true if it was ever set through the --secret-keyring flag or the CAMLI_SECRET_RING var. It returns "", false otherwise. Use of this function requires the program to call AddSecretRingFlag, and before flag.Parse is called.

func FindCamliInclude

func FindCamliInclude(configFile string) (absPath string, err error)

Find the correct absolute path corresponding to a relative path, searching the following sequence of directories: 1. Working Directory 2. CAMLI_CONFIG_DIR (deprecated, will complain if this is on env) 3. (windows only) APPDATA/camli 4. All directories in CAMLI_INCLUDE_PATH (standard PATH form for OS)

func GoPackagePath

func GoPackagePath(pkg string) (path string, err error)

GoPackagePath returns the path to the provided Go package's source directory. pkg may be a path prefix without any *.go files. The error is os.ErrNotExist if GOPATH is unset or the directory doesn't exist in any GOPATH component.

func HomeDir

func HomeDir() string

HomeDir returns the path to the user's home directory. It returns the empty string if the value isn't known.

func MemUsage

func MemUsage() int64

MemUsage returns the number of bytes used by the process. On unsupported operating systems, it returns zero.

func Mkfifo

func Mkfifo(path string, mode uint32) error

func Mksocket

func Mksocket(path string) error

Mksocket creates a socket file (a Unix Domain Socket) named path.

func OpenURL

func OpenURL(url string) error

func RegisterConfigDirFunc

func RegisterConfigDirFunc(f func() string)

RegisterConfigDirFunc registers a func f to return the Camlistore configuration directory. It may skip by returning the empty string.

func RestartProcess

func RestartProcess() error

RestartProcess returns an error if things couldn't be restarted. On success, this function never returns because the process becomes the new process.

func SecretRingFile

func SecretRingFile() string

SecretRingFile returns the path to the user's GPG secret ring file. The value comes from either the --secret-keyring flag (if previously registered with AddSecretRingFlag), or the CAMLI_SECRET_RING environment variable, or the operating system default location.

func SelfPath

func SelfPath() (string, error)

SelfPath returns the path of the executable for the currently running process. At least on linux, the returned path is a symlink to the actual executable.

func UserClientConfigPath

func UserClientConfigPath() string

func UserServerConfigPath

func UserServerConfigPath() string

func Username

func Username() string

Username returns the current user's username, as reported by the relevant environment variable.

Types

This section is empty.

Directories

Path Synopsis
Package gce configures hooks for running Camlistore for Google Compute Engine.
Package gce configures hooks for running Camlistore for Google Compute Engine.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL