wasi

package
v0.0.0-...-1228a4d Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WASI open flags
	O_CREATE = 1 << iota
	O_DIR
	O_EXCL
	O_TRUNC

	// WASI fs rights
	R_FD_READ = 1 << iota
	R_FD_SEEK
	R_FD_FDSTAT_SET_FLAGS
	R_FD_SYNC
	R_FD_TELL
	R_FD_WRITE
)

Variables

View Source
var (
	ESUCCESS        uint32 = 0
	E2BIG           uint32 = 1 /* Arg list too long */
	EACCES          uint32 = 2 /* Permission denied */
	EADDRINUSE      uint32 = 3 /* Address already in use */
	EADDRNOTAVAIL   uint32 = 4 /* Cannot assign requested address */
	EAFNOSUPPORT    uint32 = 5 /* Address family not supported by protocol */
	EAGAIN          uint32 = 6 /* Try again */
	EALREADY        uint32 = 7 /* Operation already in progress */
	EBADF           uint32 = 8 /* Bad file number */
	EBADMSG         uint32 = 9
	EBUSY           uint32 = 10
	ECANCELED       uint32 = 11
	ECHILD          uint32 = 12
	ECONNABORTED    uint32 = 13
	ECONNREFUSED    uint32 = 14
	ECONNRESET      uint32 = 15
	EDEADLK         uint32 = 16
	EDESTADDRREQ    uint32 = 17
	EDOM            uint32 = 18
	EDQUOT          uint32 = 19
	EEXIST          uint32 = 20
	EFAULT          uint32 = 21
	EFBIG           uint32 = 22
	EHOSTUNREACH    uint32 = 23
	EIDRM           uint32 = 24
	EILSEQ          uint32 = 25
	EINPROGRESS     uint32 = 26
	EINTR           uint32 = 27
	EINVAL          uint32 = 28 /* Invalid argument */
	EIO             uint32 = 29
	EISCONN         uint32 = 30
	EISDIR          uint32 = 31
	ELOOP           uint32 = 32
	EMFILE          uint32 = 33
	EMLINK          uint32 = 34
	EMSGSIZE        uint32 = 35
	EMULTIHOP       uint32 = 36
	ENAMETOOLONG    uint32 = 37
	ENETDOWN        uint32 = 38
	ENETRESET       uint32 = 39
	ENETUNREACH     uint32 = 40
	ENFILE          uint32 = 41
	ENOBUFS         uint32 = 42
	ENODEV          uint32 = 43
	ENOENT          uint32 = 44
	ENOEXEC         uint32 = 45
	ENOLCK          uint32 = 46
	ENOLINK         uint32 = 47
	ENOMEM          uint32 = 48
	ENOMSG          uint32 = 49
	ENOPROTOOPT     uint32 = 50
	ENOSPC          uint32 = 51
	ENOSYS          uint32 = 52
	ENOTCONN        uint32 = 53
	ENOTDIR         uint32 = 54
	ENOTEMPTY       uint32 = 55
	ENOTRECOVERABLE uint32 = 56
	ENOTSOCK        uint32 = 57
	ENOTSUP         uint32 = 58
	ENOTTY          uint32 = 59
	ENXIO           uint32 = 60
	EOVERFLOW       uint32 = 61
	EOWNERDEAD      uint32 = 62
	EPERM           uint32 = 63
	EPIPE           uint32 = 64
	EPROTO          uint32 = 65
	EPROTONOSUPPORT uint32 = 66
	EPROTOTYPE      uint32 = 67
	ERANGE          uint32 = 68
	EROFS           uint32 = 69
	ESPIPE          uint32 = 70
	ESRCH           uint32 = 71
	ESTALE          uint32 = 72
	ETIMEDOUT       uint32 = 73
	ETXTBSY         uint32 = 74
	EXDEV           uint32 = 75
	ENOTCAPABLE     uint32 = 76
)

WASI error codes

Functions

This section is empty.

Types

type FS

type FS interface {
	// OpenWASI is a general method to open a file, similar to
	// os.OpenFile, but with WASI flags and rights instead of POSIX.
	OpenWASI(dirFlags uint32, path string, oFlags uint32, fsRights, fsRightsInheriting uint64, fdFlags uint32) (File, error)
}

FS is an interface for a preopened directory.

func DirFS

func DirFS(dir string) FS

DirFS returns a file system (a wasi.FS) for the tree of files rooted at the directory dir. It's similar to os.DirFS, except that it implements wasi.FS instead of the fs.FS interface.

func MemFS

func MemFS() FS

type File

type File interface {
	Read([]byte) (int, error)
	Write([]byte) (int, error)
	Close() error
}

type Option

type Option func(*WASI)

func Preopen

func Preopen(dir string, fileSys FS) Option

func Stderr

func Stderr(writer io.Writer) Option

func Stdin

func Stdin(reader io.Reader) Option

func Stdout

func Stdout(writer io.Writer) Option

type WASI

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

func New

func New(opts ...Option) *WASI

func (*WASI) Modules

func (w *WASI) Modules() map[string]*wasm.Module

Jump to

Keyboard shortcuts

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