unix

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package unix re-exports Linux specific parts of golang.org/x/sys/unix.

It avoids breaking compilation on other OS by providing stubs as follows:

  • Invoking a function always returns an error.
  • Errnos have distinct, non-zero values.
  • Constants have distinct but meaningless values.
  • Types use the same names for members, but may or may not follow the Linux layout.

Index

Constants

View Source
const (
	ENOENT syscall.Errno = iota + 1
	EEXIST
	EAGAIN
	ENOSPC
	EINVAL
	EINTR
	EPERM
	ESRCH
	ENODEV
	EBADF
	E2BIG
	EFAULT
	EACCES
	EILSEQ
)

Errnos are distinct and non-zero.

View Source
const (
	BPF_F_NO_PREALLOC = iota
	BPF_F_NUMA_NODE
	BPF_F_RDONLY
	BPF_F_WRONLY
	BPF_F_RDONLY_PROG
	BPF_F_WRONLY_PROG
	BPF_F_SLEEPABLE
	BPF_F_MMAPABLE
	BPF_F_INNER_MAP
	BPF_F_KPROBE_MULTI_RETURN
	BPF_OBJ_NAME_LEN
	BPF_TAG_SIZE
	BPF_RINGBUF_BUSY_BIT
	BPF_RINGBUF_DISCARD_BIT
	BPF_RINGBUF_HDR_SZ
	SYS_BPF
	F_DUPFD_CLOEXEC
	EPOLLIN
	EPOLL_CTL_ADD
	EPOLL_CLOEXEC
	O_CLOEXEC
	O_NONBLOCK
	PROT_READ
	PROT_WRITE
	MAP_SHARED
	PERF_ATTR_SIZE_VER1
	PERF_TYPE_SOFTWARE
	PERF_TYPE_TRACEPOINT
	PERF_COUNT_SW_BPF_OUTPUT
	PERF_EVENT_IOC_DISABLE
	PERF_EVENT_IOC_ENABLE
	PERF_EVENT_IOC_SET_BPF
	PerfBitWatermark
	PERF_SAMPLE_RAW
	PERF_FLAG_FD_CLOEXEC
	RLIM_INFINITY
	RLIMIT_MEMLOCK
	BPF_STATS_RUN_TIME
	PERF_RECORD_LOST
	PERF_RECORD_SAMPLE
	AT_FDCWD
	RENAME_NOREPLACE
	SO_ATTACH_BPF
	SO_DETACH_BPF
	SOL_SOCKET
	SIGPROF
	SIG_BLOCK
	SIG_UNBLOCK
)

Constants are distinct to avoid breaking switch statements.

Variables

This section is empty.

Functions

func BytePtrFromString added in v0.5.0

func BytePtrFromString(s string) (*byte, error)

func ByteSliceToString added in v0.5.0

func ByteSliceToString(s []byte) string

func Close

func Close(fd int) (err error)

func EpollCreate1

func EpollCreate1(flag int) (fd int, err error)

func EpollCtl

func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error)

func EpollWait

func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)

func Eventfd

func Eventfd(initval uint, flags int) (fd int, err error)

func FcntlInt

func FcntlInt(fd uintptr, cmd, arg int) (int, error)

func Fstat added in v0.8.0

func Fstat(fd int, stat *Stat_t) error

func Getpid

func Getpid() int

func Gettid

func Gettid() int

func IoctlSetInt added in v0.5.0

func IoctlSetInt(fd int, req uint, value int) error

func Mmap

func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error)

func Munmap

func Munmap(b []byte) (err error)

func Open added in v0.8.0

func Open(path string, mode int, perm uint32) (int, error)

func PerfEventOpen

func PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)

func Prlimit added in v0.7.0

func Prlimit(pid, resource int, new, old *Rlimit) error

func PthreadSigmask added in v0.9.3

func PthreadSigmask(how int, set, oldset *Sigset_t) error

func Renameat2 added in v0.5.0

func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) error

func SetNonblock

func SetNonblock(fd int, nonblocking bool) (err error)

func Statfs

func Statfs(path string, buf *Statfs_t) error

func Syscall

func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)

func Tgkill

func Tgkill(tgid int, tid int, sig syscall.Signal) (err error)

func Uname

func Uname(buf *Utsname) (err error)

func Write

func Write(fd int, p []byte) (n int, err error)

Types

type EpollEvent

type EpollEvent struct {
	Events uint32
	Fd     int32
	Pad    int32
}

type PerfEventAttr

type PerfEventAttr struct {
	Type               uint32
	Size               uint32
	Config             uint64
	Sample             uint64
	Sample_type        uint64
	Read_format        uint64
	Bits               uint64
	Wakeup             uint32
	Bp_type            uint32
	Ext1               uint64
	Ext2               uint64
	Branch_sample_type uint64
	Sample_regs_user   uint64
	Sample_stack_user  uint32
	Clockid            int32
	Sample_regs_intr   uint64
	Aux_watermark      uint32
	Sample_max_stack   uint16
}

type PerfEventMmapPage

type PerfEventMmapPage struct {
	Version        uint32
	Compat_version uint32
	Lock           uint32
	Index          uint32
	Offset         int64
	Time_enabled   uint64
	Time_running   uint64
	Capabilities   uint64
	Pmc_width      uint16
	Time_shift     uint16
	Time_mult      uint32
	Time_offset    uint64
	Time_zero      uint64
	Size           uint32

	Data_head   uint64
	Data_tail   uint64
	Data_offset uint64
	Data_size   uint64
	Aux_head    uint64
	Aux_tail    uint64
	Aux_offset  uint64
	Aux_size    uint64
}

type Rlimit

type Rlimit struct {
	Cur uint64
	Max uint64
}

type Signal added in v0.9.3

type Signal int

type Sigset_t added in v0.9.3

type Sigset_t struct {
	Val [4]uint64
}

type Stat_t added in v0.8.0

type Stat_t struct{}

type Statfs_t

type Statfs_t struct {
	Type    int64
	Bsize   int64
	Blocks  uint64
	Bfree   uint64
	Bavail  uint64
	Files   uint64
	Ffree   uint64
	Fsid    [2]int32
	Namelen int64
	Frsize  int64
	Flags   int64
	Spare   [4]int64
}

type Utsname

type Utsname struct {
	Release [65]byte
	Version [65]byte
}

Jump to

Keyboard shortcuts

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