simulation

package
v0.0.0-...-1cf9932 Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Code generated by gensyscall. DO NOT EDIT.

Code generated by gensyscall. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentMachineID

func CurrentMachineID() int

func IsHandledSyscall

func IsHandledSyscall(trap uintptr) bool

func RawSyscall6

func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)

used to be... //go:nocheckptr //go:uintptrescapes

func Runtime

func Runtime(fun func())

func SyscallMachineGetLabel

func SyscallMachineGetLabel(machineID int) (label string, err error)

func SyscallMachineInodeInfo

func SyscallMachineInodeInfo(machineID int, inodeID int, info *fs.InodeInfo)

func SyscallMachineNew

func SyscallMachineNew(label string, addr string, program any) (machineID int)

func SyscallMachineRecoverInit

func SyscallMachineRecoverInit(machineID int, program any) (iterID int)

func SyscallMachineRecoverNext

func SyscallMachineRecoverNext(iterID int) (machineID int, ok bool)

func SyscallMachineRecoverRelease

func SyscallMachineRecoverRelease(iterID int)

func SyscallMachineRestart

func SyscallMachineRestart(machineID int, partialDisk bool) (err error)

func SyscallMachineSetBootProgram

func SyscallMachineSetBootProgram(machineID int, program any) (err error)

func SyscallMachineSetSometimesCrashOnSync

func SyscallMachineSetSometimesCrashOnSync(machineID int, crash bool) (err error)

func SyscallMachineStop

func SyscallMachineStop(machineID int, graceful bool)

func SyscallMachineWait

func SyscallMachineWait(machineID int)

func SyscallName

func SyscallName(trap uintptr) string

func SyscallPollClose

func SyscallPollClose(fd int, desc *syscallabi.PollDesc) (code int)

func SyscallPollOpen

func SyscallPollOpen(fd int, desc *syscallabi.PollDesc) (code int)

func SyscallSetConnected

func SyscallSetConnected(a string, b string, connected bool) (err error)

func SyscallSetDelay

func SyscallSetDelay(a string, b string, delay time.Duration) (err error)

func SyscallSetSimulationTimeout

func SyscallSetSimulationTimeout(timeout time.Duration) (err error)

func SyscallSysAccept4

func SyscallSysAccept4(s int, rsa *RawSockaddrAny, addrlen *Socklen, flags int) (fd int, err error)

func SyscallSysBind

func SyscallSysBind(s int, addr unsafe.Pointer, addrlen Socklen) (err error)

func SyscallSysChdir

func SyscallSysChdir(path string) (err error)

func SyscallSysClose

func SyscallSysClose(fd int) (err error)

func SyscallSysConnect

func SyscallSysConnect(s int, addr unsafe.Pointer, addrlen Socklen) (err error)

func SyscallSysFallocate

func SyscallSysFallocate(fd int, mode uint32, off int64, len int64) (err error)

func SyscallSysFcntl

func SyscallSysFcntl(fd int, cmd int, arg int) (val int, err error)

func SyscallSysFcntlFlock

func SyscallSysFcntlFlock(fd uintptr, cmd int, lk *Flock_t) (err error)

This ought to call the Fcntl wrapped generated by gensyscall, but the generated Fcntl wrapper does not take a pointer, and passing a uintptr would not be safe. This wrapper works, but it does not show in the handled syscalls switch.

func SyscallSysFdatasync

func SyscallSysFdatasync(fd int) (err error)

func SyscallSysFlock

func SyscallSysFlock(fd int, how int) (err error)

func SyscallSysFstat

func SyscallSysFstat(fd int, stat *Stat_t) (err error)

func SyscallSysFsync

func SyscallSysFsync(fd int) (err error)

func SyscallSysFtruncate

func SyscallSysFtruncate(fd int, length int64) (err error)

func SyscallSysGetcwd

func SyscallSysGetcwd(buf []byte) (n int, err error)

func SyscallSysGetdents64

func SyscallSysGetdents64(fd int, buf []byte) (n int, err error)

func SyscallSysGetpeername

func SyscallSysGetpeername(fd int, rsa *RawSockaddrAny, addrlen *Socklen) (err error)

func SyscallSysGetpid

func SyscallSysGetpid() (pid int)

func SyscallSysGetrandom

func SyscallSysGetrandom(buf []byte, flags int) (n int, err error)

func SyscallSysGetsockname

func SyscallSysGetsockname(fd int, rsa *RawSockaddrAny, addrlen *Socklen) (err error)

func SyscallSysGetsockopt

func SyscallSysGetsockopt(s int, level int, name int, val unsafe.Pointer, vallen *Socklen) (err error)

func SyscallSysListen

func SyscallSysListen(s int, n int) (err error)

func SyscallSysLseek

func SyscallSysLseek(fd int, offset int64, whence int) (off int64, err error)

func SyscallSysMadvise

func SyscallSysMadvise(b []byte, advice int) (err error)

func SyscallSysMkdirat

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

func SyscallSysMmap

func SyscallSysMmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)

func SyscallSysMunmap

func SyscallSysMunmap(addr uintptr, length uintptr) (err error)

func SyscallSysNewfstatat

func SyscallSysNewfstatat(fd int, path string, stat *Stat_t, flags int) (err error)

func SyscallSysOpenat

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

func SyscallSysPread64

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

func SyscallSysPwrite64

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

func SyscallSysRead

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

func SyscallSysRenameat

func SyscallSysRenameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)

func SyscallSysSetsockopt

func SyscallSysSetsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)

func SyscallSysSocket

func SyscallSysSocket(domain int, typ int, proto int) (fd int, err error)

func SyscallSysUname

func SyscallSysUname(buf *Utsname) (err error)

func SyscallSysUnlinkat

func SyscallSysUnlinkat(dirfd int, path string, flags int) (err error)

func SyscallSysWrite

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

Types

type Dentry

type Dentry struct {
	Inode  uint64
	Offset uint64
	Reclen uint16
	Type   string
	Name   string
}

type Flock_t

type Flock_t = syscall.Flock_t

type GosimOS

type GosimOS struct {
	// contains filtered or unexported fields
}

GosimOS implements all simulation-level system calls, such as creating machines, messing with the network, etc.

func NewGosimOS

func NewGosimOS(s *Simulation, d syscallabi.Dispatcher) *GosimOS

func (*GosimOS) MachineGetLabel

func (g *GosimOS) MachineGetLabel(machineID int, invocation *syscallabi.Syscall) (label string, err error)

func (*GosimOS) MachineInodeInfo

func (g *GosimOS) MachineInodeInfo(machineID int, inode int, info syscallabi.ValueView[fs.InodeInfo], invocation *syscallabi.Syscall)

func (*GosimOS) MachineNew

func (g *GosimOS) MachineNew(label string, addrStr string, program any, invocation *syscallabi.Syscall) (machineId int)

func (*GosimOS) MachineRecoverInit

func (g *GosimOS) MachineRecoverInit(machineID int, program any, invocation *syscallabi.Syscall) int

func (*GosimOS) MachineRecoverNext

func (g *GosimOS) MachineRecoverNext(crashIterId int, invocation *syscallabi.Syscall) (int, bool)

func (*GosimOS) MachineRecoverRelease

func (g *GosimOS) MachineRecoverRelease(crashIterId int, invocation *syscallabi.Syscall)

func (*GosimOS) MachineRestart

func (g *GosimOS) MachineRestart(machineID int, partialDisk bool, invocation *syscallabi.Syscall) (err error)

func (*GosimOS) MachineSetBootProgram

func (g *GosimOS) MachineSetBootProgram(machineID int, program any, invocation *syscallabi.Syscall) (err error)

func (*GosimOS) MachineSetSometimesCrashOnSync

func (g *GosimOS) MachineSetSometimesCrashOnSync(machineID int, value bool, invocation *syscallabi.Syscall) (err error)

func (*GosimOS) MachineStop

func (g *GosimOS) MachineStop(machineID int, graceful bool, invocation *syscallabi.Syscall)

func (*GosimOS) MachineWait

func (g *GosimOS) MachineWait(machineID int, invocation *syscallabi.Syscall)

func (*GosimOS) SetConnected

func (g *GosimOS) SetConnected(a, b string, connected bool, invocation *syscallabi.Syscall) error

func (*GosimOS) SetDelay

func (g *GosimOS) SetDelay(a, b string, delay time.Duration, invocation *syscallabi.Syscall) error

func (*GosimOS) SetSimulationTimeout

func (g *GosimOS) SetSimulationTimeout(d time.Duration, invocation *syscallabi.Syscall) error

type LinuxOS

type LinuxOS struct {
	// contains filtered or unexported fields
}

LinuxOS implements gosim's versions of Linux system calls.

func NewLinuxOS

func NewLinuxOS(simulation *Simulation, machine *Machine, dispatcher syscallabi.Dispatcher) *LinuxOS

func (*LinuxOS) PollClose

func (l *LinuxOS) PollClose(fd int, desc syscallabi.ValueView[syscallabi.PollDesc], invocation *syscallabi.Syscall) int

func (*LinuxOS) PollOpen

func (l *LinuxOS) PollOpen(fd int, desc syscallabi.ValueView[syscallabi.PollDesc], invocation *syscallabi.Syscall) int

func (*LinuxOS) SysAccept4

func (l *LinuxOS) SysAccept4(fd int, rsa syscallabi.ValueView[RawSockaddrAny], len syscallabi.ValueView[Socklen], flags int, invocation *syscallabi.Syscall) (int, error)

func (*LinuxOS) SysBind

func (l *LinuxOS) SysBind(fd int, addrPtr unsafe.Pointer, addrlen Socklen, invocation *syscallabi.Syscall) error

func (*LinuxOS) SysChdir

func (l *LinuxOS) SysChdir(path string, invocation *syscallabi.Syscall) (err error)

func (*LinuxOS) SysClose

func (l *LinuxOS) SysClose(fd int, invocation *syscallabi.Syscall) error

func (*LinuxOS) SysConnect

func (l *LinuxOS) SysConnect(fd int, addrPtr unsafe.Pointer, addrLen Socklen, invocation *syscallabi.Syscall) error

func (*LinuxOS) SysFallocate

func (l *LinuxOS) SysFallocate(fd int, mode uint32, off int64, len int64, invocation *syscallabi.Syscall) (err error)

func (*LinuxOS) SysFcntl

func (l *LinuxOS) SysFcntl(fd int, cmd int, arg int, invocation *syscallabi.Syscall) (val int, err error)

func (*LinuxOS) SysFcntlFlock

func (l *LinuxOS) SysFcntlFlock(fd uintptr, cmd int, lk syscallabi.ValueView[Flock_t], invocation *syscallabi.Syscall) (err error)

func (*LinuxOS) SysFdatasync

func (l *LinuxOS) SysFdatasync(fd int, invocation *syscallabi.Syscall) error

func (*LinuxOS) SysFlock

func (l *LinuxOS) SysFlock(fd int, how int, invocation *syscallabi.Syscall) (err error)

func (*LinuxOS) SysFstat

func (l *LinuxOS) SysFstat(fd int, statBuf syscallabi.ValueView[syscall.Stat_t], invocation *syscallabi.Syscall) error

func (*LinuxOS) SysFstatat

func (l *LinuxOS) SysFstatat(dirfd int, path string, statBuf syscallabi.ValueView[syscall.Stat_t], flags int, invocation *syscallabi.Syscall) error

arm64

func (*LinuxOS) SysFsync

func (l *LinuxOS) SysFsync(fd int, invocation *syscallabi.Syscall) error

func (*LinuxOS) SysFtruncate

func (l *LinuxOS) SysFtruncate(fd int, n int64, invocation *syscallabi.Syscall) error

func (*LinuxOS) SysGetcwd

func (l *LinuxOS) SysGetcwd(buf syscallabi.SliceView[byte], invocation *syscallabi.Syscall) (n int, err error)

func (*LinuxOS) SysGetdents64

func (l *LinuxOS) SysGetdents64(fd int, data syscallabi.ByteSliceView, invocation *syscallabi.Syscall) (int, error)

func (*LinuxOS) SysGetpeername

func (l *LinuxOS) SysGetpeername(fd int, rsa syscallabi.ValueView[RawSockaddrAny], len syscallabi.ValueView[Socklen], invocation *syscallabi.Syscall) error

func (*LinuxOS) SysGetpid

func (l *LinuxOS) SysGetpid(invocation *syscallabi.Syscall) int

func (*LinuxOS) SysGetrandom

func (l *LinuxOS) SysGetrandom(ptr syscallabi.ByteSliceView, flags int, invocation *syscallabi.Syscall) (int, error)

func (*LinuxOS) SysGetsockname

func (l *LinuxOS) SysGetsockname(fd int, rsa syscallabi.ValueView[RawSockaddrAny], len syscallabi.ValueView[Socklen], invocation *syscallabi.Syscall) error

func (*LinuxOS) SysGetsockopt

func (l *LinuxOS) SysGetsockopt(fd int, level int, name int, ptr unsafe.Pointer, outlen syscallabi.ValueView[Socklen], invocation *syscallabi.Syscall) error

func (*LinuxOS) SysListen

func (l *LinuxOS) SysListen(fd, backlog int, invocation *syscallabi.Syscall) error

func (*LinuxOS) SysLseek

func (l *LinuxOS) SysLseek(fd int, offset int64, whence int, invocation *syscallabi.Syscall) (off int64, err error)

func (*LinuxOS) SysMadvise

func (l *LinuxOS) SysMadvise(b syscallabi.SliceView[byte], advice int, invocation *syscallabi.Syscall) (err error)

func (*LinuxOS) SysMkdirat

func (l *LinuxOS) SysMkdirat(dirfd int, path string, mode uint32, invocation *syscallabi.Syscall) (err error)

func (*LinuxOS) SysMmap

func (l *LinuxOS) SysMmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64, invocation *syscallabi.Syscall) (xaddr uintptr, err error)

func (*LinuxOS) SysMunmap

func (l *LinuxOS) SysMunmap(addr uintptr, length uintptr, invocation *syscallabi.Syscall) (err error)

func (*LinuxOS) SysNewfstatat

func (l *LinuxOS) SysNewfstatat(dirfd int, path string, statBuf syscallabi.ValueView[syscall.Stat_t], flags int, invocation *syscallabi.Syscall) error

amd64

func (*LinuxOS) SysOpenat

func (l *LinuxOS) SysOpenat(dirfd int, path string, flags int, mode uint32, invocation *syscallabi.Syscall) (int, error)

func (*LinuxOS) SysPread64

func (l *LinuxOS) SysPread64(fd int, data syscallabi.ByteSliceView, offset int64, invocation *syscallabi.Syscall) (int, error)

func (*LinuxOS) SysPwrite64

func (l *LinuxOS) SysPwrite64(fd int, data syscallabi.ByteSliceView, offset int64, invocation *syscallabi.Syscall) (int, error)

func (*LinuxOS) SysRead

func (l *LinuxOS) SysRead(fd int, data syscallabi.ByteSliceView, invocation *syscallabi.Syscall) (int, error)

func (*LinuxOS) SysRenameat

func (l *LinuxOS) SysRenameat(olddirfd int, oldpath string, newdirfd int, newpath string, invocation *syscallabi.Syscall) error

func (*LinuxOS) SysSetsockopt

func (l *LinuxOS) SysSetsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr, invocation *syscallabi.Syscall) (err error)

func (*LinuxOS) SysSocket

func (l *LinuxOS) SysSocket(net, flags, proto int, invocation *syscallabi.Syscall) (int, error)

func (*LinuxOS) SysUname

func (l *LinuxOS) SysUname(buf syscallabi.ValueView[Utsname], invocation *syscallabi.Syscall) (err error)

func (*LinuxOS) SysUnlinkat

func (l *LinuxOS) SysUnlinkat(dirfd int, path string, flags int, invocation *syscallabi.Syscall) error

func (*LinuxOS) SysWrite

func (l *LinuxOS) SysWrite(fd int, data syscallabi.ByteSliceView, invocation *syscallabi.Syscall) (int, error)

type Machine

type Machine struct {
	// contains filtered or unexported fields
}

type OsFile

type OsFile struct {
	// contains filtered or unexported fields
}

type RawSockaddrAny

type RawSockaddrAny = syscall.RawSockaddrAny

type Simulation

type Simulation struct {
	// contains filtered or unexported fields
}

type Socket

type Socket struct {
	IsBound   bool
	BoundAddr netip.AddrPort

	Listener *network.Listener
	Stream   *network.Stream

	RecvBuffer []byte
}

type Socklen

type Socklen uint32

type Stat_t

type Stat_t = syscall.Stat_t

type Utsname

type Utsname = syscall.Utsname

Directories

Path Synopsis
This program generates wrappers for system calls in gosim to ergonomically invoke them, implement them, and hook them in the go standard library.
This program generates wrappers for system calls in gosim to ergonomically invoke them, implement them, and hook them in the go standard library.

Jump to

Keyboard shortcuts

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