cockroach: Index | Files

package sysutil

import ""

Package sysutil is a cross-platform compatibility layer on top of package syscall. It exposes APIs for common operations that require package syscall and re-exports several symbols from package syscall that are known to be safe. Using package syscall directly from other packages is forbidden.


Package Files

large_file_linux.go sysutil.go sysutil_unix.go


const (

Exported syscall.Errno constants.

func CreateLargeFile Uses

func CreateLargeFile(path string, bytes int64) error

CreateLargeFile creates a large file at the given path with bytes size. On Linux, it uses the fallocate syscall to efficiently create a file of the given size. On other platforms, it naively writes the specified number of bytes, which can take a long time.

func ExitStatus Uses

func ExitStatus(err *exec.ExitError) int

ExitStatus returns the exit status contained within an exec.ExitError.

func IsCrossDeviceLinkErrno Uses

func IsCrossDeviceLinkErrno(errno error) bool

IsCrossDeviceLinkErrno checks whether the given error object (as extracted from an *os.LinkError) is a cross-device link/rename error.

func IsErrConnectionRefused Uses

func IsErrConnectionRefused(err error) bool

IsErrConnectionRefused returns true if an error is a "connection refused" error.

func IsErrConnectionReset Uses

func IsErrConnectionReset(err error) bool

IsErrConnectionReset returns true if an error is a "connection reset by peer" error.

func ProcessIdentity Uses

func ProcessIdentity() string

ProcessIdentity returns a string describing the user and group that this process is running as.

func RefreshSignaledChan Uses

func RefreshSignaledChan() <-chan os.Signal

RefreshSignaledChan returns a channel that will receive an os.Signal whenever the process receives a "refresh" signal (currently SIGHUP). A refresh signal indicates that the user wants to apply nondisruptive updates, like reloading certificates and flushing log files.

On Windows, the returned channel will never receive any values, as Windows does not support signals. Consider exposing a refresh trigger through other means if Windows support is important.

func StatAndLinkCount Uses

func StatAndLinkCount(path string) (os.FileInfo, int64, error)

StatAndLinkCount wraps os.Stat, returning its result and, if the platform supports it, the link-count from the returned file info.

type Errno Uses

type Errno = syscall.Errno

Errno is syscall.Errno.

type FSInfo Uses

type FSInfo struct {
    FreeBlocks  int64
    AvailBlocks int64
    TotalBlocks int64
    BlockSize   int64

FSInfo describes a filesystem. It is returned by StatFS.

func StatFS Uses

func StatFS(path string) (*FSInfo, error)

StatFS returns an FSInfo describing the named filesystem. It is only supported on Unix-like platforms.

type Signal Uses

type Signal = syscall.Signal

Signal is syscall.Signal.

Package sysutil imports 8 packages (graph) and is imported by 44 packages. Updated 2020-05-14. Refresh now. Tools for package owners.