posix

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2017 License: MIT Imports: 13 Imported by: 5

Documentation

Index

Constants

View Source
const UINT64_MAX = 0xFFFFFFFFFFFFFFFF

Variables

This section is empty.

Functions

func Errno

func Errno(err error) uint64

func NewDarwinStat

func NewDarwinStat(stat *syscall.Stat_t, bits uint) interface{}

func NewLinuxStat

func NewLinuxStat(stat *syscall.Stat_t, bits uint) interface{}

func NewTargetStat

func NewTargetStat(stat *syscall.Stat_t, os string, bits uint) interface{}

func PathFromFd

func PathFromFd(dirfd int) (string, error)

func StackInit

func StackInit(u models.Usercorn, args, env []string, auxv []byte) error

func Uname

func Uname(buf co.Buf, un *models.Uname)

Types

type DarwinStat

type DarwinStat struct {
}

type DarwinStat64

type DarwinStat64 struct {
}

type File

type File struct {
	Fd    co.Fd
	Path  string
	Mode  int
	Flags int
	// entries/offset currently only used by Linux getdents
	Dirents []os.FileInfo
	Offset  uint64
}

type Iovec32

type Iovec32 struct {
	Base uint32
	Len  uint32
}

type Iovec64

type Iovec64 struct {
	Base uint64
	Len  uint64
}

type LinuxStat

type LinuxStat struct {
	Dev      uint32
	Ino      uint32
	Mode     uint16
	Nlink    uint16
	Uid, Gid uint32
	Rdev     uint32
	Size     uint32
	Blksize  uint32
	Blkcnt   uint32

	Atime     uint32
	AtimeNsec uint32
	Mtime     uint32
	MtimeNsec uint32
	Ctime     uint32
	CtimeNsec uint32

	Reserved4 uint32
	Reserved5 uint32
}

TODO: these might only work on x86

type LinuxStat64

type LinuxStat64 struct {
	Dev      uint64
	Ino      uint64
	Nlink    uint64
	Mode     uint32
	Uid, Gid uint32
	Pad0     uint32
	Rdev     uint64
	Size     int64
	Blksize  int64
	Blkcnt   int64

	Atime     uint64
	AtimeNsec uint64
	Mtime     uint64
	MtimeNsec uint64
	Ctime     uint64
	CtimeNsec uint64

	Reserved3 [3]uint64
}

type PosixKernel

type PosixKernel struct {
	*co.KernelBase
	Unpack func(co.Buf, interface{})
	Files  map[co.Fd]*File
}

func NewKernel

func NewKernel() *PosixKernel

func (*PosixKernel) Access

func (k *PosixKernel) Access(path string, amode uint32) uint64

func (*PosixKernel) Bind

func (k *PosixKernel) Bind(fd co.Fd, sa syscall.Sockaddr, size co.Len) uint64

func (*PosixKernel) Brk

func (k *PosixKernel) Brk(addr uint64) uint64

func (*PosixKernel) Chdir

func (k *PosixKernel) Chdir(path string) uint64

func (*PosixKernel) Chmod

func (k *PosixKernel) Chmod(path string, mode uint32) uint64

func (*PosixKernel) Chown

func (k *PosixKernel) Chown(path string, uid, gid int) uint64

func (*PosixKernel) Chroot

func (k *PosixKernel) Chroot(path string) uint64

func (*PosixKernel) ClockGetres

func (k *PosixKernel) ClockGetres(clockid int, out co.Obuf) uint64

func (*PosixKernel) ClockGettime

func (k *PosixKernel) ClockGettime(_ int, out co.Obuf) uint64

func (*PosixKernel) Close

func (k *PosixKernel) Close(fd co.Fd) uint64

func (*PosixKernel) Connect

func (k *PosixKernel) Connect(fd co.Fd, sa syscall.Sockaddr, size co.Len) uint64

func (*PosixKernel) Dup

func (k *PosixKernel) Dup(oldFd co.Fd) uint64

func (*PosixKernel) Dup2

func (k *PosixKernel) Dup2(oldFd co.Fd, newFd co.Fd) uint64

func (*PosixKernel) Execve

func (k *PosixKernel) Execve(path string, argvBuf, envpBuf co.Buf) uint64

func (*PosixKernel) Exit

func (k *PosixKernel) Exit(code int)

func (*PosixKernel) ExitGroup

func (k *PosixKernel) ExitGroup(code int)

func (*PosixKernel) Fchmod

func (k *PosixKernel) Fchmod(fd int, mode uint32) uint64

func (*PosixKernel) Fchown

func (k *PosixKernel) Fchown(fd, uid, gid int) uint64

func (*PosixKernel) Fcntl

func (k *PosixKernel) Fcntl(fd co.Fd, cmd int)

func (*PosixKernel) Fstat

func (k *PosixKernel) Fstat(fd co.Fd, buf co.Obuf) uint64

func (*PosixKernel) Fstatfs

func (k *PosixKernel) Fstatfs(fd co.Fd, statfs co.Obuf) uint64

func (*PosixKernel) Getcwd

func (k *PosixKernel) Getcwd(buf co.Obuf, size co.Len) uint64

func (*PosixKernel) Getegid

func (k *PosixKernel) Getegid() int

func (*PosixKernel) Geteuid

func (k *PosixKernel) Geteuid() int

func (*PosixKernel) Getgid

func (k *PosixKernel) Getgid() int

func (*PosixKernel) Getgroups

func (k *PosixKernel) Getgroups(count int, buf co.Buf) uint64

func (*PosixKernel) Getitimer

func (k *PosixKernel) Getitimer(which int, value *native.Itimerval, ovalue co.Obuf) uint64

func (*PosixKernel) Getpgid

func (k *PosixKernel) Getpgid(pid int) uint64

func (*PosixKernel) Getpgrp

func (k *PosixKernel) Getpgrp() int

func (*PosixKernel) Getpid

func (k *PosixKernel) Getpid() int

func (*PosixKernel) Getppid

func (k *PosixKernel) Getppid() int

func (*PosixKernel) Getsockopt

func (k *PosixKernel) Getsockopt(fd co.Fd, level, opt int, valueOut, valueSizeOut co.Buf) uint64

func (*PosixKernel) Gettid

func (k *PosixKernel) Gettid() int

func (*PosixKernel) Getuid

func (k *PosixKernel) Getuid() int

func (*PosixKernel) Ioctl

func (k *PosixKernel) Ioctl(fd co.Fd, req uint64)

func (*PosixKernel) Kill

func (k *PosixKernel) Kill(pid, signal int) uint64

func (*PosixKernel) Lchown

func (k *PosixKernel) Lchown(path string, uid, gid int) uint64
func (k *PosixKernel) Link(src, dst string) uint64

func (*PosixKernel) Lseek

func (k *PosixKernel) Lseek(fd co.Fd, offset co.Off, whence int) uint64

func (*PosixKernel) Lstat

func (k *PosixKernel) Lstat(path string, buf co.Obuf) uint64

func (*PosixKernel) Madvise

func (k *PosixKernel) Madvise()

func (*PosixKernel) Mlock

func (k *PosixKernel) Mlock()

func (*PosixKernel) Mlockall

func (k *PosixKernel) Mlockall()

func (*PosixKernel) Mmap

func (k *PosixKernel) Mmap(addrHint, size uint64, prot enum.MmapProt, flags enum.MmapFlag, fd co.Fd, off co.Off) uint64

func (*PosixKernel) Mmap2

func (k *PosixKernel) Mmap2(addrHint, size uint64, prot enum.MmapProt, flags enum.MmapFlag, fd co.Fd, off co.Off) uint64

func (*PosixKernel) Mprotect

func (k *PosixKernel) Mprotect(addr, size uint64, prot enum.MmapProt) uint64

func (*PosixKernel) Munlock

func (k *PosixKernel) Munlock()

func (*PosixKernel) Munlockall

func (k *PosixKernel) Munlockall()

func (*PosixKernel) Munmap

func (k *PosixKernel) Munmap(addr, size uint64) uint64

func (*PosixKernel) Open

func (k *PosixKernel) Open(path string, flags enum.OpenFlag, mode uint64) uint64

func (*PosixKernel) Openat

func (k *PosixKernel) Openat(dirfd co.Fd, path string, flags enum.OpenFlag, mode uint64) uint64

func (*PosixKernel) Pipe

func (k *PosixKernel) Pipe(files co.Buf) uint64

func (*PosixKernel) Pipe2

func (k *PosixKernel) Pipe2(files co.Buf, flags int) uint64

func (*PosixKernel) Pread64

func (k *PosixKernel) Pread64(fd co.Fd, buf co.Obuf, size co.Len, offset int64) uint64

func (*PosixKernel) Pwrite64

func (k *PosixKernel) Pwrite64(fd co.Fd, buf co.Buf, size co.Len, offset int64) uint64

func (*PosixKernel) Read

func (k *PosixKernel) Read(fd co.Fd, buf co.Obuf, size co.Len) uint64
func (k *PosixKernel) Readlink(path string, buf co.Obuf, size co.Len) uint64

func (*PosixKernel) Readv

func (k *PosixKernel) Readv(fd co.Fd, iov co.Buf, count uint64) uint64

func (*PosixKernel) Recvfrom

func (k *PosixKernel) Recvfrom(fd co.Fd, buf co.Buf, size co.Len, flags int, from co.Buf, fromlen co.Len) uint64

func (*PosixKernel) RtSigaction

func (k *PosixKernel) RtSigaction()

func (*PosixKernel) RtSigprocmask

func (k *PosixKernel) RtSigprocmask()

func (*PosixKernel) SchedYield

func (k *PosixKernel) SchedYield()

func (*PosixKernel) Select

func (k *PosixKernel) Select(args []co.Obuf, nfds int, readfds, writefds, errorfds *native.Fdset32, timeout *syscall.Timeval) uint64

func (*PosixKernel) Sendto

func (k *PosixKernel) Sendto(fd co.Fd, buf co.Buf, size co.Len, flags int, sa syscall.Sockaddr, socklen co.Len) uint64

func (*PosixKernel) Setgid

func (k *PosixKernel) Setgid(gid int) int

func (*PosixKernel) Setitimer

func (k *PosixKernel) Setitimer(which int, value co.Obuf) uint64

TODO: candidate for enum conversion but OS X and Linux appeared to have the same values for now TODO: these are stubbed because they're mostly for progress bars afaik

func (*PosixKernel) Setsockopt

func (k *PosixKernel) Setsockopt(fd co.Fd, level, opt int, valueIn co.Buf, size int) uint64

func (*PosixKernel) Setuid

func (k *PosixKernel) Setuid(uid int) int

func (*PosixKernel) Shutdown

func (k *PosixKernel) Shutdown(fd co.Fd, how int) uint64

func (*PosixKernel) Socket

func (k *PosixKernel) Socket(domain, typ, protocol int) uint64

func (*PosixKernel) Socketpair

func (k *PosixKernel) Socketpair(domain, typ, proto int, vector co.Obuf) uint64

func (*PosixKernel) Stat

func (k *PosixKernel) Stat(path string, buf co.Obuf) uint64

func (*PosixKernel) Statfs

func (k *PosixKernel) Statfs(path string, statfs co.Obuf) uint64

func (*PosixKernel) Swapoff

func (k *PosixKernel) Swapoff()

func (*PosixKernel) Swapon

func (k *PosixKernel) Swapon()
func (k *PosixKernel) Symlink(src, dst string) uint64

func (*PosixKernel) Time

func (k *PosixKernel) Time(out co.Obuf) uint64
func (k *PosixKernel) Unlink(path string) uint64

func (*PosixKernel) Write

func (k *PosixKernel) Write(fd co.Fd, buf co.Buf, size co.Len) uint64

func (*PosixKernel) Writev

func (k *PosixKernel) Writev(fd co.Fd, iov co.Buf, count uint64) uint64

Jump to

Keyboard shortcuts

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