syscall

package
v0.29.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DT_BLK     = 0x6
	DT_CHR     = 0x2
	DT_DIR     = 0x4
	DT_FIFO    = 0x1
	DT_LNK     = 0xa
	DT_REG     = 0x8
	DT_SOCK    = 0xc
	DT_UNKNOWN = 0x0
	DT_WHT     = 0xe
	F_GETFL    = 0x3
	F_SETFL    = 0x4
	O_NONBLOCK = 0x4
)

Source: upstream zerrors_darwin_amd64.go

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 BytePtrFromString added in v0.27.0

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

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 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 Dup added in v0.23.0

func Dup(fd int) (fd2 int, err error)

func Environ added in v0.22.0

func Environ() []string

func Exec added in v0.27.0

func Exec(argv0 string, argv []string, envv []string) (err error)

func Exit added in v0.7.0

func Exit(code int)

func Faccessat added in v0.27.0

func Faccessat(dirfd int, path string, mode uint32, flags int) (err error)

func Fdopendir added in v0.23.0

func Fdopendir(fd int) (dir uintptr, err error)

func Fstat added in v0.22.0

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

func Fsync added in v0.28.0

func Fsync(fd int) (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 Getpagesize added in v0.23.0

func Getpagesize() 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 Munmap added in v0.23.0

func Munmap(b []byte) (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(fds []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 Pwrite added in v0.28.0

func Pwrite(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 Dirent added in v0.23.0

type Dirent struct {
	Ino       uint64
	Seekoff   uint64
	Reclen    uint16
	Namlen    uint16
	Type      uint8
	Name      [1024]int8
	Pad_cgo_0 [3]byte
}

Source: upstream ztypes_darwin_amd64.go

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
	EISDIR      Errno = 21
	EINVAL      Errno = 22
	EMFILE      Errno = 24
	EROFS       Errno = 30
	EPIPE       Errno = 32
	EAGAIN      Errno = 35
	ENOTCONN    Errno = 57
	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 RawSockaddr added in v0.27.0

type RawSockaddr struct {
	Len    uint8
	Family uint8
	Data   [14]int8
}

type RawSockaddrInet4 added in v0.27.0

type RawSockaddrInet4 struct {
	Len    uint8
	Family uint8
	Port   uint16
	Addr   [4]byte /* in_addr */
	Zero   [8]int8
}

type RawSockaddrInet6 added in v0.27.0

type RawSockaddrInet6 struct {
	Len      uint8
	Family   uint8
	Port     uint16
	Flowinfo uint32
	Addr     [16]byte /* in6_addr */
	Scope_id uint32
}

type Signal

type Signal int
const (
	SIGINT  Signal = 2  /* interrupt */
	SIGQUIT Signal = 3  /* quit */
	SIGILL  Signal = 4  /* illegal instruction (not reset when caught) */
	SIGTRAP Signal = 5  /* trace trap (not reset when caught) */
	SIGABRT Signal = 6  /* abort() */
	SIGFPE  Signal = 8  /* floating point exception */
	SIGKILL Signal = 9  /* kill (cannot be caught or ignored) */
	SIGBUS  Signal = 10 /* bus error */
	SIGSEGV Signal = 11 /* segmentation violation */
	SIGPIPE Signal = 13 /* write on a pipe with no one to read it */
	SIGTERM Signal = 15 /* software termination signal from kill */
	SIGCHLD Signal = 20 /* to parent on child stop or exit */
)

Source: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/signal.h

func (Signal) Signal added in v0.23.0

func (s Signal) Signal()

func (Signal) String added in v0.23.0

func (s Signal) String() string

type SockaddrInet4 added in v0.27.0

type SockaddrInet4 struct {
	Port int
	Addr [4]byte
	// contains filtered or unexported fields
}

type SockaddrInet6 added in v0.27.0

type SockaddrInet6 struct {
	Port   int
	ZoneId uint32
	Addr   [16]byte
	// contains filtered or unexported fields
}

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
	Atimespec Timespec
	Mtimespec Timespec
	Ctimespec Timespec
	Btimespec Timespec
	Size      int64
	Blocks    int64
	Blksize   int32
	Flags     uint32
	Gen       uint32
	Lspare    int32
	Qspare    [2]int64
}

type SysProcAttr added in v0.22.0

type SysProcAttr struct{}

type Timespec added in v0.22.0

type Timespec struct {
	Sec  int64
	Nsec int64
}

func (*Timespec) Unix added in v0.28.0

func (ts *Timespec) Unix() (sec int64, nsec int64)

Unix returns the time stored in ts as seconds plus nanoseconds.

type WaitStatus added in v0.23.0

type WaitStatus uint32

TODO

func (WaitStatus) Continued added in v0.23.0

func (w WaitStatus) Continued() bool

func (WaitStatus) CoreDump added in v0.23.0

func (w WaitStatus) CoreDump() bool

func (WaitStatus) ExitStatus added in v0.23.0

func (w WaitStatus) ExitStatus() int

func (WaitStatus) Exited added in v0.23.0

func (w WaitStatus) Exited() bool

func (WaitStatus) Signal added in v0.23.0

func (w WaitStatus) Signal() Signal

func (WaitStatus) Signaled added in v0.23.0

func (w WaitStatus) Signaled() bool

func (WaitStatus) StopSignal added in v0.23.0

func (w WaitStatus) StopSignal() Signal

func (WaitStatus) Stopped added in v0.23.0

func (w WaitStatus) Stopped() bool

func (WaitStatus) TrapCause added in v0.23.0

func (w WaitStatus) TrapCause() int

Jump to

Keyboard shortcuts

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