Documentation ¶
Overview ¶
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.
Index ¶
- Constants
- func CreateLargeFile(path string, bytes int64) error
- func ExitStatus(err *exec.ExitError) int
- func IsCrossDeviceLinkErrno(errno error) bool
- func IsErrConnectionRefused(err error) bool
- func IsErrConnectionReset(err error) bool
- func ProcessIdentity() string
- func RefreshSignaledChan() <-chan os.Signal
- func StatAndLinkCount(path string) (os.FileInfo, int64, error)
- type Errno
- type FSInfo
- type Signal
Constants ¶
const ( ECONNRESET = syscall.ECONNRESET ECONNREFUSED = syscall.ECONNREFUSED )
Exported syscall.Errno constants.
Variables ¶
This section is empty.
Functions ¶
func CreateLargeFile ¶
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 ¶
ExitStatus returns the exit status contained within an exec.ExitError.
func IsCrossDeviceLinkErrno ¶
IsCrossDeviceLinkErrno checks whether the given error object (as extracted from an *os.LinkError) is a cross-device link/rename error.
func IsErrConnectionRefused ¶
IsErrConnectionRefused returns true if an error is a "connection refused" error.
func IsErrConnectionReset ¶
IsErrConnectionReset returns true if an error is a "connection reset by peer" error.
func ProcessIdentity ¶
func ProcessIdentity() string
ProcessIdentity returns a string describing the user and group that this process is running as.
func RefreshSignaledChan ¶
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.