olin: within.website/olin/abi/cwa Index | Files

package cwa

import "within.website/olin/abi/cwa"

Package cwa contains the ABI for CommonWA[1] applications.

[1]: https://github.com/CommonWA/cwa-spec

Index

Package Files

c.go core.go doc.go env.go error.go error_string.go io.go logging.go names.go random.go resource.go runtime.go startup.go time.go

Constants

const (
    LogLevelError   = 1
    LogLevelWarning = 3
    LogLevelInfo    = 6
)

Log levels

const (
    SpecMajor   = 0
    SpecMinor   = 1
    RuntimeName = "olin"
)

Constants

func ErrorCode Uses

func ErrorCode(err error) int

ErrorCode extracts the code from an error.

type Error Uses

type Error int

Error is an individual error as defined by the CommonWA spec.

const (
    ErrNone Error = (iota * -1)
    UnknownError
    InvalidArgumentError
    PermissionDeniedError
    NotFoundError
    EndOfFileError
)

CommonWA errors as defined by the spec at https://github.com/CommonWA/cwa-spec/blob/master/errors.md

func (Error) Error Uses

func (e Error) Error() string

func (Error) String Uses

func (i Error) String() string

type Process Uses

type Process struct {
    HC     *http.Client
    Logger *log.Logger

    FileHandles    map[int32]abi.File
    Stdin          io.Reader
    Stdout, Stderr io.Writer
    // contains filtered or unexported fields
}

Process is an individual CommonWA process. It is the collection of resources and other macguffins that the child module ends up requiring.

func NewProcess Uses

func NewProcess(name string, argv []string, env map[string]string) *Process

NewProcess creates a new process with the given name, arguments and environment.

func (*Process) ArgAt Uses

func (p *Process) ArgAt(i int32, outPtr, outLen uint32) (int32, error)

func (*Process) ArgLen Uses

func (p *Process) ArgLen() int32

func (*Process) EnvGet Uses

func (p *Process) EnvGet(keyPtr, keyLen, valPtr, valLen uint32) (int32, error)

func (*Process) Files Uses

func (p *Process) Files() []abi.File

Files returns the set of open files in use by this process.

func (*Process) IOGetStderr Uses

func (p *Process) IOGetStderr() int32

func (*Process) IOGetStdin Uses

func (p *Process) IOGetStdin() int32

func (*Process) IOGetStdout Uses

func (p *Process) IOGetStdout() int32

func (*Process) LogWrite Uses

func (p *Process) LogWrite(level int32, msgPtr, msgLen uint32)

func (*Process) Name Uses

func (p *Process) Name() string

Name returns this process' name.

func (Process) Open Uses

func (Process) Open(abi.File)

Open does nothing

func (*Process) RandI32 Uses

func (p *Process) RandI32() int32

func (*Process) RandI64 Uses

func (p *Process) RandI64() int64

func (*Process) ResolveFunc Uses

func (p *Process) ResolveFunc(module, field string) exec.FunctionImport

ResolveFunc resolves the CommonWA ABI and importable functions.

func (*Process) ResolveGlobal Uses

func (p *Process) ResolveGlobal(module, field string) int64

ResolveGlobal does nothing, currently.

func (*Process) ResourceClose Uses

func (p *Process) ResourceClose(fid int32) error

func (*Process) ResourceFlush Uses

func (p *Process) ResourceFlush(fid int32) error

func (*Process) ResourceOpen Uses

func (p *Process) ResourceOpen(urlPtr, urlLen uint32) (int32, error)

func (*Process) ResourceRead Uses

func (p *Process) ResourceRead(fid int32, dataPtr, dataLen uint32) (int32, error)

func (*Process) ResourceWrite Uses

func (p *Process) ResourceWrite(fid int32, dataPtr, dataLen uint32) (int32, error)

func (*Process) RuntimeName Uses

func (p *Process) RuntimeName(namePtr, nameLen uint32) int32

func (*Process) SetVM Uses

func (p *Process) SetVM(vm *exec.VirtualMachine)

SetVM sets the VM associated with this process.

func (*Process) Setenv Uses

func (p *Process) Setenv(m map[string]string)

Setenv updates a process' environment. This does not inform the process. It is up to the running process to detect these values have changed.

func (Process) SyscallCount Uses

func (p Process) SyscallCount() int64

func (*Process) TimeNow Uses

func (p *Process) TimeNow() int64

Package cwa imports 12 packages (graph) and is imported by 2 packages. Updated 2019-12-13. Refresh now. Tools for package owners.