# package syscall

`import "syscall"`

Package syscall contains an interface to the low-level operating system primitives. The details vary depending on the underlying system, and by default, godoc will display the syscall documentation for the current system. If you want godoc to display syscall documentation for another system, set $GOOS and $GOARCH to the desired system. For example, if you want to view documentation for freebsd/arm on linux/amd64, set $GOOS to freebsd and $GOARCH to arm. The primary use of syscall is inside other packages that provide a more portable interface to the system, such as "os", "time" and "net". Use those packages rather than this one if you can. For details of the functions and data types in this package consult the manuals for the appropriate operating system. These calls return err == nil to indicate success; otherwise err is an operating system error describing the failure. On most systems, that error has type syscall.Errno.

NOTE: This package is locked down. Code outside the standard Go repository should be migrated to use the corresponding package in the golang.org/x/sys repository. That is also where updates required by new systems or versions should be applied. See https://github.com/golang/go/blob/master/s/go1.4-syscall for more information.

dirent.go endian_little.go env_unix.go exec_linux.go exec_unix.go flock.go lsf_linux.go msan0.go netlink_linux.go setuidgid_linux.go sockcmsg_linux.go sockcmsg_unix.go str.go syscall.go syscall_linux.go syscall_linux_amd64.go syscall_unix.go timestruct.go zerrors_linux_amd64.go zsyscall_linux_amd64.go zsysnum_linux_amd64.go ztypes_linux_amd64.go

## Constants

Errors

Signals

## Variables

For testing: clients can set this flag to force creation of IPv6 sockets to return EAFNOSUPPORT.

## func Accept

## func Accept4

## func Access

## func Acct

## func Adjtimex

## func AttachLsf

Deprecated: Use golang.org/x/net/bpf instead.

## func Bind

## func BindToDevice

BindToDevice binds the socket associated with fd to device.

## func BytePtrFromString

BytePtrFromString returns a pointer to a NUL-terminated array of bytes containing the text of s. If s contains a NUL byte at any location, it returns (nil, EINVAL).

## func ByteSliceFromString

ByteSliceFromString returns a NUL-terminated slice of bytes containing the text of s. If s contains a NUL byte at any location, it returns (nil, EINVAL).

## func Chdir

## func Chmod

## func Chown

## func Chroot

## func Clearenv

## func Close

## func CloseOnExec

## func CmsgLen

CmsgLen returns the value to store in the Len field of the Cmsghdr structure, taking into account any necessary alignment.

## func CmsgSpace

CmsgSpace returns the number of bytes an ancillary element with payload of the passed data length occupies.

## func Connect

## func Creat

## func DetachLsf

Deprecated: Use golang.org/x/net/bpf instead.

## func Dup

## func Dup2

## func Dup3

## func Environ

## func EpollCreate

## func EpollCreate1

## func EpollCtl

## func EpollWait

## func Exec

Exec invokes the execve(2) system call.

## func Exit

## func Faccessat

## func Fallocate

## func Fchdir

## func Fchmod

## func Fchmodat

## func Fchown

## func Fchownat

## func FcntlFlock

FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.

## func Fdatasync

## func Flock

## func ForkExec

Combination of fork and exec, careful to be thread safe.

## func Fstat

## func Fstatfs

## func Fsync

## func Ftruncate

## func Futimes

## func Futimesat

## func Getcwd

## func Getdents

## func Getegid

## func Getenv

## func Geteuid

## func Getgid

## func Getgroups

## func Getpagesize

## func Getpgid

## func Getpgrp

## func Getpid

## func Getppid

## func Getpriority

## func Getrlimit

## func Getrusage

## func GetsockoptInet4Addr

## func GetsockoptInt

## func Gettid

## func Gettimeofday

## func Getuid

## func Getwd

## func Getxattr

## func InotifyAddWatch

## func InotifyInit

## func InotifyInit1

## func InotifyRmWatch

## func Ioperm

## func Iopl

## func Kill

## func Klogctl

## func Lchown

## func Link

## func Listen

## func Listxattr

## func LsfSocket

Deprecated: Use golang.org/x/net/bpf instead.

## func Lstat

## func Madvise

## func Mkdir

## func Mkdirat

## func Mkfifo

## func Mknod

## func Mknodat

## func Mlock

## func Mlockall

## func Mmap

## func Mount

## func Mprotect

## func Munlock

## func Munlockall

## func Munmap

## func Nanosleep

## func NetlinkRIB

NetlinkRIB returns routing information base, as known as RIB, which consists of network facility information, states and parameters.

## func Open

## func Openat

## func ParseDirent

ParseDirent parses up to max directory entries in buf, appending the names to names. It returns the number of bytes consumed from buf, the number of entries added to names, and the new names slice.

## func ParseNetlinkMessage

ParseNetlinkMessage parses b as an array of netlink messages and returns the slice containing the NetlinkMessage structures.

## func ParseNetlinkRouteAttr

ParseNetlinkRouteAttr parses m's payload as an array of netlink route attributes and returns the slice containing the NetlinkRouteAttr structures.

## func ParseSocketControlMessage

ParseSocketControlMessage parses b as an array of socket control messages.

## func ParseUnixRights

ParseUnixRights decodes a socket control message that contains an integer array of open file descriptors from another process.

## func Pause

## func Pipe

## func Pipe2

## func PivotRoot

## func Pread

## func PtraceAttach

## func PtraceCont

## func PtraceDetach

## func PtraceGetEventMsg

## func PtraceGetRegs

## func PtracePeekData

## func PtracePeekText

## func PtracePokeData

## func PtracePokeText

## func PtraceSetOptions

## func PtraceSetRegs

## func PtraceSingleStep

## func PtraceSyscall

## func Pwrite

## func RawSyscall

## func RawSyscall6

## func Read

## func ReadDirent

## func Readlink

## func Reboot

## func Recvfrom

## func Recvmsg

## func Removexattr

## func Rename

## func Renameat

## func Rmdir

## func Seek

## func Select

## func Sendfile

## func Sendmsg

## func SendmsgN

## func Sendto

## func SetLsfPromisc

Deprecated: Use golang.org/x/net/bpf instead.

## func SetNonblock

## func Setdomainname

## func Setenv

## func Setfsgid

## func Setfsuid

## func Setgid

## func Setgroups

## func Sethostname

## func Setpgid

## func Setpriority

## func Setregid

## func Setresgid

## func Setresuid

## func Setreuid

## func Setrlimit

## func Setsid

## func SetsockoptByte

## func SetsockoptICMPv6Filter

## func SetsockoptIPMreq

## func SetsockoptIPMreqn

## func SetsockoptIPv6Mreq

## func SetsockoptInet4Addr

## func SetsockoptInt

## func SetsockoptLinger

## func SetsockoptString

## func SetsockoptTimeval

## func Settimeofday

## func Setuid

## func Setxattr

## func Shutdown

## func SlicePtrFromStrings

SlicePtrFromStrings converts a slice of strings to a slice of pointers to NUL-terminated byte arrays. If any string contains a NUL byte, it returns (nil, EINVAL).

## func Socket

## func Socketpair

## func Splice

## func StartProcess

StartProcess wraps ForkExec for package os.

## func Stat

## func Statfs

## func StringBytePtr

StringBytePtr returns a pointer to a NUL-terminated array of bytes. If s contains a NUL byte this function panics instead of returning an error.

Deprecated: Use BytePtrFromString instead.

## func StringByteSlice

StringByteSlice converts a string to a NUL-terminated []byte, If s contains a NUL byte this function panics instead of returning an error.

Deprecated: Use ByteSliceFromString instead.

## func StringSlicePtr

StringSlicePtr converts a slice of strings to a slice of pointers to NUL-terminated byte arrays. If any string contains a NUL byte this function panics instead of returning an error.

Deprecated: Use SlicePtrFromStrings instead.

## func Symlink

## func Sync

## func SyncFileRange

## func Syscall

## func Syscall6

## func Sysinfo

## func Tee

## func Tgkill

## func Times

## func TimespecToNsec

TimespecToNsec converts a Timespec value into a number of nanoseconds since the Unix epoch.

## func TimevalToNsec

TimevalToNsec converts a Timeval value into a number of nanoseconds since the Unix epoch.

## func Truncate

## func Umask

## func Uname

## func UnixCredentials

UnixCredentials encodes credentials into a socket control message for sending to another process. This can be used for authentication.

## func UnixRights

UnixRights encodes a set of open file descriptors into a socket control message for sending to another process.

## func Unlink

## func Unlinkat

## func Unmount

## func Unsetenv

## func Unshare

## func Ustat

## func Utime

## func Utimes

## func UtimesNano

## func Wait4

## func Write

## type Cmsghdr

### func (*Cmsghdr) SetLen

## type Credential

Credential holds user and group identities to be assumed by a child process started by StartProcess.

## type Dirent

## type EpollEvent

## type Errno

An Errno is an unsigned number describing an error condition. It implements the error interface. The zero Errno is by convention a non-error, so code to convert from Errno to error should use:

    err = nil
    if errno != 0 {
    	err = errno
    }

### func (Errno) Error

### func (Errno) Temporary

### func (Errno) Timeout

## type FdSet

## type Flock_t

## type Fsid

## type ICMPv6Filter

### func GetsockoptICMPv6Filter

## type IPMreq

### func GetsockoptIPMreq

## type IPMreqn

### func GetsockoptIPMreqn

## type IPv6MTUInfo

### func GetsockoptIPv6MTUInfo

## type IPv6Mreq

### func GetsockoptIPv6Mreq

## type IfAddrmsg

## type IfInfomsg

## type Inet4Pktinfo

## type Inet6Pktinfo

## type InotifyEvent

## type Iovec

### func (*Iovec) SetLen

## type Linger

## type Msghdr

### func (*Msghdr) SetControllen

## type NetlinkMessage

NetlinkMessage represents a netlink message.

## type NetlinkRouteAttr

NetlinkRouteAttr represents a netlink route attribute.

## type NetlinkRouteRequest

NetlinkRouteRequest represents a request message to receive routing and link states from the kernel.

## type NlAttr

## type NlMsgerr

## type NlMsghdr

## type ProcAttr

ProcAttr holds attributes that will be applied to a new process started by StartProcess.

## type PtraceRegs

### func (*PtraceRegs) PC

### func (*PtraceRegs) SetPC

## type RawSockaddr

## type RawSockaddrAny

## type RawSockaddrInet4

## type RawSockaddrInet6

## type RawSockaddrLinklayer

## type RawSockaddrNetlink

## type RawSockaddrUnix

## type Rlimit

## type RtAttr

## type RtGenmsg

## type RtMsg

## type RtNexthop

## type Rusage

## type Signal

A Signal is a number describing a process signal. It implements the os.Signal interface.

### func (Signal) Signal

### func (Signal) String

## type SockFilter

### func LsfJump

Deprecated: Use golang.org/x/net/bpf instead.

### func LsfStmt

Deprecated: Use golang.org/x/net/bpf instead.

## type SockFprog

## type Sockaddr

### func Getpeername

### func Getsockname

## type SockaddrInet4

## type SockaddrInet6

## type SockaddrLinklayer

## type SockaddrNetlink

## type SockaddrUnix

## type SocketControlMessage

SocketControlMessage represents a socket control message.

## type Stat_t

## type Statfs_t

## type SysProcAttr

## type SysProcIDMap

SysProcIDMap holds Container ID to Host ID mappings used for User Namespaces in Linux. See user_namespaces(7).

## type Sysinfo_t

## type TCPInfo

## type Termios

## type Time_t

### func Time

## type Timespec

### func NsecToTimespec

NsecToTimespec takes a number of nanoseconds since the Unix epoch and returns the corresponding Timespec value.

### func (*Timespec) Nano

### func (*Timespec) Unix

## type Timeval

### func NsecToTimeval

NsecToTimeval takes a number of nanoseconds since the Unix epoch and returns the corresponding Timeval value.

### func (*Timeval) Nano

### func (*Timeval) Unix

## type Timex

## type Tms

## type Ucred

### func GetsockoptUcred

### func ParseUnixCredentials

ParseUnixCredentials decodes a socket control message that contains credentials in a Ucred structure. To receive such a message, the SO_PASSCRED option must be enabled on the socket.

## type Ustat_t

## type Utimbuf

## type Utsname

## type WaitStatus

### func (WaitStatus) Continued

### func (WaitStatus) CoreDump

### func (WaitStatus) ExitStatus

### func (WaitStatus) Exited

### func (WaitStatus) Signal

### func (WaitStatus) Signaled

### func (WaitStatus) StopSignal

### func (WaitStatus) Stopped

### func (WaitStatus) TrapCause