τau /

syscall

module
syscall = import("syscall")

syscall.tau - Low-level system call interface for Tau Provides a cross-platform abstraction layer for system calls Similar to Go's syscall package

Errno = fn()source

SetErrno = fn(err)source

Strerror = fn(err)source

Strerror returns the message of an errno value.

Error = fn(what)source

Error builds an error for a failed call, with the message of the errno.

O_RDONLY = 0x0000valuesource

open() flags - Linux/macOS values (POSIX)

O_WRONLY = 0x0001valuesource

O_RDWR = 0x0002valuesource

O_CREAT = 0x0040valuesource

O_EXCL = 0x0080valuesource

O_TRUNC = 0x0200valuesource

O_APPEND = 0x0400valuesource

O_NONBLOCK = 0x0800valuesource

O_SYNC = 0x1000valuesource

S_IRWXU = 0x01C0valuesource

File permissions

S_IRUSR = 0x0100valuesource

S_IWUSR = 0x0080valuesource

S_IXUSR = 0x0040valuesource

S_IRWXG = 0x0038valuesource

S_IRGRP = 0x0020valuesource

S_IWGRP = 0x0010valuesource

S_IXGRP = 0x0008valuesource

S_IRWXO = 0x0007valuesource

S_IROTH = 0x0004valuesource

S_IWOTH = 0x0002valuesource

S_IXOTH = 0x0001valuesource

SEEK_SET = 0valuesource

lseek() whence

SEEK_CUR = 1valuesource

SEEK_END = 2valuesource

F_OK = 0valuesource

access() mode

X_OK = 1valuesource

W_OK = 2valuesource

R_OK = 4valuesource

AF_INET = 2valuesource

Address families

AF_INET6 = 10valuesource

AF_UNIX = 1valuesource

SOCK_STREAM = 1valuesource

Socket types

SOCK_DGRAM = 2valuesource

SOCK_RAW = 3valuesource

IPPROTO_IP = 0valuesource

Protocols

IPPROTO_TCP = 6valuesource

IPPROTO_UDP = 17valuesource

SOL_SOCKET = 1valuesource

Socket options - level

SO_REUSEADDR = 2valuesource

Socket options - names

SO_REUSEPORT = 15valuesource

SO_KEEPALIVE = 9valuesource

SO_BROADCAST = 6valuesource

SO_LINGER = 13valuesource

SO_RCVBUF = 8valuesource

SO_SNDBUF = 7valuesource

SO_RCVTIMEO = 20valuesource

SO_SNDTIMEO = 21valuesource

SHUT_RD = 0valuesource

shutdown() how

SHUT_WR = 1valuesource

SHUT_RDWR = 2valuesource

SOMAXCONN = 128valuesource

Listen backlog

Open = fn(path, flags, mode)source

Close = fn(fd)source

Read = fn(fd, buf, count)source

Write = fn(fd, buf, count)source

Lseek = fn(fd, offset, whence)source

Mkdir = fn(path, mode)source

Rmdir = fn(path)source

Chmod = fn(path, mode)source

Access = fn(path, mode)source

Socket = fn(domain, socktype, protocol)source

Bind = fn(sockfd, addr, addrlen)source

Listen = fn(sockfd, backlog)source

Accept = fn(sockfd, addr, addrlen)source

Getsockname = fn(sockfd, addr, addrlen)source

Connect = fn(sockfd, addr, addrlen)source

Send = fn(sockfd, buf, len, flags)source

Recv = fn(sockfd, buf, len, flags)source

Sendto = fn(sockfd, buf, len, flags, dest_addr, addrlen)source

Recvfrom = fn(sockfd, buf, len, flags, src_addr, addrlen)source

Setsockopt = fn(sockfd, level, optname, optval, optlen)source

Getsockopt = fn(sockfd, level, optname, optval, optlen)source

Shutdown = fn(sockfd, how)source

Htons = fn(hostshort)source

Ntohs = fn(netshort)source

Htonl = fn(hostlong)source

Ntohl = fn(netlong)source

InetAddr = fn(cp)source

SockaddrInSize = fn()source

SockaddrInSize is the length of a sockaddr_in.

SockaddrIn = fn(ip, port)source

SockaddrIn returns a sockaddr_in filled for ip:port, ready for Bind, Connect and Sendto. An empty ip means "any address".

SockaddrPort = fn(sa)source

SockaddrPort returns the port stored in a sockaddr_in.

SockaddrIP = fn(sa)source

SockaddrIP returns the dotted address stored in a sockaddr_in.

Int32 = fn(n)source

Int32 returns the bytes of a native int32, for the calls that want a pointer to one.

Timeval = fn(ms)source

Timeval returns the bytes of a struct timeval of ms milliseconds, for the timeout options of setsockopt.

TimeUnix = fn()source

TimeUnix returns the wall clock time in seconds since the Unix epoch.

TimeMillis = fn()source

TimeMillis returns the wall clock time in milliseconds.

TimeMono = fn()source

TimeMono returns a monotonic timestamp in milliseconds.

SleepMillis = fn(ms)source

SleepMillis pauses the current tau routine for ms milliseconds.

Getenv = fn(name)source

Getenv returns the value of the variable name, or null when it isn't set.

Setenv = fn(name, value)source

Setenv sets the variable name to value, overwriting what was there.

Unsetenv = fn(name)source

Unsetenv removes the variable name.

S_IFMT = 0170000valuesource

The bits of a file mode, as returned by StatMode.

S_IFDIR = 0040000valuesource

S_IFREG = 0100000valuesource

S_IFLNK = 0120000valuesource

StatSize = fn(path)source

StatSize returns the size of the file at path in bytes.

StatMode = fn(path)source

StatMode returns the mode of the file at path, permissions and type.

StatMtime = fn(path)source

StatMtime returns when the file at path was last modified, in seconds since the Unix epoch.

StatIsDir = fn(path)source

StatIsDir reports whether path is a directory.

Rename = fn(from, to)source

Getwd = fn()source

Getwd returns the working directory.

Chdir = fn(path)source

Readdirnames = fn(path)source

Readdirnames returns the names inside the directory at path, "." and ".." included, the way the system hands them over.

TzOffset = fn(sec)source

TzOffset returns the seconds between local time and UTC at the instant sec, daylight saving included.

TzName = fn(sec)source

TzName returns the abbreviation of the local zone at the instant sec.

Spawn = fn(blob, nargs, input, out, flags)source

Spawn runs a program and waits for it. blob holds the program and its arguments one after the other, each one ended by a zero byte, and nargs says how many there are. What the program writes on its standard output is copied into out, and the return value is how many bytes it wrote in all: more than len(out) means the rest was thrown away.

input is written to the standard input of the program, or null for nothing. The flags are 1 to fold standard error into the output and 2 to leave both alone, inherited from this process.

The exit status is read with SpawnStatus after the call. See the exec module for the usual way to reach all this.

SpawnStatus = fn()source

SpawnStatus is the exit status of the last Spawn: what the program passed to exit, or 128 plus the signal that killed it, or 127 when it wasn't found.