package unix
import "github.com/cilium/ebpf/internal/unix"
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
- func Auxv() ([][2]uintptr, error)
- func BytePtrFromString(s string) (*byte, error)
- func ByteSliceFromString(s string) ([]byte, error)
- func ByteSliceToString(s []byte) string
- func Close(fd int) (err error)
- func EpollCreate1(flag int) (fd int, err error)
- func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error)
- func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
- func Eventfd(initval uint, flags int) (fd int, err error)
- func FcntlInt(fd uintptr, cmd, arg int) (int, error)
- func Fstat(fd int, stat *Stat_t) error
- func Getpid() int
- func Gettid() int
- func IoctlSetInt(fd int, req uint, value int) error
- func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error)
- func Munmap(b []byte) (err error)
- func Open(path string, mode int, perm uint32) (int, error)
- func PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)
- func Prlimit(pid, resource int, new, old *Rlimit) error
- func PthreadSigmask(how int, set, oldset *Sigset_t) error
- func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) error
- func SchedGetaffinity(pid int, set *CPUSet) error
- func SchedSetaffinity(pid int, set *CPUSet) error
- func SetNonblock(fd int, nonblocking bool) (err error)
- func SetsockoptInt(fd, level, opt, value int) error
- func Statfs(path string, buf *Statfs_t) error
- func Tgkill(tgid int, tid int, sig syscall.Signal) (err error)
- func Uname(buf *Utsname) (err error)
- func Write(fd int, p []byte) (n int, err error)
- type CPUSet
- type EpollEvent
- type Errno
- type PerfEventAttr
- type PerfEventMmapPage
- type Rlimit
- type Signal
- type Sigset_t
- type Stat_t
- type Statfs_t
- type Utsname
Constants ¶
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_F_UPROBE_MULTI_RETURN BPF_F_XDP_HAS_FRAGS 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_NONE PROT_READ PROT_WRITE MAP_ANON MAP_SHARED MAP_PRIVATE 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 PerfBitWriteBackward 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 SIGUSR1 SIG_BLOCK SIG_UNBLOCK BPF_FS_MAGIC TRACEFS_MAGIC DEBUGFS_MAGIC BPF_RB_NO_WAKEUP BPF_RB_FORCE_WAKEUP BPF_F_LOCK AF_UNSPEC IFF_UP )
Constants are distinct to avoid breaking switch statements.
Functions ¶
func Auxv ¶
func BytePtrFromString ¶
func ByteSliceFromString ¶
func ByteSliceToString ¶
func Close ¶
func EpollCreate1 ¶
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 FcntlInt ¶
func Fstat ¶
func Getpid ¶
func Getpid() int
func Gettid ¶
func Gettid() int
func IoctlSetInt ¶
func Mmap ¶
func Munmap ¶
func Open ¶
func PerfEventOpen ¶
func PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)
func Prlimit ¶
func PthreadSigmask ¶
func Renameat2 ¶
func SchedGetaffinity ¶
func SchedSetaffinity ¶
func SetNonblock ¶
func SetsockoptInt ¶
func Statfs ¶
func Tgkill ¶
func Uname ¶
func Write ¶
Types ¶
type CPUSet ¶
type CPUSet struct{}
func (*CPUSet) Set ¶
type EpollEvent ¶
type Errno ¶
const ( E2BIG Errno = iota + 1 EACCES EAGAIN EBADF EEXIST EFAULT EILSEQ EINTR EINVAL ENODEV ENOENT ENOSPC ENOTSUP ENOTSUPP EOPNOTSUPP EPERM ESRCH ESTALE )
Errnos are distinct and non-zero.
func Syscall ¶
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 Signal ¶
type Signal int
type Sigset_t ¶
type Sigset_t struct { Val [4]uint64 }
type Stat_t ¶
type Stat_t struct { Dev uint64 Ino uint64 Nlink uint64 Mode uint32 Uid uint32 Gid uint32 Rdev uint64 Size int64 Blksize int64 Blocks int64 // contains filtered or unexported fields }
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 ¶
Source Files ¶
doc.go errno_other.go error.go strings_other.go types_other.go
- Version
- v0.18.0 (latest)
- Published
- Apr 2, 2025
- Platform
- darwin/amd64
- Imports
- 5 packages
- Last checked
- 4 hours ago –
Tools for package owners.