Documentation
¶
Overview ¶
Package syscall provides support for system call for TamaGo unikernels launched in supervised mode through monitor.Exec (see monitor package).
This package is only meant to be used with `GOOS=tamago` as supported by the TamaGo framework for bare metal Go, see https://github.com/usbarmory/tamago.
Index ¶
- Constants
- func Call(serviceMethod string, args interface{}, reply interface{}) error
- func Exit()
- func GetRandom(b []byte, n uint)
- func Nanotime() int64
- func NewClient() *rpc.Client
- func Print(c byte)
- func Read(trap uint, p []byte, n uint) int
- func Supervisor()
- func Write(trap uint, p []byte, n uint)
- type Stream
Constants ¶
const ( SYS_EXIT = iota SYS_WRITE SYS_NANOTIME SYS_GETRANDOM SYS_RPC_REQ SYS_RPC_RES )
Variables ¶
This section is empty.
Functions ¶
func Call ¶
Call is a convenience method that issues an RPC call on a disposable client created with NewClient(), to avoid concurrent reads and writes a mutex is held to prevent interleaved invocations.
func Exit ¶
func Exit()
Exit terminates the execution context scheduling through a system call to the supervisor.
func GetRandom ¶
GetRandom fills a byte array with random values through a system call to the supervisor.
func Nanotime ¶
func Nanotime() int64
Nanotime returns the system time in nanoseconds through a system call to the supervisor.
func NewClient ¶
NewClient returns a new client suitable for RPC calls to the supervisor. The client automatically closes after Call() is invoked on it the first time, therefore a new instance is needed for each call (also see Call()).
func Print ¶
func Print(c byte)
Print prints a single character on standard output through a system call to the supervisor.
func Read ¶
Read requests a transfer of n bytes into p from the supervisor through the syscall specified as first argument. It can be used to implement syscalls that require request/responses data streams, along with Write().
The underlying connection used by the RPC client (see NewClient()) is an example of such implementation.
func Write ¶
Write requests a transfer of n bytes from p to the supervisor through the syscall specified as first argument. It can be used to implement syscalls that require request/responses data streams, along with Read().
The underlying connection used by the RPC client (see NewClient()) is an example of such implementation.
Types ¶
type Stream ¶
type Stream struct { // ReadSyscall is the syscall number associated to Read() ReadSyscall uint // ReadSyscall is the syscall number associated to Write() WriteSyscall uint }
Stream implements a data stream interface to exchange data buffers between the security monitor and a lower privilege execution context over syscalls.
It is used by NewClient() to stream JSON-RPC calls from an applet and receive responses from the supervisor, over syscalls.
The implementation is not safe against concurrent reads and writes, which should be avoided.