diff --git a/src/pkg/syscall/zerrors_nacl_386.go b/src/pkg/syscall/zerrors_nacl_386.go new file mode 100644 index 0000000000..e231133b85 --- /dev/null +++ b/src/pkg/syscall/zerrors_nacl_386.go @@ -0,0 +1,246 @@ +// mkerrors_nacl.sh /home/rsc/pub/nacl/native_client/src/trusted/service_runtime/include/sys/errno.h +// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT + +package syscall + +const ( + EPERM = 1; + ENOENT = 2; + ESRCH = 3; + EINTR = 4; + EIO = 5; + ENXIO = 6; + E2BIG = 7; + ENOEXEC = 8; + EBADF = 9; + ECHILD = 10; + EAGAIN = 11; + ENOMEM = 12; + EACCES = 13; + EFAULT = 14; + EBUSY = 16; + EEXIST = 17; + EXDEV = 18; + ENODEV = 19; + ENOTDIR = 20; + EISDIR = 21; + EINVAL = 22; + ENFILE = 23; + EMFILE = 24; + ENOTTY = 25; + EFBIG = 27; + ENOSPC = 28; + ESPIPE = 29; + EROFS = 30; + EMLINK = 31; + EPIPE = 32; + ENAMETOOLONG = 36; + ENOSYS = 38; + EDQUOT = 122; + EDOM = 33; + ERANGE = 34; + ENOMSG = 35; + ECHRNG = 37; + EL3HLT = 39; + EL3RST = 40; + ELNRNG = 41; + EUNATCH = 42; + ENOCSI = 43; + EL2HLT = 44; + EDEADLK = 45; + ENOLCK = 46; + EBADE = 50; + EBADR = 51; + EXFULL = 52; + ENOANO = 53; + EBADRQC = 54; + EBADSLT = 55; + EBFONT = 57; + ENOSTR = 60; + ENODATA = 61; + ETIME = 62; + ENOSR = 63; + ENONET = 64; + ENOPKG = 65; + EREMOTE = 66; + ENOLINK = 67; + EADV = 68; + ESRMNT = 69; + ECOMM = 70; + EPROTO = 71; + EMULTIHOP = 74; + ELBIN = 75; + EDOTDOT = 76; + EBADMSG = 77; + EFTYPE = 79; + ENOTUNIQ = 80; + EBADFD = 81; + EREMCHG = 82; + ELIBACC = 83; + ELIBBAD = 84; + ELIBSCN = 85; + ELIBMAX = 86; + ELIBEXEC = 87; + ENMFILE = 89; + ENOTEMPTY = 90; + ELOOP = 92; + EOPNOTSUPP = 95; + EPFNOSUPPORT = 96; + ECONNRESET = 104; + ENOBUFS = 105; + EAFNOSUPPORT = 106; + EPROTOTYPE = 107; + ENOTSOCK = 108; + ENOPROTOOPT = 109; + ESHUTDOWN = 110; + ECONNREFUSED = 111; + EADDRINUSE = 112; + ECONNABORTED = 113; + ENETUNREACH = 114; + ENETDOWN = 115; + ETIMEDOUT = 116; + EHOSTDOWN = 117; + EHOSTUNREACH = 118; + EINPROGRESS = 119; + EALREADY = 120; + EDESTADDRREQ = 121; + EPROTONOSUPPORT = 123; + ESOCKTNOSUPPORT = 124; + EADDRNOTAVAIL = 125; + ENETRESET = 126; + EISCONN = 127; + ENOTCONN = 128; + ETOOMANYREFS = 129; + EPROCLIM = 130; + EUSERS = 131; + ESTALE = 133; + ENOMEDIUM = 135; + ENOSHARE = 136; + ECASECLASH = 137; + EILSEQ = 138; + EOVERFLOW = 139; + ECANCELED = 140; + EL2NSYNC = 88; + EIDRM = 91; + EMSGSIZE = 132; + ENACL = 99; /* otherwise unused */ +) + + +// Error table +var errors = [...]string { + EPERM: "operation not permitted", + ENOENT: "no such file or directory", + ESRCH: "no such process", + EINTR: "interrupted system call", + EIO: "I/O error", + ENXIO: "no such device or address", + E2BIG: "argument list too long", + ENOEXEC: "exec format error", + EBADF: "bad file number", + ECHILD: "no child processes", + EAGAIN: "try again", + ENOMEM: "out of memory", + EACCES: "permission denied", + EFAULT: "bad address", + EBUSY: "device or resource busy", + EEXIST: "file exists", + EXDEV: "cross-device link", + ENODEV: "no such device", + ENOTDIR: "not a directory", + EISDIR: "is a directory", + EINVAL: "invalid argument", + ENFILE: "file table overflow", + EMFILE: "too many open files", + ENOTTY: "not a typewriter", + EFBIG: "file too large", + ENOSPC: "no space left on device", + ESPIPE: "illegal seek", + EROFS: "read-only file system", + EMLINK: "too many links", + EPIPE: "broken pipe", + ENAMETOOLONG: "file name too long", + ENOSYS: "function not implemented", + EDQUOT: "quota exceeded", + EDOM: "math arg out of domain of func", + ERANGE: "math result not representable", + ENOMSG: "no message of desired type", + ECHRNG: "channel number out of range", + EL3HLT: "level 3 halted", + EL3RST: "level 3 reset", + ELNRNG: "link number out of range", + EUNATCH: "protocol driver not attached", + ENOCSI: "no CSI structure available", + EL2HLT: "level 2 halted", + EDEADLK: "deadlock condition", + ENOLCK: "no record locks available", + EBADE: "invalid exchange", + EBADR: "invalid request descriptor", + EXFULL: "exchange full", + ENOANO: "no anode", + EBADRQC: "invalid request code", + EBADSLT: "invalid slot", + EBFONT: "bad font file fmt", + ENOSTR: "device not a stream", + ENODATA: "no data (for no delay io)", + ETIME: "timer expired", + ENOSR: "out of streams resources", + ENONET: "machine is not on the network", + ENOPKG: "package not installed", + EREMOTE: "the object is remote", + ENOLINK: "the link has been severed", + EADV: "advertise error", + ESRMNT: "srmount error", + ECOMM: "communication error on send", + EPROTO: "protocol error", + EMULTIHOP: "multihop attempted", + ELBIN: "inode is remote (not really error)", + EDOTDOT: "cross mount point (not really error)", + EBADMSG: "trying to read unreadable message", + EFTYPE: "inappropriate file type or format", + ENOTUNIQ: "given log. name not unique", + EBADFD: "f.d. invalid for this operation", + EREMCHG: "remote address changed", + ELIBACC: "can't access a needed shared lib", + ELIBBAD: "accessing a corrupted shared lib", + ELIBSCN: ".lib section in a.out corrupted", + ELIBMAX: "attempting to link in too many libs", + ELIBEXEC: "attempting to exec a shared library", + ENMFILE: "no more files", + ENOTEMPTY: "directory not empty", + ELOOP: "too many symbolic links", + EOPNOTSUPP: "operation not supported on transport endpoint", + EPFNOSUPPORT: "protocol family not supported", + ECONNRESET: "connection reset by peer", + ENOBUFS: "no buffer space available", + EAFNOSUPPORT: "address family not supported by protocol family", + EPROTOTYPE: "protocol wrong type for socket", + ENOTSOCK: "socket operation on non-socket", + ENOPROTOOPT: "protocol not available", + ESHUTDOWN: "can't send after socket shutdown", + ECONNREFUSED: "connection refused", + EADDRINUSE: "address already in use", + ECONNABORTED: "connection aborted", + ENETUNREACH: "network is unreachable", + ENETDOWN: "network interface is not configured", + ETIMEDOUT: "connection timed out", + EHOSTDOWN: "host is down", + EHOSTUNREACH: "host is unreachable", + EINPROGRESS: "connection already in progress", + EALREADY: "socket already connected", + EDESTADDRREQ: "destination address required", + EPROTONOSUPPORT: "unknown protocol", + ESOCKTNOSUPPORT: "socket type not supported", + EADDRNOTAVAIL: "address not available", + EISCONN: "socket is already connected", + ENOTCONN: "socket is not connected", + ENOMEDIUM: "no medium (in tape drive)", + ENOSHARE: "no such host or network path", + ECASECLASH: "filename exists with different case", + EOVERFLOW: "value too large for defined data type", + ECANCELED: "operation canceled.", + EL2NSYNC: "level 2 not synchronized", + EIDRM: "identifier removed", + EMSGSIZE: "message too long", + ENACL: "not supported by native client", +} diff --git a/src/pkg/syscall/zsyscall_nacl_386.go b/src/pkg/syscall/zsyscall_nacl_386.go new file mode 100644 index 0000000000..2565d7dd22 --- /dev/null +++ b/src/pkg/syscall/zsyscall_nacl_386.go @@ -0,0 +1,97 @@ +// mksyscall.sh -l32 syscall_nacl.go syscall_nacl_386.go +// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT + +package syscall + +import "unsafe" + +func Chmod(path string, mode int) (errno int) { + _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0); + errno = int(e1); + return; +} + +func Clock() (clock int) { + r0, _, _ := Syscall(SYS_CLOCK, 0, 0, 0); + clock = int(r0); + return; +} + +func Close(fd int) (errno int) { + _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0); + errno = int(e1); + return; +} + +func Exit(code int) () { + Syscall(SYS_EXIT, uintptr(code), 0, 0); + return; +} + +func Fstat(fd int, stat *Stat_t) (errno int) { + _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0); + errno = int(e1); + return; +} + +func Getdents(fd int, buf []byte) (n int, errno int) { + var _p0 *byte; + if len(buf) > 0 { _p0 = &buf[0]; } + r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf))); + n = int(r0); + errno = int(e1); + return; +} + +func Getpid() (pid int) { + r0, _, _ := Syscall(SYS_GETPID, 0, 0, 0); + pid = int(r0); + return; +} + +func Gettimeofday(tv *Timeval) (errno int) { + _, _, e1 := Syscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0); + errno = int(e1); + return; +} + +func Open(path string, mode int, perm int) (fd int, errno int) { + r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm)); + fd = int(r0); + errno = int(e1); + return; +} + +func Read(fd int, p []byte) (n int, errno int) { + var _p0 *byte; + if len(p) > 0 { _p0 = &p[0]; } + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p))); + n = int(r0); + errno = int(e1); + return; +} + +func read(fd int, buf *byte, nbuf int) (n int, errno int) { + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)); + n = int(r0); + errno = int(e1); + return; +} + +func Stat(path string, stat *Stat_t) (errno int) { + _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(unsafe.Pointer(stat)), 0); + errno = int(e1); + return; +} + +func Write(fd int, p []byte) (n int, errno int) { + var _p0 *byte; + if len(p) > 0 { _p0 = &p[0]; } + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p))); + n = int(r0); + errno = int(e1); + return; +} + + + diff --git a/src/pkg/syscall/zsysnum_nacl_386.go b/src/pkg/syscall/zsysnum_nacl_386.go new file mode 100644 index 0000000000..6b1a3a9900 --- /dev/null +++ b/src/pkg/syscall/zsysnum_nacl_386.go @@ -0,0 +1,62 @@ +// mksysnum_nacl.sh /home/rsc/pub/nacl/native_client/src/trusted/service_runtime/include/bits/nacl_syscalls.h +// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT + +package syscall + +const( + SYS_NULL = 1; + SYS_OPEN = 10; + SYS_CLOSE = 11; + SYS_READ = 12; + SYS_WRITE = 13; + SYS_LSEEK = 14; + SYS_IOCTL = 15; + SYS_STAT = 16; + SYS_FSTAT = 17; + SYS_CHMOD = 18; + SYS_SYSBRK = 20; + SYS_MMAP = 21; + SYS_MUNMAP = 22; + SYS_GETDENTS = 23; + SYS_EXIT = 30; + SYS_GETPID = 31; + SYS_SCHED_YIELD = 32; + SYS_SYSCONF = 33; + SYS_GETTIMEOFDAY = 40; + SYS_CLOCK = 41; + SYS_MULTIMEDIA_INIT = 50; + SYS_MULTIMEDIA_SHUTDOWN = 51; + SYS_VIDEO_INIT = 52; + SYS_VIDEO_SHUTDOWN = 53; + SYS_VIDEO_UPDATE = 54; + SYS_VIDEO_POLL_EVENT = 55; + SYS_AUDIO_INIT = 56; + SYS_AUDIO_SHUTDOWN = 57; + SYS_AUDIO_STREAM = 58; + SYS_IMC_MAKEBOUNDSOCK = 60; + SYS_IMC_ACCEPT = 61; + SYS_IMC_CONNECT = 62; + SYS_IMC_SENDMSG = 63; + SYS_IMC_RECVMSG = 64; + SYS_IMC_MEM_OBJ_CREATE = 65; + SYS_IMC_SOCKETPAIR = 66; + SYS_MUTEX_CREATE = 70; + SYS_MUTEX_LOCK = 71; + SYS_MUTEX_TRYLOCK = 72; + SYS_MUTEX_UNLOCK = 73; + SYS_COND_CREATE = 74; + SYS_COND_WAIT = 75; + SYS_COND_SIGNAL = 76; + SYS_COND_BROADCAST = 77; + SYS_COND_TIMED_WAIT_ABS = 79; + SYS_THREAD_CREATE = 80; + SYS_THREAD_EXIT = 81; + SYS_TLS_INIT = 82; + SYS_THREAD_NICE = 83; + SYS_SRPC_GET_FD = 90; + SYS_SEM_CREATE = 100; + SYS_SEM_WAIT = 101; + SYS_SEM_POST = 102; + SYS_SEM_GET_VALUE = 103; +) + diff --git a/src/pkg/syscall/ztypes_nacl.go b/src/pkg/syscall/ztypes_nacl.go new file mode 100644 index 0000000000..4a3465a2ec --- /dev/null +++ b/src/pkg/syscall/ztypes_nacl.go @@ -0,0 +1,9 @@ +// godefs -gsyscall -f-m32 -f-I/home/rsc/pub/nacl/native_client/src/third_party/nacl_sdk/linux/sdk/nacl-sdk/nacl/include -f-I/home/rsc/pub/nacl/native_client/src/trusted/service_runtime/include types_nacl.c + +// MACHINE GENERATED - DO NOT EDIT. + +package syscall + +// Constants + +// Types diff --git a/src/pkg/syscall/ztypes_nacl_386.go b/src/pkg/syscall/ztypes_nacl_386.go new file mode 100644 index 0000000000..e4bb25bb82 --- /dev/null +++ b/src/pkg/syscall/ztypes_nacl_386.go @@ -0,0 +1,101 @@ +// godefs -gsyscall -f-m32 -f-I/home/rsc/pub/nacl/native_client/src/third_party/nacl_sdk/linux/sdk/nacl-sdk/nacl/include -f-I/home/rsc/pub/nacl/native_client types_nacl.c + +// MACHINE GENERATED - DO NOT EDIT. + +package syscall + +// Constants +const ( + sizeofPtr = 0x4; + sizeofShort = 0x2; + sizeofInt = 0x4; + sizeofLong = 0x4; + sizeofLongLong = 0x8; + SYS_FORK = 0; + SYS_PTRACE = 0; + SYS_CHDIR = 0; + SYS_DUP2 = 0; + SYS_FCNTL = 0; + SYS_EXECVE = 0; + O_RDONLY = 0; + O_WRONLY = 0x1; + O_RDWR = 0x2; + O_APPEND = 0x400; + O_ASYNC = 0x2000; + O_CREAT = 0x40; + O_NOCTTY = 0; + O_NONBLOCK = 0x800; + O_SYNC = 0x1000; + O_TRUNC = 0x200; + O_CLOEXEC = 0; + F_GETFD = 0x1; + F_SETFD = 0x2; + F_GETFL = 0x3; + F_SETFL = 0x4; + FD_CLOEXEC = 0; + S_IFMT = 0x1f000; + S_IFIFO = 0x1000; + S_IFCHR = 0x2000; + S_IFDIR = 0x4000; + S_IFBLK = 0x6000; + S_IFREG = 0x8000; + S_IFLNK = 0xa000; + S_IFSOCK = 0xc000; + S_ISUID = 0x800; + S_ISGID = 0x400; + S_ISVTX = 0x200; + S_IRUSR = 0x100; + S_IWUSR = 0x80; + S_IXUSR = 0x40; +) + +// Types + +type _C_short int16 + +type _C_int int32 + +type _C_long int32 + +type _C_long_long int64 + +type _C_off_t int32 + +type Timespec struct { + Sec int32; + Nsec int32; +} + +type Timeval struct { + Sec int32; + Usec int32; +} + +type Time_t int32 + +type _Gid_t uint32 + +type Stat_t struct { + Dev int64; + Ino uint32; + Mode uint32; + Nlink uint32; + Uid uint32; + Gid uint32; + __padding int32; + Rdev int64; + Size int32; + Blksize int32; + Blocks int32; + Atime int32; + Mtime int32; + Ctime int32; +} + +type Dirent struct { + Ino uint32; + Off int32; + Reclen uint16; + Name [256]int8; + Pad0 [2]byte; +}