syscall

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Stdin  = 0
	Stdout = 1
	Stderr = 2
)
View Source
const (
	O_RDONLY = 0x0
	O_WRONLY = 0x1
	O_RDWR   = 0x2
	O_APPEND = 0x8
	O_SYNC   = 0x80
	O_CREAT  = 0x200
	O_TRUNC  = 0x400
	O_EXCL   = 0x800

	O_CLOEXEC = 0x01000000
)
View Source
const (
	PROT_NONE  = 0x00 // no permissions
	PROT_READ  = 0x01 // pages can be read
	PROT_WRITE = 0x02 // pages can be written
	PROT_EXEC  = 0x04 // pages can be executed

	MAP_SHARED  = 0x0001 // share changes
	MAP_PRIVATE = 0x0002 // changes are private

	MAP_FILE      = 0x0000 // map from file (default)
	MAP_ANON      = 0x1000 // allocated from memory, swap space
	MAP_ANONYMOUS = MAP_ANON
)

Source: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/mman.h.auto.html

View Source
const (
	S_IEXEC  = 0x40
	S_IFBLK  = 0x6000
	S_IFCHR  = 0x2000
	S_IFDIR  = 0x4000
	S_IFIFO  = 0x1000
	S_IFLNK  = 0xa000
	S_IFMT   = 0xf000
	S_IFREG  = 0x8000
	S_IFSOCK = 0xc000
	S_IFWHT  = 0xe000
	S_IREAD  = 0x100
	S_IRGRP  = 0x20
	S_IROTH  = 0x4
	S_IRUSR  = 0x100
	S_IRWXG  = 0x38
	S_IRWXO  = 0x7
	S_IRWXU  = 0x1c0
	S_ISGID  = 0x400
	S_ISTXT  = 0x200
	S_ISUID  = 0x800
	S_ISVTX  = 0x200
	S_IWGRP  = 0x10
	S_IWOTH  = 0x2
	S_IWRITE = 0x80
	S_IWUSR  = 0x80
	S_IXGRP  = 0x8
	S_IXOTH  = 0x1
	S_IXUSR  = 0x40
)

Source: https://github.com/apple/darwin-xnu/blob/main/bsd/sys/_types/_s_ifmt.h

Variables

This section is empty.

Functions

func Chdir added in v0.22.0

func Chdir(path string) (err error)

func Chmod added in v0.22.0

func Chmod(path string, mode uint32) (err error)

func Clearenv added in v0.22.0

func Clearenv()

func Close

func Close(fd int) (err error)

func Environ added in v0.22.0

func Environ() []string

func Exit added in v0.7.0

func Exit(code int)

func Fstat added in v0.22.0

func Fstat(fd int, p *Stat_t) (err error)

func Getegid added in v0.19.0

func Getegid() int

func Getenv

func Getenv(key string) (value string, found bool)

func Geteuid added in v0.19.0

func Geteuid() int

func Getgid added in v0.19.0

func Getgid() int

func Getpid

func Getpid() int

func Getppid added in v0.19.0

func Getppid() int

func Getuid added in v0.19.0

func Getuid() int

func Getwd added in v0.21.0

func Getwd() (string, error)

func Kill

func Kill(pid int, sig Signal) (err error)

func Lstat added in v0.22.0

func Lstat(path string, p *Stat_t) (err error)

func Mkdir added in v0.14.0

func Mkdir(path string, mode uint32) (err error)

func Mmap added in v0.22.0

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

func Mprotect added in v0.22.0

func Mprotect(b []byte, prot int) (err error)

func Open

func Open(path string, flag int, mode uint32) (fd int, err error)

func Pipe2 added in v0.22.0

func Pipe2(p []int, flags int) (err error)

func Pread added in v0.22.0

func Pread(fd int, p []byte, offset int64) (n int, err error)

func Read

func Read(fd int, p []byte) (n int, err error)
func Readlink(path string, p []byte) (n int, err error)

func Rename added in v0.22.0

func Rename(from, to string) (err error)

func Rmdir added in v0.22.0

func Rmdir(path string) (err error)

func Seek

func Seek(fd int, offset int64, whence int) (newoffset int64, err error)

func Setenv added in v0.22.0

func Setenv(key, val string) (err error)

func Stat added in v0.22.0

func Stat(path string, p *Stat_t) (err error)
func Symlink(from, to string) (err error)
func Unlink(path string) (err error)

func Unsetenv added in v0.22.0

func Unsetenv(key string) (err error)

func Write

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

Types

type Conn added in v0.14.0

type Conn interface {
	// SyscallConn returns a raw network connection.
	SyscallConn() (RawConn, error)
}

Conn is implemented by some types in the net and os packages to provide access to the underlying file descriptor or handle.

type Errno

type Errno uintptr

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
}
const (
	EPERM       Errno = 1
	ENOENT      Errno = 2
	EACCES      Errno = 13
	EEXIST      Errno = 17
	EINTR       Errno = 4
	ENOTDIR     Errno = 20
	EINVAL      Errno = 22
	EMFILE      Errno = 24
	EPIPE       Errno = 32
	EAGAIN      Errno = 35
	ETIMEDOUT   Errno = 60
	ENOSYS      Errno = 78
	EWOULDBLOCK Errno = EAGAIN
)

Source: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/errno.h.auto.html

func (Errno) Error

func (e Errno) Error() string

func (Errno) Is added in v0.18.0

func (e Errno) Is(target error) bool

func (Errno) Temporary

func (e Errno) Temporary() bool

func (Errno) Timeout

func (e Errno) Timeout() bool

type RawConn added in v0.14.0

type RawConn interface {
	// Control invokes f on the underlying connection's file
	// descriptor or handle.
	// The file descriptor fd is guaranteed to remain valid while
	// f executes but not after f returns.
	Control(f func(fd uintptr)) error

	// Read invokes f on the underlying connection's file
	// descriptor or handle; f is expected to try to read from the
	// file descriptor.
	// If f returns true, Read returns. Otherwise Read blocks
	// waiting for the connection to be ready for reading and
	// tries again repeatedly.
	// The file descriptor is guaranteed to remain valid while f
	// executes but not after f returns.
	Read(f func(fd uintptr) (done bool)) error

	// Write is like Read but for writing.
	Write(f func(fd uintptr) (done bool)) error
}

A RawConn is a raw network connection.

type Signal

type Signal int
const (
	SIGCHLD Signal = 0x14
	SIGINT  Signal = 0x2
	SIGKILL Signal = 0x9
	SIGTRAP Signal = 0x5
	SIGQUIT Signal = 0x3
	SIGTERM Signal = 0xf
)

type Stat_t added in v0.22.0

type Stat_t struct {
	Dev       int32
	Mode      uint16
	Nlink     uint16
	Ino       uint64
	Uid       uint32
	Gid       uint32
	Rdev      int32
	Pad_cgo_0 [4]byte
	Atim      Timespec
	Mtim      Timespec
	Ctim      Timespec
	Btim      Timespec
	Size      int64
	Blocks    int64
	Blksize   int32
	Flags     uint32
	Gen       uint32
	Lspare    int32
	Qspare    [2]int64
}

Go chose Linux's field names for Stat_t, see https://github.com/golang/go/issues/31735

type SysProcAttr added in v0.22.0

type SysProcAttr struct{}

type Timespec added in v0.22.0

type Timespec struct {
	Sec  int64
	Nsec int64
}

Jump to

Keyboard shortcuts

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