Documentation
¶
Index ¶
- Constants
- func ConvertStat(dest *Stat_t, source any) error
- func Dup(oldfd int) (int, error)
- func Dup2(oldfd int, newfd int) error
- func Dup3(oldfd int, newfd int, flags int) error
- func Fallocate(fd int, mode uint32, off int64, len int64) error
- func Fstat(fd int, stat *Stat_t) error
- func GetDeviceSize(device string) (uint64, error)
- func GetFileDescriptorLimit() (uint64, uint64, error)
- func Getrusage(who int, rusage *Rusage) error
- func Ioctl(fd int, request, argp uintptr) error
- func Lstat(path string, statbuf *Stat_t) error
- func Mkfifo(path string, mode uint32) error
- func Mknod(path string, mode uint32, dev int) error
- func Mount(source string, target string, fstype string, flags uintptr, data string) error
- func Reboot() error
- func SetAllGid(gid int) error
- func SetAllUid(uid int) error
- func SetMyPriority(priority int) error
- func SetNetNamespace(fd int) error
- func SetPriority(pid, priority int) error
- func SetSysProcAttrChroot(attr *syscall.SysProcAttr, chroot string) error
- func Stat(path string, statbuf *Stat_t) error
- func Statfs(path string, buf *Statfs_t) error
- func Sync() error
- func Unmount(target string, flags int) error
- func UnshareMountNamespace() error
- func UnshareNetNamespace() (fd int, tid int, err error)
- type Rusage
- type Stat_t
- type Statfs_t
- type Timeval
Constants ¶
const ( FALLOC_FL_COLLAPSE_RANGE = 0x8 FALLOC_FL_INSERT_RANGE = 0x20 FALLOC_FL_KEEP_SIZE = 0x1 FALLOC_FL_NO_HIDE_STALE = 0x4 FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 MS_BIND = 1 << iota MS_RDONLY RUSAGE_CHILDREN = iota RUSAGE_SELF RUSAGE_THREAD )
const ( S_IFBLK = syscall.S_IFBLK S_IFCHR = syscall.S_IFCHR S_IFDIR = syscall.S_IFDIR S_IFIFO = syscall.S_IFIFO S_IFLNK = syscall.S_IFLNK S_IFMT = syscall.S_IFMT S_IFREG = syscall.S_IFREG S_IFSOCK = syscall.S_IFSOCK S_IREAD = syscall.S_IREAD S_IRGRP = syscall.S_IRGRP S_IROTH = syscall.S_IROTH S_IRUSR = syscall.S_IRUSR S_IRWXG = syscall.S_IRWXG S_IRWXO = syscall.S_IRWXO S_IRWXU = syscall.S_IRWXU S_ISGID = syscall.S_ISGID S_ISUID = syscall.S_ISUID S_ISVTX = syscall.S_ISVTX S_IWGRP = syscall.S_IWGRP S_IWOTH = syscall.S_IWOTH S_IWRITE = syscall.S_IWRITE S_IWUSR = syscall.S_IWUSR S_IXGRP = syscall.S_IXGRP S_IXOTH = syscall.S_IXOTH S_IXUSR = syscall.S_IXUSR BLKGETSIZE = 0x00001260 )
Variables ¶
This section is empty.
Functions ¶
func ConvertStat ¶ added in v0.4.0
ConvertStat will convert a *syscall.Stat_t to a *Stat_t. It returns an error if buf is not of type *syscall.Stat_t.
func GetDeviceSize ¶ added in v0.4.0
func GetFileDescriptorLimit ¶ added in v0.3.2
GetFileDescriptorLimit returns the current limit and maximum limit on number of open file descriptors.
func SetMyPriority ¶ added in v0.3.2
SetMyPriority sets the priority of the current process, for all OS threads. On platforms which do not support changing the process priority, an error is always returned.
func SetNetNamespace ¶
SetNetNamespace is a safe wrapper for the Linux setns(fd, CLONE_NEWNET) system call. On Linux it will lock the current goroutine to an OS thread and set the network namespace to the specified file descriptor. On failure or on other platforms an error is returned.
func SetPriority ¶ added in v0.4.0
SetPriority sets the CPU priority of the specified process, for all OS threads. If pid is zero, the priority of the calling process is set. On platforms which do not support changing the process priority, an error is always returned.
func SetSysProcAttrChroot ¶ added in v0.4.0
func SetSysProcAttrChroot(attr *syscall.SysProcAttr, chroot string) error
SetSysProcAttrChroot sets the Chroot field in attr. It returns an error if this operation is not supported.
func UnshareMountNamespace ¶
func UnshareMountNamespace() error
UnshareMountNamespace is a safe wrapper for the Linux unshare(CLONE_NEWNS) system call. On Linux it will lock the current goroutine to an OS thread and unshare the mount namespace (the thread will have a private copy of the previous mount namespace). On failure or on other platforms an error is returned.
func UnshareNetNamespace ¶
UnshareNetNamespace is a safe wrapper for the Linux unshare(CLONE_NEWNET) system call. On Linux it will lock the current goroutine to an OS thread and unshare the network namespace (the thread will have a fresh network namespace). The file descriptor for the new network namespace and the Linux thread ID are returned. On failure or on other platforms an error is returned.