authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-05-03 20:48:53-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-05-03 20:48:53-07:00
log66ed7a5eb51580fb8f02e16f16ccad31abe0bcc1
tree1cd1dbe583a884695fa168cfeab79d30eefdd1bd
parent7f589c0cab105a79ff6d71233538dca8a39f8152

beginnings of network standard library code


8 files changed, 889 insertions(+), 33 deletions(-)

CMakeLists.txt+1
......@@ -203,6 +203,7 @@ install(FILES "${CMAKE_SOURCE_DIR}/std/test_runner.zig" DESTINATION "${ZIG_STD_D
203203install(FILES "${CMAKE_SOURCE_DIR}/std/test_runner_libc.zig" DESTINATION "${ZIG_STD_DEST}")
204204install(FILES "${CMAKE_SOURCE_DIR}/std/test_runner_nolibc.zig" DESTINATION "${ZIG_STD_DEST}")
205205install(FILES "${CMAKE_SOURCE_DIR}/std/io.zig" DESTINATION "${ZIG_STD_DEST}")
206install(FILES "${CMAKE_SOURCE_DIR}/std/net.zig" DESTINATION "${ZIG_STD_DEST}")
206207install(FILES "${CMAKE_SOURCE_DIR}/std/os.zig" DESTINATION "${ZIG_STD_DEST}")
207208install(FILES "${CMAKE_SOURCE_DIR}/std/str.zig" DESTINATION "${ZIG_STD_DEST}")
208209install(FILES "${CMAKE_SOURCE_DIR}/std/linux.zig" DESTINATION "${ZIG_STD_DEST}")
src/analyze.cpp+33-28
......@@ -1728,25 +1728,28 @@ static void add_global_const_expr(CodeGen *g, AstNode *expr_node) {
17281728}
17291729
17301730static bool num_lit_fits_in_other_type(CodeGen *g, AstNode *literal_node, TypeTableEntry *other_type) {
1731 if (other_type->id == TypeTableEntryIdInvalid) {
1731 TypeTableEntry *other_type_underlying = get_underlying_type(other_type);
1732
1733 if (other_type_underlying->id == TypeTableEntryIdInvalid) {
17321734 return false;
17331735 }
1736
17341737 Expr *expr = get_resolved_expr(literal_node);
17351738 ConstExprValue *const_val = &expr->const_val;
17361739 assert(const_val->ok);
1737 if (other_type->id == TypeTableEntryIdFloat) {
1740 if (other_type_underlying->id == TypeTableEntryIdFloat) {
17381741 return true;
1739 } else if (other_type->id == TypeTableEntryIdInt &&
1742 } else if (other_type_underlying->id == TypeTableEntryIdInt &&
17401743 const_val->data.x_bignum.kind == BigNumKindInt)
17411744 {
1742 if (bignum_fits_in_bits(&const_val->data.x_bignum, other_type->data.integral.bit_count,
1743 other_type->data.integral.is_signed))
1745 if (bignum_fits_in_bits(&const_val->data.x_bignum, other_type_underlying->data.integral.bit_count,
1746 other_type_underlying->data.integral.is_signed))
17441747 {
17451748 return true;
17461749 }
1747 } else if ((other_type->id == TypeTableEntryIdNumLitFloat &&
1750 } else if ((other_type_underlying->id == TypeTableEntryIdNumLitFloat &&
17481751 const_val->data.x_bignum.kind == BigNumKindFloat) ||
1749 (other_type->id == TypeTableEntryIdNumLitInt &&
1752 (other_type_underlying->id == TypeTableEntryIdNumLitInt &&
17501753 const_val->data.x_bignum.kind == BigNumKindInt))
17511754 {
17521755 return true;
......@@ -4032,9 +4035,11 @@ static TypeTableEntry *analyze_cast_expr(CodeGen *g, ImportTableEntry *import, B
40324035 AstNode *expr_node = node->data.fn_call_expr.params.at(0);
40334036 TypeTableEntry *wanted_type = resolve_type(g, fn_ref_expr);
40344037 TypeTableEntry *actual_type = analyze_expression(g, import, context, nullptr, expr_node);
4038 TypeTableEntry *wanted_type_canon = get_underlying_type(wanted_type);
4039 TypeTableEntry *actual_type_canon = get_underlying_type(actual_type);
40354040
4036 if (wanted_type->id == TypeTableEntryIdInvalid ||
4037 actual_type->id == TypeTableEntryIdInvalid)
4041 if (wanted_type_canon->id == TypeTableEntryIdInvalid ||
4042 actual_type_canon->id == TypeTableEntryIdInvalid)
40384043 {
40394044 return g->builtin_types.entry_invalid;
40404045 }
......@@ -4045,46 +4050,46 @@ static TypeTableEntry *analyze_cast_expr(CodeGen *g, ImportTableEntry *import, B
40454050 }
40464051
40474052 // explicit cast from bool to int
4048 if (wanted_type->id == TypeTableEntryIdInt &&
4049 actual_type->id == TypeTableEntryIdBool)
4053 if (wanted_type_canon->id == TypeTableEntryIdInt &&
4054 actual_type_canon->id == TypeTableEntryIdBool)
40504055 {
40514056 return resolve_cast(g, context, node, expr_node, wanted_type, CastOpBoolToInt, false);
40524057 }
40534058
40544059 // explicit cast from pointer to isize or usize
4055 if ((wanted_type == g->builtin_types.entry_isize || wanted_type == g->builtin_types.entry_usize) &&
4056 actual_type->id == TypeTableEntryIdPointer)
4060 if ((wanted_type_canon == g->builtin_types.entry_isize || wanted_type_canon == g->builtin_types.entry_usize) &&
4061 actual_type_canon->id == TypeTableEntryIdPointer)
40574062 {
40584063 return resolve_cast(g, context, node, expr_node, wanted_type, CastOpPtrToInt, false);
40594064 }
40604065
40614066
40624067 // explicit cast from isize or usize to pointer
4063 if (wanted_type->id == TypeTableEntryIdPointer &&
4064 (actual_type == g->builtin_types.entry_isize || actual_type == g->builtin_types.entry_usize))
4068 if (wanted_type_canon->id == TypeTableEntryIdPointer &&
4069 (actual_type_canon == g->builtin_types.entry_isize || actual_type_canon == g->builtin_types.entry_usize))
40654070 {
40664071 return resolve_cast(g, context, node, expr_node, wanted_type, CastOpIntToPtr, false);
40674072 }
40684073
40694074 // explicit widening or shortening cast
4070 if ((wanted_type->id == TypeTableEntryIdInt &&
4071 actual_type->id == TypeTableEntryIdInt) ||
4072 (wanted_type->id == TypeTableEntryIdFloat &&
4073 actual_type->id == TypeTableEntryIdFloat))
4075 if ((wanted_type_canon->id == TypeTableEntryIdInt &&
4076 actual_type_canon->id == TypeTableEntryIdInt) ||
4077 (wanted_type_canon->id == TypeTableEntryIdFloat &&
4078 actual_type_canon->id == TypeTableEntryIdFloat))
40744079 {
40754080 return resolve_cast(g, context, node, expr_node, wanted_type, CastOpWidenOrShorten, false);
40764081 }
40774082
40784083 // explicit cast from int to float
4079 if (wanted_type->id == TypeTableEntryIdFloat &&
4080 actual_type->id == TypeTableEntryIdInt)
4084 if (wanted_type_canon->id == TypeTableEntryIdFloat &&
4085 actual_type_canon->id == TypeTableEntryIdInt)
40814086 {
40824087 return resolve_cast(g, context, node, expr_node, wanted_type, CastOpIntToFloat, false);
40834088 }
40844089
40854090 // explicit cast from float to int
4086 if (wanted_type->id == TypeTableEntryIdInt &&
4087 actual_type->id == TypeTableEntryIdFloat)
4091 if (wanted_type_canon->id == TypeTableEntryIdInt &&
4092 actual_type_canon->id == TypeTableEntryIdFloat)
40884093 {
40894094 return resolve_cast(g, context, node, expr_node, wanted_type, CastOpFloatToInt, false);
40904095 }
......@@ -4164,17 +4169,17 @@ static TypeTableEntry *analyze_cast_expr(CodeGen *g, ImportTableEntry *import, B
41644169 if (actual_type->id == TypeTableEntryIdNumLitFloat ||
41654170 actual_type->id == TypeTableEntryIdNumLitInt)
41664171 {
4167 if (num_lit_fits_in_other_type(g, expr_node, wanted_type)) {
4172 if (num_lit_fits_in_other_type(g, expr_node, wanted_type_canon)) {
41684173 CastOp op;
41694174 if ((actual_type->id == TypeTableEntryIdNumLitFloat &&
4170 wanted_type->id == TypeTableEntryIdFloat) ||
4175 wanted_type_canon->id == TypeTableEntryIdFloat) ||
41714176 (actual_type->id == TypeTableEntryIdNumLitInt &&
4172 wanted_type->id == TypeTableEntryIdInt))
4177 wanted_type_canon->id == TypeTableEntryIdInt))
41734178 {
41744179 op = CastOpNoop;
4175 } else if (wanted_type->id == TypeTableEntryIdInt) {
4180 } else if (wanted_type_canon->id == TypeTableEntryIdInt) {
41764181 op = CastOpFloatToInt;
4177 } else if (wanted_type->id == TypeTableEntryIdFloat) {
4182 } else if (wanted_type_canon->id == TypeTableEntryIdFloat) {
41784183 op = CastOpIntToFloat;
41794184 } else {
41804185 zig_unreachable();
src/codegen.cpp+6-2
......@@ -594,10 +594,14 @@ static LLVMValueRef gen_enum_value_expr(CodeGen *g, AstNode *node, TypeTableEntr
594594 }
595595}
596596
597static LLVMValueRef gen_widen_or_shorten(CodeGen *g, AstNode *source_node, TypeTableEntry *actual_type,
598 TypeTableEntry *wanted_type, LLVMValueRef expr_val)
597static LLVMValueRef gen_widen_or_shorten(CodeGen *g, AstNode *source_node, TypeTableEntry *actual_type_non_canon,
598 TypeTableEntry *wanted_type_non_canon, LLVMValueRef expr_val)
599599{
600 TypeTableEntry *actual_type = get_underlying_type(actual_type_non_canon);
601 TypeTableEntry *wanted_type = get_underlying_type(wanted_type_non_canon);
602
600603 assert(actual_type->id == wanted_type->id);
604
601605 uint64_t actual_bits;
602606 uint64_t wanted_bits;
603607 if (actual_type->id == TypeTableEntryIdFloat) {
std/index.zig+1
......@@ -3,6 +3,7 @@ pub const io = @import("io.zig");
33pub const os = @import("os.zig");
44pub const math = @import("math.zig");
55pub const str = @import("str.zig");
6pub const net = @import("net.zig");
67
78pub fn assert(b: bool) {
89 if (!b) unreachable{}
std/linux.zig+97
......@@ -3,6 +3,7 @@ const arch = switch (@compile_var("arch")) {
33 i386 => @import("linux_i386.zig"),
44 else => unreachable{},
55};
6const errno = @import("errno.zig");
67
78pub const MMAP_PROT_NONE = 0;
89pub const MMAP_PROT_READ = 1;
......@@ -79,6 +80,22 @@ const SIG_BLOCK = 0;
7980const SIG_UNBLOCK = 1;
8081const SIG_SETMASK = 2;
8182
83const SOCK_STREAM = 1;
84const SOCK_DGRAM = 2;
85const SOCK_RAW = 3;
86pub const SOCK_RDM = 4;
87pub const SOCK_SEQPACKET = 5;
88pub const SOCK_DCCP = 6;
89pub const SOCK_PACKET = 10;
90pub const SOCK_CLOEXEC = 0o2000000;
91pub const SOCK_NONBLOCK = 0o4000;
92
93
94/// Get the errno from a syscall return value, or 0 for no error.
95pub fn get_errno(r: isize) -> isize {
96 if (r > -4096) -r else 0
97}
98
8299pub fn mmap(address: ?&u8, length: isize, prot: isize, flags: isize, fd: isize, offset: isize) -> isize {
83100 // TODO ability to cast maybe pointer to isize
84101 const addr = if (const unwrapped ?= address) isize(unwrapped) else 0;
......@@ -164,3 +181,83 @@ fn block_app_signals(set: &sigset_t) {
164181fn restore_signals(set: &sigset_t) {
165182 arch.syscall4(arch.SYS_rt_sigprocmask, SIG_SETMASK, isize(set), 0, NSIG/8);
166183}
184
185
186pub type sa_family_t = u16;
187pub type socklen_t = u32;
188
189export struct sockaddr {
190 sa_family: sa_family_t,
191 sa_data: [14]u8,
192}
193
194export struct iovec {
195 iov_base: &u8,
196 iov_len: usize,
197}
198
199pub fn getsockname(fd: i32, noalias addr: &sockaddr, noalias len: &socklen_t) -> isize {
200 arch.syscall3(arch.SYS_getsockname, fd, isize(addr), isize(len))
201}
202
203pub fn getpeername(fd: i32, noalias addr: &sockaddr, noalias len: &socklen_t) -> isize {
204 arch.syscall3(arch.SYS_getpeername, fd, isize(addr), isize(len))
205}
206
207pub fn socket(domain: i32, socket_type: i32, protocol: i32) -> isize {
208 arch.syscall3(arch.SYS_socket, domain, socket_type, protocol)
209}
210
211pub fn setsockopt(fd: i32, level: i32, optname: i32, optval: &const u8, optlen: socklen_t) -> isize {
212 arch.syscall5(arch.SYS_setsockopt, fd, level, optname, isize(optval), isize(optlen))
213}
214
215pub fn getsockopt(fd: i32, level: i32, optname: i32, noalias optval: &u8, noalias optlen: &socklen_t) -> isize {
216 arch.syscall5(arch.SYS_getsockopt, fd, level, optname, isize(optval), isize(optlen))
217}
218
219pub fn sendmsg(fd: i32, msg: &const arch.msghdr, flags: i32) -> isize {
220 arch.syscall3(arch.SYS_sendmsg, fd, isize(msg), flags)
221}
222
223pub fn connect(fd: i32, addr: &const sockaddr, len: socklen_t) -> isize {
224 arch.syscall3(arch.SYS_connect, fd, isize(addr), isize(len))
225}
226
227pub fn accept(fd: i32, noalias addr: &sockaddr, noalias len: &socklen_t) -> isize {
228 arch.syscall3(arch.SYS_accept, fd, isize(addr), isize(len))
229}
230
231pub fn recvmsg(fd: i32, msg: &arch.msghdr, flags: i32) -> isize {
232 arch.syscall3(arch.SYS_recvmsg, fd, isize(msg), flags)
233}
234
235pub fn recvfrom(fd: i32, noalias buf: &u8, len: isize, flags: i32,
236 noalias addr: &sockaddr, noalias alen: &socklen_t) -> isize
237{
238 arch.syscall6(arch.SYS_recvfrom, fd, isize(buf), len, flags, isize(addr), isize(alen))
239}
240
241pub fn shutdown(fd: i32, how: i32) -> isize {
242 arch.syscall2(arch.SYS_shutdown, fd, how)
243}
244
245pub fn bind(fd: i32, addr: &const sockaddr, len: socklen_t) {
246 arch.syscall3(arch.SYS_bind, fd, isize(addr), isize(len));
247}
248
249pub fn listen(fd: i32, backlog: i32) -> isize {
250 arch.syscall2(arch.SYS_listen, fd, backlog)
251}
252
253pub fn sendto(fd: i32, buf: &const u8, len: isize, flags: i32, addr: &const sockaddr, alen: socklen_t) -> isize {
254 arch.syscall6(arch.SYS_sendto, fd, isize(buf), len, flags, isize(addr), isize(alen))
255}
256
257pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: [2]i32) -> isize {
258 arch.syscall4(arch.SYS_socketpair, domain, socket_type, protocol, isize(&fd[0]))
259}
260
261pub fn accept4(fd: i32, noalias addr: &sockaddr, noalias len: &socklen_t, flags: i32) -> isize {
262 arch.syscall4(arch.SYS_accept4, fd, isize(addr), isize(len), flags)
263}
std/linux_i386.zig+406-1
......@@ -1,3 +1,383 @@
1const linux = @import("linux.zig");
2const socklen_t = linux.socklen_t;
3const iovec = linux.iovec;
4
5pub const SYS_restart_syscall = 0;
6pub const SYS_exit = 1;
7pub const SYS_fork = 2;
8pub const SYS_read = 3;
9pub const SYS_write = 4;
10pub const SYS_open = 5;
11pub const SYS_close = 6;
12pub const SYS_waitpid = 7;
13pub const SYS_creat = 8;
14pub const SYS_link = 9;
15pub const SYS_unlink = 10;
16pub const SYS_execve = 11;
17pub const SYS_chdir = 12;
18pub const SYS_time = 13;
19pub const SYS_mknod = 14;
20pub const SYS_chmod = 15;
21pub const SYS_lchown = 16;
22pub const SYS_break = 17;
23pub const SYS_oldstat = 18;
24pub const SYS_lseek = 19;
25pub const SYS_getpid = 20;
26pub const SYS_mount = 21;
27pub const SYS_umount = 22;
28pub const SYS_setuid = 23;
29pub const SYS_getuid = 24;
30pub const SYS_stime = 25;
31pub const SYS_ptrace = 26;
32pub const SYS_alarm = 27;
33pub const SYS_oldfstat = 28;
34pub const SYS_pause = 29;
35pub const SYS_utime = 30;
36pub const SYS_stty = 31;
37pub const SYS_gtty = 32;
38pub const SYS_access = 33;
39pub const SYS_nice = 34;
40pub const SYS_ftime = 35;
41pub const SYS_sync = 36;
42pub const SYS_kill = 37;
43pub const SYS_rename = 38;
44pub const SYS_mkdir = 39;
45pub const SYS_rmdir = 40;
46pub const SYS_dup = 41;
47pub const SYS_pipe = 42;
48pub const SYS_times = 43;
49pub const SYS_prof = 44;
50pub const SYS_brk = 45;
51pub const SYS_setgid = 46;
52pub const SYS_getgid = 47;
53pub const SYS_signal = 48;
54pub const SYS_geteuid = 49;
55pub const SYS_getegid = 50;
56pub const SYS_acct = 51;
57pub const SYS_umount2 = 52;
58pub const SYS_lock = 53;
59pub const SYS_ioctl = 54;
60pub const SYS_fcntl = 55;
61pub const SYS_mpx = 56;
62pub const SYS_setpgid = 57;
63pub const SYS_ulimit = 58;
64pub const SYS_oldolduname = 59;
65pub const SYS_umask = 60;
66pub const SYS_chroot = 61;
67pub const SYS_ustat = 62;
68pub const SYS_dup2 = 63;
69pub const SYS_getppid = 64;
70pub const SYS_getpgrp = 65;
71pub const SYS_setsid = 66;
72pub const SYS_sigaction = 67;
73pub const SYS_sgetmask = 68;
74pub const SYS_ssetmask = 69;
75pub const SYS_setreuid = 70;
76pub const SYS_setregid = 71;
77pub const SYS_sigsuspend = 72;
78pub const SYS_sigpending = 73;
79pub const SYS_sethostname = 74;
80pub const SYS_setrlimit = 75;
81pub const SYS_getrlimit = 76;
82pub const SYS_getrusage = 77;
83pub const SYS_gettimeofday = 78;
84pub const SYS_settimeofday = 79;
85pub const SYS_getgroups = 80;
86pub const SYS_setgroups = 81;
87pub const SYS_select = 82;
88pub const SYS_symlink = 83;
89pub const SYS_oldlstat = 84;
90pub const SYS_readlink = 85;
91pub const SYS_uselib = 86;
92pub const SYS_swapon = 87;
93pub const SYS_reboot = 88;
94pub const SYS_readdir = 89;
95pub const SYS_mmap = 90;
96pub const SYS_munmap = 91;
97pub const SYS_truncate = 92;
98pub const SYS_ftruncate = 93;
99pub const SYS_fchmod = 94;
100pub const SYS_fchown = 95;
101pub const SYS_getpriority = 96;
102pub const SYS_setpriority = 97;
103pub const SYS_profil = 98;
104pub const SYS_statfs = 99;
105pub const SYS_fstatfs = 100;
106pub const SYS_ioperm = 101;
107pub const SYS_socketcall = 102;
108pub const SYS_syslog = 103;
109pub const SYS_setitimer = 104;
110pub const SYS_getitimer = 105;
111pub const SYS_stat = 106;
112pub const SYS_lstat = 107;
113pub const SYS_fstat = 108;
114pub const SYS_olduname = 109;
115pub const SYS_iopl = 110;
116pub const SYS_vhangup = 111;
117pub const SYS_idle = 112;
118pub const SYS_vm86old = 113;
119pub const SYS_wait4 = 114;
120pub const SYS_swapoff = 115;
121pub const SYS_sysinfo = 116;
122pub const SYS_ipc = 117;
123pub const SYS_fsync = 118;
124pub const SYS_sigreturn = 119;
125pub const SYS_clone = 120;
126pub const SYS_setdomainname = 121;
127pub const SYS_uname = 122;
128pub const SYS_modify_ldt = 123;
129pub const SYS_adjtimex = 124;
130pub const SYS_mprotect = 125;
131pub const SYS_sigprocmask = 126;
132pub const SYS_create_module = 127;
133pub const SYS_init_module = 128;
134pub const SYS_delete_module = 129;
135pub const SYS_get_kernel_syms = 130;
136pub const SYS_quotactl = 131;
137pub const SYS_getpgid = 132;
138pub const SYS_fchdir = 133;
139pub const SYS_bdflush = 134;
140pub const SYS_sysfs = 135;
141pub const SYS_personality = 136;
142pub const SYS_afs_syscall = 137;
143pub const SYS_setfsuid = 138;
144pub const SYS_setfsgid = 139;
145pub const SYS__llseek = 140;
146pub const SYS_getdents = 141;
147pub const SYS__newselect = 142;
148pub const SYS_flock = 143;
149pub const SYS_msync = 144;
150pub const SYS_readv = 145;
151pub const SYS_writev = 146;
152pub const SYS_getsid = 147;
153pub const SYS_fdatasync = 148;
154pub const SYS__sysctl = 149;
155pub const SYS_mlock = 150;
156pub const SYS_munlock = 151;
157pub const SYS_mlockall = 152;
158pub const SYS_munlockall = 153;
159pub const SYS_sched_setparam = 154;
160pub const SYS_sched_getparam = 155;
161pub const SYS_sched_setscheduler = 156;
162pub const SYS_sched_getscheduler = 157;
163pub const SYS_sched_yield = 158;
164pub const SYS_sched_get_priority_max = 159;
165pub const SYS_sched_get_priority_min = 160;
166pub const SYS_sched_rr_get_interval = 161;
167pub const SYS_nanosleep = 162;
168pub const SYS_mremap = 163;
169pub const SYS_setresuid = 164;
170pub const SYS_getresuid = 165;
171pub const SYS_vm86 = 166;
172pub const SYS_query_module = 167;
173pub const SYS_poll = 168;
174pub const SYS_nfsservctl = 169;
175pub const SYS_setresgid = 170;
176pub const SYS_getresgid = 171;
177pub const SYS_prctl = 172;
178pub const SYS_rt_sigreturn = 173;
179pub const SYS_rt_sigaction = 174;
180pub const SYS_rt_sigprocmask = 175;
181pub const SYS_rt_sigpending = 176;
182pub const SYS_rt_sigtimedwait = 177;
183pub const SYS_rt_sigqueueinfo = 178;
184pub const SYS_rt_sigsuspend = 179;
185pub const SYS_pread64 = 180;
186pub const SYS_pwrite64 = 181;
187pub const SYS_chown = 182;
188pub const SYS_getcwd = 183;
189pub const SYS_capget = 184;
190pub const SYS_capset = 185;
191pub const SYS_sigaltstack = 186;
192pub const SYS_sendfile = 187;
193pub const SYS_getpmsg = 188;
194pub const SYS_putpmsg = 189;
195pub const SYS_vfork = 190;
196pub const SYS_ugetrlimit = 191;
197pub const SYS_mmap2 = 192;
198pub const SYS_truncate64 = 193;
199pub const SYS_ftruncate64 = 194;
200pub const SYS_stat64 = 195;
201pub const SYS_lstat64 = 196;
202pub const SYS_fstat64 = 197;
203pub const SYS_lchown32 = 198;
204pub const SYS_getuid32 = 199;
205pub const SYS_getgid32 = 200;
206pub const SYS_geteuid32 = 201;
207pub const SYS_getegid32 = 202;
208pub const SYS_setreuid32 = 203;
209pub const SYS_setregid32 = 204;
210pub const SYS_getgroups32 = 205;
211pub const SYS_setgroups32 = 206;
212pub const SYS_fchown32 = 207;
213pub const SYS_setresuid32 = 208;
214pub const SYS_getresuid32 = 209;
215pub const SYS_setresgid32 = 210;
216pub const SYS_getresgid32 = 211;
217pub const SYS_chown32 = 212;
218pub const SYS_setuid32 = 213;
219pub const SYS_setgid32 = 214;
220pub const SYS_setfsuid32 = 215;
221pub const SYS_setfsgid32 = 216;
222pub const SYS_pivot_root = 217;
223pub const SYS_mincore = 218;
224pub const SYS_madvise = 219;
225pub const SYS_madvise1 = 219;
226pub const SYS_getdents64 = 220;
227pub const SYS_fcntl64 = 221;
228pub const SYS_gettid = 224;
229pub const SYS_readahead = 225;
230pub const SYS_setxattr = 226;
231pub const SYS_lsetxattr = 227;
232pub const SYS_fsetxattr = 228;
233pub const SYS_getxattr = 229;
234pub const SYS_lgetxattr = 230;
235pub const SYS_fgetxattr = 231;
236pub const SYS_listxattr = 232;
237pub const SYS_llistxattr = 233;
238pub const SYS_flistxattr = 234;
239pub const SYS_removexattr = 235;
240pub const SYS_lremovexattr = 236;
241pub const SYS_fremovexattr = 237;
242pub const SYS_tkill = 238;
243pub const SYS_sendfile64 = 239;
244pub const SYS_futex = 240;
245pub const SYS_sched_setaffinity = 241;
246pub const SYS_sched_getaffinity = 242;
247pub const SYS_set_thread_area = 243;
248pub const SYS_get_thread_area = 244;
249pub const SYS_io_setup = 245;
250pub const SYS_io_destroy = 246;
251pub const SYS_io_getevents = 247;
252pub const SYS_io_submit = 248;
253pub const SYS_io_cancel = 249;
254pub const SYS_fadvise64 = 250;
255pub const SYS_exit_group = 252;
256pub const SYS_lookup_dcookie = 253;
257pub const SYS_epoll_create = 254;
258pub const SYS_epoll_ctl = 255;
259pub const SYS_epoll_wait = 256;
260pub const SYS_remap_file_pages = 257;
261pub const SYS_set_tid_address = 258;
262pub const SYS_timer_create = 259;
263pub const SYS_timer_settime = SYS_timer_create+1;
264pub const SYS_timer_gettime = SYS_timer_create+2;
265pub const SYS_timer_getoverrun = SYS_timer_create+3;
266pub const SYS_timer_delete = SYS_timer_create+4;
267pub const SYS_clock_settime = SYS_timer_create+5;
268pub const SYS_clock_gettime = SYS_timer_create+6;
269pub const SYS_clock_getres = SYS_timer_create+7;
270pub const SYS_clock_nanosleep = SYS_timer_create+8;
271pub const SYS_statfs64 = 268;
272pub const SYS_fstatfs64 = 269;
273pub const SYS_tgkill = 270;
274pub const SYS_utimes = 271;
275pub const SYS_fadvise64_64 = 272;
276pub const SYS_vserver = 273;
277pub const SYS_mbind = 274;
278pub const SYS_get_mempolicy = 275;
279pub const SYS_set_mempolicy = 276;
280pub const SYS_mq_open = 277;
281pub const SYS_mq_unlink = SYS_mq_open+1;
282pub const SYS_mq_timedsend = SYS_mq_open+2;
283pub const SYS_mq_timedreceive = SYS_mq_open+3;
284pub const SYS_mq_notify = SYS_mq_open+4;
285pub const SYS_mq_getsetattr = SYS_mq_open+5;
286pub const SYS_kexec_load = 283;
287pub const SYS_waitid = 284;
288pub const SYS_add_key = 286;
289pub const SYS_request_key = 287;
290pub const SYS_keyctl = 288;
291pub const SYS_ioprio_set = 289;
292pub const SYS_ioprio_get = 290;
293pub const SYS_inotify_init = 291;
294pub const SYS_inotify_add_watch = 292;
295pub const SYS_inotify_rm_watch = 293;
296pub const SYS_migrate_pages = 294;
297pub const SYS_openat = 295;
298pub const SYS_mkdirat = 296;
299pub const SYS_mknodat = 297;
300pub const SYS_fchownat = 298;
301pub const SYS_futimesat = 299;
302pub const SYS_fstatat64 = 300;
303pub const SYS_unlinkat = 301;
304pub const SYS_renameat = 302;
305pub const SYS_linkat = 303;
306pub const SYS_symlinkat = 304;
307pub const SYS_readlinkat = 305;
308pub const SYS_fchmodat = 306;
309pub const SYS_faccessat = 307;
310pub const SYS_pselect6 = 308;
311pub const SYS_ppoll = 309;
312pub const SYS_unshare = 310;
313pub const SYS_set_robust_list = 311;
314pub const SYS_get_robust_list = 312;
315pub const SYS_splice = 313;
316pub const SYS_sync_file_range = 314;
317pub const SYS_tee = 315;
318pub const SYS_vmsplice = 316;
319pub const SYS_move_pages = 317;
320pub const SYS_getcpu = 318;
321pub const SYS_epoll_pwait = 319;
322pub const SYS_utimensat = 320;
323pub const SYS_signalfd = 321;
324pub const SYS_timerfd_create = 322;
325pub const SYS_eventfd = 323;
326pub const SYS_fallocate = 324;
327pub const SYS_timerfd_settime = 325;
328pub const SYS_timerfd_gettime = 326;
329pub const SYS_signalfd4 = 327;
330pub const SYS_eventfd2 = 328;
331pub const SYS_epoll_create1 = 329;
332pub const SYS_dup3 = 330;
333pub const SYS_pipe2 = 331;
334pub const SYS_inotify_init1 = 332;
335pub const SYS_preadv = 333;
336pub const SYS_pwritev = 334;
337pub const SYS_rt_tgsigqueueinfo = 335;
338pub const SYS_perf_event_open = 336;
339pub const SYS_recvmmsg = 337;
340pub const SYS_fanotify_init = 338;
341pub const SYS_fanotify_mark = 339;
342pub const SYS_prlimit64 = 340;
343pub const SYS_name_to_handle_at = 341;
344pub const SYS_open_by_handle_at = 342;
345pub const SYS_clock_adjtime = 343;
346pub const SYS_syncfs = 344;
347pub const SYS_sendmmsg = 345;
348pub const SYS_setns = 346;
349pub const SYS_process_vm_readv = 347;
350pub const SYS_process_vm_writev = 348;
351pub const SYS_kcmp = 349;
352pub const SYS_finit_module = 350;
353pub const SYS_sched_setattr = 351;
354pub const SYS_sched_getattr = 352;
355pub const SYS_renameat2 = 353;
356pub const SYS_seccomp = 354;
357pub const SYS_getrandom = 355;
358pub const SYS_memfd_create = 356;
359pub const SYS_bpf = 357;
360pub const SYS_execveat = 358;
361pub const SYS_socket = 359;
362pub const SYS_socketpair = 360;
363pub const SYS_bind = 361;
364pub const SYS_connect = 362;
365pub const SYS_listen = 363;
366pub const SYS_accept4 = 364;
367pub const SYS_getsockopt = 365;
368pub const SYS_setsockopt = 366;
369pub const SYS_getsockname = 367;
370pub const SYS_getpeername = 368;
371pub const SYS_sendto = 369;
372pub const SYS_sendmsg = 370;
373pub const SYS_recvfrom = 371;
374pub const SYS_recvmsg = 372;
375pub const SYS_shutdown = 373;
376pub const SYS_userfaultfd = 374;
377pub const SYS_membarrier = 375;
378pub const SYS_mlock2 = 376;
379
380
1381pub const O_CREAT = 0o100;
2382pub const O_EXCL = 0o200;
3383pub const O_NOCTTY = 0o400;
......@@ -79,7 +459,22 @@ pub fn syscall4(number: isize, arg1: isize, arg2: isize, arg3: isize, arg4: isiz
79459 [arg4] "{esi}" (arg4))
80460}
81461
82pub fn syscall6(number: isize, arg1: isize, arg2: isize, arg3: isize, arg4: isize, arg5: isize, arg6: isize) -> isize {
462pub fn syscall5(number: isize, arg1: isize, arg2: isize, arg3: isize,
463 arg4: isize, arg5: isize) -> isize
464{
465 asm volatile ("int $0x80"
466 : [ret] "={eax}" (-> isize)
467 : [number] "{eax}" (number),
468 [arg1] "{ebx}" (arg1),
469 [arg2] "{ecx}" (arg2),
470 [arg3] "{edx}" (arg3),
471 [arg4] "{esi}" (arg4),
472 [arg5] "{edi}" (arg5))
473}
474
475pub fn syscall6(number: isize, arg1: isize, arg2: isize, arg3: isize,
476 arg4: isize, arg5: isize, arg6: isize) -> isize
477{
83478 asm volatile ("int $0x80"
84479 : [ret] "={eax}" (-> isize)
85480 : [number] "{eax}" (number),
......@@ -90,3 +485,13 @@ pub fn syscall6(number: isize, arg1: isize, arg2: isize, arg3: isize, arg4: isiz
90485 [arg5] "{edi}" (arg5),
91486 [arg6] "{ebp}" (arg6))
92487}
488
489export struct msghdr {
490 msg_name: &u8,
491 msg_namelen: socklen_t,
492 msg_iov: &iovec,
493 msg_iovlen: i32,
494 msg_control: &u8,
495 msg_controllen: socklen_t,
496 msg_flags: i32,
497}
std/linux_x86_64.zig+341-2
......@@ -1,20 +1,333 @@
1const linux = @import("linux.zig");
2const socklen_t = linux.socklen_t;
3const iovec = linux.iovec;
4
15pub const SYS_read = 0;
26pub const SYS_write = 1;
37pub const SYS_open = 2;
48pub const SYS_close = 3;
5pub const SYS_creat = 85;
9pub const SYS_stat = 4;
10pub const SYS_fstat = 5;
11pub const SYS_lstat = 6;
12pub const SYS_poll = 7;
613pub const SYS_lseek = 8;
714pub const SYS_mmap = 9;
15pub const SYS_mprotect = 10;
816pub const SYS_munmap = 11;
17pub const SYS_brk = 12;
18pub const SYS_rt_sigaction = 13;
919pub const SYS_rt_sigprocmask = 14;
20pub const SYS_rt_sigreturn = 15;
21pub const SYS_ioctl = 16;
22pub const SYS_pread64 = 17;
23pub const SYS_pwrite64 = 18;
24pub const SYS_readv = 19;
25pub const SYS_writev = 20;
26pub const SYS_access = 21;
27pub const SYS_pipe = 22;
28pub const SYS_select = 23;
29pub const SYS_sched_yield = 24;
30pub const SYS_mremap = 25;
31pub const SYS_msync = 26;
32pub const SYS_mincore = 27;
33pub const SYS_madvise = 28;
34pub const SYS_shmget = 29;
35pub const SYS_shmat = 30;
36pub const SYS_shmctl = 31;
37pub const SYS_dup = 32;
38pub const SYS_dup2 = 33;
39pub const SYS_pause = 34;
40pub const SYS_nanosleep = 35;
41pub const SYS_getitimer = 36;
42pub const SYS_alarm = 37;
43pub const SYS_setitimer = 38;
44pub const SYS_getpid = 39;
45pub const SYS_sendfile = 40;
46pub const SYS_socket = 41;
47pub const SYS_connect = 42;
48pub const SYS_accept = 43;
49pub const SYS_sendto = 44;
50pub const SYS_recvfrom = 45;
51pub const SYS_sendmsg = 46;
52pub const SYS_recvmsg = 47;
53pub const SYS_shutdown = 48;
54pub const SYS_bind = 49;
55pub const SYS_listen = 50;
56pub const SYS_getsockname = 51;
57pub const SYS_getpeername = 52;
58pub const SYS_socketpair = 53;
59pub const SYS_setsockopt = 54;
60pub const SYS_getsockopt = 55;
61pub const SYS_clone = 56;
62pub const SYS_fork = 57;
63pub const SYS_vfork = 58;
64pub const SYS_execve = 59;
1065pub const SYS_exit = 60;
66pub const SYS_wait4 = 61;
1167pub const SYS_kill = 62;
68pub const SYS_uname = 63;
69pub const SYS_semget = 64;
70pub const SYS_semop = 65;
71pub const SYS_semctl = 66;
72pub const SYS_shmdt = 67;
73pub const SYS_msgget = 68;
74pub const SYS_msgsnd = 69;
75pub const SYS_msgrcv = 70;
76pub const SYS_msgctl = 71;
77pub const SYS_fcntl = 72;
78pub const SYS_flock = 73;
79pub const SYS_fsync = 74;
80pub const SYS_fdatasync = 75;
81pub const SYS_truncate = 76;
82pub const SYS_ftruncate = 77;
83pub const SYS_getdents = 78;
84pub const SYS_getcwd = 79;
85pub const SYS_chdir = 80;
86pub const SYS_fchdir = 81;
87pub const SYS_rename = 82;
88pub const SYS_mkdir = 83;
89pub const SYS_rmdir = 84;
90pub const SYS_creat = 85;
91pub const SYS_link = 86;
92pub const SYS_unlink = 87;
93pub const SYS_symlink = 88;
94pub const SYS_readlink = 89;
95pub const SYS_chmod = 90;
96pub const SYS_fchmod = 91;
97pub const SYS_chown = 92;
98pub const SYS_fchown = 93;
99pub const SYS_lchown = 94;
100pub const SYS_umask = 95;
101pub const SYS_gettimeofday = 96;
102pub const SYS_getrlimit = 97;
103pub const SYS_getrusage = 98;
104pub const SYS_sysinfo = 99;
105pub const SYS_times = 100;
106pub const SYS_ptrace = 101;
107pub const SYS_getuid = 102;
108pub const SYS_syslog = 103;
12109pub const SYS_getgid = 104;
110pub const SYS_setuid = 105;
111pub const SYS_setgid = 106;
112pub const SYS_geteuid = 107;
113pub const SYS_getegid = 108;
114pub const SYS_setpgid = 109;
115pub const SYS_getppid = 110;
116pub const SYS_getpgrp = 111;
117pub const SYS_setsid = 112;
118pub const SYS_setreuid = 113;
119pub const SYS_setregid = 114;
120pub const SYS_getgroups = 115;
121pub const SYS_setgroups = 116;
122pub const SYS_setresuid = 117;
123pub const SYS_getresuid = 118;
124pub const SYS_setresgid = 119;
125pub const SYS_getresgid = 120;
126pub const SYS_getpgid = 121;
127pub const SYS_setfsuid = 122;
128pub const SYS_setfsgid = 123;
129pub const SYS_getsid = 124;
130pub const SYS_capget = 125;
131pub const SYS_capset = 126;
132pub const SYS_rt_sigpending = 127;
133pub const SYS_rt_sigtimedwait = 128;
134pub const SYS_rt_sigqueueinfo = 129;
135pub const SYS_rt_sigsuspend = 130;
136pub const SYS_sigaltstack = 131;
137pub const SYS_utime = 132;
138pub const SYS_mknod = 133;
139pub const SYS_uselib = 134;
140pub const SYS_personality = 135;
141pub const SYS_ustat = 136;
142pub const SYS_statfs = 137;
143pub const SYS_fstatfs = 138;
144pub const SYS_sysfs = 139;
145pub const SYS_getpriority = 140;
146pub const SYS_setpriority = 141;
147pub const SYS_sched_setparam = 142;
148pub const SYS_sched_getparam = 143;
149pub const SYS_sched_setscheduler = 144;
150pub const SYS_sched_getscheduler = 145;
151pub const SYS_sched_get_priority_max = 146;
152pub const SYS_sched_get_priority_min = 147;
153pub const SYS_sched_rr_get_interval = 148;
154pub const SYS_mlock = 149;
155pub const SYS_munlock = 150;
156pub const SYS_mlockall = 151;
157pub const SYS_munlockall = 152;
158pub const SYS_vhangup = 153;
159pub const SYS_modify_ldt = 154;
160pub const SYS_pivot_root = 155;
161pub const SYS__sysctl = 156;
162pub const SYS_prctl = 157;
163pub const SYS_arch_prctl = 158;
164pub const SYS_adjtimex = 159;
165pub const SYS_setrlimit = 160;
166pub const SYS_chroot = 161;
167pub const SYS_sync = 162;
168pub const SYS_acct = 163;
169pub const SYS_settimeofday = 164;
170pub const SYS_mount = 165;
171pub const SYS_umount2 = 166;
172pub const SYS_swapon = 167;
173pub const SYS_swapoff = 168;
174pub const SYS_reboot = 169;
175pub const SYS_sethostname = 170;
176pub const SYS_setdomainname = 171;
177pub const SYS_iopl = 172;
178pub const SYS_ioperm = 173;
179pub const SYS_create_module = 174;
180pub const SYS_init_module = 175;
181pub const SYS_delete_module = 176;
182pub const SYS_get_kernel_syms = 177;
183pub const SYS_query_module = 178;
184pub const SYS_quotactl = 179;
185pub const SYS_nfsservctl = 180;
186pub const SYS_getpmsg = 181;
187pub const SYS_putpmsg = 182;
188pub const SYS_afs_syscall = 183;
189pub const SYS_tuxcall = 184;
190pub const SYS_security = 185;
13191pub const SYS_gettid = 186;
192pub const SYS_readahead = 187;
193pub const SYS_setxattr = 188;
194pub const SYS_lsetxattr = 189;
195pub const SYS_fsetxattr = 190;
196pub const SYS_getxattr = 191;
197pub const SYS_lgetxattr = 192;
198pub const SYS_fgetxattr = 193;
199pub const SYS_listxattr = 194;
200pub const SYS_llistxattr = 195;
201pub const SYS_flistxattr = 196;
202pub const SYS_removexattr = 197;
203pub const SYS_lremovexattr = 198;
204pub const SYS_fremovexattr = 199;
14205pub const SYS_tkill = 200;
206pub const SYS_time = 201;
207pub const SYS_futex = 202;
208pub const SYS_sched_setaffinity = 203;
209pub const SYS_sched_getaffinity = 204;
210pub const SYS_set_thread_area = 205;
211pub const SYS_io_setup = 206;
212pub const SYS_io_destroy = 207;
213pub const SYS_io_getevents = 208;
214pub const SYS_io_submit = 209;
215pub const SYS_io_cancel = 210;
216pub const SYS_get_thread_area = 211;
217pub const SYS_lookup_dcookie = 212;
218pub const SYS_epoll_create = 213;
219pub const SYS_epoll_ctl_old = 214;
220pub const SYS_epoll_wait_old = 215;
221pub const SYS_remap_file_pages = 216;
222pub const SYS_getdents64 = 217;
223pub const SYS_set_tid_address = 218;
224pub const SYS_restart_syscall = 219;
225pub const SYS_semtimedop = 220;
226pub const SYS_fadvise64 = 221;
227pub const SYS_timer_create = 222;
228pub const SYS_timer_settime = 223;
229pub const SYS_timer_gettime = 224;
230pub const SYS_timer_getoverrun = 225;
231pub const SYS_timer_delete = 226;
232pub const SYS_clock_settime = 227;
233pub const SYS_clock_gettime = 228;
234pub const SYS_clock_getres = 229;
235pub const SYS_clock_nanosleep = 230;
236pub const SYS_exit_group = 231;
237pub const SYS_epoll_wait = 232;
238pub const SYS_epoll_ctl = 233;
15239pub const SYS_tgkill = 234;
240pub const SYS_utimes = 235;
241pub const SYS_vserver = 236;
242pub const SYS_mbind = 237;
243pub const SYS_set_mempolicy = 238;
244pub const SYS_get_mempolicy = 239;
245pub const SYS_mq_open = 240;
246pub const SYS_mq_unlink = 241;
247pub const SYS_mq_timedsend = 242;
248pub const SYS_mq_timedreceive = 243;
249pub const SYS_mq_notify = 244;
250pub const SYS_mq_getsetattr = 245;
251pub const SYS_kexec_load = 246;
252pub const SYS_waitid = 247;
253pub const SYS_add_key = 248;
254pub const SYS_request_key = 249;
255pub const SYS_keyctl = 250;
256pub const SYS_ioprio_set = 251;
257pub const SYS_ioprio_get = 252;
258pub const SYS_inotify_init = 253;
259pub const SYS_inotify_add_watch = 254;
260pub const SYS_inotify_rm_watch = 255;
261pub const SYS_migrate_pages = 256;
16262pub const SYS_openat = 257;
263pub const SYS_mkdirat = 258;
264pub const SYS_mknodat = 259;
265pub const SYS_fchownat = 260;
266pub const SYS_futimesat = 261;
267pub const SYS_newfstatat = 262;
268pub const SYS_unlinkat = 263;
269pub const SYS_renameat = 264;
270pub const SYS_linkat = 265;
271pub const SYS_symlinkat = 266;
272pub const SYS_readlinkat = 267;
273pub const SYS_fchmodat = 268;
274pub const SYS_faccessat = 269;
275pub const SYS_pselect6 = 270;
276pub const SYS_ppoll = 271;
277pub const SYS_unshare = 272;
278pub const SYS_set_robust_list = 273;
279pub const SYS_get_robust_list = 274;
280pub const SYS_splice = 275;
281pub const SYS_tee = 276;
282pub const SYS_sync_file_range = 277;
283pub const SYS_vmsplice = 278;
284pub const SYS_move_pages = 279;
285pub const SYS_utimensat = 280;
286pub const SYS_epoll_pwait = 281;
287pub const SYS_signalfd = 282;
288pub const SYS_timerfd_create = 283;
289pub const SYS_eventfd = 284;
290pub const SYS_fallocate = 285;
291pub const SYS_timerfd_settime = 286;
292pub const SYS_timerfd_gettime = 287;
293pub const SYS_accept4 = 288;
294pub const SYS_signalfd4 = 289;
295pub const SYS_eventfd2 = 290;
296pub const SYS_epoll_create1 = 291;
297pub const SYS_dup3 = 292;
298pub const SYS_pipe2 = 293;
299pub const SYS_inotify_init1 = 294;
300pub const SYS_preadv = 295;
301pub const SYS_pwritev = 296;
302pub const SYS_rt_tgsigqueueinfo = 297;
303pub const SYS_perf_event_open = 298;
304pub const SYS_recvmmsg = 299;
305pub const SYS_fanotify_init = 300;
306pub const SYS_fanotify_mark = 301;
307pub const SYS_prlimit64 = 302;
308pub const SYS_name_to_handle_at = 303;
309pub const SYS_open_by_handle_at = 304;
310pub const SYS_clock_adjtime = 305;
311pub const SYS_syncfs = 306;
312pub const SYS_sendmmsg = 307;
313pub const SYS_setns = 308;
314pub const SYS_getcpu = 309;
315pub const SYS_process_vm_readv = 310;
316pub const SYS_process_vm_writev = 311;
317pub const SYS_kcmp = 312;
318pub const SYS_finit_module = 313;
319pub const SYS_sched_setattr = 314;
320pub const SYS_sched_getattr = 315;
321pub const SYS_renameat2 = 316;
322pub const SYS_seccomp = 317;
17323pub const SYS_getrandom = 318;
324pub const SYS_memfd_create = 319;
325pub const SYS_kexec_file_load = 320;
326pub const SYS_bpf = 321;
327pub const SYS_execveat = 322;
328pub const SYS_userfaultfd = 323;
329pub const SYS_membarrier = 324;
330pub const SYS_mlock2 = 325;
18331
19332pub const O_CREAT = 0o100;
20333pub const O_EXCL = 0o200;
......@@ -102,7 +415,21 @@ pub fn syscall4(number: isize, arg1: isize, arg2: isize, arg3: isize, arg4: isiz
102415 : "rcx", "r11")
103416}
104417
105pub fn syscall6(number: isize, arg1: isize, arg2: isize, arg3: isize, arg4: isize, arg5: isize, arg6: isize) -> isize {
418pub fn syscall5(number: isize, arg1: isize, arg2: isize, arg3: isize, arg4: isize, arg5: isize) -> isize {
419 asm volatile ("syscall"
420 : [ret] "={rax}" (-> isize)
421 : [number] "{rax}" (number),
422 [arg1] "{rdi}" (arg1),
423 [arg2] "{rsi}" (arg2),
424 [arg3] "{rdx}" (arg3),
425 [arg4] "{r10}" (arg4),
426 [arg5] "{r8}" (arg5)
427 : "rcx", "r11")
428}
429
430pub fn syscall6(number: isize, arg1: isize, arg2: isize, arg3: isize, arg4: isize,
431 arg5: isize, arg6: isize) -> isize
432{
106433 asm volatile ("syscall"
107434 : [ret] "={rax}" (-> isize)
108435 : [number] "{rax}" (number),
......@@ -114,3 +441,15 @@ pub fn syscall6(number: isize, arg1: isize, arg2: isize, arg3: isize, arg4: isiz
114441 [arg6] "{r9}" (arg6)
115442 : "rcx", "r11")
116443}
444
445export struct msghdr {
446 msg_name: &u8,
447 msg_namelen: socklen_t,
448 msg_iov: &iovec,
449 msg_iovlen: i32,
450 __pad1: i32,
451 msg_control: &u8,
452 msg_controllen: socklen_t,
453 __pad2: socklen_t,
454 msg_flags: i32,
455}
std/net.zig created+4
......@@ -0,0 +1,4 @@
1const linux = @import("linux.zig");
2
3pub fn open(hostname: []const u8) -> %void {
4}