ref: f89df20e0dae4f7884cd432e9064ddb0f6e26ede
parent: bef1877e245cc389dacbf1abafc174716337334d
author: Ori Bernstein <[email protected]>
date: Thu Oct 24 09:43:31 EDT 2013
Add some functions for server-side network support
--- a/libstd/sys-linux.myr
+++ b/libstd/sys-linux.myr
@@ -479,8 +479,12 @@
const lseek = {fd, off, whence; -> syscall(Syslseek, fd, off, whence)}
const fstat = {fd, sb; -> syscall(Sysfstat, fd, sb)}
+/* networking */
const socket = {dom, stype, proto; -> syscall(Syssocket, dom castto(int64), stype, proto) castto(fd)}
const connect = {sock, addr, len; -> syscall(Sysconnect, sock, addr, len) castto(int)}
+const bind = {sock, addr, len; -> syscall(Sysbind, sock, addr, len) castto(int)}
+const listen = {sock, backlog; -> syscall(Syslisten, sock, backlog castto(int64)) castto(int)}
+const accept = {sock, addr, lenp; -> syscall(Sysbind, sock, addr, lenp) castto(fd)}
/* memory mapping */
const munmap = {addr, len; -> syscall(Sysmunmap, addr, len)}