shithub: mc

Download patch

ref: 241b498591ec1c86165c4e749f5e74ce7a03dd2a
parent: 2c911dc66fe609309ca666da961ca3e78c0379d0
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Aug 5 21:44:39 EDT 2017

Add system call generation scripts.

	Should start to make life easier. Maybe.

diff: cannot open b/support/syscall-gen//null: file does not exist: 'b/support/syscall-gen//null'
--- /dev/null
+++ b/support/syscall-gen/c2myr.py
@@ -1,0 +1,369 @@
+import sys
+import re
+import os
+import traceback
+import pycparser
+import StringIO
+from pycparser import c_parser, c_ast
+from pycparser.plyparser import Coord
+#from pycparser import c_parser, c_ast, parse_file
+
+#from pycparser.plyparser import Coord
+
+ctypes = {}
+myrtypes = {
+    'void':                     'void',
+    'char':                     'byte',
+    'short':                    'int16',
+    'int':                      'int',
+    'long':                     'int64',
+    'long long':                'int64',
+
+    'unsigned char':            'byte',
+    'unsigned short':           'uint16',
+    'unsigned int':             'uint',
+    'unsigned long':            'uint64',
+    'unsigned long long':       'uint64',
+
+    'unsigned short int':       'uint16',
+    'unsigned long int':        'uint64',
+    'unsigned long long int':   'uint64',
+
+    'short int':                'int16',
+    'long int':                 'int64',
+    'long long int':            'int64',
+
+    'int8_t':                   'byte',
+    'int16_t':                  'int16',
+    'int32_t':                  'int32',
+    'int64_t':                  'int64',
+
+    'uint8_t':                  'byte',
+    'uint16_t':                 'uint16',
+    'uint32_t':                 'uint32',
+    'uint64_t':                 'uint64',
+
+    'size_t':                   'size',
+    'ssize_t':                  'size', # myrddin sizes are signed
+
+    # kernel-defined types?
+    'u_char':                   'byte',
+    'u_short':                  'uint16',
+    'u_int':                    'uint',
+    'u_long':                   'uint64',
+
+    'u_int8':                   'uint8',
+    'u_int16':                  'uint16',
+    'u_int32':                  'uint32',
+    'u_int64':                  'uint64',
+
+    'int8':                     'int8',
+    'int16':                    'int16',
+    'int32':                    'int32',
+    'int64':                    'int64',
+
+    '__int64_t':                'int64',
+
+    'char':                     'byte',
+    'short':                    'int16',
+    'int':                      'int',
+    'long':                     'int64',
+
+    'caddr_t':                  'void#',
+}
+
+have = set()
+
+#valid for all unixes we support...
+sizes = {
+        'char':                     1,
+        'short':                    2,
+        'int':                      4,
+        'long':                     8,
+        'long int':                 8,
+        'long long':                8,
+        'long long int':            8,
+        'unsigned char':            1,
+        'unsigned short':           2,
+        'unsigned short int':       2,
+        'unsigned int':             4,
+        'unsigned long':            8,
+        'unsigned long int':        8,
+        'unsigned long long':       8,
+        'unsigned long long int':   8,
+        'void*':                    1,
+}
+
+def fullydefined(t):
+    return type(t) == c_ast.Struct and t.decls
+
+def collectdef(n, t):
+    if t in [c_ast.Decl, c_ast.TypeDecl] and type(n.type) == c_ast.Struct:
+        if fullydefined(n.type):
+            ctypes[n.type.name] = n.type
+    elif t == c_ast.Typedef:
+        # typedef struct foo foo is valid.
+        if n.name not in ctypes:
+            ctypes[n.name] = n
+        # as is 'typedef struct foo { ... } bar'
+        if type(n.type) is c_ast.TypeDecl:
+            if type(n.type.type) is c_ast.Struct:
+                collectdef(n.type, type(n.type))
+
+def collect(ast):
+    for n in ast.ext:
+        collectdef(n, type(n))
+
+def typename(t):
+    if type(t) == c_ast.Struct:
+        return t.name
+    elif type(t) == c_ast.IdentifierType:
+        return ' '.join(t.names)
+    elif type(t) == c_ast.Typedef:
+        return t.name
+    elif type(t) == c_ast.Struct:
+        return t.name
+    elif type(t) == c_ast.TypeDecl:
+        return typename(t.type)
+    elif type(t) == c_ast.TypeDecl:
+        return typename(t.type)
+    else:
+        t.show()
+        raise ValueError('unknown type')
+
+def deprefix(decls):
+    pfx = None
+    for d in decls:
+        name = d.name
+        if not name:
+            return
+        if name.startswith('__'):
+            name = name[2:]
+        sp = name.split('_', 1)
+        if len(sp) != 2:
+            return
+        if pfx and sp[0] != pfx:
+            return
+        pfx = sp[0]
+
+    for d in decls:
+        if d.name.startswith('__'):
+            d.name = d.name[2:]
+        (hd, tl) = d.name.split('_', 1)
+        d.name = tl
+
+def myrname(n):
+    namemap = {
+        'acl_type_t':           'acltype',
+	'acl_tag_t':	        'acltag',
+	'acl_perm_t':	        'aclperm',
+	'acl_entry_type_t':     'aclenttype',
+	'mode_t':               'filemode',
+	'ssize_t':              'size',
+	'__socklen_t':          'int32',
+	'socklen_t':            'int32',
+	'fd_set':               'fdset',
+	'__ucontext':           'ucontext',
+	'cap_rights_t':         'caprights',
+	'stack_t':              'sigstack',
+        'thr_param':            'thrparam',
+        'stat':                 'statbuf',
+        'nstat':                'statbuf',
+        'newstat':              'statbuf',
+    }
+    if n in namemap:
+        return namemap[n]
+    if n.endswith('_t'):
+        n = n[:-2]
+    if n.startswith('__'):
+        n = n[2:]
+    return n
+
+def tysize(t):
+    if type(t) == c_ast.Typename:
+        return tysize(t.type)
+    if type(t) == c_ast.TypeDecl:
+        return tysize(t.type)
+    if type(t) == c_ast.Typedef:
+        return tysize(t.type)
+    if type(t) == c_ast.Typedef:
+        return tysize(t.type)
+    if type(t) == c_ast.PtrDecl:
+        return sizes['void*']
+    if type(t) == c_ast.ArrayDecl:
+        return tysize(t.type) * fold(t.dim)
+    elif type(t) == c_ast.IdentifierType:
+        name = ' '.join(t.names)
+        if name in ctypes:
+            return tysize(ctypes[name])
+        else:
+            return sizes[name]
+    else:
+        raise ValueError('unsupported type' + str(t))
+
+def fold(expr):
+    try:
+        if type(expr) is c_ast.BinaryOp:
+            if expr.op == '+':  return fold(expr.left) + fold(expr.right)
+            if expr.op == '-':  return fold(expr.left) - fold(expr.right)
+            if expr.op == '*':  return fold(expr.left) * fold(expr.right)
+            if expr.op == '/':  return fold(expr.left) / fold(expr.right)
+            if expr.op == '%':  return fold(expr.left) % fold(expr.right)
+            if expr.op == '&':  return fold(expr.left) & fold(expr.right)
+            if expr.op == '|':  return fold(expr.left) | fold(expr.right)
+            if expr.op == '^':  return fold(expr.left) >> fold(expr.right)
+            if expr.op == '<<': return fold(expr.left) << fold(expr.right)
+            if expr.op == '>>': return fold(expr.left) >> fold(expr.right)
+        elif type(expr) is c_ast.UnaryOp:
+            if expr.op == '+':  return fold(expr.expr)
+            if expr.op == '-':  return -fold(expr.expr)
+            if expr.op == 'sizeof':
+                return tysize(expr.expr)
+        elif type(expr) is c_ast.Cast:
+            return fold(expr.expr)
+        else:
+            return int(expr.value)
+    except Exception:
+        raise
+
+def emitstruct(t, defname):
+    fields = []
+    if t.name:
+        name = myrname(t.name)
+    else:
+        name = defname
+    deprefix(t.decls)
+    for d in t.decls:
+        if not d.name:
+            raise ValueError('null name in type')
+        etype = emit(d.type)
+        fname = d.name
+        if fname == 'type':
+            fname = 'kind'
+        fields.append('{}\t: {}'.format(fname, etype))
+    structs.write('type {} = struct\n\t{}\n\n;;\n\n'.format(name, '\n\t'.join(fields)))
+    return name
+
+def emit(t, defname=None):
+    if type(t) == c_ast.Struct:
+        if t.name:
+            if myrname(t.name) in have:
+                return t.name
+            # linked lists can be a problem...
+            have.add(myrname(t.name))
+        if not t.decls:
+            t = ctypes[t.name]
+        return emitstruct(t, defname)
+    elif type(t) == c_ast.IdentifierType:
+        name = ' '.join(t.names)
+        if name in myrtypes:
+            return myrtypes[' '.join(t.names)]
+        return myrtype(name, defname)
+    elif type(t) == c_ast.Typedef:
+        if t.name in myrtypes:
+            return myrtypes[t.name]
+        name = myrname(t.name)
+        if name in have:
+            return name
+        # fold chains of typedefs
+        sub = emit(t.type, name)
+        if defname:
+            return myrname(sub)
+        else:
+            if name != sub and name not in have:
+                have.add(name)
+                defs.write('type {} = {}\n'.format(name, sub))
+            return name
+    elif type(t) == c_ast.TypeDecl:
+        return emit(t.type, defname)
+    elif type(t) == c_ast.ArrayDecl:
+        ret = emit(t.type)
+        return '{}[{}]'.format(ret, fold(t.dim))
+    elif type(t) == c_ast.PtrDecl:
+        # Myrddin functions aren't easy to translate to C.
+        if type(t.type) == c_ast.FuncDecl:
+            return 'void#'
+        return emit(t.type) + '#'
+    elif type(t) == c_ast.Union:
+        raise ValueError('unions unsupported')
+    else:
+        t.show()
+        raise ValueError('unknown type')
+
+
+def myrtype(name, defname=None):
+    if name is None:
+        return None
+    if myrname(name) in myrtypes:
+        return myrtypes[myrname(name)]
+
+    t = ctypes[name]
+    gen = emit(t, defname)
+    have.add(myrname(gen))
+    return gen
+
+if __name__ == '__main__':
+    structs = StringIO.StringIO()
+    defs = StringIO.StringIO()
+
+    prehdr = '''
+#define __builtin_va_list int
+#define __inline
+#define __restrict
+#define __attribute__(_)
+#define __asm(x)
+#define __extension__
+#define __signed__
+#define __extern_inline__
+#define volatile(_) /* catches '__asm volatile(asm)' on openbsd */
+
+#include <sys/types.h>
+#include <sys/cdefs.h>
+#ifdef __linux__
+#include <sys/sysinfo.h>
+#include <utime.h>
+#include <ucontext.h>
+#include <linux/futex.h>
+#endif
+    '''
+    includes = []
+    # A bunch of these headers are system-only. We wouldn't
+    # care, but they also try to prevent people from depending
+    # on them accidentally. As a result, let's just try including
+    # each one ahead of time, and see if it works.
+    #
+    # if so, we generate a mega-header with all the types.
+
+    for hdr in os.listdir('/usr/include/sys'):
+        print 'trying {}'.format(hdr)
+        try:
+            include = prehdr + '\n#include <sys/{}>'.format(hdr)
+            with open('/tmp/myr-includes.h', 'w') as f:
+                f.write(include)
+            pycparser.parse_file('/tmp/myr-includes.h', use_cpp=True)
+            includes.append('#include <sys/{}>'.format(hdr))
+        except Exception:
+            print '...skip'
+
+    print('importing' + ' '.join(includes))
+    with open('/tmp/myr-includes.h', 'w') as f:
+        f.write(prehdr + '\n' + '\n'.join(includes))
+    with open('want.txt') as f:
+        want = f.read().split()
+    with open('have.txt') as f:
+        have |= set(f.read().split())
+        for sz in ['', 8, 16, 32, 64]:
+            have.add('int{}'.format(sz))
+            have.add('uint{}'.format(sz))
+    ast = pycparser.parse_file('/tmp/myr-includes.h', use_cpp=True)
+    collect(ast)
+    for w in want:
+        try:
+            myrtype(w)
+        except (ValueError,KeyError) as e:
+            print('unconvertable type {}: add a manual override: {}'.format(w, e))
+    f = 'gentypes+{}-{}.frag'.format(sys.argv[1], sys.argv[2])
+    with open(f, 'w') as f:
+        f.write(defs.getvalue())
+        f.write('\n')
+        f.write(structs.getvalue())
--- /dev/null
+++ b/support/syscall-gen/gencalls.awk
@@ -1,0 +1,328 @@
+BEGIN {
+	sys = ARGV[1]
+	split(sys, sp, ":")
+	systype = sp[1]
+	sysvers = sp[2]
+	arch = ARGV[2]
+
+	print "/*";
+	print "  generated-ish source";
+	print "  stitched for "sys" arch:"arch;
+	print "  edit with caution.";
+	print " */";
+	ARGC=1
+	if (systype =="freebsd" || systype == "linux") {
+		Typefield = 3;
+		Protofield = 4;
+		renamings["sys_exit"] = "exit"
+		if (systype == "linux") {
+			strippfx="^(linux_|linux_new)"
+			renamings["mmap2"] = "mmap";
+			renamings["sys_futex"] = "futex";
+		}
+	} else if (systype == "openbsd") {
+		Typefield = 2;
+		Protofield = 3;
+		strippfx="^sys_"
+	} else if (systype == "netbsd") {
+		Typefield = 2;
+		Protofield = 4;
+	} else {
+		print "unknown system " ARGV[1];
+		exit 1;
+	}
+	# stop processing args as files.
+
+	loadtypes()
+	loadspecials()
+}
+
+NF == 0 || $1 ~ /^;/ || $1 ~ "^#" {
+	next
+}
+
+END {
+	printf("pkg sys =\n")
+	for(i = 0; i < ntypes; i++)
+		printf("\t%s\n", types[i])
+	printf("\n")
+	for(i = 0; i < nnums; i++)
+		printf("\t%s\n", scnums[i])
+	printf("\n")
+	printf("\t/* start manual overrides { */\n");
+	for(i = 0; i < nspecialdefs; i++)
+		printf("\t%s\n", specialdefs[i])
+	printf("\t/* } end manual overrides */\n");
+	printf("\n")
+	for(i = 0; i < nproto; i++)
+		printf("\t%s\n", scproto[i])
+	printf(";;\n\n")
+
+	printf("\t/* start manual overrides { */\n");
+	for(i = 0; i < nspecialbody; i++)
+		printf("\t%s\n", specialbody[i])
+	printf("\t/* } end manual overrides */\n");
+	for(i = 0; i < ncall; i++)
+		printf("%s\n", sccall[i])
+}
+
+$Typefield == "STD" || (systype == "linux" && $Typefield == "NOPROTO") {
+	parse();
+	if (length("const Sys") + length(name) < 16)
+		tabs="\t\t\t"
+	else if (length("const Sys") + length(name) < 24)
+		tabs="\t\t"
+	else
+		tabs = "\t"
+	num = sprintf("const Sys%s%s: scno = %d", name, tabs, number);
+	scnums[nnums++] = num
+
+	if (nocode)
+		next;
+
+	if (length("const ") + length(name) < 16)
+		tabs="\t\t\t"
+	else if (length("const ") + length(name) < 24)
+		tabs="\t\t"
+	else
+		tabs = "\t"
+	proto = sprintf("const %s%s:  (", name, tabs);
+	sep="";
+	for (i = 0; i < argc; i++) {
+		proto = proto sprintf("%s%s : %s", sep, argname[i], argtype[i])
+		sep = ", ";
+	}
+	proto = proto sprintf(" -> %s)", ret)
+	scproto[nproto++] = proto
+
+	call = sprintf("const %s\t= {", name);
+	sep="";
+	for (i = 0; i < argc; i++) {
+		call = call sprintf("%s%s", sep, argname[i])
+		sep = ", ";
+	}
+	call = call sprintf("\n\t -> (syscall(Sys%s", name)
+	for (i = 1; i < argc; i++) {
+		call = call sprintf(", a(%s)", argname[i])
+	}
+	call = call sprintf(") : %s)\n}", ret)
+	sccall[ncall++] = call
+}
+
+
+function err(was, wanted) {
+	printf("%s: line %d: unexpected %s (expected %s)\n",
+		infile, NR, was, wanted);
+	printf("\tnear %s\n", $0);
+	exit 1;
+}
+
+function myrtype(t) {
+	gsub("[[:space:]]", "", t)
+	if (systype == "linux")
+		gsub("^l_", "", t)
+
+	if (t == "char")		t = "byte";
+	if (t == "unsigned int")	t = "uint";
+	if (t == "unsigned long")	t = "uint64";
+	if (t == "long")		t = "int64";
+	if (t == "u_char")		t = "byte";
+	if (t == "u_int")		t = "uint";
+	if (t == "u_long")		t = "uint64";
+	if (t == "acl_type_t")		t = "acltype";
+	if (t == "acl_tag_t")		t = "acltag";
+	if (t == "acl_perm_t")		t = "aclperm";
+	if (t == "acl_entry_type_t")	t = "aclenttype";
+	if (t == "mode_t")		t = "filemode"
+	# myrddin sizes are signed
+	if (t == "ssize_t")		t = "size";
+	if (t == "__socklen_t")		t = "int32";
+	if (t == "socklen_t")		t = "int32";
+	if (t == "fd_set")		t = "fdset";
+	if (t == "__ucontext")		t = "ucontext";
+	if (t == "cap_rights_t")	t = "caprights";
+	if (t == "stack_t")		t = "sigstack";
+	if (t == "thr_param")		t = "thrparam";
+	if (t == "nstat")		t = "statbuf";
+	if (t == "stat")		t = "statbuf";
+	if (t == "suseconds_t")		t = "int64";
+	if (t == "caddr_t")		t = "void#";
+
+	# linux stuff
+	if (t == "times_argv")		t = "tms";
+	if (t == "newstat")		t = "statbuf";
+	if (t == "stat64")		t = "statbuf";
+	if (t == "new_utsname")		t = "utsname"
+	if (t == "user_cap_header")	t = "capuserheader";
+	if (t == "user_cap_data")	t = "capuserdata";
+	if (t == "epoll_event")		t = "epollevt";
+	if (t == "statfs_buf")		t = "statfs";
+	if (t == "linux_robust_list_head")
+		t = "robust_list_head"
+
+	gsub("_t$", "", t)
+	gsub("^__", "", t)
+	return t;
+}
+
+function cname(t) {
+	# mostly to work around freebsd's linux syscalls.master
+	# being a bit off in places.
+	if (systype == "linux")
+		gsub("^l_", "", t)
+	if (t == "times_argv")		t = "tms";
+	if (t == "newstat")		t = "stat";
+	if (t == "statfs_buf")		t = "statfs";
+	if (t == "linux_robust_list_head")
+		t = "robust_list_head"
+
+	return t;
+}
+
+function unkeyword(kw) {
+	if (kw == "type")
+		return "kind";
+	if (kw == "in")
+		return "_in";
+	return kw;
+}
+
+function parse() {
+	number = $1;
+	type = $Typefield;
+
+	argc = 0
+	nocode = 0
+	if ($NF == "}") {
+		funcalias="";
+		argalias="";
+		rettype="int";
+		end=NF;
+	} else if ($(NF-1) == "}") {
+		funcalias=$(NF-1);
+		argalias="";
+		end=NF-1;
+	} else {
+		funcalias=$(NF-2);
+		argalias=$(NF-1);
+		rettype=$NF;
+		end=NF-3;
+	}
+
+	f = Protofield; 
+	# openbsd puts flags after the kind of call
+	if (systype == "openbsd" && $f != "{")
+		f++;
+	if ($f != "{")
+		err($f, "{");
+	f++
+	if ($end != "}")
+		err($f, "closing }");
+	end--;
+	if ($end != ";")
+		err($end, ";");
+	end--;
+	if ($end != ")")
+		err($end, ")");
+	end--;
+
+	ret=myrtype($f);
+	f++;
+	if ($f == "*") {
+		$f = $f"#";
+		f++;
+	}
+	name=$f;
+	if (strippfx)
+		gsub(strippfx, "", name);
+	if (renamings[name])
+		name=renamings[name];
+	if (special[name])
+		nocode = 1
+	f++;
+
+	if ($f != "(")
+		err($f, "(");
+	f++; 
+	if (f == end) {
+		if ($f != "void")
+			parserr($f, "argument definition")
+		return
+	}
+
+	while (f <= end) {
+		argtype[argc]=""
+		oldf=""
+		while (f < end && $(f+1) != ",") {
+			if ($f == "...")
+				f++;
+			if (argtype[argc] != "" && oldf != "*" && $f != "*")
+				argtype[argc] = argtype[argc]" ";
+			if ($f == "*")
+				$f="#"
+			if ($f != "const" && $f != "struct" &&
+			    $f != "__restrict" && $f != "volatile" &&
+			    $f != "union") {
+				argtype[argc] = myrtype(argtype[argc]$f);
+				if ($f != "#" && !knowntypes[myrtype($f)] && !wanttype[$f]) {
+					t = cname($f)
+					wanttype[t] = 1
+					printf("%s\n", t) > "want.txt"
+				}
+			}
+			oldf = $f;
+			f++
+		}
+		if (argtype[argc] == "")
+			err($f, "argument definition")
+		argname[argc]=unkeyword($f);
+		f += 2;			# skip name, and any comma
+		argc++
+	}
+}
+
+function loadtypes() {
+	path="types+"sys"-"arch".frag";
+	while ((getline ln < path) > 0) {
+		types[ntypes++] = ln;
+		split(ln, a)
+		if (a[1] == "type") {
+			knowntypes[a[2]] = 1
+			printf("%s\n", a[2]) > "have.txt"
+		}
+	}
+	path="gentypes+"sys"-"arch".frag";
+	while ((getline ln < path) > 0) {
+		types[ntypes++] = ln;
+		split(ln, a)
+		if (a[1] == "type") {
+			knowntypes[a[2]] = 1
+			printf("%s\n", a[2]) > "have.txt"
+		}
+	}
+}
+
+function loadspecials() {
+	path="specials+"sys"-"arch".frag";
+	while ((getline ln < path) > 0) {
+		while (match(ln, "\\\\[ \t]*$")) {
+			getline ln2 < path
+			ln = ln "\n" ln2
+		}
+		split(ln, sp)
+		off = 0
+		if (sp[off+1] == "extern")
+			off++;
+		if (sp[off+1] == "const" || sp[off+1] == "generic") {
+			special[sp[off+2]] = 1
+			if (sp[off+3] == ":")
+				specialdefs[nspecialdefs++] = ln;
+			else if (sp[3] == "=")
+				specialbody[nspecialbody++] = ln;
+			else
+				err(sp[3], ": or =")
+		} else {
+			specialbody[nspecialbody++] = ln;
+		}
+	}
+}
--- /dev/null
+++ b/support/syscall-gen/gensys.sh
@@ -1,0 +1,28 @@
+#!/bin/sh
+
+if [ $# -ne 2 ]; then
+	echo usage: $0 sysname arch
+	exit 1
+fi
+
+gen() {
+	sed -e '
+	s/\$//g
+	:join
+		/\\$/{a\
+
+		N
+		s/\\\n//
+		b join
+		}
+	2,${
+		/^#/!s/\([{}()*,]\)/ \1 /g
+	}
+	' < syscalls+$1.master | awk -f gencalls.awk $1 $2 > sys+$1-$2.myr
+}
+
+rm -f have.txt want.txt gentypes+$1-$2.frag
+
+gen $1 $2
+python ./c2myr.py $1 $2
+gen $1 $2
--- /dev/null
+++ b/support/syscall-gen/specials+freebsd-x64.frag
@@ -1,0 +1,299 @@
+/* pkg sys */
+	/* process control */
+	const exit	: (status:int -> void)
+	const getpid	: ( -> pid)
+	const kill	: (pid:pid, sig:int64 -> int64)
+	const fork	: (-> pid)
+	const wait4	: (pid:pid, loc:int32#, opt : int64, usage:rusage#	-> int64)
+	const waitpid	: (pid:pid, loc:int32#, opt : int64	-> int64)
+	const execv	: (cmd : byte[:], args : byte[:][:] -> int64)
+	const execve	: (cmd : byte[:], args : byte[:][:], env : byte[:][:] -> int64)
+	/* wrappers to extract wait status */
+	const waitstatus	: (st : int32 -> waitstatus)
+
+	/* thread control */
+	const thr_new	: (param : thrparam#, paramsz : int -> int)
+	const thr_exit	: (state : int64# -> void)
+	const umtx_op	: (obj : void#, op : umtxop, val : uint64, a1 : void#, a2 : void# -> int)
+	const yield	: (-> int)
+
+	/* fd manipulation */
+	const open	: (path:byte[:], opts:fdopt -> fd)
+	const openmode	: (path:byte[:], opts:fdopt, mode:int64 -> fd)
+	const close	: (fd:fd -> int64)
+	const creat	: (path:byte[:], mode:int64 -> fd)
+	const unlink	: (path:byte[:] -> int)
+	const read	: (fd:fd, buf:byte[:] -> size)
+	const pread	: (fd:fd, buf:byte[:], off : off -> size)
+	const readv	: (fd:fd, iov:iovec[:] -> size)
+	const write	: (fd:fd, buf:byte[:] -> size)
+	const pwrite	: (fd:fd, buf:byte[:], off : off -> size)
+	const writev	: (fd:fd, iov : iovec[:] -> size)
+	const lseek	: (fd:fd, off : off, whence : whence -> int64)
+	const stat	: (path:byte[:], sb:statbuf# -> int64)
+	const lstat	: (path:byte[:], sb:statbuf# -> int64)
+	const fstat	: (fd:fd, sb:statbuf# -> int64)
+	const mkdir	: (path : byte[:], mode : int64	-> int64)
+	generic ioctl	: (fd:fd, req : int64, arg:@a# -> int64)
+	const getdirentries	: (fd : fd, buf : byte[:], basep : int64# -> int64)
+	const chdir	: (p : byte[:] -> int64)
+	const __getcwd	: (buf : byte[:] -> int64)
+
+	/* signals */
+	const sigaction	: (sig : signo, act : sigaction#, oact : sigaction# -> int)
+	const sigprocmask	: (how : int32, set : sigset#, oset : sigset# -> int)
+
+	/* fd stuff */
+	const pipe	: (fds : fd[2]# -> int64)
+	const dup	: (fd : fd -> fd)
+	const dup2	: (src : fd, dst : fd -> fd)
+	/* NB: the C ABI uses '...' for the args. */
+	const fcntl	: (fd : fd, cmd : fcntlcmd, args : byte# -> int64)
+	const poll	: (pfd : pollfd[:], tm : int -> int)
+
+	/* networking */
+	const socket	: (dom : sockfam, stype : socktype, proto : sockproto	-> fd)
+	const connect	: (sock	: fd, addr : sockaddr#, len : size -> int)
+	const accept	: (sock : fd, addr : sockaddr#, len : size# -> fd)
+	const listen	: (sock : fd, backlog : int	-> int)
+	const bind	: (sock : fd, addr : sockaddr#, len : size -> int)
+	const setsockopt	: (sock : fd, lev : sockproto, opt : sockopt, val : void#, len : size -> int)
+	const getsockopt	: (sock : fd, lev : sockproto, opt : sockopt, val : void#, len : size# -> int)
+
+	/* memory mapping */
+	const munmap	: (addr:byte#, len:size -> int64)
+	const mmap	: (addr:byte#, len:size, prot:mprot, flags:mopt, fd:fd, off:off -> byte#)
+
+	/* time - doublecheck if this is right */
+	const clock_getres	: (clk : clock, ts : timespec# -> int32)
+	const clock_gettime	: (clk : clock, ts : timespec# -> int32)
+	const clock_settime	: (clk : clock, ts : timespec# -> int32)
+	const nanosleep	: (req : timespec#, rem : timespec# -> int32)
+	const sched_yield	: (-> void)
+
+	/* system information */
+	const uname 	: (buf : utsname# -> int)
+	const sysctl	: (mib : int[:], \
+		old : void#, oldsz : size#, \
+		new : void#, newsz : size# \
+		-> int)
+
+	/* filled by start code */
+/* ;; */
+
+/* 
+wraps a syscall argument, converting it to 64 bits for the syscall function. This is
+the same as casting, but more concise than (writing : int64)
+*/
+generic a = {x : @t; -> (x : uint64)}
+
+extern const cstring	: (str : byte[:] -> byte#)
+extern const alloca	: (sz : size	-> byte#)
+
+extern const __freebsd_pipe	: (fds : fd[2]# -> int64)
+
+/* process management */
+const exit	= {status;		syscall(Sysexit, a(status))}
+const getpid	= {;			-> (syscall(Sysgetpid, 1) : pid)}
+const kill	= {pid, sig;		-> syscall(Syskill, pid, sig)}
+const fork	= {;			-> (syscall(Sysfork) : pid)}
+const wait4	= {pid, loc, opt, usage;	-> syscall(Syswait4, pid, loc, opt, usage)}
+const waitpid	= {pid, loc, opt;
+	-> wait4(pid, loc, opt, (0 : rusage#)) 
+}
+
+const execv	= {cmd, args
+	var p, cargs, i
+
+	/* of course we fucking have to duplicate this code everywhere,
+	* since we want to stack allocate... */
+	p = alloca((args.len + 1)*sizeof(byte#))
+	cargs = ((p : byte##))[:args.len + 1]
+	for i = 0; i < args.len; i++
+		cargs[i] = cstring(args[i])
+	;;
+	cargs[args.len] = (0 : byte#)
+	-> syscall(Sysexecve, cstring(cmd), a(p), a(__cenvp))
+}
+
+const execve	= {cmd, args, env
+	var cargs, cenv, i
+	var p
+
+	/* copy the args */
+	p = alloca((args.len + 1)*sizeof(byte#))
+	cargs = ((p : byte##))[:args.len]
+	for i = 0; i < args.len; i++
+		cargs[i] = cstring(args[i])
+	;;
+	cargs[args.len] = (0 : byte#)
+
+	/*
+	 copy the env.
+	 of course we fucking have to duplicate this code everywhere,
+	 since we want to stack allocate... 
+	*/
+	p = alloca((env.len + 1)*sizeof(byte#))
+	cenv = ((p : byte##))[:env.len]
+	for i = 0; i < env.len; i++
+		cenv[i] = cstring(env[i])
+	;;
+	cenv[env.len] = (0 : byte#)
+
+	-> syscall(Sysexecve, cstring(cmd), a(p), a(cenv))
+}
+
+/* thread management */
+const thr_new	= {param, sz;	-> (syscall(Systhr_new, a(param), a(sz)) : int)}
+const thr_exit	= {state;	syscall(Systhr_exit, a(state))}
+const umtx_op	= {obj, op, val, a1, a2; -> (syscall(Sys_umtx_op, a(obj), a(op), a(val), a(a1), a(a2)) : int)}
+const yield	= {;	-> (syscall(Sysyield) : int)}
+
+/* fd manipulation */
+const open	= {path, opts;		-> (syscall(Sysopen, cstring(path), a(opts), a(0o777)) : fd)}
+const openmode	= {path, opts, mode;	-> (syscall(Sysopen, cstring(path), a(opts), a(mode)) : fd)}
+const close	= {fd;			-> syscall(Sysclose, a(fd))}
+const creat	= {path, mode;		-> (openmode(path, Ocreat | Otrunc | Owronly, mode) : fd)}
+const unlink	= {path;		-> (syscall(Sysunlink, cstring(path)) : int)}
+const read	= {fd, buf;		-> (syscall(Sysread, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pread	= {fd, buf, off;	-> (syscall(Syspread, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
+const readv	= {fd, vec;		-> (syscall(Sysreadv, a(fd), (vec : iovec#), a(vec.len)) : size)}
+const write	= {fd, buf;		-> (syscall(Syswrite, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pwrite	= {fd, buf, off;	-> (syscall(Syspwrite, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
+const writev	= {fd, vec;		-> (syscall(Syswritev, a(fd), (vec : iovec#), a(vec.len)) : size)}
+const lseek	= {fd, off, whence;	-> syscall(Syslseek, a(fd), a(off), a(whence))}
+const stat	= {path, sb;		-> syscall(Sysstat, cstring(path), a(sb))}
+const lstat	= {path, sb;		-> syscall(Syslstat, cstring(path), a(sb))}
+const fstat	= {fd, sb;		-> syscall(Sysfstat, a(fd), a(sb))}
+const mkdir	= {path, mode;		-> (syscall(Sysmkdir, cstring(path), a(mode)) : int64)}
+generic ioctl	= {fd, req, arg;	-> (syscall(Sysioctl, a(fd), a(req), a(arg)) : int64)
+}
+const getdirentries	= {fd, buf, basep;	-> syscall(Sysgetdirentries, a(fd), (buf : byte#), a(buf.len), a(basep))}
+const chdir	= {dir;	-> syscall(Syschdir, cstring(dir))}
+const __getcwd	= {buf;	-> syscall(Sys__getcwd, a(buf), a(buf.len))}
+
+/* file stuff */
+const pipe	= {fds;	-> __freebsd_pipe(fds)}
+const dup 	= {fd;	-> (syscall(Sysdup, a(fd)) : fd)}
+const dup2 	= {src, dst;	-> (syscall(Sysdup2, a(src), a(dst)) : fd)}
+const fcntl	= {fd, cmd, args; 	-> syscall(Sysfcntl, a(fd), a(cmd), a(args))}
+const poll	= {pfd, tm;	-> (syscall(Syspoll, (pfd : byte#), a(pfd.len), a(tm)) : int)}
+
+/* signals */
+const sigaction	= {sig, act, oact;	-> (syscall(Syssigaction, a(sig), a(act), a(oact)) : int)}
+const sigprocmask	= {sig, act, oact;	-> (syscall(Syssigprocmask, a(sig), a(act), a(oact)) : int)}
+
+/* networking */
+const socket	= {dom, stype, proto;	-> (syscall(Syssocket, a(dom), a(stype), a(proto)) : fd) }
+const connect	= {sock, addr, len;	-> (syscall(Sysconnect, a(sock), a(addr), a(len)) : int)}
+const accept	= {sock, addr, len;	-> (syscall(Sysaccept, a(sock), a(addr), a(len)) : fd)}
+const listen	= {sock, backlog;	-> (syscall(Syslisten, a(sock), a(backlog)) : int)}
+const bind	= {sock, addr, len;	-> (syscall(Sysbind, a(sock), a(addr), a(len)) : int)}
+const setsockopt	= {sock, lev, opt, val, len;	-> (syscall(Syssetsockopt, a(sock), a(lev), a(opt), a(val), a(len)) : int)}
+const getsockopt	= {sock, lev, opt, val, len;	-> (syscall(Syssetsockopt, a(sock), a(lev), a(opt), a(val), a(len)) : int)}
+
+/* memory management */
+const munmap	= {addr, len;		-> syscall(Sysmunmap, a(addr), a(len))}
+const mmap	= {addr, len, prot, flags, fd, off;
+	-> (syscall(Sysmmap, a(addr), a(len), a(prot), a(flags), a(fd), a(off)) : byte#)}
+
+/* time */
+const clock_getres = {clk, ts;	-> (syscall(Sysclock_getres, clockid(clk), a(ts)) : int32)}
+const clock_gettime = {clk, ts;	-> (syscall(Sysclock_gettime, clockid(clk), a(ts)) : int32)}
+const clock_settime = {clk, ts;	-> (syscall(Sysclock_settime, clockid(clk), a(ts)) : int32)}
+const nanosleep	= {req, rem;	-> (syscall(Sysnanosleep, a(req), a(rem)) : int32)}
+const sched_yield = {;	syscall(Syssched_yield)}
+
+
+const sysctl = {mib, old, oldsz, new, newsz
+	/* all args already passed through a() or ar  ptrs */
+	-> (syscall(Sys__sysctl, \
+		(mib : int#), a(mib.len), old, oldsz, new, newsz) : int)
+}
+
+const clockid = {clk
+	match clk
+	| `Clockrealtime:		-> 0
+	| `Clockvirtual:		-> 1
+	| `Clockprof:			-> 2
+	| `Clockmonotonic:		-> 4
+	| `Clockuptime:			-> 5
+	| `Clockuptime_precise:		-> 7
+	| `Clockuptime_fast:		-> 8
+	| `Clockrealtime_precise:	-> 9
+	| `Clockrealtime_fast:		-> 10
+	| `Clockmonotonic_precise:	-> 11
+	| `Clockmonotonic_fast:		-> 12
+	| `Clocksecond:			-> 13
+	;;
+	-> a(-1)
+}
+
+const waitstatus = {st
+	if st < 0
+		-> `Waitfail st
+	;;
+	match st & 0o177
+	| 0:    -> `Waitexit (st >> 8)
+	| 0x7f:-> `Waitstop (st >> 8)
+	| sig:  -> `Waitsig sig
+	;;
+}
+
+const uname	= {buf
+	var mib : int[2]
+	var ret
+	var sys, syssz
+	var nod, nodsz
+	var rel, relsz
+	var ver, versz
+	var mach, machsz
+
+	ret = 0
+	mib[0] = 1 /* CTL_KERN */
+	mib[1] = 1 /* KERN_OSTYPE */
+	sys = (buf.system[:] : void#)
+	syssz = buf.system.len
+	ret = sysctl(mib[:], sys, &syssz, (0 : void#), (0 : size#))
+	if ret < 0
+		-> ret
+	;;
+
+	mib[0] = 1 /* CTL_KERN */
+	mib[1] = 10 /* KERN_HOSTNAME */
+	nod = (buf.node[:] : void#)
+	nodsz = buf.node.len
+	ret = sysctl(mib[:], nod, &nodsz, (0 : void#), (0 : size#))
+	if ret < 0
+		-> ret
+	;;
+
+	mib[0] = 1 /* CTL_KERN */
+	mib[1] = 2 /* KERN_OSRELEASE */
+	rel = (buf.release[:] : void#)
+	relsz = buf.release.len
+	ret = sysctl(mib[:], rel, &relsz, (0 : void#), (0 : size#))
+	if ret < 0
+		-> ret
+	;;
+
+	mib[0] = 1 /* CTL_KERN */
+	mib[1] = 4 /* KERN_VERSION */
+	ver = (buf.version[:] : void#)
+	versz = buf.version.len
+	ret = sysctl(mib[:], ver, &versz, (0 : void#), (0 : size#))
+	if ret < 0
+		-> ret
+	;;
+
+	mib[0] = 6 /* CTL_HW */
+	mib[1] = 1 /* HW_MACHINE */
+	mach = (buf.machine[:] : void#)
+	machsz = buf.machine.len
+	ret = sysctl(mib[:], mach, &machsz, (0 : void#), (0 : size#))
+	if ret < 0
+		-> ret
+	;;
+
+	-> 0
+}
--- /dev/null
+++ b/support/syscall-gen/specials+linux-x64.frag
@@ -1,0 +1,276 @@
+/* getting to the os */
+extern const syscall	: (sc:scno, args:... -> int64)
+extern const sigreturn	: (-> void)
+
+/* process management */
+const exit	: (status:int -> void)
+const exit_group	: (status:int -> void)
+const getpid	: ( -> pid)
+const kill	: (pid:pid, sig:int64 -> int64)
+const fork	: (-> pid)
+/* FIXME: where the fuck is 'struct pt_reg' defined?? */
+const clone	: (flags : cloneopt, stk : byte#, ptid : pid#, ctid : pid#, ptreg : byte# -> pid)
+extern const fnclone	: ( flags : cloneopt, \
+			stk : byte#, \
+			ptid : pid#, \
+			tls : byte#, \
+			ctid : pid#, \
+			ptreg : byte#, \
+			fn : void#  /* we need a raw pointer */ \
+			-> pid)
+const wait4	: (pid:pid, loc:int32#, opt : int64, usage:rusage#	-> int64)
+const waitpid	: (pid:pid, loc:int32#, opt : int64	-> int64)
+const execv	: (cmd : byte[:], args : byte[:][:] -> int64)
+const execve	: (cmd : byte[:], args : byte[:][:], env : byte[:][:] -> int64)
+/* wrappers to extract wait status */
+const waitstatus	: (st : int32 -> waitstatus)
+
+/* file manipulation */
+const open	: (path:byte[:], opts:fdopt -> fd)
+const openmode	: (path:byte[:], opts:fdopt, mode:int64 -> fd)
+const close	: (fd:fd -> int64)
+const rename	: (from : byte[:], to : byte[:] -> int64)
+const creat	: (path:byte[:], mode:int64 -> fd)
+const unlink	: (path:byte[:] -> int)
+const readlink	: (path:byte[:], buf:byte[:] -> int64)
+const read	: (fd:fd, buf:byte[:] -> size)
+const pread	: (fd:fd, buf:byte[:], off : off -> size)
+const write	: (fd:fd, buf:byte[:] -> size)
+const pwrite	: (fd:fd, buf:byte[:], off : off -> size)
+const lseek	: (fd:fd, off:off, whence:whence -> int64)
+const stat	: (path:byte[:], sb:statbuf# -> int64)
+const lstat	: (path:byte[:], sb:statbuf# -> int64)
+const fstat	: (fd:fd, sb:statbuf# -> int64)
+const mkdir	: (path : byte[:], mode : int64	-> int64)
+generic ioctl	: (fd:fd, req : int64, arg:@a# -> int64)
+const getdents64	: (fd:fd, buf : byte[:] -> int64)
+const chdir	: (p : byte[:] -> int64)
+const getcwd	: (buf : byte[:] -> int64)
+const sendmsg	: (fd:fd, msg:msghdr#, flags:msgflags -> int64)
+const recvmsg	: (fd:fd, msg:msghdr#, flags:msgflags -> int64)
+const fallocate : (fd:fd, mode:fallocmode, off:off, len:off -> int64)
+
+/* signals */
+const sigaction	: (sig : signo, act : sigaction#, oact : sigaction# -> int)
+const sigprocmask	: (how : int32, set : sigset#, oset : sigset# -> int)
+
+/* fd stuff */
+const pipe	: (fds : fd[2]# -> int64)
+const dup	: (fd : fd -> fd)
+const dup2	: (src : fd, dst : fd -> fd)
+
+/* threading */
+const futex	: (uaddr : int32#, op : futexop, val : int32, \
+	timeout : timespec#, uaddr2 : int32#, val3 : int32 -> int64)
+const semctl	:  (semid : int, semnum : int, cmd : int, arg : void# -> int)
+
+/* polling */
+const epollcreate	: (flg : epollflags	-> fd)	/* actually epoll_create1 */
+const epollctl	: (epfd : fd, op : int, fd : fd, evt : epollevt# -> int)
+const epollwait	: (epfd : fd, evts : epollevt[:], timeout : int -> int)
+const poll	: (pfd	: pollfd[:], timeout : int	-> int)
+
+/* networking */
+const socket	: (dom : sockfam, stype : socktype, proto : sockproto	-> fd)
+const connect	: (sock	: fd, addr : sockaddr#, len : size -> int)
+const accept	: (sock : fd, addr : sockaddr#, len : size# -> fd)
+const listen	: (sock : fd, backlog : int	-> int)
+const bind	: (sock : fd, addr : sockaddr#, len : size -> int)
+const setsockopt	: (sock : fd, lev : sockproto, opt : sockopt, val : void#, len : size -> int)
+const getsockopt	: (sock : fd, lev : sockproto, opt : sockopt, val : void#, len : size# -> int)
+
+/* memory mapping */
+const munmap	: (addr:byte#, len:size -> int64)
+const mmap	: (addr:byte#, len:size, prot:mprot, flags:mopt, fd:fd, off:off -> byte#)
+
+/* time */
+const clock_getres	: (clk : clock, ts : timespec# -> int32)
+const clock_gettime	: (clk : clock, ts : timespec# -> int32)
+const clock_settime	: (clk : clock, ts : timespec# -> int32)
+const nanosleep	: (req : timespec#, rem : timespec# -> int32)
+
+/* user/group management */
+const getuid : ( -> uint32)
+const getgid : ( -> uint32)
+const setuid : (uid : uint32 -> int32)
+const setgid : (gid : uint32 -> int32)
+
+/* system information */
+const uname 	: (buf : utsname# -> int)
+
+/*
+wraps a syscall argument, converting it to 64 bits for the syscall function.
+This is the same as casting, but more concise than writing a cast to int64.
+*/
+generic a = {x : @t; -> (x : uint64)}
+
+/* asm stubs from util.s */
+extern const cstring	: (str : byte[:] -> byte#)
+extern const alloca	: (sz : size	-> byte#)
+
+/* process management */
+const exit	= {status;		syscall(Sysexit, a(status))}
+const exit_group	= {status;	syscall(Sysexit_group, a(status))}
+const getpid	= {;			-> (syscall(Sysgetpid) : pid)}
+const kill	= {pid, sig;		-> syscall(Syskill, a(pid), a(sig))}
+const fork	= {;			-> (syscall(Sysfork) : pid)}
+const clone	= {flags, stk, ptid, ctid, ptreg;	-> (syscall(Sysclone, a(flags), a(stk), a(ptid), a(ctid), a(ptreg)) : pid)}
+const wait4	= {pid, loc, opt, usage;	-> syscall(Syswait4, a(pid), a(loc), a(opt), a(usage))}
+const waitpid	= {pid, loc, opt;
+	var rusage
+	-> wait4(pid, loc, opt, &rusage)
+}
+
+const execv	= {cmd, args
+	var p, cargs, i
+
+	/* of course we fucking have to duplicate this code everywhere,
+	* since we want to stack allocate... */
+	p = alloca((args.len + 1)*sizeof(byte#))
+	cargs = (p : byte##)[:args.len + 1]
+	for i = 0; i < args.len; i++
+		cargs[i] = cstring(args[i])
+	;;
+	cargs[args.len] = (0 : byte#)
+	-> syscall(Sysexecve, cstring(cmd), a(p), a(__cenvp))
+}
+
+const execve	= {cmd, args, env
+	var cargs, cenv, i
+	var ap, ep
+
+	/* copy the args */
+	ap = alloca((args.len + 1)*sizeof(byte#))
+	cargs = (ap : byte##)[:args.len + 1]
+	for i = 0; i < args.len; i++
+		cargs[i] = cstring(args[i])
+	;;
+	cargs[args.len] = (0 : byte#)
+
+	/*
+	 copy the env.
+	 of course we fucking have to duplicate this code everywhere,
+	 since we want to stack allocate...
+	*/
+	ep = alloca((env.len + 1)*sizeof(byte#))
+	cenv = (ep : byte##)[:env.len]
+	for i = 0; i < env.len; i++
+		cenv[i] = cstring(env[i])
+	;;
+	cenv[env.len] = (0 : byte#)
+
+	-> syscall(Sysexecve, cstring(cmd), a(ap), a(ep))
+}
+
+/* file manipulation */
+const open	= {path, opts;		-> (syscall(Sysopen, cstring(path), a(opts), a(0o777)) : fd)}
+const openmode	= {path, opts, mode;	-> (syscall(Sysopen, cstring(path), a(opts), a(mode)) : fd)}
+const close	= {fd;			-> syscall(Sysclose, a(fd))}
+const creat	= {path, mode;		-> (syscall(Syscreat, cstring(path), a(mode)) : fd)}
+const rename	= {from, to;		-> syscall(Sysrename, cstring(from), cstring(to))}
+const unlink	= {path;		-> (syscall(Sysunlink, cstring(path)) : int)}
+const readlink	= {path, buf; -> syscall(Sysreadlink, cstring(path), (buf : byte#), a(buf.len))}
+const read	= {fd, buf;		-> (syscall(Sysread, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pread	= {fd, buf, off;	-> (syscall(Syspread, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
+const write	= {fd, buf;		-> (syscall(Syswrite, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pwrite	= {fd, buf, off;	-> (syscall(Syspwrite, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
+const lseek	= {fd, off, whence;	-> syscall(Syslseek, a(fd), a(off), a(whence))}
+const stat	= {path, sb;		-> syscall(Sysstat, cstring(path), a(sb))}
+const lstat	= {path, sb;		-> syscall(Syslstat, cstring(path), a(sb))}
+const fstat	= {fd, sb;		-> syscall(Sysfstat, a(fd), a(sb))}
+const mkdir	= {path, mode;		-> (syscall(Sysmkdir, cstring(path), a(mode)) : int64)}
+generic ioctl	= {fd, req, arg;	-> (syscall(Sysioctl, a(fd), a(req), a(arg)) : int64)}
+const getdents64	= {fd, buf;	-> syscall(Sysgetdents64, a(fd), (buf : byte#), a(buf.len))}
+const chdir	= {dir;	-> syscall(Syschdir, cstring(dir))}
+const getcwd	= {buf;	-> syscall(Sysgetcwd, a(buf), a(buf.len))}
+const sendmsg	= {fd, msg, flags;	-> syscall(Syssendmsg, a(fd), msg, a(flags))}
+const recvmsg	= {fd, msg, flags;	-> syscall(Sysrecvmsg, a(fd), msg, a(flags))}
+const fallocate	= {fd, mode, off, len;	-> syscall(Sysfallocate, a(fd), a(mode),  a(off), a(len))}
+
+/* file stuff */
+const pipe	= {fds;	-> syscall(Syspipe, a(fds))}
+const dup 	= {fd;	-> (syscall(Sysdup, a(fd)) : fd)}
+const dup2 	= {src, dst;	-> (syscall(Sysdup2, a(src), a(dst)) : fd)}
+
+const sigaction	= {sig, act, oact;
+	if act.restore == (0 : byte#)
+		act.flags |= Sarestorer
+		act.restore = (sys.sigreturn : byte#)
+	;;
+	-> (syscall(Sysrt_sigaction, a(sig), a(act), a(oact), a(sizeof(sigflags))) : int)
+}
+const sigprocmask	= {sig, act, oact;	-> (syscall(Sysrt_sigprocmask, a(sig), a(act), a(oact), a(sizeof(sigflags))) : int)}
+
+/* threading */
+const futex	= {uaddr, op, val, timeout, uaddr2, val3
+	-> syscall(Sysfutex, a(uaddr), a(op), a(val), a(timeout), a(uaddr2), a(val3))
+}
+const semctl	= {semid, semnum, cmd, arg
+	-> (syscall(Syssemctl, a(semnum), a(cmd), a(arg)) : int)
+}
+
+/* poll */
+const poll	= {pfd, timeout;	-> (syscall(Syspoll, (pfd : pollfd#), a(pfd.len), a(timeout)) : int)}
+const epollctl	= {epfd, op, fd, evt;
+	-> (syscall(Sysepoll_ctl, a(epfd), a(op), a(fd), a(evt)) : int)}
+const epollwait	= {epfd, evts, timeout;
+	-> (syscall(Sysepoll_wait, a(epfd), (evts : epollevt#), a(evts.len), a(timeout)) : int)}
+const epollcreate	= {flg;	-> (syscall(Sysepoll_create1, a(flg)) : fd)}
+
+/* networking */
+const socket	= {dom, stype, proto;	-> (syscall(Syssocket, a(dom), a(stype), a(proto)) : fd)}
+const connect	= {sock, addr, len;	-> (syscall(Sysconnect, a(sock), a(addr), a(len)) : int)}
+const bind	= {sock, addr, len;	-> (syscall(Sysbind, a(sock), a(addr), a(len)) : int)}
+const listen	= {sock, backlog;	-> (syscall(Syslisten, a(sock), a(backlog)) : int)}
+const accept	= {sock, addr, lenp;	-> (syscall(Sysaccept, a(sock), a(addr), a(lenp)) : fd)}
+const setsockopt	= {sock, lev, opt, val, len;	-> (syscall(Syssetsockopt, a(sock), a(lev), a(opt), a(val), a(len)) : int)}
+const getsockopt	= {sock, lev, opt, val, len;	-> (syscall(Syssetsockopt, a(sock), a(lev), a(opt), a(val), a(len)) : int)}
+
+/* memory mapping */
+const munmap	= {addr, len;		-> syscall(Sysmunmap, a(addr), a(len))}
+const mmap	= {addr, len, prot, flags, fd, off;
+	-> (syscall(Sysmmap, a(addr), a(len), a(prot), a(flags), a(fd), a(off)) : byte#)
+}
+
+/* time */
+const clock_getres = {clk, ts;	-> (syscall(Sysclock_getres, clockid(clk), a(ts)) : int32)}
+const clock_gettime = {clk, ts;	-> (syscall(Sysclock_gettime, clockid(clk), a(ts)) : int32)}
+const clock_settime = {clk, ts;	-> (syscall(Sysclock_settime, clockid(clk), a(ts)) : int32)}
+const nanosleep	= {req, rem;	-> (syscall(Sysnanosleep, a(req), a(rem)) : int32)}
+
+/* user/group management */
+const getuid = {; -> (syscall(Sysgetuid) : uint32)}
+const getgid = {; -> (syscall(Sysgetgid) : uint32)}
+const setuid = {uid; -> (syscall(Syssetuid, a(uid)) : int32)}
+const setgid = {gid; -> (syscall(Syssetgid, a(gid)) : int32)}
+
+/* system information */
+const uname	= {buf;	-> (syscall(Sysuname, buf) : int)}
+
+const clockid = {clk
+	match clk
+	| `Clockrealtime:	-> 0
+	| `Clockmonotonic:	-> 1
+	| `Clockproccpu:	-> 2
+	| `Clockthreadcpu:	-> 3
+	| `Clockmonotonicraw:	-> 4
+	| `Clockrealtimecoarse:	-> 5
+	| `Clockmonotoniccoarse:-> 6
+	| `Clockboottime:	-> 7
+	| `Clockrealtimealarm:	-> 8
+	| `Clockboottimealarm:	-> 9
+	;;
+	-> -1
+}
+
+
+const waitstatus = {st
+	if st & 0x7f == 0 /* if exited */
+		-> `Waitexit ((st & 0xff00) >> 8)
+	elif ((st & 0xffff)-1) < 0xff /* if signaled */
+		-> `Waitsig ((st) & 0x7f)
+	elif (((st & 0xffff)*0x10001)>>8) > 0x7f00
+		-> `Waitstop ((st & 0xff00) >> 8)
+	;;
+	-> `Waitfail st	/* wait failed to give a result */
+}
--- /dev/null
+++ b/support/syscall-gen/specials+openbsd:6.1-x64.frag
@@ -1,0 +1,286 @@
+/* process control */
+const exit	: (status:int -> void)
+const getpid	: ( -> pid)
+const kill	: (pid:pid, sig:int64 -> int64)
+const fork	: (-> pid)
+const wait4	: (pid:pid, loc:int32#, opt : int64, usage:rusage#	-> int64)
+const waitpid	: (pid:pid, loc:int32#, opt : int64	-> int64)
+const execv	: (cmd : byte[:], args : byte[:][:] -> int64)
+const execve	: (cmd : byte[:], args : byte[:][:], env : byte[:][:] -> int64)
+/* wrappers to extract wait status */
+const waitstatus	: (st : int32 -> waitstatus)
+extern const __tfork_thread	: (tfp : tforkparams#, sz : size, fn : void#, arg : void# -> pid)
+
+/* fd manipulation */
+const open	: (path:byte[:], opts:fdopt -> fd)
+const openmode	: (path:byte[:], opts:fdopt, mode:int64 -> fd)
+const close	: (fd:fd -> int64)
+const creat	: (path:byte[:], mode:int64 -> fd)
+const unlink	: (path:byte[:] -> int)
+const read	: (fd:fd, buf:byte[:] -> size)
+const pread	: (fd:fd, buf:byte[:], off : off -> size)
+const readv	: (fd:fd, iov:iovec[:] -> size)
+const write	: (fd:fd, buf:byte[:] -> size)
+const pwrite	: (fd:fd, buf:byte[:], off : off -> size)
+const writev	: (fd:fd, iov:iovec[:] -> size)
+const lseek	: (fd:fd, off : off, whence : whence -> int64)
+const stat	: (path:byte[:], sb:statbuf# -> int64)
+const lstat	: (path:byte[:], sb:statbuf# -> int64)
+const fstat	: (fd:fd, sb:statbuf# -> int64)
+const mkdir	: (path : byte[:], mode : int64	-> int64)
+generic ioctl	: (fd:fd, req : int64, arg:@a# -> int64)
+const getdents	: (fd : fd, buf : byte[:] -> int64)
+const chdir	: (p : byte[:] -> int64)
+const __getcwd	: (buf : byte[:] -> int64)
+const poll	: (pfd : pollfd[:], tm : int -> int)
+
+/* signals */
+const sigaction	: (sig : signo, act : sigaction#, oact : sigaction# -> int)
+const sigprocmask	: (how : int32, set : sigset#, oset : sigset# -> int)
+
+/* fd stuff */
+const pipe	: (fds : fd[2]# -> int64)
+const dup	: (fd : fd -> fd)
+const dup2	: (src : fd, dst : fd -> fd)
+/* NB: the C ABI uses '...' for the args. */
+const fcntl	: (fd : fd, cmd : fcntlcmd, args : byte# -> int64)
+
+/* networking */
+const socket	: (dom : sockfam, stype : socktype, proto : sockproto	-> fd)
+const connect	: (sock	: fd, addr : sockaddr#, len : size -> int)
+const accept	: (sock : fd, addr : sockaddr#, len : size# -> fd)
+const listen	: (sock : fd, backlog : int	-> int)
+const bind	: (sock : fd, addr : sockaddr#, len : size -> int)
+const setsockopt	: (sock : fd, lev : sockproto, opt : sockopt, val : void#, len : size -> int)
+const getsockopt	: (sock : fd, lev : sockproto, opt : sockopt, val : void#, len : size# -> int)
+
+/* memory mapping */
+const munmap	: (addr:byte#, len:size -> int64)
+const mmap	: (addr:byte#, len:size, prot:mprot, flags:mopt, fd:fd, off:off -> byte#)
+
+/* time - doublecheck if this is right */
+const clock_getres	: (clk : clock, ts : timespec# -> int32)
+const clock_gettime	: (clk : clock, ts : timespec# -> int32)
+const clock_settime	: (clk : clock, ts : timespec# -> int32)
+const sleep	: (time : uint64 -> int32)
+const nanosleep	: (req : timespec#, rem : timespec# -> int32)
+
+/* system information */
+const uname 	: (buf : utsname# -> int)
+const sysctl	: (mib : int[:], \
+		old : void#, oldsz : size#, \
+		new : void#, newsz : size# \
+		-> int)
+
+/* 
+wraps a syscall argument, converting it to 64 bits for the syscall function. This is
+the same as casting, but more concise than writing a cast to uint64
+*/
+generic a = {x : @t; -> (x : uint64)}
+
+extern const cstring	: (str : byte[:] -> byte#)
+extern const alloca	: (sz : size	-> byte#)
+
+extern const __freebsd_pipe	: (fds : fd[2]# -> int64)
+
+/* process management */
+const exit	= {status;		syscall(Sysexit, a(status))}
+const getpid	= {;			-> (syscall(Sysgetpid, 1) : pid)}
+const kill	= {pid, sig;		-> syscall(Syskill, pid, sig)}
+const fork	= {;			-> (syscall(Sysfork) : pid)}
+const wait4	= {pid, loc, opt, usage;	-> syscall(Syswait4, pid, loc, opt, usage)}
+const waitpid	= {pid, loc, opt;
+	-> wait4(pid, loc, opt, (0 : rusage#)) 
+}
+
+const execv	= {cmd, args
+	var p, cargs, i
+
+	/* of course we fucking have to duplicate this code everywhere,
+	* since we want to stack allocate... */
+	p = alloca((args.len + 1)*sizeof(byte#))
+	cargs = (p : byte##)[:args.len + 1]
+	for i = 0; i < args.len; i++
+		cargs[i] = cstring(args[i])
+	;;
+	cargs[args.len] = (0 : byte#)
+	-> syscall(Sysexecve, cstring(cmd), a(p), a(__cenvp))
+}
+
+const execve	= {cmd, args, env
+	var cargs, cenv, i
+	var p
+
+	/* copy the args */
+	p = alloca((args.len + 1)*sizeof(byte#))
+	cargs = (p : byte##)[:args.len]
+	for i = 0; i < args.len; i++
+		cargs[i] = cstring(args[i])
+	;;
+	cargs[args.len] = (0 : byte#)
+
+	/*
+	 copy the env.
+	 of course we fucking have to duplicate this code everywhere,
+	 since we want to stack allocate... 
+	*/
+	p = alloca((env.len + 1)*sizeof(byte#))
+	cenv = (p : byte##)[:env.len]
+	for i = 0; i < env.len; i++
+		cenv[i] = cstring(env[i])
+	;;
+	cenv[env.len] = (0 : byte#)
+
+	-> syscall(Sysexecve, cstring(cmd), a(p), a(cenv))
+}
+
+/* fd manipulation */
+const open	= {path, opts;		-> (syscall(Sysopen, cstring(path), a(opts), a(0o777)) : fd)}
+const openmode	= {path, opts, mode;	-> (syscall(Sysopen, cstring(path), a(opts), a(mode)) : fd)}
+const close	= {fd;			-> syscall(Sysclose, a(fd))}
+const creat	= {path, mode;		-> (openmode(path, Ocreat | Otrunc | Owronly, mode) : fd)}
+const unlink	= {path;		-> (syscall(Sysunlink, cstring(path)) : int)}
+const read	= {fd, buf;		-> (syscall(Sysread, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pread	= {fd, buf, off;	-> (syscall(Syspread, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
+const readv	= {fd, vec;		-> (syscall(Sysreadv, a(fd), (vec : iovec#), a(vec.len)) : size)}
+const write	= {fd, buf;		-> (syscall(Syswrite, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pwrite	= {fd, buf, off;	-> (syscall(Syspwrite, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
+const writev	= {fd, vec;		-> (syscall(Syswritev, a(fd), (vec : iovec#), a(vec.len)) : size)}
+const lseek	= {fd, off, whence;	-> syscall(Syslseek, a(fd), a(off), a(whence))}
+const stat	= {path, sb;		-> syscall(Sysstat, cstring(path), a(sb))}
+const lstat	= {path, sb;		-> syscall(Syslstat, cstring(path), a(sb))}
+const fstat	= {fd, sb;		-> syscall(Sysfstat, a(fd), a(sb))}
+const mkdir	= {path, mode;		-> (syscall(Sysmkdir, cstring(path), a(mode)) : int64)}
+generic ioctl	= {fd, req, arg;	-> (syscall(Sysioctl, a(fd), a(req), a(arg)) : int64)}
+const chdir	= {dir;	-> syscall(Syschdir, cstring(dir))}
+const __getcwd	= {buf;	-> syscall(Sys__getcwd, a(buf), a(buf.len))}
+const getdents	= {fd, buf;		-> (syscall(Sysgetdents, a(buf), a(buf.len)) : int64)}
+
+/* signals */
+const sigaction	= {sig, act, oact;	-> (syscall(Syssigaction, a(sig), a(act), a(oact)) : int)}
+const sigprocmask	= {sig, act, oact;	-> (syscall(Syssigprocmask, a(sig), a(act), a(oact)) : int)}
+
+/* file stuff */
+const pipe	= {fds;	-> syscall(Syspipe, fds)}
+const dup 	= {fd;	-> (syscall(Sysdup, a(fd)) : fd)}
+const dup2 	= {src, dst;	-> (syscall(Sysdup2, a(src), a(dst)) : fd)}
+const fcntl	= {fd, cmd, args; 	-> syscall(Sysfcntl, a(fd), a(cmd), a(args))}
+const poll      = {pfd, tm;     -> (syscall(Syspoll, (pfd : byte#), a(pfd.len), a(tm)) : int)}
+
+/* networking */
+const socket	= {dom, stype, proto;	-> (syscall(Syssocket, a(dom), a(stype), a(proto)) : fd)}
+const connect	= {sock, addr, len;	-> (syscall(Sysconnect, a(sock), a(addr), a(len)) : int)}
+const accept	= {sock, addr, len;	-> (syscall(Sysaccept, a(sock), a(addr), a(len)) : fd)}
+const listen	= {sock, backlog;	-> (syscall(Syslisten, a(sock), a(backlog)) : int)}
+const bind	= {sock, addr, len;	-> (syscall(Sysbind, a(sock), a(addr), a(len)) : int)}
+const setsockopt	= {sock, lev, opt, val, len;	-> (syscall(Syssetsockopt, a(sock), a(lev), a(opt), a(val), a(len)) : int)}
+const getsockopt	= {sock, lev, opt, val, len;	-> (syscall(Syssetsockopt, a(sock), a(lev), a(opt), a(val), a(len)) : int)}
+
+/* memory management */
+const munmap	= {addr, len;		-> syscall(Sysmunmap, a(addr), a(len))}
+const mmap	= {addr, len, prot, flags, fd, off;
+	/* the actual syscall has padding on the offset arg */
+	-> (syscall(Sysmmap, a(addr), a(len), a(prot), a(flags), a(fd), a(0), a(off)) : byte#)
+}
+
+/* time */
+const clock_getres = {clk, ts;	-> (syscall(Sysclock_getres, clockid(clk), a(ts)) : int32)}
+const clock_gettime = {clk, ts;	-> (syscall(Sysclock_gettime, clockid(clk), a(ts)) : int32)}
+const clock_settime = {clk, ts;	-> (syscall(Sysclock_settime, clockid(clk), a(ts)) : int32)}
+
+const sleep = {time
+	var req, rem
+	req = [.sec = time, .nsec = 0]
+	-> nanosleep(&req, &rem)
+}
+
+const nanosleep	= {req, rem;	-> (syscall(Sysnanosleep, a(req), a(rem)) : int32)}
+
+
+/* system information */
+const uname	= {buf
+	var mib : int[2]
+	var ret
+	var sys, syssz
+	var nod, nodsz
+	var rel, relsz
+	var ver, versz
+	var mach, machsz
+
+	ret = 0
+	mib[0] = 1 /* CTL_KERN */
+	mib[1] = 1 /* KERN_OSTYPE */
+	sys = (buf.system[:] : void#)
+	syssz = buf.system.len
+	ret = sysctl(mib[:], sys, &syssz, (0 : void#), (0 : size#))
+	if ret < 0
+		-> ret
+	;;
+
+	mib[0] = 1 /* CTL_KERN */
+	mib[1] = 10 /* KERN_HOSTNAME */
+	nod = (buf.node[:] : void#)
+	nodsz = buf.node.len
+	ret = sysctl(mib[:], nod, &nodsz, (0 : void#), (0 : size#))
+	if ret < 0
+		-> ret
+	;;
+
+	mib[0] = 1 /* CTL_KERN */
+	mib[1] = 2 /* KERN_OSRELEASE */
+	rel = (buf.release[:] : void#)
+	relsz = buf.release.len
+	ret = sysctl(mib[:], rel, &relsz, (0 : void#), (0 : size#))
+	if ret < 0
+		-> ret
+	;;
+
+	mib[0] = 1 /* CTL_KERN */
+	mib[1] = 27 /* KERN_OSVERSION */
+	ver = (buf.version[:] : void#)
+	versz = buf.version.len
+	ret = sysctl(mib[:], ver, &versz, (0 : void#), (0 : size#))
+	if ret < 0
+		-> ret
+	;;
+
+	mib[0] = 6 /* CTL_HW */
+	mib[1] = 1 /* HW_MACHINE */
+	mach = (buf.machine[:] : void#)
+	machsz = buf.machine.len
+	ret = sysctl(mib[:], mach, &machsz, (0 : void#), (0 : size#))
+	if ret < 0
+		-> ret
+	;;
+
+	-> 0
+}
+
+const sysctl = {mib, old, oldsz, new, newsz
+	/* all args already passed through a() or ar  ptrs */
+	-> (syscall(Syssysctl, \
+		(mib : int#), a(mib.len), old, oldsz, new, newsz) : int)
+}
+
+const clockid = {clk
+	match clk
+	| `Clockrealtime:	-> 0
+	| `Clockproccputime:	-> 2
+	| `Clockmonotonic:	-> 3
+	| `Clockthreadcputime:	-> 4
+	| `Clockuptime:	-> 5
+	;;
+	-> -1
+}
+
+const waitstatus = {st
+	if st < 0
+		-> `Waitfail st
+	;;
+	match st & 0o177
+	| 0:    -> `Waitexit (st >> 8)
+	| 0x7f:-> `Waitstop (st >> 8)
+	| sig:  -> `Waitsig sig
+	;;
+}
+
--- /dev/null
+++ b/support/syscall-gen/syscalls+freebsd.master
@@ -1,0 +1,999 @@
+;	from: @(#)syscalls.master	8.2 (Berkeley) 1/13/94
+;
+; System call name/number master file.
+; Processed to created init_sysent.c, syscalls.c and syscall.h.
+
+; Columns: number audit type name alt{name,tag,rtyp}/comments
+;	number	system call number, must be in order
+;	audit	the audit event associated with the system call
+;		A value of AUE_NULL means no auditing, but it also means that
+;		there is no audit event for the call at this time. For the
+;		case where the event exists, but we don't want auditing, the
+;		event should be #defined to AUE_NULL in audit_kevents.h.
+;	type	one of STD, OBSOL, UNIMPL, COMPAT, COMPAT4, COMPAT6,
+;		COMPAT7, NODEF, NOARGS, NOPROTO, NOSTD
+;		The COMPAT* options may be combined with one or more NO*
+;		options separated by '|' with no spaces (e.g. COMPAT|NOARGS)
+;	name	psuedo-prototype of syscall routine
+;		If one of the following alts is different, then all appear:
+;	altname	name of system call if different
+;	alttag	name of args struct tag if different from [o]`name'"_args"
+;	altrtyp	return type if not int (bogus - syscalls always return int)
+;		for UNIMPL/OBSOL, name continues with comments
+
+; types:
+;	STD	always included
+;	COMPAT	included on COMPAT #ifdef
+;	COMPAT4	included on COMPAT_FREEBSD4 #ifdef (FreeBSD 4 compat)
+;	COMPAT6	included on COMPAT_FREEBSD6 #ifdef (FreeBSD 6 compat)
+;	COMPAT7	included on COMPAT_FREEBSD7 #ifdef (FreeBSD 7 compat)
+;	COMPAT10 included on COMPAT_FREEBSD10 #ifdef (FreeBSD 10 compat)
+;	OBSOL	obsolete, not included in system, only specifies name
+;	UNIMPL	not implemented, placeholder only
+;	NOSTD	implemented but as a lkm that can be statically
+;		compiled in; sysent entry will be filled with lkmressys
+;		so the SYSCALL_MODULE macro works
+;	NOARGS	same as STD except do not create structure in sys/sysproto.h
+;	NODEF	same as STD except only have the entry in the syscall table
+;		added.  Meaning - do not create structure or function
+;		prototype in sys/sysproto.h
+;	NOPROTO	same as STD except do not create structure or
+;		function prototype in sys/sysproto.h.  Does add a
+;		definition to syscall.h besides adding a sysent.
+;	NOTSTATIC syscall is loadable
+;
+; Please copy any additions and changes to the following compatability tables:
+; sys/compat/freebsd32/syscalls.master
+
+; #ifdef's, etc. may be included, and are copied to the output files.
+
+#include <sys/param.h>
+#include <sys/sysent.h>
+#include <sys/sysproto.h>
+
+; Reserved/unimplemented system calls in the range 0-150 inclusive
+; are reserved for use in future Berkeley releases.
+; Additional system calls implemented in vendor and other
+; redistributions should be placed in the reserved range at the end
+; of the current calls.
+
+0	AUE_NULL	STD	{ int nosys(void); } syscall nosys_args int
+1	AUE_EXIT	STD	{ void sys_exit(int rval); } exit \
+				    sys_exit_args void
+2	AUE_FORK	STD	{ int fork(void); }
+3	AUE_NULL	STD	{ ssize_t read(int fd, void *buf, \
+				    size_t nbyte); }
+4	AUE_NULL	STD	{ ssize_t write(int fd, const void *buf, \
+				    size_t nbyte); }
+5	AUE_OPEN_RWTC	STD	{ int open(char *path, int flags, int mode); }
+; XXX should be		{ int open(const char *path, int flags, ...); }
+; but we're not ready for `const' or varargs.
+; XXX man page says `mode_t mode'.
+6	AUE_CLOSE	STD	{ int close(int fd); }
+7	AUE_WAIT4	STD	{ int wait4(int pid, int *status, \
+				    int options, struct rusage *rusage); }
+8	AUE_CREAT	COMPAT	{ int creat(char *path, int mode); }
+9	AUE_LINK	STD	{ int link(char *path, char *link); }
+10	AUE_UNLINK	STD	{ int unlink(char *path); }
+11	AUE_NULL	OBSOL	execv
+12	AUE_CHDIR	STD	{ int chdir(char *path); }
+13	AUE_FCHDIR	STD	{ int fchdir(int fd); }
+14	AUE_MKNOD	STD	{ int mknod(char *path, int mode, int dev); }
+15	AUE_CHMOD	STD	{ int chmod(char *path, int mode); }
+16	AUE_CHOWN	STD	{ int chown(char *path, int uid, int gid); }
+17	AUE_NULL	STD	{ int obreak(char *nsize); } break \
+				    obreak_args int
+18	AUE_GETFSSTAT	COMPAT4	{ int getfsstat(struct ostatfs *buf, \
+				    long bufsize, int flags); }
+19	AUE_LSEEK	COMPAT	{ long lseek(int fd, long offset, \
+				    int whence); }
+20	AUE_GETPID	STD	{ pid_t getpid(void); }
+21	AUE_MOUNT	STD	{ int mount(char *type, char *path, \
+				    int flags, caddr_t data); }
+; XXX `path' should have type `const char *' but we're not ready for that.
+22	AUE_UMOUNT	STD	{ int unmount(char *path, int flags); }
+23	AUE_SETUID	STD	{ int setuid(uid_t uid); }
+24	AUE_GETUID	STD	{ uid_t getuid(void); }
+25	AUE_GETEUID	STD	{ uid_t geteuid(void); }
+26	AUE_PTRACE	STD	{ int ptrace(int req, pid_t pid, \
+				    caddr_t addr, int data); }
+27	AUE_RECVMSG	STD	{ int recvmsg(int s, struct msghdr *msg, \
+				    int flags); }
+28	AUE_SENDMSG	STD	{ int sendmsg(int s, struct msghdr *msg, \
+				    int flags); }
+29	AUE_RECVFROM	STD	{ int recvfrom(int s, caddr_t buf, \
+				    size_t len, int flags, \
+				    struct sockaddr * __restrict from, \
+				    __socklen_t * __restrict fromlenaddr); }
+30	AUE_ACCEPT	STD	{ int accept(int s, \
+				    struct sockaddr * __restrict name, \
+				    __socklen_t * __restrict anamelen); }
+31	AUE_GETPEERNAME	STD	{ int getpeername(int fdes, \
+				    struct sockaddr * __restrict asa, \
+				    __socklen_t * __restrict alen); }
+32	AUE_GETSOCKNAME	STD	{ int getsockname(int fdes, \
+				    struct sockaddr * __restrict asa, \
+				    __socklen_t * __restrict alen); }
+33	AUE_ACCESS	STD	{ int access(char *path, int amode); }
+34	AUE_CHFLAGS	STD	{ int chflags(const char *path, u_long flags); }
+35	AUE_FCHFLAGS	STD	{ int fchflags(int fd, u_long flags); }
+36	AUE_SYNC	STD	{ int sync(void); }
+37	AUE_KILL	STD	{ int kill(int pid, int signum); }
+38	AUE_STAT	COMPAT	{ int stat(char *path, struct ostat *ub); }
+39	AUE_GETPPID	STD	{ pid_t getppid(void); }
+40	AUE_LSTAT	COMPAT	{ int lstat(char *path, struct ostat *ub); }
+41	AUE_DUP		STD	{ int dup(u_int fd); }
+42	AUE_PIPE	COMPAT10	{ int pipe(void); }
+43	AUE_GETEGID	STD	{ gid_t getegid(void); }
+44	AUE_PROFILE	STD	{ int profil(caddr_t samples, size_t size, \
+				    size_t offset, u_int scale); }
+45	AUE_KTRACE	STD	{ int ktrace(const char *fname, int ops, \
+				    int facs, int pid); }
+46	AUE_SIGACTION	COMPAT	{ int sigaction(int signum, \
+				    struct osigaction *nsa, \
+				    struct osigaction *osa); }
+47	AUE_GETGID	STD	{ gid_t getgid(void); }
+48	AUE_SIGPROCMASK	COMPAT	{ int sigprocmask(int how, osigset_t mask); }
+; XXX note nonstandard (bogus) calling convention - the libc stub passes
+; us the mask, not a pointer to it, and we return the old mask as the
+; (int) return value.
+49	AUE_GETLOGIN	STD	{ int getlogin(char *namebuf, u_int \
+				    namelen); }
+50	AUE_SETLOGIN	STD	{ int setlogin(char *namebuf); }
+51	AUE_ACCT	STD	{ int acct(char *path); }
+52	AUE_SIGPENDING	COMPAT	{ int sigpending(void); }
+53	AUE_SIGALTSTACK	STD	{ int sigaltstack(stack_t *ss, \
+				    stack_t *oss); }
+54	AUE_IOCTL	STD	{ int ioctl(int fd, u_long com, \
+				    caddr_t data); }
+55	AUE_REBOOT	STD	{ int reboot(int opt); }
+56	AUE_REVOKE	STD	{ int revoke(char *path); }
+57	AUE_SYMLINK	STD	{ int symlink(char *path, char *link); }
+58	AUE_READLINK	STD	{ ssize_t readlink(char *path, char *buf, \
+				    size_t count); }
+59	AUE_EXECVE	STD	{ int execve(char *fname, char **argv, \
+				    char **envv); }
+60	AUE_UMASK	STD	{ int umask(int newmask); } umask umask_args \
+				    int
+61	AUE_CHROOT	STD	{ int chroot(char *path); }
+62	AUE_FSTAT	COMPAT	{ int fstat(int fd, struct ostat *sb); }
+63	AUE_NULL	COMPAT	{ int getkerninfo(int op, char *where, \
+				    size_t *size, int arg); } getkerninfo \
+				    getkerninfo_args int
+64	AUE_NULL	COMPAT	{ int getpagesize(void); } getpagesize \
+				    getpagesize_args int
+65	AUE_MSYNC	STD	{ int msync(void *addr, size_t len, \
+				    int flags); }
+66	AUE_VFORK	STD	{ int vfork(void); }
+67	AUE_NULL	OBSOL	vread
+68	AUE_NULL	OBSOL	vwrite
+69	AUE_SBRK	STD	{ int sbrk(int incr); }
+70	AUE_SSTK	STD	{ int sstk(int incr); }
+71	AUE_MMAP	COMPAT	{ int mmap(void *addr, int len, int prot, \
+				    int flags, int fd, long pos); }
+72	AUE_O_VADVISE	STD	{ int ovadvise(int anom); } vadvise \
+				    ovadvise_args int
+73	AUE_MUNMAP	STD	{ int munmap(void *addr, size_t len); }
+74	AUE_MPROTECT	STD	{ int mprotect(const void *addr, size_t len, \
+				    int prot); }
+75	AUE_MADVISE	STD	{ int madvise(void *addr, size_t len, \
+				    int behav); }
+76	AUE_NULL	OBSOL	vhangup
+77	AUE_NULL	OBSOL	vlimit
+78	AUE_MINCORE	STD	{ int mincore(const void *addr, size_t len, \
+				    char *vec); }
+79	AUE_GETGROUPS	STD	{ int getgroups(u_int gidsetsize, \
+				    gid_t *gidset); }
+80	AUE_SETGROUPS	STD	{ int setgroups(u_int gidsetsize, \
+				    gid_t *gidset); }
+81	AUE_GETPGRP	STD	{ int getpgrp(void); }
+82	AUE_SETPGRP	STD	{ int setpgid(int pid, int pgid); }
+83	AUE_SETITIMER	STD	{ int setitimer(u_int which, struct \
+				    itimerval *itv, struct itimerval *oitv); }
+84	AUE_WAIT4	COMPAT	{ int wait(void); }
+85	AUE_SWAPON	STD	{ int swapon(char *name); }
+86	AUE_GETITIMER	STD	{ int getitimer(u_int which, \
+				    struct itimerval *itv); }
+87	AUE_SYSCTL	COMPAT	{ int gethostname(char *hostname, \
+				    u_int len); } gethostname \
+				    gethostname_args int
+88	AUE_SYSCTL	COMPAT	{ int sethostname(char *hostname, \
+				    u_int len); } sethostname \
+				    sethostname_args int
+89	AUE_GETDTABLESIZE	STD	{ int getdtablesize(void); }
+90	AUE_DUP2	STD	{ int dup2(u_int from, u_int to); }
+91	AUE_NULL	UNIMPL	getdopt
+92	AUE_FCNTL	STD	{ int fcntl(int fd, int cmd, long arg); }
+; XXX should be	{ int fcntl(int fd, int cmd, ...); }
+; but we're not ready for varargs.
+93	AUE_SELECT	STD	{ int select(int nd, fd_set *in, fd_set *ou, \
+				    fd_set *ex, struct timeval *tv); }
+94	AUE_NULL	UNIMPL	setdopt
+95	AUE_FSYNC	STD	{ int fsync(int fd); }
+96	AUE_SETPRIORITY	STD	{ int setpriority(int which, int who, \
+				    int prio); }
+97	AUE_SOCKET	STD	{ int socket(int domain, int type, \
+				    int protocol); }
+98	AUE_CONNECT	STD	{ int connect(int s, caddr_t name, \
+				    int namelen); }
+99	AUE_ACCEPT	COMPAT|NOARGS { int accept(int s, caddr_t name, \
+				    int *anamelen); } accept accept_args int
+100	AUE_GETPRIORITY	STD	{ int getpriority(int which, int who); }
+101	AUE_SEND	COMPAT	{ int send(int s, caddr_t buf, int len, \
+				    int flags); }
+102	AUE_RECV	COMPAT	{ int recv(int s, caddr_t buf, int len, \
+				    int flags); }
+103	AUE_SIGRETURN	COMPAT	{ int sigreturn( \
+				    struct osigcontext *sigcntxp); }
+104	AUE_BIND	STD	{ int bind(int s, caddr_t name, \
+				    int namelen); }
+105	AUE_SETSOCKOPT	STD	{ int setsockopt(int s, int level, int name, \
+				    caddr_t val, int valsize); }
+106	AUE_LISTEN	STD	{ int listen(int s, int backlog); }
+107	AUE_NULL	OBSOL	vtimes
+108	AUE_NULL	COMPAT	{ int sigvec(int signum, struct sigvec *nsv, \
+				    struct sigvec *osv); }
+109	AUE_NULL	COMPAT	{ int sigblock(int mask); }
+110	AUE_NULL	COMPAT	{ int sigsetmask(int mask); }
+111	AUE_NULL	COMPAT	{ int sigsuspend(osigset_t mask); }
+; XXX note nonstandard (bogus) calling convention - the libc stub passes
+; us the mask, not a pointer to it.
+112	AUE_NULL	COMPAT	{ int sigstack(struct sigstack *nss, \
+				    struct sigstack *oss); }
+113	AUE_RECVMSG	COMPAT	{ int recvmsg(int s, struct omsghdr *msg, \
+				    int flags); }
+114	AUE_SENDMSG	COMPAT	{ int sendmsg(int s, caddr_t msg, \
+				    int flags); }
+115	AUE_NULL	OBSOL	vtrace
+116	AUE_GETTIMEOFDAY	STD	{ int gettimeofday(struct timeval *tp, \
+				    struct timezone *tzp); }
+117	AUE_GETRUSAGE	STD	{ int getrusage(int who, \
+				    struct rusage *rusage); }
+118	AUE_GETSOCKOPT	STD	{ int getsockopt(int s, int level, int name, \
+				    caddr_t val, int *avalsize); }
+119	AUE_NULL	UNIMPL	resuba (BSD/OS 2.x)
+120	AUE_READV	STD	{ int readv(int fd, struct iovec *iovp, \
+				    u_int iovcnt); }
+121	AUE_WRITEV	STD	{ int writev(int fd, struct iovec *iovp, \
+				    u_int iovcnt); }
+122	AUE_SETTIMEOFDAY	STD	{ int settimeofday(struct timeval *tv, \
+				    struct timezone *tzp); }
+123	AUE_FCHOWN	STD	{ int fchown(int fd, int uid, int gid); }
+124	AUE_FCHMOD	STD	{ int fchmod(int fd, int mode); }
+125	AUE_RECVFROM	COMPAT|NOARGS { int recvfrom(int s, caddr_t buf, \
+				    size_t len, int flags, caddr_t from, int \
+				    *fromlenaddr); } recvfrom recvfrom_args \
+				    int
+126	AUE_SETREUID	STD	{ int setreuid(int ruid, int euid); }
+127	AUE_SETREGID	STD	{ int setregid(int rgid, int egid); }
+128	AUE_RENAME	STD	{ int rename(char *from, char *to); }
+129	AUE_TRUNCATE	COMPAT	{ int truncate(char *path, long length); }
+130	AUE_FTRUNCATE	COMPAT	{ int ftruncate(int fd, long length); }
+131	AUE_FLOCK	STD	{ int flock(int fd, int how); }
+132	AUE_MKFIFO	STD	{ int mkfifo(char *path, int mode); }
+133	AUE_SENDTO	STD	{ int sendto(int s, caddr_t buf, size_t len, \
+				    int flags, caddr_t to, int tolen); }
+134	AUE_SHUTDOWN	STD	{ int shutdown(int s, int how); }
+135	AUE_SOCKETPAIR	STD	{ int socketpair(int domain, int type, \
+				    int protocol, int *rsv); }
+136	AUE_MKDIR	STD	{ int mkdir(char *path, int mode); }
+137	AUE_RMDIR	STD	{ int rmdir(char *path); }
+138	AUE_UTIMES	STD	{ int utimes(char *path, \
+				    struct timeval *tptr); }
+139	AUE_NULL	OBSOL	4.2 sigreturn
+140	AUE_ADJTIME	STD	{ int adjtime(struct timeval *delta, \
+				    struct timeval *olddelta); }
+141	AUE_GETPEERNAME	COMPAT	{ int getpeername(int fdes, caddr_t asa, \
+				    int *alen); }
+142	AUE_SYSCTL	COMPAT	{ long gethostid(void); }
+143	AUE_SYSCTL	COMPAT	{ int sethostid(long hostid); }
+144	AUE_GETRLIMIT	COMPAT	{ int getrlimit(u_int which, struct \
+				    orlimit *rlp); }
+145	AUE_SETRLIMIT	COMPAT	{ int setrlimit(u_int which, \
+				    struct orlimit *rlp); }
+146	AUE_KILLPG	COMPAT	{ int killpg(int pgid, int signum); }
+147	AUE_SETSID	STD	{ int setsid(void); }
+148	AUE_QUOTACTL	STD	{ int quotactl(char *path, int cmd, int uid, \
+				    caddr_t arg); }
+149	AUE_O_QUOTA	COMPAT	{ int quota(void); }
+150	AUE_GETSOCKNAME	COMPAT|NOARGS { int getsockname(int fdec, \
+				    caddr_t asa, int *alen); } getsockname \
+				    getsockname_args int
+
+; Syscalls 151-180 inclusive are reserved for vendor-specific
+; system calls.  (This includes various calls added for compatibity
+; with other Unix variants.)
+; Some of these calls are now supported by BSD...
+151	AUE_NULL	UNIMPL	sem_lock (BSD/OS 2.x)
+152	AUE_NULL	UNIMPL	sem_wakeup (BSD/OS 2.x)
+153	AUE_NULL	UNIMPL	asyncdaemon (BSD/OS 2.x)
+; 154 is initialised by the NLM code, if present.
+154	AUE_NULL	NOSTD	{ int nlm_syscall(int debug_level, int grace_period, int addr_count, char **addrs); }
+; 155 is initialized by the NFS code, if present.
+155	AUE_NFS_SVC	NOSTD	{ int nfssvc(int flag, caddr_t argp); }
+156	AUE_GETDIRENTRIES	COMPAT	{ int getdirentries(int fd, char *buf, \
+				    u_int count, long *basep); }
+157	AUE_STATFS	COMPAT4	{ int statfs(char *path, \
+				    struct ostatfs *buf); }
+158	AUE_FSTATFS	COMPAT4	{ int fstatfs(int fd, \
+				    struct ostatfs *buf); }
+159	AUE_NULL	UNIMPL	nosys
+160	AUE_LGETFH	STD	{ int lgetfh(char *fname, \
+				    struct fhandle *fhp); }
+161	AUE_NFS_GETFH	STD	{ int getfh(char *fname, \
+				    struct fhandle *fhp); }
+162	AUE_SYSCTL	COMPAT4	{ int getdomainname(char *domainname, \
+				    int len); }
+163	AUE_SYSCTL	COMPAT4	{ int setdomainname(char *domainname, \
+				    int len); }
+164	AUE_NULL	COMPAT4	{ int uname(struct utsname *name); }
+165	AUE_SYSARCH	STD	{ int sysarch(int op, char *parms); }
+166	AUE_RTPRIO	STD	{ int rtprio(int function, pid_t pid, \
+				    struct rtprio *rtp); }
+167	AUE_NULL	UNIMPL	nosys
+168	AUE_NULL	UNIMPL	nosys
+169	AUE_SEMSYS	NOSTD	{ int semsys(int which, int a2, int a3, \
+				    int a4, int a5); }
+; XXX should be	{ int semsys(int which, ...); }
+170	AUE_MSGSYS	NOSTD	{ int msgsys(int which, int a2, int a3, \
+				    int a4, int a5, int a6); }
+; XXX should be	{ int msgsys(int which, ...); }
+171	AUE_SHMSYS	NOSTD	{ int shmsys(int which, int a2, int a3, \
+				    int a4); }
+; XXX should be	{ int shmsys(int which, ...); }
+172	AUE_NULL	UNIMPL	nosys
+173	AUE_PREAD	COMPAT6	{ ssize_t pread(int fd, void *buf, \
+				    size_t nbyte, int pad, off_t offset); }
+174	AUE_PWRITE	COMPAT6	{ ssize_t pwrite(int fd, \
+				    const void *buf, \
+				    size_t nbyte, int pad, off_t offset); }
+175	AUE_NULL	STD	{ int setfib(int fibnum); }
+176	AUE_NTP_ADJTIME	STD	{ int ntp_adjtime(struct timex *tp); }
+177	AUE_NULL	UNIMPL	sfork (BSD/OS 2.x)
+178	AUE_NULL	UNIMPL	getdescriptor (BSD/OS 2.x)
+179	AUE_NULL	UNIMPL	setdescriptor (BSD/OS 2.x)
+180	AUE_NULL	UNIMPL	nosys
+
+; Syscalls 181-199 are used by/reserved for BSD
+181	AUE_SETGID	STD	{ int setgid(gid_t gid); }
+182	AUE_SETEGID	STD	{ int setegid(gid_t egid); }
+183	AUE_SETEUID	STD	{ int seteuid(uid_t euid); }
+184	AUE_NULL	UNIMPL	lfs_bmapv
+185	AUE_NULL	UNIMPL	lfs_markv
+186	AUE_NULL	UNIMPL	lfs_segclean
+187	AUE_NULL	UNIMPL	lfs_segwait
+188	AUE_STAT	STD	{ int stat(char *path, struct stat *ub); }
+189	AUE_FSTAT	STD	{ int fstat(int fd, struct stat *sb); }
+190	AUE_LSTAT	STD	{ int lstat(char *path, struct stat *ub); }
+191	AUE_PATHCONF	STD	{ int pathconf(char *path, int name); }
+192	AUE_FPATHCONF	STD	{ int fpathconf(int fd, int name); }
+193	AUE_NULL	UNIMPL	nosys
+194	AUE_GETRLIMIT	STD	{ int getrlimit(u_int which, \
+				    struct rlimit *rlp); } getrlimit \
+				    __getrlimit_args int
+195	AUE_SETRLIMIT	STD	{ int setrlimit(u_int which, \
+				    struct rlimit *rlp); } setrlimit \
+				    __setrlimit_args int
+196	AUE_GETDIRENTRIES	STD	{ int getdirentries(int fd, char *buf, \
+				    u_int count, long *basep); }
+197	AUE_MMAP	COMPAT6	{ caddr_t mmap(caddr_t addr, \
+				    size_t len, int prot, int flags, int fd, \
+				    int pad, off_t pos); }
+198	AUE_NULL	NOPROTO	{ int nosys(void); } __syscall \
+				    __syscall_args int
+199	AUE_LSEEK	COMPAT6	{ off_t lseek(int fd, int pad, \
+				    off_t offset, int whence); }
+200	AUE_TRUNCATE	COMPAT6	{ int truncate(char *path, int pad, \
+				    off_t length); }
+201	AUE_FTRUNCATE	COMPAT6	{ int ftruncate(int fd, int pad, \
+				    off_t length); }
+202	AUE_SYSCTL	STD	{ int __sysctl(int *name, u_int namelen, \
+				    void *old, size_t *oldlenp, void *new, \
+				    size_t newlen); } __sysctl sysctl_args int
+203	AUE_MLOCK	STD	{ int mlock(const void *addr, size_t len); }
+204	AUE_MUNLOCK	STD	{ int munlock(const void *addr, size_t len); }
+205	AUE_UNDELETE	STD	{ int undelete(char *path); }
+206	AUE_FUTIMES	STD	{ int futimes(int fd, struct timeval *tptr); }
+207	AUE_GETPGID	STD	{ int getpgid(pid_t pid); }
+208	AUE_NULL	UNIMPL	newreboot (NetBSD)
+209	AUE_POLL	STD	{ int poll(struct pollfd *fds, u_int nfds, \
+				    int timeout); }
+
+;
+; The following are reserved for loadable syscalls
+;
+210	AUE_NULL	NODEF|NOTSTATIC	lkmnosys lkmnosys nosys_args int
+211	AUE_NULL	NODEF|NOTSTATIC	lkmnosys lkmnosys nosys_args int
+212	AUE_NULL	NODEF|NOTSTATIC	lkmnosys lkmnosys nosys_args int
+213	AUE_NULL	NODEF|NOTSTATIC	lkmnosys lkmnosys nosys_args int
+214	AUE_NULL	NODEF|NOTSTATIC	lkmnosys lkmnosys nosys_args int
+215	AUE_NULL	NODEF|NOTSTATIC	lkmnosys lkmnosys nosys_args int
+216	AUE_NULL	NODEF|NOTSTATIC	lkmnosys lkmnosys nosys_args int
+217	AUE_NULL	NODEF|NOTSTATIC	lkmnosys lkmnosys nosys_args int
+218	AUE_NULL	NODEF|NOTSTATIC	lkmnosys lkmnosys nosys_args int
+219	AUE_NULL	NODEF|NOTSTATIC	lkmnosys lkmnosys nosys_args int
+
+;
+; The following were introduced with NetBSD/4.4Lite-2
+220	AUE_SEMCTL	COMPAT7|NOSTD { int __semctl(int semid, int semnum, \
+				    int cmd, union semun_old *arg); }
+221	AUE_SEMGET	NOSTD	{ int semget(key_t key, int nsems, \
+				    int semflg); }
+222	AUE_SEMOP	NOSTD	{ int semop(int semid, struct sembuf *sops, \
+				    size_t nsops); }
+223	AUE_NULL	UNIMPL	semconfig
+224	AUE_MSGCTL	COMPAT7|NOSTD { int msgctl(int msqid, int cmd, \
+				    struct msqid_ds_old *buf); }
+225	AUE_MSGGET	NOSTD	{ int msgget(key_t key, int msgflg); }
+226	AUE_MSGSND	NOSTD	{ int msgsnd(int msqid, const void *msgp, \
+				    size_t msgsz, int msgflg); }
+227	AUE_MSGRCV	NOSTD	{ int msgrcv(int msqid, void *msgp, \
+				    size_t msgsz, long msgtyp, int msgflg); }
+228	AUE_SHMAT	NOSTD	{ int shmat(int shmid, const void *shmaddr, \
+				    int shmflg); }
+229	AUE_SHMCTL	COMPAT7|NOSTD { int shmctl(int shmid, int cmd, \
+				    struct shmid_ds_old *buf); }
+230	AUE_SHMDT	NOSTD	{ int shmdt(const void *shmaddr); }
+231	AUE_SHMGET	NOSTD	{ int shmget(key_t key, size_t size, \
+				    int shmflg); }
+;
+232	AUE_NULL	STD	{ int clock_gettime(clockid_t clock_id, \
+				    struct timespec *tp); }
+233	AUE_CLOCK_SETTIME	STD	{ int clock_settime( \
+				    clockid_t clock_id, \
+				    const struct timespec *tp); }
+234	AUE_NULL	STD	{ int clock_getres(clockid_t clock_id, \
+				    struct timespec *tp); }
+235	AUE_NULL	STD	{ int ktimer_create(clockid_t clock_id, \
+				    struct sigevent *evp, int *timerid); }
+236	AUE_NULL	STD	{ int ktimer_delete(int timerid); }
+237	AUE_NULL	STD	{ int ktimer_settime(int timerid, int flags, \
+				    const struct itimerspec *value, \
+				    struct itimerspec *ovalue); }
+238	AUE_NULL	STD	{ int ktimer_gettime(int timerid, struct \
+				    itimerspec *value); }
+239	AUE_NULL	STD	{ int ktimer_getoverrun(int timerid); }
+240	AUE_NULL	STD	{ int nanosleep(const struct timespec *rqtp, \
+				    struct timespec *rmtp); }
+241	AUE_NULL	STD	{ int ffclock_getcounter(ffcounter *ffcount); }
+242	AUE_NULL	STD	{ int ffclock_setestimate( \
+				    struct ffclock_estimate *cest); }
+243	AUE_NULL	STD	{ int ffclock_getestimate( \
+				    struct ffclock_estimate *cest); }
+244	AUE_NULL	UNIMPL	nosys
+245	AUE_NULL	UNIMPL	nosys
+246	AUE_NULL	UNIMPL	nosys
+247	AUE_NULL	STD	{ int clock_getcpuclockid2(id_t id,\
+				    int which, clockid_t *clock_id); }
+;248	AUE_NULL	STD	{ int ntp_gettime(struct ntptimeval *ntvp); }
+249	AUE_NULL	UNIMPL	nosys
+; syscall numbers initially used in OpenBSD
+250	AUE_MINHERIT	STD	{ int minherit(void *addr, size_t len, \
+				    int inherit); }
+251	AUE_RFORK	STD	{ int rfork(int flags); }
+252	AUE_POLL	STD	{ int openbsd_poll(struct pollfd *fds, \
+				    u_int nfds, int timeout); }
+253	AUE_ISSETUGID	STD	{ int issetugid(void); }
+254	AUE_LCHOWN	STD	{ int lchown(char *path, int uid, int gid); }
+255	AUE_NULL	STD	{ int aio_read(struct aiocb *aiocbp); }
+256	AUE_NULL	STD	{ int aio_write(struct aiocb *aiocbp); }
+257	AUE_NULL	STD	{ int lio_listio(int mode, \
+				    struct aiocb * const *acb_list, \
+				    int nent, struct sigevent *sig); }
+258	AUE_NULL	UNIMPL	nosys
+259	AUE_NULL	UNIMPL	nosys
+260	AUE_NULL	UNIMPL	nosys
+261	AUE_NULL	UNIMPL	nosys
+262	AUE_NULL	UNIMPL	nosys
+263	AUE_NULL	UNIMPL	nosys
+264	AUE_NULL	UNIMPL	nosys
+265	AUE_NULL	UNIMPL	nosys
+266	AUE_NULL	UNIMPL	nosys
+267	AUE_NULL	UNIMPL	nosys
+268	AUE_NULL	UNIMPL	nosys
+269	AUE_NULL	UNIMPL	nosys
+270	AUE_NULL	UNIMPL	nosys
+271	AUE_NULL	UNIMPL	nosys
+272	AUE_O_GETDENTS	STD	{ int getdents(int fd, char *buf, \
+				    size_t count); }
+273	AUE_NULL	UNIMPL	nosys
+274	AUE_LCHMOD	STD	{ int lchmod(char *path, mode_t mode); }
+275	AUE_LCHOWN	NOPROTO	{ int lchown(char *path, uid_t uid, \
+				    gid_t gid); } netbsd_lchown lchown_args \
+				    int
+276	AUE_LUTIMES	STD	{ int lutimes(char *path, \
+				    struct timeval *tptr); }
+277	AUE_MSYNC	NOPROTO	{ int msync(void *addr, size_t len, \
+				    int flags); } netbsd_msync msync_args int
+278	AUE_STAT	STD	{ int nstat(char *path, struct nstat *ub); }
+279	AUE_FSTAT	STD	{ int nfstat(int fd, struct nstat *sb); }
+280	AUE_LSTAT	STD	{ int nlstat(char *path, struct nstat *ub); }
+281	AUE_NULL	UNIMPL	nosys
+282	AUE_NULL	UNIMPL	nosys
+283	AUE_NULL	UNIMPL	nosys
+284	AUE_NULL	UNIMPL	nosys
+285	AUE_NULL	UNIMPL	nosys
+286	AUE_NULL	UNIMPL	nosys
+287	AUE_NULL	UNIMPL	nosys
+288	AUE_NULL	UNIMPL	nosys
+; 289 and 290 from NetBSD (OpenBSD: 267 and 268)
+289	AUE_PREADV	STD	{ ssize_t preadv(int fd, struct iovec *iovp, \
+					u_int iovcnt, off_t offset); }
+290	AUE_PWRITEV	STD	{ ssize_t pwritev(int fd, struct iovec *iovp, \
+					u_int iovcnt, off_t offset); }
+291	AUE_NULL	UNIMPL	nosys
+292	AUE_NULL	UNIMPL	nosys
+293	AUE_NULL	UNIMPL	nosys
+294	AUE_NULL	UNIMPL	nosys
+295	AUE_NULL	UNIMPL	nosys
+296	AUE_NULL	UNIMPL	nosys
+; XXX 297 is 300 in NetBSD 
+297	AUE_FHSTATFS	COMPAT4	{ int fhstatfs( \
+				    const struct fhandle *u_fhp, \
+				    struct ostatfs *buf); }
+298	AUE_FHOPEN	STD	{ int fhopen(const struct fhandle *u_fhp, \
+				    int flags); }
+299	AUE_FHSTAT	STD	{ int fhstat(const struct fhandle *u_fhp, \
+				    struct stat *sb); }
+; syscall numbers for FreeBSD
+300	AUE_NULL	STD	{ int modnext(int modid); }
+;301	AUE_NULL	STD	{ int modstat(int modid, \
+;				    struct module_stat *stat); }
+302	AUE_NULL	STD	{ int modfnext(int modid); }
+303	AUE_NULL	STD	{ int modfind(const char *name); }
+304	AUE_MODLOAD	STD	{ int kldload(const char *file); }
+305	AUE_MODUNLOAD	STD	{ int kldunload(int fileid); }
+306	AUE_NULL	STD	{ int kldfind(const char *file); }
+307	AUE_NULL	STD	{ int kldnext(int fileid); }
+;308	AUE_NULL	STD	{ int kldstat(int fileid, struct \
+;				    kld_file_stat* stat); }
+309	AUE_NULL	STD	{ int kldfirstmod(int fileid); }
+310	AUE_GETSID	STD	{ int getsid(pid_t pid); }
+311	AUE_SETRESUID	STD	{ int setresuid(uid_t ruid, uid_t euid, \
+				    uid_t suid); }
+312	AUE_SETRESGID	STD	{ int setresgid(gid_t rgid, gid_t egid, \
+				    gid_t sgid); }
+313	AUE_NULL	OBSOL	signanosleep
+314	AUE_NULL	STD	{ ssize_t aio_return(struct aiocb *aiocbp); }
+315	AUE_NULL	STD	{ int aio_suspend( \
+				    struct aiocb * const * aiocbp, int nent, \
+				    const struct timespec *timeout); }
+316	AUE_NULL	STD	{ int aio_cancel(int fd, \
+				    struct aiocb *aiocbp); }
+317	AUE_NULL	STD	{ int aio_error(struct aiocb *aiocbp); }
+318	AUE_NULL	COMPAT6	{ int aio_read(struct oaiocb *aiocbp); }
+319	AUE_NULL	COMPAT6	{ int aio_write(struct oaiocb *aiocbp); }
+320	AUE_NULL	COMPAT6	{ int lio_listio(int mode, \
+				    struct oaiocb * const *acb_list, \
+				    int nent, struct osigevent *sig); }
+321	AUE_NULL	STD	{ int yield(void); }
+322	AUE_NULL	OBSOL	thr_sleep
+323	AUE_NULL	OBSOL	thr_wakeup
+324	AUE_MLOCKALL	STD	{ int mlockall(int how); }
+325	AUE_MUNLOCKALL	STD	{ int munlockall(void); }
+326	AUE_GETCWD	STD	{ int __getcwd(char *buf, u_int buflen); }
+
+327	AUE_NULL	STD	{ int sched_setparam (pid_t pid, \
+				    const struct sched_param *param); }
+328	AUE_NULL	STD	{ int sched_getparam (pid_t pid, struct \
+				    sched_param *param); }
+
+329	AUE_NULL	STD	{ int sched_setscheduler (pid_t pid, int \
+				    policy, const struct sched_param \
+				    *param); }
+330	AUE_NULL	STD	{ int sched_getscheduler (pid_t pid); }
+
+331	AUE_NULL	STD	{ int sched_yield (void); }
+332	AUE_NULL	STD	{ int sched_get_priority_max (int policy); }
+333	AUE_NULL	STD	{ int sched_get_priority_min (int policy); }
+334	AUE_NULL	STD	{ int sched_rr_get_interval (pid_t pid, \
+				    struct timespec *interval); }
+335	AUE_NULL	STD	{ int utrace(const void *addr, size_t len); }
+336	AUE_SENDFILE	COMPAT4	{ int sendfile(int fd, int s, \
+				    off_t offset, size_t nbytes, \
+				    struct sf_hdtr *hdtr, off_t *sbytes, \
+				    int flags); }
+337	AUE_NULL	STD	{ int kldsym(int fileid, int cmd, \
+				    void *data); }
+338	AUE_JAIL	STD	{ int jail(struct jail *jail); }
+339	AUE_NULL	NOSTD|NOTSTATIC	{ int nnpfs_syscall(int operation, \
+				    char *a_pathP, int a_opcode, \
+				    void *a_paramsP, int a_followSymlinks); }
+340	AUE_SIGPROCMASK	STD	{ int sigprocmask(int how, \
+				    const sigset_t *set, sigset_t *oset); }
+341	AUE_SIGSUSPEND	STD	{ int sigsuspend(const sigset_t *sigmask); }
+342	AUE_SIGACTION	COMPAT4	{ int sigaction(int sig, const \
+				    struct sigaction *act, \
+				    struct sigaction *oact); }
+343	AUE_SIGPENDING	STD	{ int sigpending(sigset_t *set); }
+344	AUE_SIGRETURN	COMPAT4	{ int sigreturn( \
+				    const struct ucontext4 *sigcntxp); }
+345	AUE_SIGWAIT	STD	{ int sigtimedwait(const sigset_t *set, \
+				    siginfo_t *info, \
+				    const struct timespec *timeout); }
+346	AUE_NULL	STD	{ int sigwaitinfo(const sigset_t *set, \
+				    siginfo_t *info); }
+347	AUE_NULL	STD	{ int __acl_get_file(const char *path, \
+				    acl_type_t type, struct acl *aclp); }
+348	AUE_NULL	STD	{ int __acl_set_file(const char *path, \
+				    acl_type_t type, struct acl *aclp); }
+349	AUE_NULL	STD	{ int __acl_get_fd(int filedes, \
+				    acl_type_t type, struct acl *aclp); }
+350	AUE_NULL	STD	{ int __acl_set_fd(int filedes, \
+				    acl_type_t type, struct acl *aclp); }
+351	AUE_NULL	STD	{ int __acl_delete_file(const char *path, \
+				    acl_type_t type); }
+352	AUE_NULL	STD	{ int __acl_delete_fd(int filedes, \
+				    acl_type_t type); }
+353	AUE_NULL	STD	{ int __acl_aclcheck_file(const char *path, \
+				    acl_type_t type, struct acl *aclp); }
+354	AUE_NULL	STD	{ int __acl_aclcheck_fd(int filedes, \
+				    acl_type_t type, struct acl *aclp); }
+355	AUE_EXTATTRCTL	STD	{ int extattrctl(const char *path, int cmd, \
+				    const char *filename, int attrnamespace, \
+				    const char *attrname); }
+356	AUE_EXTATTR_SET_FILE	STD	{ ssize_t extattr_set_file( \
+				    const char *path, int attrnamespace, \
+				    const char *attrname, void *data, \
+				    size_t nbytes); }
+357	AUE_EXTATTR_GET_FILE	STD	{ ssize_t extattr_get_file( \
+				    const char *path, int attrnamespace, \
+				    const char *attrname, void *data, \
+				    size_t nbytes); }
+358	AUE_EXTATTR_DELETE_FILE	STD	{ int extattr_delete_file(const char *path, \
+				    int attrnamespace, \
+				    const char *attrname); }
+359	AUE_NULL	STD	{ ssize_t aio_waitcomplete( \
+				    struct aiocb **aiocbp, \
+				    struct timespec *timeout); }
+360	AUE_GETRESUID	STD	{ int getresuid(uid_t *ruid, uid_t *euid, \
+				    uid_t *suid); }
+361	AUE_GETRESGID	STD	{ int getresgid(gid_t *rgid, gid_t *egid, \
+				    gid_t *sgid); }
+362	AUE_KQUEUE	STD	{ int kqueue(void); }
+363	AUE_NULL	STD	{ int kevent(int fd, \
+				    struct kevent *changelist, int nchanges, \
+				    struct kevent *eventlist, int nevents, \
+				    const struct timespec *timeout); }
+364	AUE_NULL	UNIMPL	__cap_get_proc
+365	AUE_NULL	UNIMPL	__cap_set_proc
+366	AUE_NULL	UNIMPL	__cap_get_fd
+367	AUE_NULL	UNIMPL	__cap_get_file
+368	AUE_NULL	UNIMPL	__cap_set_fd
+369	AUE_NULL	UNIMPL	__cap_set_file
+370	AUE_NULL	UNIMPL	nosys
+371	AUE_EXTATTR_SET_FD	STD	{ ssize_t extattr_set_fd(int fd, \
+				    int attrnamespace, const char *attrname, \
+				    void *data, size_t nbytes); }
+372	AUE_EXTATTR_GET_FD	STD	{ ssize_t extattr_get_fd(int fd, \
+				    int attrnamespace, const char *attrname, \
+				    void *data, size_t nbytes); }
+373	AUE_EXTATTR_DELETE_FD	STD	{ int extattr_delete_fd(int fd, \
+				    int attrnamespace, \
+				    const char *attrname); }
+374	AUE_NULL	STD	{ int __setugid(int flag); }
+375	AUE_NULL	UNIMPL	nfsclnt
+376	AUE_EACCESS	STD	{ int eaccess(char *path, int amode); }
+377	AUE_NULL	NOSTD|NOTSTATIC	{ int afs3_syscall(long syscall, \
+				    long parm1, long parm2, long parm3, \
+				    long parm4, long parm5, long parm6); }
+378	AUE_NMOUNT	STD	{ int nmount(struct iovec *iovp, \
+				    unsigned int iovcnt, int flags); }
+379	AUE_NULL	UNIMPL	kse_exit
+380	AUE_NULL	UNIMPL	kse_wakeup
+381	AUE_NULL	UNIMPL	kse_create
+382	AUE_NULL	UNIMPL	kse_thr_interrupt
+383	AUE_NULL	UNIMPL	kse_release
+384	AUE_NULL	STD	{ int __mac_get_proc(struct mac *mac_p); }
+385	AUE_NULL	STD	{ int __mac_set_proc(struct mac *mac_p); }
+386	AUE_NULL	STD	{ int __mac_get_fd(int fd, \
+				    struct mac *mac_p); }
+387	AUE_NULL	STD	{ int __mac_get_file(const char *path_p, \
+				    struct mac *mac_p); }
+388	AUE_NULL	STD	{ int __mac_set_fd(int fd, \
+				    struct mac *mac_p); }
+389	AUE_NULL	STD	{ int __mac_set_file(const char *path_p, \
+				    struct mac *mac_p); }
+390	AUE_NULL	STD	{ int kenv(int what, const char *name, \
+				    char *value, int len); }
+391	AUE_LCHFLAGS	STD	{ int lchflags(const char *path, \
+				    u_long flags); }
+392	AUE_NULL	STD	{ int uuidgen(struct uuid *store, \
+				    int count); }
+393	AUE_SENDFILE	STD	{ int sendfile(int fd, int s, off_t offset, \
+				    size_t nbytes, struct sf_hdtr *hdtr, \
+				    off_t *sbytes, int flags); }
+394	AUE_NULL	STD	{ int mac_syscall(const char *policy, \
+				    int call, void *arg); }
+395	AUE_GETFSSTAT	STD	{ int getfsstat(struct statfs *buf, \
+				    long bufsize, int flags); }
+396	AUE_STATFS	STD	{ int statfs(char *path, \
+				    struct statfs *buf); }
+397	AUE_FSTATFS	STD	{ int fstatfs(int fd, struct statfs *buf); }
+398	AUE_FHSTATFS	STD	{ int fhstatfs(const struct fhandle *u_fhp, \
+				    struct statfs *buf); }
+399	AUE_NULL	UNIMPL	nosys
+400	AUE_NULL	NOSTD	{ int ksem_close(semid_t id); }
+401	AUE_NULL	NOSTD	{ int ksem_post(semid_t id); }
+402	AUE_NULL	NOSTD	{ int ksem_wait(semid_t id); }
+403	AUE_NULL	NOSTD	{ int ksem_trywait(semid_t id); }
+404	AUE_NULL	NOSTD	{ int ksem_init(semid_t *idp, \
+				    unsigned int value); }
+405	AUE_NULL	NOSTD	{ int ksem_open(semid_t *idp, \
+				    const char *name, int oflag, \
+				    mode_t mode, unsigned int value); }
+406	AUE_NULL	NOSTD	{ int ksem_unlink(const char *name); }
+407	AUE_NULL	NOSTD	{ int ksem_getvalue(semid_t id, int *val); }
+408	AUE_NULL	NOSTD	{ int ksem_destroy(semid_t id); }
+409	AUE_NULL	STD	{ int __mac_get_pid(pid_t pid, \
+				    struct mac *mac_p); }
+410	AUE_NULL	STD	{ int __mac_get_link(const char *path_p, \
+				    struct mac *mac_p); }
+411	AUE_NULL	STD	{ int __mac_set_link(const char *path_p, \
+				    struct mac *mac_p); }
+412	AUE_EXTATTR_SET_LINK	STD	{ ssize_t extattr_set_link( \
+				    const char *path, int attrnamespace, \
+				    const char *attrname, void *data, \
+				    size_t nbytes); }
+413	AUE_EXTATTR_GET_LINK	STD	{ ssize_t extattr_get_link( \
+				    const char *path, int attrnamespace, \
+				    const char *attrname, void *data, \
+				    size_t nbytes); }
+414	AUE_EXTATTR_DELETE_LINK	STD	{ int extattr_delete_link( \
+				    const char *path, int attrnamespace, \
+				    const char *attrname); }
+415	AUE_NULL	STD	{ int __mac_execve(char *fname, char **argv, \
+				    char **envv, struct mac *mac_p); }
+416	AUE_SIGACTION	STD	{ int sigaction(int sig, \
+				    const struct sigaction *act, \
+				    struct sigaction *oact); }
+417	AUE_SIGRETURN	STD	{ int sigreturn( \
+				    const struct __ucontext *sigcntxp); }
+418	AUE_NULL	UNIMPL	__xstat
+419	AUE_NULL	UNIMPL	__xfstat
+420	AUE_NULL	UNIMPL	__xlstat
+421	AUE_NULL	STD	{ int getcontext(struct __ucontext *ucp); }
+422	AUE_NULL	STD	{ int setcontext( \
+				    const struct __ucontext *ucp); }
+423	AUE_NULL	STD	{ int swapcontext(struct __ucontext *oucp, \
+				    const struct __ucontext *ucp); }
+424	AUE_SWAPOFF	STD	{ int swapoff(const char *name); }
+425	AUE_NULL	STD	{ int __acl_get_link(const char *path, \
+				    acl_type_t type, struct acl *aclp); }
+426	AUE_NULL	STD	{ int __acl_set_link(const char *path, \
+				    acl_type_t type, struct acl *aclp); }
+427	AUE_NULL	STD	{ int __acl_delete_link(const char *path, \
+				    acl_type_t type); }
+428	AUE_NULL	STD	{ int __acl_aclcheck_link(const char *path, \
+				    acl_type_t type, struct acl *aclp); }
+429	AUE_SIGWAIT	STD	{ int sigwait(const sigset_t *set, \
+				    int *sig); }
+430	AUE_NULL	STD	{ int thr_create(ucontext_t *ctx, long *id, \
+				    int flags); }
+431	AUE_NULL	STD	{ void thr_exit(long *state); }
+432	AUE_NULL	STD	{ int thr_self(long *id); }
+433	AUE_NULL	STD	{ int thr_kill(long id, int sig); }
+434	AUE_NULL	UNIMPL	nosys
+435	AUE_NULL	UNIMPL	nosys
+436	AUE_NULL	STD	{ int jail_attach(int jid); }
+437	AUE_EXTATTR_LIST_FD	STD	{ ssize_t extattr_list_fd(int fd, \
+				    int attrnamespace, void *data, \
+				    size_t nbytes); }
+438	AUE_EXTATTR_LIST_FILE	STD	{ ssize_t extattr_list_file( \
+				    const char *path, int attrnamespace, \
+				    void *data, size_t nbytes); }
+439	AUE_EXTATTR_LIST_LINK	STD	{ ssize_t extattr_list_link( \
+				    const char *path, int attrnamespace, \
+				    void *data, size_t nbytes); }
+440	AUE_NULL	UNIMPL	kse_switchin
+441	AUE_NULL	NOSTD	{ int ksem_timedwait(semid_t id, \
+				    const struct timespec *abstime); }
+442	AUE_NULL	STD	{ int thr_suspend( \
+				    const struct timespec *timeout); }
+443	AUE_NULL	STD	{ int thr_wake(long id); }
+444	AUE_MODUNLOAD	STD	{ int kldunloadf(int fileid, int flags); }
+445	AUE_AUDIT	STD	{ int audit(const void *record, \
+				    u_int length); }
+446	AUE_AUDITON	STD	{ int auditon(int cmd, void *data, \
+				    u_int length); }
+;447	AUE_GETAUID	STD	{ int getauid(uid_t *auid); }
+;448	AUE_SETAUID	STD	{ int setauid(uid_t *auid); }
+;449	AUE_GETAUDIT	STD	{ int getaudit(struct auditinfo *auditinfo); }
+;450	AUE_SETAUDIT	STD	{ int setaudit(struct auditinfo *auditinfo); }
+;451	AUE_GETAUDIT_ADDR	STD	{ int getaudit_addr( \
+;				    struct auditinfo_addr *auditinfo_addr, \
+;				    u_int length); }
+;452	AUE_SETAUDIT_ADDR	STD	{ int setaudit_addr( \
+;				    struct auditinfo_addr *auditinfo_addr, \
+;				    u_int length); }
+;453	AUE_AUDITCTL	STD	{ int auditctl(char *path); }
+454	AUE_NULL	STD	{ int _umtx_op(void *obj, int op, \
+				    u_long val, void *uaddr1, void *uaddr2); }
+455	AUE_NULL	STD	{ int thr_new(struct thr_param *param, \
+				    int param_size); }
+456	AUE_NULL	STD	{ int sigqueue(pid_t pid, int signum, void *value); }
+457	AUE_NULL	NOSTD	{ int kmq_open(const char *path, int flags, \
+				    mode_t mode, const struct mq_attr *attr); }
+458	AUE_NULL	NOSTD	{ int kmq_setattr(int mqd,		\
+				    const struct mq_attr *attr,		\
+				    struct mq_attr *oattr); }
+459	AUE_NULL	NOSTD	{ int kmq_timedreceive(int mqd,	\
+				    char *msg_ptr, size_t msg_len,	\
+				    unsigned *msg_prio,			\
+				    const struct timespec *abs_timeout); }
+460	AUE_NULL	NOSTD	{ int kmq_timedsend(int mqd,		\
+				    const char *msg_ptr, size_t msg_len,\
+				    unsigned msg_prio,			\
+				    const struct timespec *abs_timeout);}
+461	AUE_NULL	NOSTD	{ int kmq_notify(int mqd,		\
+				    const struct sigevent *sigev); }
+462	AUE_NULL	NOSTD	{ int kmq_unlink(const char *path); }
+463	AUE_NULL	STD	{ int abort2(const char *why, int nargs, void **args); }
+464	AUE_NULL	STD	{ int thr_set_name(long id, const char *name); }
+465	AUE_NULL	STD	{ int aio_fsync(int op, struct aiocb *aiocbp); }
+466	AUE_RTPRIO	STD	{ int rtprio_thread(int function, \
+				    lwpid_t lwpid, struct rtprio *rtp); }
+467	AUE_NULL	UNIMPL	nosys
+468	AUE_NULL	UNIMPL	nosys
+469	AUE_NULL	UNIMPL	__getpath_fromfd
+470	AUE_NULL	UNIMPL	__getpath_fromaddr
+471	AUE_NULL	NOSTD	{ int sctp_peeloff(int sd, uint32_t name); }
+472     AUE_NULL        NOSTD	{ int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \
+	                            caddr_t to, __socklen_t tolen, \
+				    struct sctp_sndrcvinfo *sinfo, int flags); }
+473     AUE_NULL        NOSTD	{ int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \
+	                            caddr_t to, __socklen_t tolen, \
+				    struct sctp_sndrcvinfo *sinfo, int flags); }
+474     AUE_NULL        NOSTD	{ int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \
+				    struct sockaddr * from, __socklen_t *fromlenaddr, \
+				    struct sctp_sndrcvinfo *sinfo, int *msg_flags); }
+475	AUE_PREAD	STD	{ ssize_t pread(int fd, void *buf, \
+				    size_t nbyte, off_t offset); }
+476	AUE_PWRITE	STD	{ ssize_t pwrite(int fd, const void *buf, \
+				    size_t nbyte, off_t offset); }
+477	AUE_MMAP	STD	{ caddr_t mmap(caddr_t addr, size_t len, \
+				    int prot, int flags, int fd, off_t pos); }
+478	AUE_LSEEK	STD	{ off_t lseek(int fd, off_t offset, \
+				    int whence); }
+479	AUE_TRUNCATE	STD	{ int truncate(char *path, off_t length); }
+480	AUE_FTRUNCATE	STD	{ int ftruncate(int fd, off_t length); }
+481	AUE_KILL	STD	{ int thr_kill2(pid_t pid, long id, int sig); }
+482	AUE_SHMOPEN	STD	{ int shm_open(const char *path, int flags, \
+				    mode_t mode); }
+483	AUE_SHMUNLINK	STD	{ int shm_unlink(const char *path); }
+484	AUE_NULL	STD	{ int cpuset(cpusetid_t *setid); }
+485	AUE_NULL	STD	{ int cpuset_setid(cpuwhich_t which, id_t id, \
+				    cpusetid_t setid); }
+486	AUE_NULL	STD	{ int cpuset_getid(cpulevel_t level, \
+				    cpuwhich_t which, id_t id, \
+				    cpusetid_t *setid); }
+487	AUE_NULL	STD	{ int cpuset_getaffinity(cpulevel_t level, \
+				    cpuwhich_t which, id_t id, size_t cpusetsize, \
+				    cpuset_t *mask); }
+488	AUE_NULL	STD	{ int cpuset_setaffinity(cpulevel_t level, \
+				    cpuwhich_t which, id_t id, size_t cpusetsize, \
+				    const cpuset_t *mask); }
+489	AUE_FACCESSAT	STD	{ int faccessat(int fd, char *path, int amode, \
+				    int flag); }
+490	AUE_FCHMODAT	STD	{ int fchmodat(int fd, char *path, mode_t mode, \
+				    int flag); }
+491	AUE_FCHOWNAT	STD	{ int fchownat(int fd, char *path, uid_t uid, \
+				    gid_t gid, int flag); }
+492	AUE_FEXECVE	STD	{ int fexecve(int fd, char **argv, \
+				    char **envv); }
+493	AUE_FSTATAT	STD	{ int fstatat(int fd, char *path, \
+				    struct stat *buf, int flag); }
+494	AUE_FUTIMESAT	STD	{ int futimesat(int fd, char *path, \
+				    struct timeval *times); }
+495	AUE_LINKAT	STD	{ int linkat(int fd1, char *path1, int fd2, \
+				    char *path2, int flag); }
+496	AUE_MKDIRAT	STD	{ int mkdirat(int fd, char *path, mode_t mode); }
+497	AUE_MKFIFOAT	STD	{ int mkfifoat(int fd, char *path, mode_t mode); }
+498	AUE_MKNODAT	STD	{ int mknodat(int fd, char *path, mode_t mode, \
+				    dev_t dev); }
+; XXX: see the comment for open
+499	AUE_OPENAT_RWTC	STD	{ int openat(int fd, char *path, int flag, \
+				    mode_t mode); }
+500	AUE_READLINKAT	STD	{ int readlinkat(int fd, char *path, char *buf, \
+				    size_t bufsize); }
+501	AUE_RENAMEAT	STD	{ int renameat(int oldfd, char *old, int newfd, \
+				     char *new); }
+502	AUE_SYMLINKAT	STD	{ int symlinkat(char *path1, int fd, \
+				     char *path2); }
+503	AUE_UNLINKAT	STD	{ int unlinkat(int fd, char *path, int flag); }
+504	AUE_POSIX_OPENPT	STD	{ int posix_openpt(int flags); }
+; 505 is initialised by the kgssapi code, if present.
+505	AUE_NULL	NOSTD	{ int gssd_syscall(char *path); }
+506	AUE_NULL	STD	{ int jail_get(struct iovec *iovp, \
+				    unsigned int iovcnt, int flags); }
+507	AUE_NULL	STD	{ int jail_set(struct iovec *iovp, \
+				    unsigned int iovcnt, int flags); }
+508	AUE_NULL	STD	{ int jail_remove(int jid); }
+509	AUE_CLOSEFROM	STD	{ int closefrom(int lowfd); }
+510	AUE_SEMCTL	NOSTD	{ int __semctl(int semid, int semnum, \
+				    int cmd, union semun *arg); }
+511	AUE_MSGCTL	NOSTD	{ int msgctl(int msqid, int cmd, \
+				    struct msqid_ds *buf); }
+512	AUE_SHMCTL	NOSTD	{ int shmctl(int shmid, int cmd, \
+				    struct shmid_ds *buf); }
+513	AUE_LPATHCONF	STD	{ int lpathconf(char *path, int name); }
+514	AUE_NULL	OBSOL	cap_new
+515	AUE_CAP_RIGHTS_GET	STD	{ int __cap_rights_get(int version, \
+				    int fd, cap_rights_t *rightsp); }
+516	AUE_CAP_ENTER	STD	{ int cap_enter(void); }
+517	AUE_CAP_GETMODE	STD	{ int cap_getmode(u_int *modep); }
+518	AUE_PDFORK	STD	{ int pdfork(int *fdp, int flags); }
+519	AUE_PDKILL	STD	{ int pdkill(int fd, int signum); }
+520	AUE_PDGETPID	STD	{ int pdgetpid(int fd, pid_t *pidp); }
+521	AUE_PDWAIT	UNIMPL	pdwait4
+522	AUE_SELECT	STD	{ int pselect(int nd, fd_set *in, \
+				    fd_set *ou, fd_set *ex, \
+				    const struct timespec *ts, \
+				    const sigset_t *sm); }
+523	AUE_NULL	STD	{ int getloginclass(char *namebuf, \
+				    size_t namelen); }
+524	AUE_NULL	STD	{ int setloginclass(const char *namebuf); }
+525	AUE_NULL	STD	{ int rctl_get_racct(const void *inbufp, \
+				    size_t inbuflen, void *outbufp, \
+				    size_t outbuflen); }
+526	AUE_NULL	STD	{ int rctl_get_rules(const void *inbufp, \
+				    size_t inbuflen, void *outbufp, \
+				    size_t outbuflen); }
+527	AUE_NULL	STD	{ int rctl_get_limits(const void *inbufp, \
+				    size_t inbuflen, void *outbufp, \
+				    size_t outbuflen); }
+528	AUE_NULL	STD	{ int rctl_add_rule(const void *inbufp, \
+				    size_t inbuflen, void *outbufp, \
+				    size_t outbuflen); }
+529	AUE_NULL	STD	{ int rctl_remove_rule(const void *inbufp, \
+				    size_t inbuflen, void *outbufp, \
+				    size_t outbuflen); }
+530	AUE_NULL	STD	{ int posix_fallocate(int fd, \
+				    off_t offset, off_t len); }
+531	AUE_NULL	STD	{ int posix_fadvise(int fd, off_t offset, \
+				    off_t len, int advice); }
+532	AUE_WAIT6	STD	{ int wait6(idtype_t idtype, id_t id, \
+				    int *status, int options, \
+				    struct __wrusage *wrusage, \
+				    siginfo_t *info); }
+533	AUE_CAP_RIGHTS_LIMIT	STD	{ int cap_rights_limit(int fd, \
+					    cap_rights_t *rightsp); }
+534	AUE_CAP_IOCTLS_LIMIT	STD	{ int cap_ioctls_limit(int fd, \
+					    const u_long *cmds, size_t ncmds); }
+535	AUE_CAP_IOCTLS_GET	STD	{ ssize_t cap_ioctls_get(int fd, \
+					    u_long *cmds, size_t maxcmds); }
+536	AUE_CAP_FCNTLS_LIMIT	STD	{ int cap_fcntls_limit(int fd, \
+					    uint32_t fcntlrights); }
+537	AUE_CAP_FCNTLS_GET	STD	{ int cap_fcntls_get(int fd, \
+					    uint32_t *fcntlrightsp); }
+538	AUE_BINDAT	STD	{ int bindat(int fd, int s, caddr_t name, \
+				    int namelen); }
+539	AUE_CONNECTAT	STD	{ int connectat(int fd, int s, caddr_t name, \
+				    int namelen); }
+540	AUE_CHFLAGSAT	STD	{ int chflagsat(int fd, const char *path, \
+				    u_long flags, int atflag); }
+541	AUE_ACCEPT	STD	{ int accept4(int s, \
+				    struct sockaddr * __restrict name, \
+				    __socklen_t * __restrict anamelen, \
+				    int flags); }
+542	AUE_PIPE	STD	{ int pipe2(int *fildes, int flags); }
+543	AUE_NULL	STD	{ int aio_mlock(struct aiocb *aiocbp); }
+544	AUE_NULL	STD	{ int procctl(idtype_t idtype, id_t id, \
+				    int com, void *data); }
+545	AUE_POLL	STD	{ int ppoll(struct pollfd *fds, u_int nfds, \
+				    const struct timespec *ts, \
+				    const sigset_t *set); }
+546	AUE_FUTIMES	STD	{ int futimens(int fd, \
+				    struct timespec *times); }
+547	AUE_FUTIMESAT	STD	{ int utimensat(int fd, \
+				    char *path, \
+				    struct timespec *times, int flag); }
+;548	AUE_NULL	STD	{ int numa_getaffinity(cpuwhich_t which, \
+;				    id_t id, \
+;				    struct vm_domain_policy_entry *policy); }
+;549	AUE_NULL	STD	{ int numa_setaffinity(cpuwhich_t which, \
+;				    id_t id, \
+;				    const struct vm_domain_policy_entry *policy); }
+;
+; Please copy any additions and changes to the following compatability tables:
+; sys/compat/freebsd32/syscalls.master
--- /dev/null
+++ b/support/syscall-gen/syscalls+linux.master
@@ -1,0 +1,515 @@
+ $FreeBSD: releng/11.0/sys/amd64/linux/syscalls.master 303005 2016-07-18 16:34:11Z dchagin $
+
+;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
+; System call name/number master file (or rather, slave, from LINUX).
+; Processed to create linux_sysent.c, linux_proto.h and linux_syscall.h.
+
+; Columns: number audit type nargs name alt{name,tag,rtyp}/comments
+;	number	system call number, must be in order
+;	audit	the audit event associated with the system call
+;		A value of AUE_NULL means no auditing, but it also means that
+;		there is no audit event for the call at this time. For the
+;		case where the event exists, but we don't want auditing, the
+;		event should be #defined to AUE_NULL in audit_kevents.h.
+;	type	one of STD, OBSOL, UNIMPL
+;	name	psuedo-prototype of syscall routine
+;		If one of the following alts is different, then all appear:
+;	altname	name of system call if different
+;	alttag	name of args struct tag if different from [o]`name'"_args"
+;	altrtyp	return type if not int (bogus - syscalls always return int)
+;		for UNIMPL/OBSOL, name continues with comments
+
+; types:
+;	STD	always included
+;	OBSOL	obsolete, not included in system, only specifies name
+;	UNIMPL	not implemented, placeholder only
+
+#include <sys/param.h>
+#include <sys/sysent.h>
+#include <sys/sysproto.h>
+#include <compat/linux/linux_sysproto.h>
+#include <amd64/linux/linux.h>
+#include <amd64/linux/linux_proto.h>
+
+; Isn't pretty, but there seems to be no other way to trap nosys
+#define	nosys	linux_nosys
+
+; #ifdef's, etc. may be included, and are copied to the output files.
+
+0	AUE_NULL	NOPROTO	{ int read(int fd, char *buf, \
+				    u_int nbyte); }
+1	AUE_NULL	NOPROTO	{ int write(int fd, char *buf, \
+				    u_int nbyte); }
+2	AUE_OPEN_RWTC	STD	{ int linux_open(char *path, l_int flags, \
+				    l_int mode); }
+3	AUE_CLOSE	NOPROTO	{ int close(int fd); }
+4	AUE_STAT	STD	{ int linux_newstat(char *path, \
+				    struct l_newstat *buf); }
+5	AUE_FSTAT	STD	{ int linux_newfstat(l_uint fd, \
+				    struct l_newstat *buf); }
+6	AUE_LSTAT	STD	{ int linux_newlstat(char *path, \
+				    struct l_newstat *buf); }
+7	AUE_POLL	NOPROTO	{ int poll(struct pollfd *fds, u_int nfds, \
+				    int timeout); }
+8	AUE_LSEEK	STD	{ int linux_lseek(l_uint fdes, l_off_t off, \
+				    l_int whence); }
+9	AUE_MMAP	STD	{ int linux_mmap2(l_ulong addr, l_ulong len, \
+				    l_ulong prot, l_ulong flags, l_ulong fd, \
+				    l_ulong pgoff); }
+10	AUE_MPROTECT	STD	{ int linux_mprotect(caddr_t addr, int len, \
+				    int prot); }
+11	AUE_MUNMAP	NOPROTO	{ int munmap(caddr_t addr, int len); }
+12	AUE_NULL	STD	{ int linux_brk(l_ulong dsend); }
+13	AUE_NULL	STD	{ int linux_rt_sigaction(l_int sig, \
+				    l_sigaction_t *act, l_sigaction_t *oact, \
+				    l_size_t sigsetsize); }
+14	AUE_NULL	STD	{ int linux_rt_sigprocmask(l_int how, \
+				    l_sigset_t *mask, l_sigset_t *omask, \
+				    l_size_t sigsetsize); }
+15	AUE_NULL	STD	{ int linux_rt_sigreturn( \
+				    struct l_ucontext *ucp); }
+16	AUE_IOCTL	STD	{ int linux_ioctl(l_uint fd, l_uint cmd, \
+				    uintptr_t arg); }
+17	AUE_PREAD	STD	{ int linux_pread(l_uint fd, char *buf, \
+				    l_size_t nbyte, l_loff_t offset); }
+18	AUE_PWRITE	STD	{ int linux_pwrite(l_uint fd, char *buf, \
+				    l_size_t nbyte, l_loff_t offset); }
+19	AUE_READV	NOPROTO { int readv(int fd, struct iovec *iovp, \
+				    u_int iovcnt); }
+20	AUE_WRITEV	NOPROTO	{ int writev(int fd, struct iovec *iovp, \
+				    u_int iovcnt); }
+21	AUE_ACCESS	STD	{ int linux_access(char *path, l_int amode); }
+22	AUE_PIPE	STD	{ int linux_pipe(l_ulong *pipefds); }
+23	AUE_SELECT	STD	{ int linux_select(l_int nfds, \
+				    l_fd_set *readfds, l_fd_set *writefds, \
+				    l_fd_set *exceptfds, \
+				    struct l_timeval *timeout); }
+24	AUE_NULL	NOPROTO	{ int sched_yield(void); }
+25	AUE_NULL	STD	{ int linux_mremap(l_ulong addr, \
+				    l_ulong old_len, l_ulong new_len, \
+				    l_ulong flags, l_ulong new_addr); }
+26	AUE_MSYNC	STD	{ int linux_msync(l_ulong addr, \
+				    l_size_t len, l_int fl); }
+27	AUE_MINCORE	STD	{ int linux_mincore(l_ulong start, \
+				    l_size_t len, u_char *vec); }
+28	AUE_MADVISE	NOPROTO	{ int madvise(void *addr, size_t len, \
+				    int behav); }
+29	AUE_NULL	STD	{ int linux_shmget(l_key_t key, l_size_t size, \
+				    l_int shmflg); }
+30	AUE_NULL	STD	{ int linux_shmat(l_int shmid, char *shmaddr, \
+				    l_int shmflg); }
+31	AUE_NULL	STD	{ int linux_shmctl(l_int shmid, l_int cmd, \
+				    struct l_shmid_ds *buf); }
+32	AUE_DUP		NOPROTO	{ int dup(u_int fd); }
+33	AUE_DUP2	NOPROTO	{ int dup2(u_int from, u_int to); }
+34	AUE_NULL	STD	{ int linux_pause(void); }
+35	AUE_NULL	STD	{ int linux_nanosleep( \
+				    const struct l_timespec *rqtp, \
+				    struct l_timespec *rmtp); }
+36	AUE_GETITIMER	STD	{ int linux_getitimer(l_int which, \
+				    struct l_itimerval *itv); }
+37	AUE_NULL	STD	{ int linux_alarm(l_uint secs); }
+38	AUE_SETITIMER	STD	{ int linux_setitimer(l_int which, \
+				    struct l_itimerval *itv, \
+				    struct l_itimerval *oitv); }
+39	AUE_GETPID	STD	{ int linux_getpid(void); }
+40	AUE_SENDFILE	STD	{ int linux_sendfile(int out, int in, \
+				    l_long *offset, l_size_t count); }
+41	AUE_SOCKET	STD	{ int linux_socket(l_int domain, l_int type, \
+				    l_int protocol); }
+42	AUE_CONNECT	STD	{ int linux_connect(l_int s, l_uintptr_t name, \
+				    l_int namelen); }
+43	AUE_ACCEPT	STD	{ int linux_accept(l_int s, l_uintptr_t addr, \
+				    l_uintptr_t namelen); }
+44	AUE_SENDTO	STD	{ int linux_sendto(l_int s, l_uintptr_t msg, \
+				    l_int len, l_int flags, l_uintptr_t to, \
+				    l_int tolen); }
+45	AUE_RECVFROM	STD	{ int linux_recvfrom(l_int s, l_uintptr_t buf, \
+				    l_size_t len, l_int flags, l_uintptr_t from, \
+				    l_uintptr_t fromlen); }
+46	AUE_SENDMSG	STD	{ int linux_sendmsg(l_int s, l_uintptr_t msg, \
+				    l_int flags); }
+47	AUE_RECVMSG	STD	{ int linux_recvmsg(l_int s, l_uintptr_t msg, \
+				    l_int flags); }
+48	AUE_NULL	STD	{ int linux_shutdown(l_int s, l_int how); }
+49	AUE_BIND	STD	{ int linux_bind(l_int s, l_uintptr_t name, \
+				    l_int namelen); }
+50	AUE_LISTEN	STD	{ int linux_listen(l_int s, l_int backlog); }
+51	AUE_GETSOCKNAME	STD	{ int linux_getsockname(l_int s, \
+				    l_uintptr_t addr, l_uintptr_t namelen); }
+52	AUE_GETPEERNAME	STD	{ int linux_getpeername(l_int s, \
+				    l_uintptr_t addr, l_uintptr_t namelen); }
+53	AUE_SOCKETPAIR	STD	{ int linux_socketpair(l_int domain, \
+				    l_int type, l_int protocol, l_uintptr_t rsv); }
+54	AUE_SETSOCKOPT	STD	{ int linux_setsockopt(l_int s, l_int level, \
+				    l_int optname, l_uintptr_t optval, \
+				    l_int optlen); }
+55	AUE_GETSOCKOPT	STD	{ int linux_getsockopt(l_int s, l_int level, \
+				    l_int optname, l_uintptr_t optval, \
+				    l_uintptr_t optlen); }
+56	AUE_RFORK	STD	{ int linux_clone(l_int flags, void *stack, \
+				    void *parent_tidptr, void * child_tidptr, void *tls ); }
+57	AUE_FORK	STD	{ int linux_fork(void); }
+58	AUE_VFORK	STD	{ int linux_vfork(void); }
+59	AUE_EXECVE	STD	{ int linux_execve(char *path, char **argp, \
+				    char **envp); }
+60	AUE_EXIT	STD	{ void linux_exit(int rval); }
+61	AUE_WAIT4	STD	{ int linux_wait4(l_pid_t pid, \
+				    l_int *status, l_int options, \
+				    struct rusage *rusage); }
+62	AUE_KILL	STD	{ int linux_kill(l_int pid, l_int signum); }
+63	AUE_NULL	STD	{ int linux_newuname( \
+				    struct l_new_utsname *buf); }
+64	AUE_NULL	STD	{ int linux_semget(l_key_t key, \
+				    l_int nsems, l_int semflg); }
+65	AUE_NULL	STD	{ int linux_semop(l_int semid, \
+				    struct l_sembuf *tsops, l_uint nsops); }
+66	AUE_NULL	STD	{ int linux_semctl(l_int semid, \
+				    l_int semnum, l_int cmd, union l_semun arg); }
+67	AUE_NULL	STD	{ int linux_shmdt(char *shmaddr); }
+68	AUE_NULL	STD	{ int linux_msgget(l_key_t key, l_int msgflg); }
+69	AUE_NULL	STD	{ int linux_msgsnd(l_int msqid, \
+				    struct l_msgbuf *msgp, l_size_t msgsz, \
+				    l_int msgflg); }
+70	AUE_NULL	STD	{ int linux_msgrcv(l_int msqid, \
+				    struct l_msgbuf *msgp, l_size_t msgsz, \
+				    l_long msgtyp, l_int msgflg); }
+71	AUE_NULL	STD	{ int linux_msgctl(l_int msqid, l_int cmd, \
+				    struct l_msqid_ds *buf); }
+72	AUE_FCNTL	STD	{ int linux_fcntl(l_uint fd, l_uint cmd, \
+				    l_ulong arg); }
+73	AUE_FLOCK	NOPROTO	{ int flock(int fd, int how); }
+74	AUE_FSYNC	NOPROTO	{ int fsync(int fd); }
+75	AUE_NULL	STD	{ int linux_fdatasync(l_uint fd); }
+76	AUE_TRUNCATE	STD	{ int linux_truncate(char *path, \
+				    l_ulong length); }
+77	AUE_FTRUNCATE	STD	{ int linux_ftruncate(l_int fd, l_long length); }
+78	AUE_GETDIRENTRIES	STD { int linux_getdents(l_uint fd, void *dent, \
+				    l_uint count); }
+79	AUE_GETCWD	STD	{ int linux_getcwd(char *buf, \
+				    l_ulong bufsize); }
+80	AUE_CHDIR	STD	{ int linux_chdir(char *path); }
+81	AUE_FCHDIR	NOPROTO	{ int fchdir(int fd); }
+82	AUE_RENAME	STD	{ int linux_rename(char *from, char *to); }
+83	AUE_MKDIR	STD	{ int linux_mkdir(char *path, l_int mode); }
+84	AUE_RMDIR	STD	{ int linux_rmdir(char *path); }
+85	AUE_CREAT	STD	{ int linux_creat(char *path, \
+				    l_int mode); }
+86	AUE_LINK	STD	{ int linux_link(char *path, char *to); }
+87	AUE_UNLINK	STD	{ int linux_unlink(char *path); }
+88	AUE_SYMLINK	STD	{ int linux_symlink(char *path, char *to); }
+89	AUE_READLINK	STD	{ int linux_readlink(char *name, char *buf, \
+				    l_int count); }
+90	AUE_CHMOD	STD	{ int linux_chmod(char *path, \
+				    l_mode_t mode); }
+91	AUE_FCHMOD	NOPROTO	{ int fchmod(int fd, int mode); }
+92	AUE_LCHOWN	STD	{ int linux_chown(char *path, \
+				    l_uid_t uid, l_gid_t gid); }
+93	AUE_FCHOWN	NOPROTO	{ int fchown(int fd, int uid, int gid); }
+94	AUE_LCHOWN	STD	{ int linux_lchown(char *path, l_uid_t uid, \
+				    l_gid_t gid); }
+95	AUE_UMASK	NOPROTO	{ int umask(int newmask); }
+96	AUE_NULL	NOPROTO	{ int gettimeofday(struct l_timeval *tp, \
+				    struct timezone *tzp); }
+97	AUE_GETRLIMIT	STD	{ int linux_getrlimit(l_uint resource, \
+				    struct l_rlimit *rlim); }
+98	AUE_GETRUSAGE	NOPROTO	{ int getrusage(int who, struct rusage *rusage); }
+99	AUE_NULL	STD	{ int linux_sysinfo(struct l_sysinfo *info); }
+100	AUE_NULL	STD	{ int linux_times(struct l_times_argv *buf); }
+101	AUE_PTRACE	STD	{ int linux_ptrace(l_long req, l_long pid, \
+				    l_long addr, l_long data); }
+102	AUE_GETUID	STD	{ int linux_getuid(void); }
+103	AUE_NULL	STD	{ int linux_syslog(l_int type, char *buf, \
+				    l_int len); }
+104	AUE_GETGID	STD	{ int linux_getgid(void); }
+105	AUE_SETUID	NOPROTO	{ int setuid(uid_t uid); }
+106	AUE_SETGID	NOPROTO	{ int setgid(gid_t gid); }
+107	AUE_GETEUID	NOPROTO	{ int geteuid(void); }
+108	AUE_GETEGID	NOPROTO	{ int getegid(void); }
+109	AUE_SETPGRP	NOPROTO	{ int setpgid(int pid, int pgid); }
+110	AUE_GETPPID	STD	{ int linux_getppid(void); }
+111	AUE_GETPGRP	NOPROTO	{ int getpgrp(void); }
+112	AUE_SETSID	NOPROTO	{ int setsid(void); }
+113	AUE_SETREUID	NOPROTO	{ int setreuid(uid_t ruid, uid_t euid); }
+114	AUE_SETREGID	NOPROTO	{ int setregid(gid_t rgid, gid_t egid); }
+115	AUE_GETGROUPS	STD	{ int linux_getgroups(l_int gidsetsize, \
+				    l_gid_t *grouplist); }
+116	AUE_SETGROUPS	STD	{ int linux_setgroups(l_int gidsetsize, \
+				    l_gid_t *grouplist); }
+117	AUE_SETRESUID	NOPROTO	{ int setresuid(uid_t ruid, uid_t euid, \
+				    uid_t suid); }
+118	AUE_GETRESUID	NOPROTO	{ int getresuid(uid_t *ruid, uid_t *euid, \
+				    uid_t *suid); }
+119	AUE_SETRESGID	NOPROTO	{ int setresgid(gid_t rgid, gid_t egid, \
+				    gid_t sgid); }
+120	AUE_GETRESGID	NOPROTO	{ int getresgid(gid_t *rgid, gid_t *egid, \
+				    gid_t *sgid); }
+121	AUE_GETPGID	NOPROTO	{ int getpgid(int pid); }
+122	AUE_SETFSUID	STD	{ int linux_setfsuid(l_uid_t uid); }
+123	AUE_SETFSGID	STD	{ int linux_setfsgid(l_gid_t gid); }
+124	AUE_GETSID	STD	{ int linux_getsid(l_pid_t pid); }
+125	AUE_CAPGET	STD	{ int linux_capget(struct l_user_cap_header *hdrp, \
+				    struct l_user_cap_data *datap); }
+126	AUE_CAPSET	STD	{ int linux_capset(struct l_user_cap_header *hdrp, \
+				    struct l_user_cap_data *datap); }
+127	AUE_NULL	STD	{ int linux_rt_sigpending(l_sigset_t *set, \
+				    l_size_t sigsetsize); }
+128	AUE_NULL	STD	{ int linux_rt_sigtimedwait(l_sigset_t *mask, \
+				    l_siginfo_t *ptr, \
+				    struct l_timeval *timeout, \
+				    l_size_t sigsetsize); }
+129	AUE_NULL	STD	{ int linux_rt_sigqueueinfo(l_pid_t pid, l_int sig, \
+				    l_siginfo_t *info); }
+130	AUE_NULL	STD	{ int linux_rt_sigsuspend( \
+				    l_sigset_t *newset, \
+				    l_size_t sigsetsize); }
+131	AUE_NULL	STD	{ int linux_sigaltstack(l_stack_t *uss, \
+				    l_stack_t *uoss); }
+132	AUE_UTIME	STD	{ int linux_utime(char *fname, \
+				    struct l_utimbuf *times); }
+133	AUE_MKNOD	STD	{ int linux_mknod(char *path, l_int mode, \
+				    l_dev_t dev); }
+134	AUE_USELIB	UNIMPL	uselib
+135	AUE_PERSONALITY	STD	{ int linux_personality(l_uint per); }
+136	AUE_NULL	STD	{ int linux_ustat(l_dev_t dev, \
+				    struct l_ustat *ubuf); }
+137	AUE_STATFS	STD	{ int linux_statfs(char *path, \
+				    struct l_statfs_buf *buf); }
+138	AUE_FSTATFS	STD	{ int linux_fstatfs(l_uint fd, \
+				    struct l_statfs_buf *buf); }
+139	AUE_NULL	STD	{ int linux_sysfs(l_int option, \
+				    l_ulong arg1, l_ulong arg2); }
+140	AUE_GETPRIORITY	STD	{ int linux_getpriority(int which, int who); }
+141	AUE_SETPRIORITY	NOPROTO	{ int setpriority(int which, int who, \
+				    int prio); }
+142	AUE_SCHED_SETPARAM	STD	{ int linux_sched_setparam(l_pid_t pid, \
+				    struct sched_param *param); }
+143	AUE_SCHED_GETPARAM	STD	{ int linux_sched_getparam(l_pid_t pid, \
+				    struct sched_param *param); }
+144	AUE_SCHED_SETSCHEDULER	STD { int linux_sched_setscheduler( \
+				    l_pid_t pid, l_int policy, \
+				    struct sched_param *param); }
+145	AUE_SCHED_GETSCHEDULER	STD { int linux_sched_getscheduler( \
+				    l_pid_t pid); }
+146	AUE_SCHED_GET_PRIORITY_MAX	STD { int linux_sched_get_priority_max( \
+				    l_int policy); }
+147	AUE_SCHED_GET_PRIORITY_MIN	STD { int linux_sched_get_priority_min( \
+				    l_int policy); }
+148	AUE_SCHED_RR_GET_INTERVAL	STD { int linux_sched_rr_get_interval(l_pid_t pid, \
+				    struct l_timespec *interval); }
+149	AUE_MLOCK	NOPROTO	{ int mlock(const void *addr, size_t len); }
+150	AUE_MUNLOCK	NOPROTO	{ int munlock(const void *addr, size_t len); }
+151	AUE_MLOCKALL	NOPROTO	{ int mlockall(int how); }
+152	AUE_MUNLOCKALL	NOPROTO	{ int munlockall(void); }
+153	AUE_NULL	STD	{ int linux_vhangup(void); }
+154	AUE_NULL	UNIMPL	modify_ldt
+155	AUE_PIVOT_ROOT	STD	{ int linux_pivot_root(void); }
+156	AUE_SYSCTL	STD	{ int linux_sysctl( \
+				    struct l___sysctl_args *args); }
+157	AUE_PRCTL	STD	{ int linux_prctl(l_int option, l_uintptr_t arg2, \
+				    l_uintptr_t arg3, l_uintptr_t arg4, \
+				    l_uintptr_t arg5); }
+158	AUE_PRCTL	STD	{ int linux_arch_prctl(l_int code, l_ulong addr); }
+159	AUE_ADJTIME	STD	{ int linux_adjtimex(void); }
+160	AUE_SETRLIMIT	STD	{ int linux_setrlimit(l_uint resource, \
+				    struct l_rlimit *rlim); }
+161	AUE_CHROOT	NOPROTO	{ int chroot(char *path); }
+162	AUE_SYNC	NOPROTO	{ int sync(void); }
+163	AUE_ACCT	NOPROTO	{ int acct(char *path); }
+164	AUE_SETTIMEOFDAY	NOPROTO	{ int settimeofday(struct l_timeval *tv, struct timezone *tzp); }
+165	AUE_MOUNT	STD	{ int linux_mount(char *specialfile, \
+				    char *dir, char *filesystemtype, \
+				    l_ulong rwflag, void *data); }
+166	AUE_UMOUNT	STD	{ int linux_umount(char *path, l_int flags); }
+167	AUE_SWAPON	NOPROTO	{ int swapon(char *name); }
+168	AUE_SWAPOFF	STD	{ int linux_swapoff(void); }
+169	AUE_REBOOT	STD	{ int linux_reboot(l_int magic1, \
+				    l_int magic2, l_uint cmd, void *arg); }
+170	AUE_SYSCTL	STD	{ int linux_sethostname(char *hostname, \
+				    l_uint len); }
+171	AUE_SYSCTL	STD	{ int linux_setdomainname(char *name, \
+				    l_int len); }
+172	AUE_NULL	STD	{ int linux_iopl(l_uint level); }
+173	AUE_NULL	UNIMPL	ioperm
+174	AUE_NULL	STD	{ int linux_create_module(void); }
+175	AUE_NULL	STD	{ int linux_init_module(void); }
+176	AUE_NULL	STD	{ int linux_delete_module(void); }
+177	AUE_NULL	STD	{ int linux_get_kernel_syms(void); }
+178	AUE_NULL	STD	{ int linux_query_module(void); }
+179	AUE_QUOTACTL	STD	{ int linux_quotactl(void); }
+180	AUE_NULL	STD	{ int linux_nfsservctl(void); }
+181	AUE_GETPMSG	STD	{ int linux_getpmsg(void); }
+182	AUE_PUTPMSG	STD	{ int linux_putpmsg(void); }
+183	AUE_NULL	STD	{ int linux_afs_syscall(void); }
+184	AUE_NULL	STD	{ int linux_tuxcall(void); }
+185	AUE_NULL	STD	{ int linux_security(void); }
+186	AUE_NULL	STD	{ int linux_gettid(void); }
+187	AUE_NULL	UNIMPL	linux_readahead
+188	AUE_NULL	STD	{ int linux_setxattr(void); }
+189	AUE_NULL	STD	{ int linux_lsetxattr(void); }
+190	AUE_NULL	STD	{ int linux_fsetxattr(void); }
+191	AUE_NULL	STD	{ int linux_getxattr(void); }
+192	AUE_NULL	STD	{ int linux_lgetxattr(void); }
+193	AUE_NULL	STD	{ int linux_fgetxattr(void); }
+194	AUE_NULL	STD	{ int linux_listxattr(void); }
+195	AUE_NULL	STD	{ int linux_llistxattr(void); }
+196	AUE_NULL	STD	{ int linux_flistxattr(void); }
+197	AUE_NULL	STD	{ int linux_removexattr(void); }
+198	AUE_NULL	STD	{ int linux_lremovexattr(void); }
+199	AUE_NULL	STD	{ int linux_fremovexattr(void); }
+200	AUE_NULL	STD	{ int linux_tkill(int tid, int sig); }
+201	AUE_NULL	STD	{ int linux_time(l_time_t *tm); }
+202	AUE_NULL	STD	{ int linux_sys_futex(void *uaddr, int op, int val, \
+				    struct l_timespec *timeout, void *uaddr2, int val3); }
+203	AUE_NULL	STD	{ int linux_sched_setaffinity(l_pid_t pid, l_uint len, \
+				    l_ulong *user_mask_ptr); }
+204	AUE_NULL	STD	{ int linux_sched_getaffinity(l_pid_t pid, l_uint len, \
+				    l_ulong *user_mask_ptr); }
+205	AUE_NULL	STD	{ int linux_set_thread_area(void); }
+206	AUE_NULL	UNIMPL	linux_io_setup
+207	AUE_NULL	UNIMPL	linux_io_destroy
+208	AUE_NULL	UNIMPL	linux_io_getevents
+209	AUE_NULL	UNIMPL	inux_io_submit
+210	AUE_NULL	UNIMPL	linux_io_cancel
+211	AUE_NULL	UNIMPL	linux_get_thread_area
+212	AUE_NULL	STD	{ int linux_lookup_dcookie(void); }
+213	AUE_NULL	STD	{ int linux_epoll_create(l_int size); }
+214	AUE_NULL	STD	{ int linux_epoll_ctl_old(void); }
+215	AUE_NULL	STD	{ int linux_epoll_wait_old(void); }
+216	AUE_NULL	STD	{ int linux_remap_file_pages(void); }
+217	AUE_GETDIRENTRIES	STD { int linux_getdents64(l_uint fd, \
+				    void *dirent, l_uint count); }
+218	AUE_NULL	STD	{ int linux_set_tid_address(int *tidptr); }
+219	AUE_NULL	UNIMPL	restart_syscall
+220	AUE_NULL	STD	{ int linux_semtimedop(void); }
+221	AUE_NULL	STD	{ int linux_fadvise64(int fd, l_loff_t offset, \
+				    l_size_t len, int advice); }
+222	AUE_NULL	STD	{ int linux_timer_create(clockid_t clock_id, \
+				    struct sigevent *evp, l_timer_t *timerid); }
+223	AUE_NULL	STD	{ int linux_timer_settime(l_timer_t timerid, l_int flags, \
+				    const struct itimerspec *new, struct itimerspec *old); }
+224	AUE_NULL	STD	{ int linux_timer_gettime(l_timer_t timerid, struct itimerspec *setting); }
+225	AUE_NULL	STD	{ int linux_timer_getoverrun(l_timer_t timerid); }
+226	AUE_NULL	STD	{ int linux_timer_delete(l_timer_t timerid); }
+227	AUE_CLOCK_SETTIME	STD	{ int linux_clock_settime(clockid_t which, struct l_timespec *tp); }
+228	AUE_NULL	STD	{ int linux_clock_gettime(clockid_t which, struct l_timespec *tp); }
+229	AUE_NULL	STD	{ int linux_clock_getres(clockid_t which, struct l_timespec *tp); }
+230	AUE_NULL	STD	{ int linux_clock_nanosleep(clockid_t which, int flags, \
+				    struct l_timespec *rqtp, struct l_timespec *rmtp); }
+231	AUE_EXIT	STD	{ int linux_exit_group(int error_code); }
+232	AUE_NULL	STD	{ int linux_epoll_wait(l_int epfd, struct epoll_event *events, \
+					l_int maxevents, l_int timeout); }
+233	AUE_NULL	STD	{ int linux_epoll_ctl(l_int epfd, l_int op, l_int fd, \
+					struct epoll_event *event); }
+234	AUE_NULL	STD	{ int linux_tgkill(int tgid, int pid, int sig); }
+235	AUE_UTIMES	STD	{ int linux_utimes(char *fname, \
+				    struct l_timeval *tptr); }
+236	AUE_NULL	UNIMPL	vserver
+237	AUE_NULL	STD	{ int linux_mbind(void); }
+238	AUE_NULL	STD	{ int linux_set_mempolicy(void); }
+239	AUE_NULL	STD	{ int linux_get_mempolicy(void); }
+240	AUE_NULL	STD	{ int linux_mq_open(void); }
+241	AUE_NULL	STD	{ int linux_mq_unlink(void); }
+242	AUE_NULL	STD	{ int linux_mq_timedsend(void); }
+243	AUE_NULL	STD	{ int linux_mq_timedreceive(void); }
+244	AUE_NULL	STD	{ int linux_mq_notify(void); }
+245	AUE_NULL	STD	{ int linux_mq_getsetattr(void); }
+246	AUE_NULL	STD	{ int linux_kexec_load(void); }
+247	AUE_WAIT6	STD	{ int linux_waitid(int idtype, l_pid_t id, \
+				    l_siginfo_t *info, int options, \
+				    struct rusage *rusage); }
+248	AUE_NULL	STD	{ int linux_add_key(void); }
+249	AUE_NULL	STD	{ int linux_request_key(void); }
+250	AUE_NULL	STD	{ int linux_keyctl(void); }
+251	AUE_NULL	STD	{ int linux_ioprio_set(void); }
+252	AUE_NULL	STD	{ int linux_ioprio_get(void); }
+253	AUE_NULL	STD	{ int linux_inotify_init(void); }
+254	AUE_NULL	STD	{ int linux_inotify_add_watch(void); }
+255	AUE_NULL	STD	{ int linux_inotify_rm_watch(void); }
+256	AUE_NULL	STD	{ int linux_migrate_pages(void); }
+257	AUE_OPEN_RWTC	STD	{ int linux_openat(l_int dfd, const char *filename, \
+				    l_int flags, l_int mode); }
+258	AUE_MKDIRAT	STD	{ int linux_mkdirat(l_int dfd, const char *pathname, \
+				    l_int mode); }
+259	AUE_MKNODAT	STD	{ int linux_mknodat(l_int dfd, const char *filename, \
+				    l_int mode, l_uint dev); }
+260	AUE_FCHOWNAT	STD	{ int linux_fchownat(l_int dfd, const char *filename, \
+				    l_uid_t uid, l_gid_t gid, l_int flag); }
+261	AUE_FUTIMESAT	STD	{ int linux_futimesat(l_int dfd, char *filename, \
+				    struct l_timeval *utimes); }
+262	AUE_FSTATAT	STD	{ int linux_newfstatat(l_int dfd, char *pathname, \
+				    struct l_stat64 *statbuf, l_int flag); }
+263	AUE_UNLINKAT	STD	{ int linux_unlinkat(l_int dfd, const char *pathname, \
+				    l_int flag); }
+264	AUE_RENAMEAT	STD	{ int linux_renameat(l_int olddfd, const char *oldname, \
+				    l_int newdfd, const char *newname); }
+265	AUE_LINKAT	STD	{ int linux_linkat(l_int olddfd, const char *oldname, \
+				    l_int newdfd, const char *newname, l_int flag); }
+266	AUE_SYMLINKAT	STD	{ int linux_symlinkat(const char *oldname, l_int newdfd, \
+				    const char *newname); }
+267	AUE_READLINKAT	STD	{ int linux_readlinkat(l_int dfd, const char *path, \
+				    char *buf, l_int bufsiz); }
+268	AUE_FCHMODAT	STD	{ int linux_fchmodat(l_int dfd, const char *filename, \
+				    l_mode_t mode); }
+269	AUE_FACCESSAT	STD	{ int linux_faccessat(l_int dfd, const char *filename, \
+				    l_int amode); }
+270	AUE_SELECT	STD	{ int linux_pselect6(l_int nfds,			\
+				    l_fd_set *readfds, l_fd_set *writefds, l_fd_set *exceptfds,	\
+				    struct l_timespec *tsp, l_uintptr_t *sig); }
+271	AUE_POLL	STD	{ int linux_ppoll(struct pollfd *fds, uint32_t nfds,	\
+				    struct l_timespec *tsp, l_sigset_t *sset, l_size_t ssize); }
+272	AUE_NULL	STD	{ int linux_unshare(void); }
+273	AUE_NULL	STD	{ int linux_set_robust_list(struct linux_robust_list_head *head, \
+				    l_size_t len); }
+274	AUE_NULL	STD	{ int linux_get_robust_list(l_int pid, \
+				    struct linux_robust_list_head **head, l_size_t *len); }
+275	AUE_NULL	STD	{ int linux_splice(void); }
+276	AUE_NULL	STD	{ int linux_tee(void); }
+277	AUE_NULL	STD	{ int linux_sync_file_range(void); }
+278	AUE_NULL	STD	{ int linux_vmsplice(void); }
+279	AUE_NULL	STD	{ int linux_move_pages(void); }
+280	AUE_FUTIMESAT	STD	{ int linux_utimensat(l_int dfd, const char *pathname, \
+					const struct l_timespec *times, l_int flags); }
+281     AUE_NULL        STD     { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \
+                                        l_int maxevents, l_int timeout, l_sigset_t *mask); }
+282	AUE_NULL	STD	{ int linux_signalfd(void); }
+283	AUE_NULL	STD	{ int linux_timerfd(void); }
+284	AUE_NULL	STD	{ int linux_eventfd(l_uint initval); }
+285	AUE_NULL	STD	{ int linux_fallocate(l_int fd, l_int mode, \
+				    l_loff_t offset, l_loff_t len); }
+286	AUE_NULL	STD	{ int linux_timerfd_settime(void); }
+287	AUE_NULL	STD	{ int linux_timerfd_gettime(void); }
+288	AUE_ACCEPT	STD	{ int linux_accept4(l_int s, l_uintptr_t addr, \
+				    l_uintptr_t namelen, int flags); }
+289	AUE_NULL	STD	{ int linux_signalfd4(void); }
+290	AUE_NULL	STD	{ int linux_eventfd2(l_uint initval, l_int flags); }
+291	AUE_NULL	STD	{ int linux_epoll_create1(l_int flags); }
+292	AUE_NULL	STD	{ int linux_dup3(l_int oldfd,		\
+				    l_int newfd, l_int flags); }
+293	AUE_NULL	STD	{ int linux_pipe2(l_int *pipefds, l_int flags); }
+294	AUE_NULL	STD	{ int linux_inotify_init1(void); }
+295	AUE_NULL	STD	{ int linux_preadv(void); }
+296	AUE_NULL	STD	{ int linux_pwritev(void); }
+297	AUE_NULL	STD	{ int linux_rt_tsigqueueinfo(void); }
+298	AUE_NULL	STD	{ int linux_perf_event_open(void); }
+299	AUE_NULL	STD	{ int linux_recvmmsg(l_int s,			\
+				    struct l_mmsghdr *msg, l_uint vlen,		\
+				    l_uint flags, struct l_timespec *timeout); }
+300	AUE_NULL	STD	{ int linux_fanotify_init(void); }
+301	AUE_NULL	STD	{ int linux_fanotify_mark(void); }
+302	AUE_NULL	STD	{ int linux_prlimit64(l_pid_t pid, l_uint resource, \
+				    struct rlimit *new, struct rlimit *old); }
+303	AUE_NULL	STD	{ int linux_name_to_handle_at(void); }
+304	AUE_NULL	STD	{ int linux_open_by_handle_at(void); }
+305	AUE_NULL	STD	{ int linux_clock_adjtime(void); }
+306	AUE_SYNC	STD	{ int linux_syncfs(l_int fd); }
+307	AUE_NULL	STD	{ int linux_sendmmsg(l_int s,			\
+				    struct l_mmsghdr *msg, l_uint vlen,		\
+				    l_uint flags); }
+308	AUE_NULL	STD	{ int linux_setns(void); }
+309	AUE_NULL	STD	{ int linux_process_vm_readv(void); }
+310	AUE_NULL	STD	{ int linux_process_vm_writev(void); }
+311	AUE_NULL	STD	{ int linux_kcmp(void); }
+312	AUE_NULL	STD	{ int linux_finit_module(void); }
+; please, keep this line at the end.
+313	AUE_NULL	UNIMPL	nosys
--- /dev/null
+++ b/support/syscall-gen/syscalls+openbsd.master
@@ -1,0 +1,566 @@
+;	$OpenBSD: syscalls.master,v 1.176 2017/04/28 13:50:55 mpi Exp $
+;	$NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
+
+;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
+
+; OpenBSD system call name/number "master" file.
+; (See syscalls.conf to see what it is processed into.)
+;
+; Fields: number type [type-dependent ...]
+;	number	system call number, must be in order
+;	type	one of the types described below, or one of the
+;		compatibility options defined in syscalls.conf
+;
+; types:
+;	INDIR	included, but don't define the syscall args structure,
+;		and allow it to be "really" varargs
+;	NOARGS	included, but don't define the syscall args structure
+;	NODEF	included, but don't define the syscall number
+;	NOLOCK	don't acquire the kernel lock when calling this syscall
+;	OBSOL	obsolete, not included in system
+;	STD	always included
+;	UNIMPL	unimplemented, not included in system
+;
+; The compat options are defined in the syscalls.conf file, and the
+; compat option name is prefixed to the syscall name.  Other than
+; that, they're like NODEF (for 'compat' options), or STD (for
+; 'libcompat' options).
+;
+; The type-dependent arguments are as follows:
+; For STD, NODEF, NOARGS, and compat syscalls:
+;	{ pseudo-proto } [alias]
+; For other syscalls:
+;	[comment]
+;
+; #ifdef's, etc. may be included, and are copied to the output files.
+; #include's are copied to the syscall switch definition file only.
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/signal.h>
+#include <sys/mount.h>
+#include <sys/syscallargs.h>
+#include <sys/poll.h>
+
+; Reserved/unimplemented system calls in the range 0-150 inclusive
+; are reserved for use in future Berkeley releases.
+; Additional system calls implemented in vendor and other
+; redistributions should be placed in the reserved range at the end
+; of the current calls.
+
+0	INDIR		{ int sys_syscall(int number, ...); }
+1	STD		{ void sys_exit(int rval); }
+2	STD		{ int sys_fork(void); }
+3	STD		{ ssize_t sys_read(int fd, void *buf, size_t nbyte); }
+4	STD		{ ssize_t sys_write(int fd, const void *buf, \
+			    size_t nbyte); }
+5	STD		{ int sys_open(const char *path, \
+			    int flags, ... mode_t mode); }
+6	STD		{ int sys_close(int fd); }
+7	STD NOLOCK	{ int sys_getentropy(void *buf, size_t nbyte); }
+8	STD		{ int sys___tfork(const struct __tfork *param, \
+			    size_t psize); }
+9	STD		{ int sys_link(const char *path, const char *link); }
+10	STD		{ int sys_unlink(const char *path); }
+11	STD		{ pid_t sys_wait4(pid_t pid, int *status, \
+			    int options, struct rusage *rusage); }
+12	STD		{ int sys_chdir(const char *path); }
+13	STD		{ int sys_fchdir(int fd); }
+14	STD		{ int sys_mknod(const char *path, mode_t mode, \
+			    dev_t dev); }
+15	STD		{ int sys_chmod(const char *path, mode_t mode); }
+16	STD		{ int sys_chown(const char *path, uid_t uid, \
+			    gid_t gid); }
+17	STD		{ int sys_obreak(char *nsize); } break
+18	STD NOLOCK	{ int sys_getdtablecount(void); }
+19	STD		{ int sys_getrusage(int who, \
+			    struct rusage *rusage); }
+20	STD NOLOCK	{ pid_t sys_getpid(void); }
+21	STD		{ int sys_mount(const char *type, const char *path, \
+			    int flags, void *data); }
+22	STD		{ int sys_unmount(const char *path, int flags); }
+23	STD		{ int sys_setuid(uid_t uid); }
+24	STD NOLOCK	{ uid_t sys_getuid(void); }
+25	STD NOLOCK	{ uid_t sys_geteuid(void); }
+#ifdef PTRACE
+26	STD		{ int sys_ptrace(int req, pid_t pid, caddr_t addr, \
+			    int data); }
+#else
+26	UNIMPL		ptrace
+#endif
+27	STD		{ ssize_t sys_recvmsg(int s, struct msghdr *msg, \
+			    int flags); }
+28	STD		{ ssize_t sys_sendmsg(int s, \
+			    const struct msghdr *msg, int flags); }
+29	STD		{ ssize_t sys_recvfrom(int s, void *buf, size_t len, \
+			    int flags, struct sockaddr *from, \
+			    socklen_t *fromlenaddr); }
+30	STD		{ int sys_accept(int s, struct sockaddr *name, \
+			    socklen_t *anamelen); }
+31	STD		{ int sys_getpeername(int fdes, struct sockaddr *asa, \
+			    socklen_t *alen); }
+32	STD		{ int sys_getsockname(int fdes, struct sockaddr *asa, \
+			    socklen_t *alen); }
+33	STD		{ int sys_access(const char *path, int amode); }
+34	STD		{ int sys_chflags(const char *path, u_int flags); }
+35	STD		{ int sys_fchflags(int fd, u_int flags); }
+36	STD		{ void sys_sync(void); }
+37	OBSOL		o58_kill
+38	STD		{ int sys_stat(const char *path, struct stat *ub); }
+39	STD		{ pid_t sys_getppid(void); }
+40	STD		{ int sys_lstat(const char *path, struct stat *ub); }
+41	STD		{ int sys_dup(int fd); }
+42	STD		{ int sys_fstatat(int fd, const char *path, \
+			    struct stat *buf, int flag); }
+43	STD NOLOCK	{ gid_t sys_getegid(void); }
+44	STD		{ int sys_profil(caddr_t samples, size_t size, \
+			    u_long offset, u_int scale); }
+#ifdef KTRACE
+45	STD		{ int sys_ktrace(const char *fname, int ops, \
+			    int facs, pid_t pid); }
+#else
+45	UNIMPL		ktrace
+#endif
+46	STD		{ int sys_sigaction(int signum, \
+			    const struct sigaction *nsa, \
+			    struct sigaction *osa); }
+47	STD NOLOCK	{ gid_t sys_getgid(void); }
+48	STD NOLOCK	{ int sys_sigprocmask(int how, sigset_t mask); }
+49	OBSOL		ogetlogin
+50	STD		{ int sys_setlogin(const char *namebuf); }
+#ifdef ACCOUNTING
+51	STD		{ int sys_acct(const char *path); }
+#else
+51	UNIMPL		acct
+#endif
+52	STD		{ int sys_sigpending(void); }
+53	STD		{ int sys_fstat(int fd, struct stat *sb); }
+54	STD		{ int sys_ioctl(int fd, \
+			    u_long com, ... void *data); }
+55	STD		{ int sys_reboot(int opt); }
+56	STD		{ int sys_revoke(const char *path); }
+57	STD		{ int sys_symlink(const char *path, \
+			    const char *link); }
+58	STD		{ ssize_t sys_readlink(const char *path, \
+			    char *buf, size_t count); }
+59	STD		{ int sys_execve(const char *path, \
+			    char * const *argp, char * const *envp); }
+60	STD		{ mode_t sys_umask(mode_t newmask); }
+61	STD		{ int sys_chroot(const char *path); }
+62	STD		{ int sys_getfsstat(struct statfs *buf, size_t bufsize, \
+			    int flags); }
+63	STD		{ int sys_statfs(const char *path, \
+			    struct statfs *buf); }
+64	STD		{ int sys_fstatfs(int fd, struct statfs *buf); }
+65	STD		{ int sys_fhstatfs(const fhandle_t *fhp, \
+			    struct statfs *buf); }
+66	STD		{ int sys_vfork(void); }
+67	STD NOLOCK	{ int sys_gettimeofday(struct timeval *tp, \
+			    struct timezone *tzp); }
+68	STD		{ int sys_settimeofday(const struct timeval *tv, \
+			    const struct timezone *tzp); }
+69	STD		{ int sys_setitimer(int which, \
+			    const struct itimerval *itv, \
+			    struct itimerval *oitv); }
+70	STD		{ int sys_getitimer(int which, \
+			    struct itimerval *itv); }
+71	STD		{ int sys_select(int nd, fd_set *in, fd_set *ou, \
+			    fd_set *ex, struct timeval *tv); }
+72	STD		{ int sys_kevent(int fd, \
+			    const struct kevent *changelist, int nchanges, \
+			    struct kevent *eventlist, int nevents, \
+			    const struct timespec *timeout); }
+73	STD		{ int sys_munmap(void *addr, size_t len); }
+74	STD		{ int sys_mprotect(void *addr, size_t len, \
+			    int prot); }
+75	STD		{ int sys_madvise(void *addr, size_t len, \
+			    int behav); }
+76	STD		{ int sys_utimes(const char *path, \
+			    const struct timeval *tptr); }
+77	STD		{ int sys_futimes(int fd, \
+			    const struct timeval *tptr); }
+78	STD		{ int sys_mincore(void *addr, size_t len, \
+			    char *vec); }
+79	STD NOLOCK	{ int sys_getgroups(int gidsetsize, \
+			    gid_t *gidset); }
+80	STD		{ int sys_setgroups(int gidsetsize, \
+			    const gid_t *gidset); }
+81	STD		{ int sys_getpgrp(void); }
+82	STD		{ int sys_setpgid(pid_t pid, pid_t pgid); }
+83	STD NOLOCK	{ int sys_futex(uint32_t *f, int op, int val, \
+			    const struct timespec *timeout, uint32_t *g); }
+84	STD		{ int sys_utimensat(int fd, const char *path, \
+			    const struct timespec *times, int flag); }
+85	STD		{ int sys_futimens(int fd, \
+			    const struct timespec *times); }
+86	STD		{ int sys_kbind(const struct __kbind *param, \
+			    size_t psize, int64_t proc_cookie); }
+87	STD NOLOCK	{ int sys_clock_gettime(clockid_t clock_id, \
+			    struct timespec *tp); }
+88	STD		{ int sys_clock_settime(clockid_t clock_id, \
+			    const struct timespec *tp); }
+89	STD NOLOCK	{ int sys_clock_getres(clockid_t clock_id, \
+			    struct timespec *tp); }
+90	STD		{ int sys_dup2(int from, int to); }
+91	STD		{ int sys_nanosleep(const struct timespec *rqtp, \
+			    struct timespec *rmtp); }
+92	STD		{ int sys_fcntl(int fd, int cmd, ... void *arg); }
+93	STD		{ int sys_accept4(int s, struct sockaddr *name, \
+			    socklen_t *anamelen, int flags); }
+94	STD		{ int sys___thrsleep(const volatile void *ident, \
+			    clockid_t clock_id, const struct timespec *tp, \
+			    void *lock, const int *abort); }
+95	STD		{ int sys_fsync(int fd); }
+96	STD		{ int sys_setpriority(int which, id_t who, int prio); }
+97	STD		{ int sys_socket(int domain, int type, int protocol); }
+98	STD		{ int sys_connect(int s, const struct sockaddr *name, \
+			    socklen_t namelen); }
+99	STD		{ int sys_getdents(int fd, void *buf, size_t buflen); }
+100	STD		{ int sys_getpriority(int which, id_t who); }
+101	STD		{ int sys_pipe2(int *fdp, int flags); }
+102	STD		{ int sys_dup3(int from, int to, int flags); }
+103	STD		{ int sys_sigreturn(struct sigcontext *sigcntxp); }
+104	STD		{ int sys_bind(int s, const struct sockaddr *name, \
+			    socklen_t namelen); }
+105	STD		{ int sys_setsockopt(int s, int level, int name, \
+			    const void *val, socklen_t valsize); }
+106	STD		{ int sys_listen(int s, int backlog); }
+107	STD		{ int sys_chflagsat(int fd, const char *path, \
+			    u_int flags, int atflags); }
+108	STD 		{ int sys_pledge(const char *request, const char **paths); }
+109	STD		{ int sys_ppoll(struct pollfd *fds, \
+			    u_int nfds, const struct timespec *ts, \
+			    const sigset_t *mask); }
+110	STD		{ int sys_pselect(int nd, fd_set *in, fd_set *ou, \
+			    fd_set *ex, const struct timespec *ts, \
+			    const sigset_t *mask); }
+111	STD		{ int sys_sigsuspend(int mask); }
+112	STD		{ int sys_sendsyslog(const void *buf, size_t nbyte, \
+			    int flags); }
+113	OBSOL		orecvmsg
+114	OBSOL		osendmsg
+115	OBSOL		vtrace
+116	OBSOL		t32_gettimeofday
+117	OBSOL		t32_getrusage
+118	STD		{ int sys_getsockopt(int s, int level, int name, \
+			    void *val, socklen_t *avalsize); }
+119	STD		{ int sys_thrkill(pid_t tid, int signum, void *tcb); }
+120	STD		{ ssize_t sys_readv(int fd, \
+			    const struct iovec *iovp, int iovcnt); }
+121	STD		{ ssize_t sys_writev(int fd, \
+			    const struct iovec *iovp, int iovcnt); }
+122	STD		{ int sys_kill(int pid, int signum); }
+123	STD		{ int sys_fchown(int fd, uid_t uid, gid_t gid); }
+124	STD		{ int sys_fchmod(int fd, mode_t mode); }
+125	OBSOL		orecvfrom
+126	STD		{ int sys_setreuid(uid_t ruid, uid_t euid); }
+127	STD		{ int sys_setregid(gid_t rgid, gid_t egid); }
+128	STD		{ int sys_rename(const char *from, const char *to); }
+129	OBSOL		otruncate
+130	OBSOL		oftruncate
+131	STD		{ int sys_flock(int fd, int how); }
+132	STD		{ int sys_mkfifo(const char *path, mode_t mode); }
+133	STD		{ ssize_t sys_sendto(int s, const void *buf, \
+			    size_t len, int flags, const struct sockaddr *to, \
+			    socklen_t tolen); }
+134	STD		{ int sys_shutdown(int s, int how); }
+135	STD		{ int sys_socketpair(int domain, int type, \
+			    int protocol, int *rsv); }
+136	STD		{ int sys_mkdir(const char *path, mode_t mode); }
+137	STD		{ int sys_rmdir(const char *path); }
+138	OBSOL		t32_utimes
+139	OBSOL		4.2 sigreturn
+140	STD		{ int sys_adjtime(const struct timeval *delta, \
+			    struct timeval *olddelta); }
+141	STD		{ int sys_getlogin_r(char *namebuf, u_int namelen); }
+142	OBSOL		ogethostid
+143	OBSOL		osethostid
+144	OBSOL		ogetrlimit
+145	OBSOL		osetrlimit
+146	OBSOL		okillpg
+147	STD		{ int sys_setsid(void); }
+148	STD		{ int sys_quotactl(const char *path, int cmd, \
+			    int uid, char *arg); }
+149	OBSOL		oquota
+150	OBSOL		ogetsockname
+
+; Syscalls 151-180 inclusive are reserved for vendor-specific
+; system calls.  (This includes various calls added for compatibility
+; with other Unix variants.)
+; Some of these calls are now supported by BSD...
+151	UNIMPL
+152	UNIMPL
+153	UNIMPL
+154	UNIMPL
+#if defined(NFSCLIENT) || defined(NFSSERVER)
+155	STD		{ int sys_nfssvc(int flag, void *argp); }
+#else
+155	UNIMPL
+#endif
+156	OBSOL		ogetdirentries
+157	OBSOL		statfs25
+158	OBSOL		fstatfs25
+159	UNIMPL
+160	UNIMPL
+161	STD		{ int sys_getfh(const char *fname, fhandle_t *fhp); }
+162	OBSOL		ogetdomainname
+163	OBSOL		osetdomainname
+164	UNIMPL		ouname
+165	STD		{ int sys_sysarch(int op, void *parms); }
+166	UNIMPL
+167	UNIMPL
+168	UNIMPL
+169	OBSOL		semsys10
+170	OBSOL		msgsys10
+171	OBSOL		shmsys10
+172	UNIMPL
+173	STD		{ ssize_t sys_pread(int fd, void *buf, \
+			  size_t nbyte, int pad, off_t offset); }
+174	STD		{ ssize_t sys_pwrite(int fd, const void *buf, \
+			  size_t nbyte, int pad, off_t offset); }
+175	UNIMPL		ntp_gettime
+176	UNIMPL		ntp_adjtime
+177	UNIMPL
+178	UNIMPL
+179	UNIMPL
+180	UNIMPL
+
+; Syscalls 181-199 are used by/reserved for BSD
+181	STD		{ int sys_setgid(gid_t gid); }
+182	STD		{ int sys_setegid(gid_t egid); }
+183	STD		{ int sys_seteuid(uid_t euid); }
+184	OBSOL		lfs_bmapv
+185	OBSOL		lfs_markv
+186	OBSOL		lfs_segclean
+187	OBSOL		lfs_segwait
+188	OBSOL		stat35
+189	OBSOL		fstat35
+190	OBSOL		lstat35
+191	STD		{ long sys_pathconf(const char *path, int name); }
+192	STD		{ long sys_fpathconf(int fd, int name); }
+193	STD		{ int sys_swapctl(int cmd, const void *arg, int misc); }
+194	STD		{ int sys_getrlimit(int which, \
+			    struct rlimit *rlp); }
+195	STD		{ int sys_setrlimit(int which, \
+			    const struct rlimit *rlp); }
+196	OBSOL		ogetdirentries48
+197	STD		{ void *sys_mmap(void *addr, size_t len, int prot, \
+			    int flags, int fd, long pad, off_t pos); }
+198	INDIR		{ quad_t sys___syscall(quad_t num, ...); }
+199	STD		{ off_t sys_lseek(int fd, int pad, off_t offset, \
+			    int whence); }
+200	STD		{ int sys_truncate(const char *path, int pad, \
+			    off_t length); }
+201	STD		{ int sys_ftruncate(int fd, int pad, off_t length); }
+202	STD		{ int sys_sysctl(const int *name, u_int namelen, \
+			    void *old, size_t *oldlenp, void *new, \
+			    size_t newlen); }
+203	STD		{ int sys_mlock(const void *addr, size_t len); }
+204	STD		{ int sys_munlock(const void *addr, size_t len); }
+205	UNIMPL		sys_undelete
+206	OBSOL		t32_futimes
+207	STD		{ pid_t sys_getpgid(pid_t pid); }
+208	OBSOL		nnpfspioctl
+209	STD		{ int sys_utrace(const char *label, const void *addr, \
+			    size_t len); }
+;
+; Syscalls 210-219 were reserved for dynamically loaded syscalls
+;
+210	UNIMPL
+211	UNIMPL
+212	UNIMPL
+213	UNIMPL
+214	UNIMPL
+215	UNIMPL
+216	UNIMPL
+217	UNIMPL
+218	UNIMPL
+219	UNIMPL
+; System calls 220-240 are reserved for use by OpenBSD
+#ifdef SYSVSEM
+220	UNIMPL
+221	STD		{ int sys_semget(key_t key, int nsems, int semflg); }
+#else
+220	UNIMPL		semctl
+221	UNIMPL		semget
+#endif
+222	OBSOL		semop35
+223	OBSOL		semconfig35
+#ifdef SYSVMSG
+224	UNIMPL
+225	STD		{ int sys_msgget(key_t key, int msgflg); }
+226	STD		{ int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, \
+			    int msgflg); }
+227	STD		{ int sys_msgrcv(int msqid, void *msgp, size_t msgsz, \
+			    long msgtyp, int msgflg); }
+#else
+224	UNIMPL		msgctl
+225	UNIMPL		msgget
+226	UNIMPL		msgsnd
+227	UNIMPL		msgrcv
+#endif
+#ifdef SYSVSHM
+228	STD		{ void *sys_shmat(int shmid, const void *shmaddr, \
+			    int shmflg); }
+229	UNIMPL
+230	STD		{ int sys_shmdt(const void *shmaddr); }
+#else
+228	UNIMPL		shmat
+229	UNIMPL		shmctl
+230	UNIMPL		shmdt
+#endif
+231	OBSOL		shmget35
+232	OBSOL		t32_clock_gettime
+233	OBSOL		t32_clock_settime
+234	OBSOL		t32_clock_getres
+235	UNIMPL		timer_create
+236	UNIMPL		timer_delete
+237	UNIMPL		timer_settime
+238	UNIMPL		timer_gettime
+239	UNIMPL		timer_getoverrun
+;
+; System calls 240-249 are reserved for other IEEE Std1003.1b syscalls
+;
+240	OBSOL		t32_nanosleep
+241	UNIMPL
+242	UNIMPL
+243	UNIMPL
+244	UNIMPL
+245	UNIMPL
+246	UNIMPL
+247	UNIMPL
+248	UNIMPL
+249	UNIMPL
+250	STD		{ int sys_minherit(void *addr, size_t len, \
+			    int inherit); }
+251	OBSOL		rfork
+252	STD		{ int sys_poll(struct pollfd *fds, \
+			    u_int nfds, int timeout); }
+253	STD NOLOCK	{ int sys_issetugid(void); }
+254	STD		{ int sys_lchown(const char *path, uid_t uid, gid_t gid); }
+255	STD		{ pid_t sys_getsid(pid_t pid); }
+256	STD		{ int sys_msync(void *addr, size_t len, int flags); }
+257	OBSOL		semctl35
+258	OBSOL		shmctl35
+259	OBSOL		msgctl35
+260	UNIMPL
+261	UNIMPL
+262	UNIMPL
+263	STD		{ int sys_pipe(int *fdp); }
+264	STD		{ int sys_fhopen(const fhandle_t *fhp, int flags); }
+265	UNIMPL
+266	UNIMPL
+267	STD		{ ssize_t sys_preadv(int fd, \
+			  const struct iovec *iovp, int iovcnt, \
+			  int pad, off_t offset); }
+268	STD		{ ssize_t sys_pwritev(int fd, \
+			  const struct iovec *iovp, int iovcnt, \
+			  int pad, off_t offset); }
+269	STD		{ int sys_kqueue(void); }
+270	OBSOL		t32_kevent
+271	STD		{ int sys_mlockall(int flags); }
+272	STD		{ int sys_munlockall(void); }
+273	UNIMPL		sys_getpeereid
+274	UNIMPL		sys_extattrctl
+275	UNIMPL		sys_extattr_set_file
+276	UNIMPL		sys_extattr_get_file
+277	UNIMPL		sys_extattr_delete_file
+278	UNIMPL		sys_extattr_set_fd
+279	UNIMPL		sys_extattr_get_fd
+280	UNIMPL		sys_extattr_delete_fd
+281	STD NOLOCK	{ int sys_getresuid(uid_t *ruid, uid_t *euid, \
+			    uid_t *suid); }
+282	STD		{ int sys_setresuid(uid_t ruid, uid_t euid, \
+			    uid_t suid); }
+283	STD NOLOCK	{ int sys_getresgid(gid_t *rgid, gid_t *egid, \
+			    gid_t *sgid); }
+284	STD		{ int sys_setresgid(gid_t rgid, gid_t egid, \
+			    gid_t sgid); }
+285	OBSOL		sys_omquery
+286	STD		{ void *sys_mquery(void *addr, size_t len, int prot, \
+			    int flags, int fd, long pad, off_t pos); }
+287	STD		{ int sys_closefrom(int fd); }
+288	STD		{ int sys_sigaltstack(const struct sigaltstack *nss, \
+			    struct sigaltstack *oss); }
+#ifdef SYSVSHM
+289	STD		{ int sys_shmget(key_t key, size_t size, int shmflg); }
+#else
+289	UNIMPL		shmget
+#endif
+#ifdef SYSVSEM
+290	STD		{ int sys_semop(int semid, struct sembuf *sops, \
+			    size_t nsops); }
+#else
+290    UNIMPL		semop
+#endif
+291	OBSOL		t32_stat
+292	OBSOL		t32_fstat
+293	OBSOL		t32_lstat
+294	STD		{ int sys_fhstat(const fhandle_t *fhp, \
+			    struct stat *sb); }
+#ifdef SYSVSEM
+295	STD		{ int sys___semctl(int semid, int semnum, int cmd, \
+			    union semun *arg); }
+#else
+295	UNIMPL
+#endif
+#ifdef SYSVSHM
+296	STD		{ int sys_shmctl(int shmid, int cmd, \
+			    struct shmid_ds *buf); }
+#else
+296	UNIMPL
+#endif
+#ifdef SYSVMSG
+297	STD		{ int sys_msgctl(int msqid, int cmd, \
+			    struct msqid_ds *buf); }
+#else
+297	UNIMPL
+#endif
+298	STD		{ int sys_sched_yield(void); }
+299	STD NOLOCK	{ pid_t sys_getthrid(void); }
+300	OBSOL		t32___thrsleep
+301	STD		{ int sys___thrwakeup(const volatile void *ident, \
+			    int n); }
+302	STD		{ void sys___threxit(pid_t *notdead); }
+303	STD		{ int sys___thrsigdivert(sigset_t sigmask, \
+			    siginfo_t *info, const struct timespec *timeout); }
+304	STD		{ int sys___getcwd(char *buf, size_t len); }
+305	STD		{ int sys_adjfreq(const int64_t *freq, \
+			    int64_t *oldfreq); }
+306	OBSOL		getfsstat53
+307	OBSOL		statfs53
+308	OBSOL		fstatfs53
+309	OBSOL		fhstatfs53
+310	STD		{ int sys_setrtable(int rtableid); }
+311	STD NOLOCK	{ int sys_getrtable(void); }
+312	OBSOL		t32_getdirentries
+313	STD		{ int sys_faccessat(int fd, const char *path, \
+			    int amode, int flag); }
+314	STD		{ int sys_fchmodat(int fd, const char *path, \
+			    mode_t mode, int flag); }
+315	STD		{ int sys_fchownat(int fd, const char *path, \
+			    uid_t uid, gid_t gid, int flag); }
+316	OBSOL		t32_fstatat
+317	STD		{ int sys_linkat(int fd1, const char *path1, int fd2, \
+			    const char *path2, int flag); }
+318	STD		{ int sys_mkdirat(int fd, const char *path, \
+			    mode_t mode); }
+319	STD		{ int sys_mkfifoat(int fd, const char *path, \
+			    mode_t mode); }
+320	STD		{ int sys_mknodat(int fd, const char *path, \
+			    mode_t mode, dev_t dev); }
+321	STD		{ int sys_openat(int fd, const char *path, int flags, \
+			    ... mode_t mode); }
+322	STD		{ ssize_t sys_readlinkat(int fd, const char *path, \
+			    char *buf, size_t count); }
+323	STD		{ int sys_renameat(int fromfd, const char *from, \
+			    int tofd, const char *to); }
+324	STD		{ int sys_symlinkat(const char *path, int fd, \
+			    const char *link); }
+325	STD		{ int sys_unlinkat(int fd, const char *path, \
+			    int flag); }
+326	OBSOL		t32_utimensat
+327	OBSOL		t32_futimens
+328	OBSOL		__tfork51
+329	STD NOLOCK	{ void sys___set_tcb(void *tcb); }
+330	STD NOLOCK	{ void *sys___get_tcb(void); }
--- /dev/null
+++ b/support/syscall-gen/types+freebsd-x64.frag
@@ -1,0 +1,793 @@
+type size	= int64		/* spans entire address space */
+type usize	= uint64	/* unsigned size */
+type off	= int64		/* file offsets */
+type intptr	= uint64	/* can hold any pointer losslessly */
+type time	= int64		/* milliseconds since epoch */
+type pid	= int		/* process id */
+type scno	= int64		/*syscall*/
+type fdopt	= int64		/* fd options */
+type fd		= int32		/* fd */
+type whence	= uint64	/* seek from whence */
+type mprot	= int64		/* memory protection */
+type mopt	= int64		/* memory mapping options */
+type socktype	= int64		/* socket type */
+type sockopt	= int64		/* socket option */
+type sockproto	= int64		/* socket protocol */
+type sockfam	= uint8		/* socket family */
+type filemode	= uint16
+type filetype	= uint8
+type fcntlcmd	= int64
+type umtxop	= int32
+type signo	= int32
+type sigflags	= int32
+type gid	= int32
+type uid	= int32
+type ffcounter	= int64
+type register	= int64
+type lwpid	= int32
+type rlim	= int64
+type socklen	= int32
+type cpuwhich	= int32
+type id		= int64
+type cpulevel	= int
+type cpusetid	= int
+type idtype	= int
+
+type acltype	= int
+type acltag	= uint32
+type aclperm	= uint32
+type aclenttype	= uint16
+type aclflag	= uint16
+type aclpermset = int#
+type aclflagset	= uint16#
+type clockid	= int32
+type dev	= int32
+
+type caddr	= byte#
+
+type clock = union
+	`Clockrealtime
+	`Clockrealtime_precise
+	`Clockrealtime_fast
+	`Clockmonotonic
+	`Clockmonotonic_precise     
+	`Clockmonotonic_fast
+	`Clockuptime
+	`Clockuptime_precise
+	`Clockuptime_fast
+	`Clockvirtual
+	`Clockprof
+	`Clocksecond
+;;
+
+type kevent = struct
+	ident	: intptr	/* identifier for this event */
+	filter	: int16		/* filter for event */
+	flags	: uint16
+	fflags	: int32
+	data	: intptr
+	udata	: void#		/* user : opaque data identifier */
+;;
+
+type pollfd = struct
+	fd	: fd
+	events	: uint16
+	revents	: uint16
+;;
+
+const Fdsetsize = 1024
+type fdset = struct
+	_mask	: uint64[Fdsetsize/64]
+;;
+
+type bintime = struct
+	sec	: time
+	frac	: uint64
+;;
+
+type mac = struct
+	buflen	: size
+	string	: byte#
+;;
+
+const Aclmaxent = 254
+type acl = struct
+	maxcnt	: uint
+	cnt	: uint
+	/* Will be required e.g. to implement NFSv4.1 ACL inheritance. */
+	spare	: int[4];
+	entry	: aclentry[Aclmaxent];
+;;
+
+type aclentry = struct
+	tag	: acltag
+	id	: uid
+	perm	: aclperm
+	/* NFSv4 entry type, "allow" or "deny".  Unused in POSIX.1e ACLs. */
+	etype	: aclenttype
+	/* NFSv4 ACL inheritance.  Unused in POSIX.1e ACLs. */
+	flags	: aclflag
+;;
+
+const _MC_FPFMT_NODEV	: int64 = 0x10000	/* device not present or configured */
+const _MC_FPFMT_XMM	: int64 = 0x10002
+const _MC_FPOWNED_NONE	: int64 = 0x20000	/* FP state not used */
+const _MC_FPOWNED_FPU	: int64 = 0x20001	/* FP state came from FPU */
+const _MC_FPOWNED_PCB	: int64 = 0x20002	/* FP state came from PCB */
+
+type mcontext = struct
+	/*
+	 * The definition of mcontext must match the layout of
+	 * struct sigcontext after the sc_mask member.  This is so
+	 * that we can support sigcontext and ucontext at the same
+	 * time.
+	 */
+	onstack	: register	/* XXX - sigcontext compat. */
+	rdi	: register		/* machine state (struct trapframe) */
+	rsi	: register
+	rdx	: register
+	rcx	: register
+	r8	: register
+	r9	: register
+	rax	: register
+	rbx	: register
+	rbp	: register
+	r10	: register
+	r11	: register
+	r12	: register
+	r13	: register
+	r14	: register
+	r15	: register
+	trapno	: uint32
+	fs	: uint16
+	gs	: uint16
+	addr	: register
+	flags	: uint32
+	es	: uint16
+	ds	: uint16
+	err	: register
+	rip	: register
+	cs	: register
+	rflags	: register
+	rsp	: register
+	ss	: register
+
+	len	: int64			/* sizeof(mcontext) */
+
+	fpfmt	: int64
+	ownedfp	: int64
+	/*
+	 * See <machine/fpu.h> for the internals of mc_fpstate[].
+	 */
+	/* FIXME: needs padding? */
+	fpstate	: uint64[64]// __aligned(16);
+
+	fsbase	: register
+	gsbase	: register
+
+	xfpustate	: register
+	xfpustate_len	: register
+
+	mc_spare : int64[4];
+;;
+
+type ucontext = struct
+	/*
+	 * Keep the order of the first two fields. Also,
+	 * keep them the first two fields in the structure.
+	 * This way we can have a union with struct
+	 * sigcontext and ucontext. This allows us to
+	 * support them both at the same time.
+	 * note: the union is not defined, though.
+	 */
+	sigmask		: sigset
+	mcontext	: mcontext
+	link		: ucontext#
+	sigstack	: sigstack
+
+	flags		: int
+	spare		: int[4]
+;;
+
+type ffclock_estimate = struct
+	update_time	: bintime	/* Time of last estimates update. */
+	update_ffcount	: ffcounter	/* Counter value at last update. */
+	leapsec_next	: ffcounter	/* Counter value of next leap second. */
+	period		: uint64	/* Estimate of counter period. */
+	errb_abs	: uint32	/* Bound on absolute clock error [ns]. */
+	errb_rate	: uint32	/* Bound on counter rate error [ps/s]. */
+	status		: uint32	/* Clock status. */
+	leapsec_total	: int16		/* All leap seconds seen so far. */
+	leapsec		: int8		/* Next leap second (in {-1,0,1}). */
+;;
+
+type sigset = struct
+	bits	: uint32[4]
+;;
+
+type sigaction = struct
+	handler	: byte#	/* code pointer */
+	flags	: sigflags
+	mask	: sigset
+;;
+
+type sigstack = struct
+	sp	: void#	/* signal stack base */
+	size	: size 	/* signal stack length */
+	flags	: int  	/* SS_DISABLE and/or SS_ONSTACK */
+;;
+
+type sigevent = struct
+	notify	: int;		/* Notification type */
+	signo	: int;		/* Signal number */
+	value	: uint64
+	_union	: uint64[8]	/* FIXME: replace with actual type */
+;;
+
+type siginfo = struct
+	signo	: int		/* signal number */
+	errno	: int		/* errno association */
+	/*
+	 * Cause of signal, one of the SI_ macros or signal-specific
+	 * values, i.e. one of the FPE_... values for SIGFPE.  This
+	 * value is equivalent to the second argument to an old-style
+	 * FreeBSD signal handler.
+	 */
+	code	: int		/* signal code */
+	pid	: pid			/* sending process */
+	uid	: uid			/* sender's ruid */
+	status	: int		/* exit value */
+	addr	: void#		/* faulting instruction */
+	val	: uint64
+	_spare1	: int64	/* FIXME: abi */
+	_spare2	: int[7]
+;;
+
+type waitstatus = union
+	`Waitfail int32
+	`Waitexit int32
+	`Waitsig  int32
+	`Waitstop int32
+;;
+
+type timezone = struct
+	minswest	: int	/* minutes west of Greenwich */
+	dsttime		: int	/* type of dst correction */
+;;
+
+type timespec = struct
+	sec	: uint64
+	nsec	: uint64 
+;;
+
+type timeval = struct
+	sec	: uint64
+	usec	: uint64
+;;
+
+type itimerval = struct
+	interval	: timeval
+	value		: timeval
+;;
+
+type itimerspec = struct
+	interval	: timespec
+	value		: timespec
+;;
+
+/*
+ * NTP daemon interface -- ntp_adjtime(2) -- used to discipline CPU clock
+ * oscillator and control/determine status.
+ *
+ * Note: The offset, precision and jitter members are in microseconds if
+ * STA_NANO is zero and nanoseconds if not.
+ */
+type timex = struct
+	modes 		: uint	/* clock mode bits (wo) */
+	offset		: int64			/* time offset (ns/us) (rw) */
+	freq		: int64			/* frequency offset (scaled PPM) (rw) */
+	maxerror	: int64		/* maximum error (us) (rw) */
+	esterror	: int64		/* estimated error (us) (rw) */
+	status		: int	   	/* clock status bits (rw) */
+	constant	: int64		/* poll interval (log2 s) (rw) */
+	precision	: int64		/* clock precision (ns/us) (ro) */
+	tolerance	: int64		/* clock frequency tolerance (scaled
+				 	 * PPM) (ro) */
+	/*
+	 * following : The read-only structure members are implemented
+	 * if : only the PPS signal discipline is configured in the
+	 * kernel. are : They included in all configurations to insure
+	 * portability.
+	 */
+	ppsfreq	: int64		/* PPS frequency (scaled PPM) (ro) */
+	jitter	: int64			/* PPS jitter (ns/us) (ro) */
+	shift	: int			/* interval duration (s) (shift) (ro) */
+	stabil	: int64			/* PPS stability (scaled PPM) (ro) */
+	jitcnt	: int64			/* jitter limit exceeded (ro) */
+	calcnt	: int64			/* calibration intervals (ro) */
+	errcnt	: int64			/* calibration errors (ro) */
+	stbcnt	: int64			/* stability limit exceeded (ro) */
+;;
+
+type rusage = struct
+	utime	: timeval /* user time */
+	stime	: timeval /* system time */
+	maxrss	: uint64 /* max resident set size*/
+	ixrss	: uint64 /* shared text size */
+	idrss	: uint64 /* unshared data size */
+	isrss	: uint64 /* unshared stack size */
+	minflt	: uint64 /* page reclaims */
+	majflt	: uint64 /* page faults */
+	nswap	: uint64 /* swaps */
+	inblock	: uint64 /* block input ops */
+	oublock	: uint64 /* block output ops */
+	msgsnd	: uint64 /* messages sent */	
+	msgrcv	: uint64 /* messages received */
+	nsignals : uint64 /* signals received */
+	nvcsw	: uint64 /* voluntary context switches */
+	nivcsw	: uint64 /* involuntary context switches */
+;;
+
+type wrusage = struct
+	self	: rusage
+	child	: rusage
+;;
+
+type rlimit = struct
+	cur	: rlim
+	max	: rlim
+;;
+
+const Caprightsversion	= 0
+type caprights = struct
+	rights	: uint64[Caprightsversion + 2]
+;;
+
+type statbuf = struct
+	dev	: uint32 
+	ino	: uint32 
+	mode	: filemode
+	nlink	: uint16
+	uid	: uint32
+	gid	: uint32
+	rdev	: uint32
+	atime	: timespec
+	mtime	: timespec
+	ctime	: timespec
+	size	: int64
+	blocks	: int64
+	blksize	: uint32
+	flags	: uint32
+	gen	: uint32
+	lspare	: int32
+	birthtim	: timespec 
+;;
+
+const Mfsnamelen	= 16		/* length of type name including null */
+const Mnamelen		= 88		/* size of on/from name bufs */
+const Statfs_version	= 0x20030518	/* current version number */
+type statfs = struct
+	version		: uint32	/* structure version number */
+	kind		: uint32	/* type of filesystem */
+	flags		: uint64	/* copy of mount exported flags */
+	bsize		: uint64	/* filesystem fragment size */
+	iosize		: uint64	/* optimal transfer block size */
+	blocks		: uint64	/* total data blocks in filesystem */
+	bfree		: uint64	/* free blocks in filesystem */
+	bavail		: int64		/* free blocks avail to non-superuser */
+	files		: uint64	/* total file nodes in filesystem */
+	ffree		: int64		/* free nodes avail to non-superuser */
+	syncwrites	: uint64	/* count of sync writes since mount */
+	asyncwrites	: uint64	/* count of async writes since mount */
+	syncreads	: uint64	/* count of sync reads since mount */
+	asyncreads	: uint64	/* count of async reads since mount */
+	spare		: uint64[10]	/* unused spare */
+	namemax		: uint32	/* maximum filename length */
+	owner	  	: uid		/* user that mounted the filesystem */
+	fsid	  	: fsid		/* filesystem id */
+	charspare	: byte[80]	/* spare string space */
+	fstypename	: byte[Mfsnamelen]	/* filesystem type name */
+	mntfromname	: byte[Mnamelen]	/* mounted filesystem */
+	mntonname	: byte[Mnamelen]	/* directory on which mounted */
+;;
+
+type fhandle = struct
+	fsid	: fsid
+	fid	: fid
+;;
+
+type fsid = struct
+	val	: int32[2]
+;;
+
+const Maxfidsz = 16
+type fid = struct
+	len	: int16		/* length of data in bytes */
+	data0	: int16	/* force longword alignment */
+	data	: byte[Maxfidsz];	/* data (variable length) */
+;;
+
+type utsname = struct
+	system	: byte[256]
+	node	: byte[256] 
+	release	: byte[256]
+	version	: byte[256]
+	machine	: byte[256]
+;;
+
+
+type inaddr = struct
+	addr	: byte[4]
+;;
+
+type in6addr = struct
+	addr	: byte[16]
+;;
+
+type sockaddr = struct
+	len	: byte
+	fam	: sockfam
+	data	: byte[14] /* what is the *actual* length? */
+;;
+
+type sockaddr_in = struct
+	len	: byte
+	fam	: sockfam
+	port	: uint16
+	addr	: byte[4]
+	zero	: byte[8]
+;;
+
+type sockaddr_in6 = struct
+	len	: byte
+	fam	: sockfam
+	port	: uint16
+	flow	: uint32
+	addr	: byte[16]
+	scope	: uint32
+;;
+
+type sockaddr_un = struct
+	len	: uint8
+	fam	: sockfam
+	path	: byte[104]
+;;
+
+type sockaddr_storage = struct
+	len	: byte
+	fam	: sockfam
+	__pad1	: byte[6]
+	__align	: int64
+	__pad2 	: byte[112]
+;;	
+
+type dirent = struct
+	fileno	: uint32
+	reclen	: uint16
+	ftype	: filetype
+	namelen	: uint8
+	name	: byte[256]	
+;;	
+
+type rtprio = struct
+	rttype	: uint16
+	rtprio	: uint16
+;;
+
+type thrparam = struct
+	startfn	: void#	/* pointer to code for thread entry */
+	arg	: void#	/* pointer argument for thread entry */
+	stkbase	: byte#	/* stack base address */
+	stksz	: size	/* size of stack */
+	tlsbase	: byte#	/* base of thread local storage */
+	tlssz	: size	/* size of tls */
+	tid	: uint64#	/* place to store new tid */
+	ptid	: uint64#	/* place to store parent tid */
+	flags	: int32	/* flags for the thread */
+	rtp	: rtprio#	/* realtime priority */
+	spare	: void#[3]	/* padding */
+;;
+
+type iovec = struct
+	base	: byte#
+	len	: uint64
+;;
+
+const Maxcpu = 256
+type cpuset = struct
+	bits	: uint64[Maxcpu/64]
+;;
+
+type sched_param = struct
+	priority	: int
+;;
+
+const Jailapi =	2
+type jail =  struct
+	version	: uint32;
+	path	: byte#
+	hostname		: byte#
+	jailname		: byte#
+	ip4s	: uint32
+	ip6s	: uint32
+	ip4	: inaddr#
+	ip6	: in6addr#
+;;
+
+const Msgoob		= 0x1		/* process out-of-band data */
+const Msgpeek		= 0x2		/* peek at incoming message */
+const Msgdontroute	= 0x4		/* send without using routing tables */
+const Msgeor		= 0x8		/* data completes record */
+const Msgtrunc		= 0x10		/* data discarded before delivery */
+const Msgctrunc		= 0x20		/* control data lost before delivery */
+const Msgwaitall	= 0x40		/* wait for full request or error */
+const Msgnosignal	= 0x20000	/* do not generate SIGPIPE on EOF */
+const Msgdontwait	= 0x80		/* this message should be nonblocking */
+const Msgeof		= 0x100		/* data completes connection */
+const Msgnotification	= 0x2000        /* SCTP notification */
+const Msgnbio		= 0x4000	/* FIONBIO mode, used by fifofs */
+const Msgcompat      	= 0x8000	/* used in sendit() */
+const Msgcmsg_cloexec 	= 0x40000	/* make received fds close-on-exec */
+const Msgwaitforone	= 0x80000	/* for recvmmsg() */
+type msghdr = struct
+	name	: void#	/* optional address */
+	namelen	: int32	/* size of address */
+	iov	: iovec	/* scatter/gather array */
+	iovlen	: int	/* # elements in msg_iov */
+	ctl	: void#	/* ancillary data, see below */
+	ctllen	: int32	/* ancillary data buffer len */
+	flags	: int	/* flags on received message */
+;;
+
+type sf_hdtr = struct
+	hdr	: iovec#
+	hdrcnt	: int
+	trl	: iovec#
+	trlcnt	: int
+;;
+
+type aiocb = struct
+	fildes	: int		/* File descriptor */
+	offset	: off		/* File offset for I/O */
+	buf	: void# 	/* I/O buffer in process space */
+	nbytes	: size		/* Number of bytes for I/O */
+	__spare__ 	: int[2]
+	__spare2__	: void#
+	lio_opcode	: int		/* LIO opcode */
+	reqprio		: int		/* Request priority -- ignored */
+	_aiocb_private	: __aiocb_private
+	sigevent	: sigevent	/* Signal to deliver */
+;;
+
+type __aiocb_private = struct
+	status	: int64
+	error	: int64
+	kinfo	: void#
+;;
+
+const _Uuidnodesz = 6
+type uuid = struct
+	time_low			: uint32
+	time_mid			: uint16
+	time_hi_and_version		: uint16
+	clock_seq_hi_and_reserved	: uint8
+	clock_seq_low			: uint8
+	node				: uint8[_Uuidnodesz];
+;;
+
+/* open options */
+const Ordonly  	: fdopt = 0x0
+const Owronly  	: fdopt = 0x1
+const Ordwr    	: fdopt = 0x2
+const Oappend  	: fdopt = 0x8
+const Ocreat   	: fdopt = 0x200
+const Onofollow	: fdopt = 0x100
+const Ondelay  	: fdopt = 0x4
+const Otrunc   	: fdopt = 0x400
+const Odir	: fdopt = 0x20000
+
+const Oshlock	: fdopt = 0x0010	/* open with shared file lock */
+const Oexlock	: fdopt = 0x0020	/* open with exclusive file lock */
+const Oasync	: fdopt = 0x0040	/* signal pgrp when data ready */
+const Ofsync	: fdopt = 0x0080	/* synchronous writes */
+const Oexcl	: fdopt = 0x0800	/* error if already exists */
+const Ocloexec	: fdopt = 0x00100000
+
+/* stat modes */	
+const Sifmt	: filemode = 0xf000
+const Sififo	: filemode = 0x1000
+const Sifchr	: filemode = 0x2000
+const Sifdir	: filemode = 0x4000
+const Sifblk	: filemode = 0x6000
+const Sifreg	: filemode = 0x8000
+const Siflnk	: filemode = 0xa000
+const Sifsock 	: filemode = 0xc000
+
+/* mmap protection */
+const Mprotnone	: mprot = 0x0
+const Mprotrd	: mprot = 0x1
+const Mprotwr	: mprot = 0x2
+const Mprotexec	: mprot = 0x4
+const Mprotrw	: mprot = 0x3
+
+/* mmap options */
+const Mshared	: mopt = 0x1
+const Mpriv	: mopt = 0x2
+const Mfixed	: mopt = 0x10
+const Mfile	: mopt = 0x0
+const Manon	: mopt = 0x1000
+const M32bit	: mopt = 0x80000
+
+/* file types */
+const Dtunknown	: filetype = 0
+const Dtfifo	: filetype = 1
+const Dtchr	: filetype = 2
+const Dtdir	: filetype = 4
+const Dtblk	: filetype = 6
+const Dtreg	: filetype = 8
+const Dtlnk	: filetype = 10
+const Dtsock	: filetype = 12
+const Dtwht	: filetype = 14
+
+/* socket families. INCOMPLETE. */
+const Afunspec	: sockfam = 0
+const Afunix	: sockfam = 1
+const Afinet	: sockfam = 2
+const Afinet6	: sockfam = 28
+
+/* socket types. */
+const Sockstream	: socktype = 1
+const Sockdgram		: socktype = 2
+const Sockraw		: socktype = 3
+const Sockrdm		: socktype = 4
+const Sockseqpacket	: socktype = 5
+
+/* socket options */
+const Sodebug	: sockopt = 0x0001		/* turn on debugging info recording */
+const Soacceptconn	: sockopt = 0x0002	/* socket has had listen() */
+const Soreuseaddr	: sockopt = 0x0004	/* allow local address reuse */
+const Sokeepalive	: sockopt = 0x0008	/* keep connections alive */
+const Sodontroute	: sockopt = 0x0010	/* just use interface addresses */
+const Sobroadcast	: sockopt = 0x0020	/* permit sending of broadcast msgs */
+const Souseloopback	: sockopt = 0x0040	/* bypass hardware when possible */
+const Solinger		: sockopt = 0x0080	/* linger on close if data present */
+const Sooobinline	: sockopt = 0x0100	/* leave received OOB data in line */
+const Soreuseport	: sockopt = 0x0200	/* allow local address & port reuse */
+const Sotimestamp	: sockopt = 0x0400	/* timestamp received dgram traffic */
+const Sonosigpipe	: sockopt = 0x0800	/* no SIGPIPE from EPIPE */
+const Soacceptfilter	: sockopt = 0x1000	/* there is an accept filter */
+const Sobintime		: sockopt = 0x2000	/* timestamp received dgram traffic */
+const Sonooffload	: sockopt = 0x4000	/* socket cannot be offloaded */
+const Sonoddp		: sockopt = 0x8000	/* disable direct data placement */
+
+/* socket option levels */
+const Solsocket		: sockproto = 0xffff
+
+/* network protocols */
+const Ipproto_ip	: sockproto = 0
+const Ipproto_icmp	: sockproto = 1
+const Ipproto_tcp	: sockproto = 6
+const Ipproto_udp	: sockproto = 17
+const Ipproto_raw	: sockproto = 255
+
+/* poll options */
+const Pollin		: uint16 = 0x0001	/* any readable data available */
+const Pollpri		: uint16 = 0x0002	/* OOB/Urgent readable data */
+const Pollout		: uint16 = 0x0004	/* file descriptor is writeable */
+const Pollrdnorm	: uint16 = 0x0040	/* non-OOB/URG data available */
+const Pollwrnorm	: uint16 = Pollout	/* no write type differentiation */
+const Pollrdband	: uint16 = 0x0080	/* OOB/Urgent readable data */
+const Pollwrband	: uint16 = 0x0100	/* OOB/Urgent data can be written */
+/* General FreeBSD extension (currently only supported for sockets): */
+const Pollinigneof	: uint16 = 0x2000	/* like POLLIN, except ignore EOF */
+/*
+* These events are set if they occur regardless of whether they were
+* requested.
+*/
+const Pollerr		: uint16 = 0x0008		/* some poll error occurred */
+const Pollhup		: uint16 = 0x0010		/* file descriptor was "hung up" */
+const Pollnval		: uint16 = 0x0020		/* requested events "invalid" */
+
+const Seekset	: whence = 0
+const Seekcur	: whence = 1
+const Seekend	: whence = 2
+
+/* system specific constants */
+const Maxpathlen	: size = 1024
+
+/* fcntl constants */
+const Fdupfd	: fcntlcmd = 0		/* duplicate file descriptor */
+const Fgetfd	: fcntlcmd = 1		/* get file descriptor flags */
+const Fsetfd	: fcntlcmd = 2		/* set file descriptor flags */
+const Fgetfl	: fcntlcmd = 3		/* get file status flags */
+const Fsetfl	: fcntlcmd = 4		/* set file status flags */
+const Fgetown	: fcntlcmd = 5		/* get SIGIO/SIGURG proc/pgrp */
+const Fsetown	: fcntlcmd = 6		/* set SIGIO/SIGURG proc/pgrp */
+const Fogetlk	: fcntlcmd = 7		/* get record locking information */
+const Fosetlk	: fcntlcmd = 8		/* set record locking information */
+const Fosetlkw	: fcntlcmd = 9		/* F_SETLK; wait if blocked */
+const Fdup2fd	: fcntlcmd = 10		/* duplicate file descriptor to arg */
+const Fgetlk	: fcntlcmd = 11		/* get record locking information */
+const Fsetlk	: fcntlcmd = 12		/* set record locking information */
+const Fsetlkw	: fcntlcmd = 13		/* F_SETLK; wait if blocked */
+const Fsetlk_remote	: fcntlcmd = 14		/* debugging support for remote locks */
+const Freadahead	: fcntlcmd = 15		/* read ahead */
+const Frdahead	: fcntlcmd = 16		/* Darwin compatible read ahead */
+const Fdupfd_cloexec	: fcntlcmd = 17		/* Like F_DUPFD, but FD_CLOEXEC is set */
+const Fdup2fd_cloexec	: fcntlcmd = 18		/* Like F_DUP2FD, but FD_CLOEXEC is set */
+
+/* return value for a failed mapping */
+const Mapbad	: byte# = (-1 : byte#)
+
+/* umtx ops */
+const Umtxlock	: umtxop = 0
+const Umtxunlock	: umtxop = 1
+const Umtxwait	: umtxop = 2
+const Umtxwake	: umtxop = 3
+const UmtxmtxTrylock	: umtxop = 4
+const Umtxmtxlock	: umtxop = 5
+const Umtxmtxunlock	: umtxop = 6
+const Umtxsetceiling	: umtxop = 7
+const Umtxcvwait	: umtxop = 8
+const Umtxcvsignal	: umtxop = 9
+const Umtxcvbroadcast	: umtxop = 10
+const Umtxwaituint	: umtxop = 11
+const Umtxrwrdlock	: umtxop = 12
+const Umtxrwwrlock	: umtxop = 13
+const Umtxrwunlock	: umtxop = 14
+const Umtxwaituintpriv	: umtxop = 15
+const Umtxwakepriv	: umtxop = 16
+const Umtxmutexwait	: umtxop = 17
+const Umtxsemwait	: umtxop = 19
+const Umtxsemwake	: umtxop = 20
+const Umtxnwakepriv	: umtxop = 21
+const Umtxmtxwake2	: umtxop = 22
+const Umtxmax	: umtxop = 23
+
+/* signal actions */
+const Saonstack		: sigflags = 0x0001	/* take signal on signal stack */
+const Sarestart		: sigflags = 0x0002	/* restart system call on signal return */
+const Saresethand	: sigflags = 0x0004	/* reset to SIG_DFL when taking signal */
+const Sanodefer		: sigflags = 0x0010	/* don't mask the signal we're delivering */
+const Sanocldwait	: sigflags = 0x0020	/* don't keep zombies around */
+const Sasiginfo		: sigflags = 0x0040	/* signal handler with SA_SIGINFO args */
+
+/* signal numbers */
+const Sighup	: signo = 1	/* hangup */
+const Sigint	: signo = 2	/* interrupt */
+const Sigquit	: signo = 3	/* quit */
+const Sigill	: signo = 4	/* illegal instr. (not reset when caught) */
+const Sigtrap	: signo = 5	/* trace trap (not reset when caught) */
+const Sigabrt	: signo = 6	/* abort() */
+const Sigiot	: signo = Sigabrt	/* compatibility */
+const Sigemt	: signo = 7	/* EMT instruction */
+const Sigfpe	: signo = 8	/* floating point exception */
+const Sigkill	: signo = 9	/* kill (cannot be caught or ignored) */
+const Sigbus	: signo = 10	/* bus error */
+const Sigsegv	: signo = 11	/* segmentation violation */
+const Sigsys	: signo = 12	/* non-existent system call invoked */
+const Sigpipe	: signo = 13	/* write on a pipe with no one to read it */
+const Sigalrm	: signo = 14	/* alarm clock */
+const Sigterm	: signo = 15	/* software termination signal from kill */
+const Sigurg	: signo = 16	/* urgent condition on IO channel */
+const Sigstop	: signo = 17	/* sendable stop signal not from tty */
+const Sigtstp	: signo = 18	/* stop signal from tty */
+const Sigcont	: signo = 19	/* continue a stopped process */
+const Sigchld	: signo = 20	/* to parent on child stop or exit */
+const Sigttin	: signo = 21	/* to readers pgrp upon background tty read */
+const Sigttou	: signo = 22	/* like TTIN if (tp->t_local&LTOSTOP) */
+const Sigio	: signo = 23	/* input/output possible signal */
+const Sigxcpu	: signo = 24	/* exceeded CPU time limit */
+const Sigxfsz	: signo = 25	/* exceeded file size limit */
+const Sigvtalrm	: signo = 26	/* virtual time alarm */
+const Sigprof	: signo = 27	/* profiling time alarm */
+const Sigwinch	: signo = 28	/* window size changes */
+const Siginfo	: signo = 29	/* information request */
+const Sigusr1	: signo = 30	/* user defined signal 1 */
+const Sigusr2	: signo = 31	/* user defined signal 2 */
+const Sigthr	: signo = 32	/* reserved by thread library. */
+const Siglwp	: signo = Sigthr
+const Siglibrt	: signo = 33	/* reserved by real-time library. */
+
+extern const syscall : (sc:scno, args:... -> int64)
+extern var __cenvp : byte##
--- /dev/null
+++ b/support/syscall-gen/types+linux-x64.frag
@@ -1,0 +1,498 @@
+type size	= int64		/* spans entire address space */
+type usize	= uint64	/* unsigned size */
+type off	= int64         /* file offsets */
+type intptr	= uint64	/* can hold any pointer losslessly */
+type time	= int64		/* milliseconds since epoch */
+type scno	= int64		/* syscall */
+
+/* processes/threads */
+type pid	= int	/* process id */
+type tid	= int	/* thread id */
+type cloneopt	= int64	/* options for clone(2) */
+
+/* file descriptor manipulation */
+type fdopt	= int64	/* fd options */
+type fd		= int32	/* fd */
+type whence	= uint64	/* seek from whence */
+type filemode	= uint32	/* file open mode */
+
+type mprot	= int64	/* memory protection */
+type mopt	= int64	/* memory mapping options */
+type socktype	= int64	/* socket type */
+type sockproto	= int32	/* socket protocol */
+type sockfam	= uint16	/* socket family */
+type sockopt	= int64
+type msgflags	= uint32
+type cmsgtype	= uint32
+
+type epollflags	= uint32
+type epollop	= uint32
+type epollevttype	= uint32
+
+type pollevt	= uint16
+
+type futexop	= uint32
+type signo	= int32
+type sigflags	= int64
+
+type fallocmode	= uint32
+
+type mfdflags	= uint32
+
+type clock = union
+	`Clockrealtime
+	`Clockmonotonic
+	`Clockproccpu
+	`Clockthreadcpu
+	`Clockmonotonicraw
+	`Clockrealtimecoarse
+	`Clockmonotoniccoarse
+	`Clockboottime
+	`Clockrealtimealarm
+	`Clockboottimealarm
+;;
+
+type waitstatus = union
+	`Waitexit int32
+	`Waitsig  int32
+	`Waitstop int32
+	`Waitfail int32
+;;
+
+type sigset = struct
+	bits	: uint32[2]
+;;
+
+type sigaction = struct
+	handler	: byte#	/* code pointer */
+	flags	: sigflags
+	restore	: byte#	/* code pointer */
+	mask	: sigset
+;;
+
+const Sipadsz = 128
+type siginfo = struct
+	signo	: int
+	errno	: int
+	code	: int
+
+	_pad	: int[Sipadsz]
+;;
+
+/* union { int, void* } */
+type sigval = struct
+	_pad	: void#
+;;
+
+const Sigevmaxsz = 64
+const Sigevpadsz = Sigevmaxsz / sizeof(int) - 4
+type sigevent = struct
+	value	: sigval
+	signo	: int
+	notify	: int
+	_pad	: int[Sigevpadsz]
+;;
+
+type timespec = struct
+	sec	: uint64
+	nsec	: uint64
+;;
+
+type timeval = struct
+	sec	: uint64
+	usec	: uint64
+;;
+
+type rusage = struct
+	utime	: timeval	/* user time */
+	stime	: timeval	/* system time */
+	_opaque	: uint64[14]	/* padding (darwin-specific data) */
+;;
+
+type sched_param = struct
+	priority	: int
+;;
+
+type statbuf = struct
+	dev	: uint64
+	ino	: uint64
+	nlink	: uint64
+	mode	: filemode
+	uid	: uint32
+	gid	: uint32
+	__pad0	: uint32
+	rdev	: uint64
+	size	: uint64
+	blksz	: uint32
+	blocks	: uint64
+	atime	: timespec
+	mtime	: timespec
+	ctime	: timespec
+	__pad1	: uint64[3]
+;;
+
+type dirent64 = struct
+	ino	: uint64
+	off	: uint64
+	reclen	: uint16
+	etype	: byte
+	name	: byte[...]	/* special case; zero length => unchecked indexing */
+;;
+
+type utsname = struct
+	system	: byte[65]
+	node	: byte[65]
+	release	: byte[65]
+	version	: byte[65]
+	machine	: byte[65]
+	domain	: byte[65]
+;;
+
+type sockaddr = struct
+	fam	: sockfam
+	data	: byte[14]
+;;
+
+type sockaddr_in = struct
+	fam	: sockfam
+	port	: uint16
+	addr	: byte[4]
+	zero	: byte[8]
+;;
+
+type sockaddr_in6 = struct
+	fam	: sockfam
+	port	: uint16
+	addr	: byte[16]
+	scope	: uint32
+;;
+
+type sockaddr_un = struct
+	fam	: sockfam
+	path	: byte[108]
+;;
+
+type sockaddr_storage = struct
+	fam	: sockfam
+	__align	: uint32
+	__pad	: byte[112]
+;;
+
+type epollevt = struct
+	events	: epollevttype
+	data	: byte[8]
+;;
+
+type pollfd = struct
+	fd	: fd
+	events	: pollevt
+	revents	: pollevt
+;;
+
+type iovec = struct
+	base	: byte#
+	len	: uint64
+;;
+
+type semun = struct
+	__pad	: void#
+;;
+
+type msgbuf = struct
+	mtype	: int64
+	buf	: byte[...]
+;;
+
+type msghdr = struct
+	name		: sockaddr#
+	namelen		: int32
+	iov		: iovec#
+	iovlen		: uint64
+	control		: byte#
+	controllen	: uint64
+	flags		: msgflags
+;;
+
+type mmsghdr = struct
+	hdr	: msghdr
+	len	: uint32
+;;
+
+type cmsghdr = struct
+	len	: uint64
+	level	: sockproto
+	cmtype	: cmsgtype
+	data	: byte[...]
+;;
+
+type capuserheader = struct
+	version	: uint32
+	pid	: int
+;;
+
+type capuserdata = struct
+	effective	: uint32
+	permitted	: uint32
+	inheritable	: uint32
+;;
+
+/* clone options */
+const Clonesignal	: cloneopt = 0xff
+const Clonevm		: cloneopt = 0x100
+const Clonefs		: cloneopt = 0x200
+const Clonefiles	: cloneopt = 0x400
+const Clonesighand	: cloneopt = 0x800
+const Cloneptrace	: cloneopt = 0x2000
+const Clonevfork	: cloneopt = 0x4000
+const Cloneparent	: cloneopt = 0x8000
+const Clonethread	: cloneopt = 0x10000
+const Clonenewns	: cloneopt = 0x20000
+const Clonesysvsem	: cloneopt = 0x40000
+const Clonesettls	: cloneopt = 0x80000
+const Cloneparentsettid	: cloneopt = 0x100000
+const Clonechildcleartid: cloneopt = 0x200000
+const Clonedetached	: cloneopt = 0x400000
+const Cloneuntraced	: cloneopt = 0x800000
+const Clonechildsettid	: cloneopt = 0x1000000
+const Clonenewuts	: cloneopt = 0x4000000
+const Clonenewipc	: cloneopt = 0x8000000
+const Clonenewuser	: cloneopt = 0x10000000
+const Clonenewpid	: cloneopt = 0x20000000
+const Clonenewnet	: cloneopt = 0x40000000
+const Cloneio		: cloneopt = 0x80000000
+
+type ptregs = struct
+;;
+
+/* open options */
+const Ordonly  	: fdopt = 0x0
+const Owronly  	: fdopt = 0x1
+const Ordwr    	: fdopt = 0x2
+const Ocreat   	: fdopt = 0x40
+const Oexcl  	: fdopt = 0x80
+const Otrunc   	: fdopt = 0x200
+const Oappend  	: fdopt = 0x400
+const Ondelay  	: fdopt = 0x800
+const Odirect	: fdopt = 0x4000
+const Olarge	: fdopt = 0x8000
+const Odir	: fdopt = 0x10000
+const Onofollow	: fdopt = 0x20000
+const Onoatime	: fdopt = 0x40000
+const Ocloexec	: fdopt = 0x80000
+
+/* stat modes */
+const Sifmt	: filemode = 0xf000
+const Sififo	: filemode = 0x1000
+const Sifchr	: filemode = 0x2000
+const Sifdir	: filemode = 0x4000
+const Sifblk	: filemode = 0x6000
+const Sifreg	: filemode = 0x8000
+const Siflnk	: filemode = 0xa000
+const Sifsock	: filemode = 0xc000
+
+/* mmap protection */
+const Mprotnone	: mprot = 0x0
+const Mprotrd	: mprot = 0x1
+const Mprotwr	: mprot = 0x2
+const Mprotexec	: mprot = 0x4
+const Mprotrw	: mprot = 0x3 /* convenience */
+
+/* mmap options */
+const Mshared	: mopt = 0x1
+const Mpriv	: mopt = 0x2
+const Mfixed	: mopt = 0x10
+const Mfile	: mopt = 0x0
+const Manon	: mopt = 0x20
+const M32bit	: mopt = 0x40
+
+/* socket families. INCOMPLETE. */
+const Afunspec	: sockfam = 0
+const Afunix	: sockfam = 1
+const Afinet	: sockfam = 2
+const Afinet6	: sockfam = 10
+
+/* socket types. */
+const Sockstream	: socktype = 1	/* sequenced, reliable byte stream */
+const Sockdgram		: socktype = 2	/* datagrams */
+const Sockraw		: socktype = 3	/* raw proto */
+const Sockrdm		: socktype = 4	/* reliably delivered messages */
+const Sockseqpacket	: socktype = 5	/* sequenced, reliable packets */
+const Sockdccp		: socktype = 6	/* data congestion control protocol */
+const Sockpack		: socktype = 10	/* linux specific packet */
+
+/* socket options */
+const Sodebug		: sockopt = 1
+const Soreuseaddr	: sockopt = 2
+const Sotype		: sockopt = 3
+const Soerror		: sockopt = 4
+const Sodontroute	: sockopt = 5
+const Sobroadcast	: sockopt = 6
+const Sosndbuf		: sockopt = 7
+const Sorcvbuf		: sockopt = 8
+const Sosndbufforce	: sockopt = 32
+const Sorcvbufforce	: sockopt = 33
+const Sokeepalive	: sockopt = 9
+const Sooobinline	: sockopt = 10
+const Sono_check	: sockopt = 11
+const Sopriority	: sockopt = 12
+const Solinger		: sockopt = 13
+const Sobsdcompat	: sockopt = 14
+const Soreuseport	: sockopt = 15
+const Sopasscred	: sockopt = 16
+const Sopeercred	: sockopt = 17
+const Sorcvlowat	: sockopt = 18
+const Sosndlowat	: sockopt = 19
+const Sorcvtimeo	: sockopt = 20
+const Sosndtimeo	: sockopt = 21
+
+/* socket option levels */
+const Solsocket		: sockproto = 1
+
+/* network protocols */
+const Ipproto_ip	: sockproto = 0
+const Ipproto_icmp	: sockproto = 1
+const Ipproto_tcp	: sockproto = 6
+const Ipproto_udp	: sockproto = 17
+const Ipproto_raw	: sockproto = 255
+
+/* message flags */
+const Msgoob		: msgflags = 0x0001
+const Msgpeek		: msgflags = 0x0002
+const Msgdontroute	: msgflags = 0x0004
+const Msgctrunc		: msgflags = 0x0008
+const Msgtrunc		: msgflags = 0x0020
+const Msgeor		: msgflags = 0x0080
+const Msgwaitall	: msgflags = 0x0100
+const Msgnosignal	: msgflags = 0x4000
+
+/* ancillary data */
+const Scmrights		: cmsgtype = 1
+
+/* epoll flags */
+const Epollcloexec	: epollflags	= 0o2000000
+
+/* epoll ops */
+const Epollctladd	: epollop	= 1
+const Epollctlmod	: epollop	= 2
+const Epollctldel	: epollop	= 3
+
+/* epoll events */
+const Epollin	: epollevttype = 0x001
+const Epollpri	: epollevttype = 0x002
+const Epollout	: epollevttype = 0x004
+const Epollerr	: epollevttype = 0x008
+const Epollhup	: epollevttype = 0x010
+const Epollrdnorm	: epollevttype = 0x040
+const Epollrdband	: epollevttype = 0x080
+const Epollwrnorm	: epollevttype = 0x100
+const Epollwrband	: epollevttype = 0x200
+const Epollmsg		: epollevttype = 0x400
+const Epollrdhup	: epollevttype = 0x2000
+const Epollwakeup	: epollevttype = 1 << 29
+const Epolloneshot	: epollevttype = 1 << 30
+const Epolledge	: epollevttype = 1 << 31
+
+/* futex ops */
+const Futexwait	: futexop = 0
+const Futexwake	: futexop = 1
+/* Futexfd: removed */
+const Futexrequeue	: futexop = 3
+const Futexcmprequeue	: futexop = 4
+const Futexwakeop	: futexop = 5
+const Futexlockpi	: futexop = 6
+const Futexunlockpi	: futexop = 7
+const Futextrylockpi	: futexop = 8
+const Futexwaitbitset	: futexop = 9
+const Futexwakebitset	: futexop = 10
+const Futexwaitrequeuepi	: futexop = 11
+const Futexcmprequeuepi	: futexop = 12
+
+const Futexpriv	: futexop = 128
+const Futexclockrt	: futexop = 256
+
+/* poll events : posix */
+const Pollin	: pollevt = 0x001	/* There is data to read.  */
+const Pollpri	: pollevt = 0x002	/* There is urgent data to read.  */
+const Pollout	: pollevt = 0x004	/* Writing now will not block.  */
+const Pollerr	: pollevt = 0x008           /* Error condition.  */
+const Pollhup	: pollevt = 0x010           /* Hung up.  */
+const Pollnval	: pollevt = 0x020           /* Invalid polling request.  */
+
+/* poll events: xopen */
+const Pollrdnorm	: pollevt = 0x040	/* Normal data may be read.  */
+const Pollrdband	: pollevt = 0x080	/* Priority data may be read.  */
+const Pollwrnorm	: pollevt = 0x100	/* Writing now will not block.  */
+const Pollwrband	: pollevt = 0x200	/* Priority data may be written.  */
+
+/* poll events: linux */
+const Pollmsg		: pollevt = 0x400
+const Pollremove	: pollevt = 0x1000
+const Pollrdhup		: pollevt = 0x2000
+
+const Seekset	: whence = 0
+const Seekcur	: whence = 1
+const Seekend	: whence = 2
+
+/* return value for a failed mapping */
+const Mapbad	: byte# = (-1 : byte#)
+
+/* signal flags */
+const Sanocldstop	: sigflags = 0x00000001
+const Sanocldwait	: sigflags = 0x00000002
+const Sasiginfo		: sigflags = 0x00000004
+const Sarestorer	: sigflags = 0x04000000
+const Saonstack		: sigflags = 0x08000000
+const Sarestart		: sigflags = 0x10000000
+const Sanodefer		: sigflags = 0x40000000
+const Saresethand	: sigflags = 0x80000000
+const Sanomask		: sigflags = Sanodefer
+const Saoneshot		: sigflags = Saresethand
+
+/* signal numbers */
+const Sighup	: signo = 1
+const Sigint	: signo = 2
+const Sigquit	: signo = 3
+const Sigill	: signo = 4
+const Sigtrap	: signo = 5
+const Sigabrt	: signo = 6
+const Sigiot	: signo = 6
+const Sigbus	: signo = 7
+const Sigfpe	: signo = 8
+const Sigkill	: signo = 9
+const Sigusr1	: signo = 10
+const Sigsegv	: signo = 11
+const Sigusr2	: signo = 12
+const Sigpipe	: signo = 13
+const Sigalrm	: signo = 14
+const Sigterm	: signo = 15
+const Sigstkflt	: signo = 16
+const Sigchld	: signo = 17
+const Sigcont	: signo = 18
+const Sigstop	: signo = 19
+const Sigtstp	: signo = 20
+const Sigttin	: signo = 21
+const Sigttou	: signo = 22
+const Sigurg	: signo = 23
+const Sigxcpu	: signo = 24
+const Sigxfsz	: signo = 25
+const Sigvtalrm	: signo = 26
+const Sigprof	: signo = 27
+const Sigwinch	: signo = 28
+const Sigio	: signo = 29
+const Sigpoll	: signo = Sigio
+
+/* fallocate mode */
+const Fallockeepsize		: fallocmode = 0x01
+const Fallocpunchhole		: fallocmode = 0x02
+const Fallocnohidestale		: fallocmode = 0x04
+const Falloccollapserange	: fallocmode = 0x08
+const Falloczerorange		: fallocmode = 0x10
+const Fallocinsertrange		: fallocmode = 0x20
+
+/* memfd flags */
+const Mfdcloexec	: mfdflags = 0x01
+const Mfdallowsealing	: mfdflags = 0x02
+
+/* exported values: initialized by start code */
+extern var __cenvp : byte##
+
--- /dev/null
+++ b/support/syscall-gen/types+openbsd:6.1-x64.frag
@@ -1,0 +1,396 @@
+type size	= int64	/* spans entire address space */
+type usize	= uint64	/* unsigned size */
+type off	= int64	/* file offsets */
+type intptr	= uint64/* can hold any pointer losslessly */
+type time	= int64	/* milliseconds since epoch */
+type pid	= int32	/* process id */
+type scno	= int64	/*syscall*/
+type fdopt	= int64	/* fd options */
+type fd		= int32	/* fd */
+type whence	= uint64	/* seek from whence */
+type mprot	= int64	/* memory protection */
+type mopt	= int64	/* memory mapping options */
+type socktype	= int64	/* socket type */
+type sockproto	= int64	/* socket protocol */
+type sockopt	= int32	/* socket option */
+type sockfam	= uint8	/* socket family */
+type filemode	= uint32
+type filetype	= uint8
+type fcntlcmd	= int64
+type signo	= int32
+type sigflags	= int32
+type sigset	= uint32
+type msg	= void
+
+type clock = union
+	`Clockrealtime
+	`Clockmonotonic
+	`Clockproccputime
+	`Clockthreadcputime
+	`Clockuptime
+;;
+
+type waitstatus = union
+	`Waitfail int32
+	`Waitexit int32
+	`Waitsig  int32
+	`Waitstop int32
+;;
+
+type timespec = struct
+	sec	: uint64
+	nsec	: uint64 
+;;
+
+type timeval = struct
+	sec	: uint64
+	usec	: uint64
+;;
+
+
+type pollfd = struct
+	fd      : fd
+	events  : uint16
+	revents : uint16
+;;
+
+type sigaction = struct
+	handler	: byte#	/* code pointer */
+	mask	: sigset
+	flags	: sigflags
+;;
+
+const Simaxsz	= 128
+const Sipad	= (Simaxsz / 4) - 3
+type siginfo = struct
+	signo	: int
+	code	: int
+	errno	: int
+	pad	: int[Sipad]
+;;
+
+type rusage = struct
+	utime	: timeval /* user time */
+	stime	: timeval /* system time */
+	maxrss	: uint64 /* max resident set size*/
+	ixrss	: uint64 /* shared text size */
+	idrss	: uint64 /* unshared data size */
+	isrss	: uint64 /* unshared stack size */
+	minflt	: uint64 /* page reclaims */
+	majflt	: uint64 /* page faults */
+	nswap	: uint64 /* swaps */
+	inblock	: uint64 /* block input ops */
+	oublock	: uint64 /* block output ops */
+	msgsnd	: uint64 /* messages sent */	
+	msgrcv	: uint64 /* messages received */
+	nsignals : uint64 /* signals received */
+	nvcsw	: uint64 /* voluntary context switches */
+	nivcsw	: uint64 /* involuntary context switches */
+;;
+
+type tforkparams = struct
+	tcb	: void#
+	tid	: pid#
+	stk	: byte#
+;;
+
+type statbuf = struct
+	mode	: filemode
+	dev	: uint32 
+	ino	: uint64
+	nlink	: uint32
+	uid	: uint32
+	gid	: uint32
+	rdev	: uint32
+	atime	: timespec
+	mtime	: timespec
+	ctime	: timespec
+	size	: off
+	blocks	: int64
+	blksize	: uint32
+	flags	: uint32
+	gen	: uint32
+	birthtim	: timespec 
+;;
+
+type semun = struct
+	semarr	: void#
+;;
+
+const Mfsnamelen 	= 16	/* length of fs type name, including nul */
+const Mnamelen		= 90	/* length of buffer for returned name */
+
+type statfs = struct
+	flags	: uint32	/* copy of mount flags */
+	bsize	: uint32	/* file system block size */
+	iosize	: uint32	/* optimal transfer block size */
+
+		        	/* unit is f_bsize */
+	blocks	: uint64	/* total data blocks in file system */
+	bfree	: uint64	/* free blocks in fs */
+	bavail	: int64		/* free blocks avail to non-superuser */
+
+	files	: int64		/* total file nodes in file system */
+	ffree	: int64		/* free file nodes in fs */
+	favail	: int64		/* free file nodes avail to non-root */
+
+	syncwr	: int64		/* count of sync writes since mount */
+	syncrd	: int64		/* count of sync reads since mount */
+	asyncwr	: int64		/* count of async writes since mount */
+	asyncrd	: int64		/* count of async reads since mount */
+
+	fsid	: fsid		/* file system id */
+	namemax	: uint32	/* maximum filename length */
+	owner	: uid		/* user that mounted the file system */
+	ctime	: uint64	/* last mount [-u] time */
+
+	fstypename	: byte[Mfsnamelen];	/* fs type name */
+	mntonname	: byte[Mnamelen];	/* directory on which mounted */
+	mntfromname	: byte[Mnamelen];	/* mounted file system */
+	mntfromspec	: byte[Mnamelen];	/* special for mount request */
+	///union mount_info mount_info;	/* per-filesystem mount options */
+	__mountinfo	: byte[160];	/* storage for 'union mount_info' */
+;;
+
+type utsname = struct
+	system	: byte[32]
+	node : byte[32] 
+	release : byte[32]
+	version : byte[32]
+	machine : byte[32]
+;;
+
+type sockaddr = struct
+	len	: byte
+	fam	: sockfam
+	data	: byte[14] /* what is the *actual* length? */
+;;
+
+type sockaddr_in = struct
+	len	: byte
+	fam	: sockfam
+	port	: uint16
+	addr	: byte[4]
+	zero	: byte[8]
+;;
+
+type sockaddr_in6 = struct
+	len	: byte
+	fam	: sockfam
+	port	: uint16
+	flow	: uint32
+	addr	: byte[16]
+	scope	: uint32
+;;
+
+type sockaddr_un = struct
+	len	: uint8
+	fam	: sockfam
+	path	: byte[104]
+;;
+
+type sockaddr_storage = struct
+	len	: byte
+	fam	: sockfam
+	__pad1  : byte[6]
+	__align : int64
+	__pad2  : byte[240]
+;;	
+
+type dirent = struct
+	fileno	: uint64
+	off	: uint64
+	reclen	: uint16
+	ftype	: uint8
+	namlen	: uint8
+	__pad	: byte[4]
+	name	: byte[256]	
+;;
+
+type iovec = struct
+	base	: byte#
+	len	: uint64
+;;
+
+/* open options */
+const Ordonly  	: fdopt = 0x0
+const Owronly  	: fdopt = 0x1
+const Ordwr    	: fdopt = 0x2
+const Oappend  	: fdopt = 0x8
+const Ondelay  	: fdopt = 0x4
+const Oshlock	: fdopt = 0x10		/* open with shared file lock */
+const Oexlock	: fdopt = 0x20		/* open with exclusive file lock */
+const Oasync	: fdopt = 0x40		/* signal pgrp when data ready */
+const Osync	: fdopt = 0x80		/* backwards compatibility */
+const Onofollow	: fdopt = 0x100
+const Ocreat   	: fdopt = 0x200
+const Otrunc   	: fdopt = 0x400
+const Oexcl   	: fdopt = 0x800
+const Ocloexec	: fdopt = 0x10000
+const Odsync	: fdopt = Osync		/* synchronous data writes */
+const Orsync	: fdopt = Osync		/* synchronous reads */
+const Odir	: fdopt = 0x20000
+
+/* poll options */
+const Pollin	: uint16 = 0x0001
+const Pollpri	: uint16 = 0x0002
+const Pollout	: uint16 = 0x0004
+const Pollerr	: uint16 = 0x0008
+const Pollhup	: uint16 = 0x0010
+const Pollnval	: uint16 = 0x0020
+const Pollnorm	: uint16 = 0x0040
+const Pollrdband: uint16 = 0x0080
+const Pollwrband: uint16 = 0x0100
+
+/* stat modes */	
+const Sifmt	: filemode = 0xf000
+const Sififo	: filemode = 0x1000
+const Sifchr	: filemode = 0x2000
+const Sifdir	: filemode = 0x4000
+const Sifblk	: filemode = 0x6000
+const Sifreg	: filemode = 0x8000
+const Siflnk	: filemode = 0xa000
+const Sifsock 	: filemode = 0xc000
+const Sisvtx 	: filemode = 0x0200
+
+/* mmap protection */
+const Mprotnone	: mprot = 0x0
+const Mprotrd	: mprot = 0x1
+const Mprotwr	: mprot = 0x2
+const Mprotexec	: mprot = 0x4
+const Mprotrw	: mprot = 0x3
+
+/* mmap options */
+const Mshared	: mopt = 0x1
+const Mpriv	: mopt = 0x2
+const Mfixed	: mopt = 0x10
+const Mfile	: mopt = 0x0
+const Manon	: mopt = 0x1000
+const Mnoreplace	: mopt = 0x0800
+
+/* file types */
+const Dtunknown	: filetype = 0
+const Dtfifo	: filetype = 1
+const Dtchr	: filetype = 2
+const Dtdir	: filetype = 4
+const Dtblk	: filetype = 6
+const Dtreg	: filetype = 8
+const Dtlnk	: filetype = 10
+const Dtsock	: filetype = 12
+
+/* socket families. INCOMPLETE. */
+const Afunspec	: sockfam = 0
+const Afunix	: sockfam = 1
+const Afinet	: sockfam = 2
+const Afinet6	: sockfam = 24
+
+/* socket types. */
+const Sockstream	: socktype = 1
+const Sockdgram		: socktype = 2
+const Sockraw		: socktype = 3
+const Sockrdm		: socktype = 4
+const Sockseqpacket	: socktype = 5
+
+/* socket options */
+const Sodebug		: sockopt = 0x0001	/* turn on debugging info recording */
+const Soacceptconn	: sockopt = 0x0002	/* socket has had listen() */
+const Soreuseaddr	: sockopt = 0x0004	/* allow local address reuse */
+const Sokeepalive	: sockopt = 0x0008	/* keep connections alive */
+const Sodontroute	: sockopt = 0x0010	/* just use interface addresses */
+const Sobroadcast	: sockopt = 0x0020	/* permit sending of broadcast msgs */
+const Souseloopback	: sockopt = 0x0040	/* bypass hardware when possible */
+const Solinger		: sockopt = 0x0080	/* linger on close if data present */
+const Sooobinline	: sockopt = 0x0100	/* leave received OOB data in line */
+const Soreuseport	: sockopt = 0x0200	/* allow local address & port reuse */
+const Sotimestamp	: sockopt = 0x0800	/* timestamp received dgram traffic */
+const Sobindany		: sockopt = 0x1000	/* allow bind to any address */
+const Sosndbuf		: sockopt = 0x1001	/* send buffer size */
+const Sorcvbuf		: sockopt = 0x1002	/* receive buffer size */
+const Sosndlowat	: sockopt = 0x1003	/* send low-water mark */
+const Sorcvlowat	: sockopt = 0x1004	/* receive low-water mark */
+const Sosndtimeo	: sockopt = 0x1005	/* send timeout */
+const Sorcvtimeo	: sockopt = 0x1006	/* receive timeout */
+const Soerror		: sockopt = 0x1007	/* get error status and clear */
+const Sotype		: sockopt = 0x1008	/* get socket type */
+const Sonetproc		: sockopt = 0x1020	/* multiplex; network processing */
+const Sortable		: sockopt = 0x1021	/* routing table to be used */
+const Sopeercred	: sockopt = 0x1022	/* get connect-time credentials */
+const Sosplice		: sockopt = 0x1023	/* splice data to other socket */
+
+/* socket option levels */
+const Solsocket		: sockproto = 0xffff
+
+/* network protocols */
+const Ipproto_ip	: sockproto = 0
+const Ipproto_icmp	: sockproto = 1
+const Ipproto_tcp	: sockproto = 6
+const Ipproto_udp	: sockproto = 17
+const Ipproto_raw	: sockproto = 255
+
+const Seekset	: whence = 0
+const Seekcur	: whence = 1
+const Seekend	: whence = 2
+
+/* system specific constants */
+const Maxpathlen	: size = 1024
+
+/* fcntl constants */
+const Fdupfd	 : fcntlcmd = 0		/* duplicate file descriptor */
+const Fgetfd	 : fcntlcmd = 1		/* get file descriptor flags */
+const Fsetfd	 : fcntlcmd = 2		/* set file descriptor flags */
+const Fgetfl	 : fcntlcmd = 3		/* get file status flags */
+const Fsetfl	 : fcntlcmd = 4		/* set file status flags */
+const Fgetown	 : fcntlcmd = 5		/* get SIGIO/SIGURG proc/pgrp */
+const Fsetown	 : fcntlcmd = 6		/* set SIGIO/SIGURG proc/pgrp */
+const Fogetlk	 : fcntlcmd = 7		/* get record locking information */
+const Fosetlk	 : fcntlcmd = 8		/* set record locking information */
+
+/* return value for a failed mapping */
+const Mapbad	: byte# = (-1 : byte#)
+
+/* signal flags */
+const Saonstack		: sigflags = 0x0001	/* take signal on signal stack */
+const Sarestart		: sigflags = 0x0002	/* restart system on signal return */
+const Saresethand	: sigflags = 0x0004	/* reset to SIG_DFL when taking signal */
+const Sanodefer		: sigflags = 0x0010	/* don't mask the signal we're delivering */
+const Sanocldwait	: sigflags = 0x0020	/* don't create zombies (assign to pid 1) */
+const Sanocldstop	: sigflags = 0x0008	/* do not generate SIGCHLD on child stop */
+const Sasiginfo		: sigflags = 0x0040	/* generate siginfo_t */
+
+/* signals */
+const Sighup	: signo = 1	/* hangup */
+const Sigint	: signo = 2	/* interrupt */
+const Sigquit	: signo = 3	/* quit */
+const Sigill	: signo = 4	/* illegal instruction (not reset when caught) */
+const Sigtrap	: signo = 5	/* trace trap (not reset when caught) */
+const Sigabrt	: signo = 6	/* abort() */
+const Sigiot	: signo = Sigabrt	/* compatibility */
+const Sigemt	: signo = 7	/* EMT instruction */
+const Sigfpe	: signo = 8	/* floating point exception */
+const Sigkill	: signo = 9	/* kill (cannot be caught or ignored) */
+const Sigbus	: signo = 10	/* bus error */
+const Sigsegv	: signo = 11	/* segmentation violation */
+const Sigsys	: signo = 12	/* bad argument to system call */
+const Sigpipe	: signo = 13	/* write on a pipe with no one to read it */
+const Sigalrm	: signo = 14	/* alarm clock */
+const Sigterm	: signo = 15	/* software termination signal from kill */
+const Sigurg	: signo = 16	/* urgent condition on IO channel */
+const Sigstop	: signo = 17	/* sendable stop signal not from tty */
+const Sigtstp	: signo = 18	/* stop signal from tty */
+const Sigcont	: signo = 19	/* continue a stopped process */
+const Sigchld	: signo = 20	/* to parent on child stop or exit */
+const Sigttin	: signo = 21	/* to readers pgrp upon background tty read */
+const Sigttou	: signo = 22	/* like TTIN for output if (tp->t_local&LTOSTOP) */
+const Sigio	: signo = 23	/* input/output possible signal */
+const Sigxcpu	: signo = 24	/* exceeded CPU time limit */
+const Sigxfsz	: signo = 25	/* exceeded file size limit */
+const Sigvtalrm : signo = 26	/* virtual time alarm */
+const Sigprof	: signo = 27	/* profiling time alarm */
+const Sigwinch	: signo = 28	/* window size changes */
+const Siginfo	: signo = 29	/* information request */
+const Sigusr1	: signo = 30	/* user defined signal 1 */
+const Sigusr2	: signo = 31	/* user defined signal 2 */
+const Sigthr	: signo = 32	/* thread library AST */
+
+extern const syscall : (sc:scno, args:... -> int64)
+extern var __cenvp : byte##