Commit cda73c3c18
Changed files (1)
lib
std
os
bits
lib/std/os/bits/netbsd.zig
@@ -25,6 +25,65 @@ pub const dl_phdr_info = extern struct {
dlpi_phnum: u16,
};
+pub const addrinfo = extern struct {
+ flags: i32,
+ family: i32,
+ socktype: i32,
+ protocol: i32,
+ addrlen: socklen_t,
+ canonname: ?[*:0]u8,
+ addr: ?*sockaddr,
+ next: ?*addrinfo,
+};
+
+pub const EAI = extern enum(c_int) {
+ /// address family for hostname not supported
+ ADDRFAMILY = 1,
+
+ /// name could not be resolved at this time
+ AGAIN = 2,
+
+ /// flags parameter had an invalid value
+ BADFLAGS = 3,
+
+ /// non-recoverable failure in name resolution
+ FAIL = 4,
+
+ /// address family not recognized
+ FAMILY = 5,
+
+ /// memory allocation failure
+ MEMORY = 6,
+
+ /// no address associated with hostname
+ NODATA = 7,
+
+ /// name does not resolve
+ NONAME = 8,
+
+ /// service not recognized for socket type
+ SERVICE = 9,
+
+ /// intended socket type was not recognized
+ SOCKTYPE = 10,
+
+ /// system error returned in errno
+ SYSTEM = 11,
+
+ /// invalid value for hints
+ BADHINTS = 12,
+
+ /// resolved protocol is unknown
+ PROTOCOL = 13,
+
+ /// argument buffer overflow
+ OVERFLOW = 14,
+
+ _,
+};
+
+pub const EAI_MAX = 15;
+
pub const msghdr = extern struct {
/// optional address
msg_name: ?*sockaddr,
@@ -122,7 +181,6 @@ pub const dirent = extern struct {
d_reclen: u16,
d_namlen: u16,
d_type: u8,
- d_off: i64,
d_name: [512]u8,
pub fn reclen(self: dirent) u16 {
@@ -146,7 +204,7 @@ pub const sockaddr = extern struct {
pub const sockaddr_in = extern struct {
len: u8 = @sizeOf(sockaddr_in),
- family: sa_family_t,
+ family: sa_family_t = AF_INET,
port: in_port_t,
addr: u32,
zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 },
@@ -154,7 +212,7 @@ pub const sockaddr_in = extern struct {
pub const sockaddr_in6 = extern struct {
len: u8 = @sizeOf(sockaddr_in6),
- family: sa_family_t,
+ family: sa_family_t = AF_INET6,
port: in_port_t,
flowinfo: u32,
addr: [16]u8,
@@ -167,12 +225,27 @@ pub const sockaddr_un = extern struct {
len: u8 = @sizeOf(sockaddr_un),
/// AF_LOCAL
- family: sa_family_t,
+ family: sa_family_t = AF_LOCAL,
/// path name
path: [104]u8,
};
+/// get address to use bind()
+pub const AI_PASSIVE = 0x00000001;
+
+/// fill ai_canonname
+pub const AI_CANONNAME = 0x00000002;
+
+/// prevent host name resolution
+pub const AI_NUMERICHOST = 0x00000004;
+
+/// prevent service name resolution
+pub const AI_NUMERICSERV = 0x00000008;
+
+/// only if any address is assigned
+pub const AI_ADDRCONFIG = 0x00000400;
+
pub const CTL_KERN = 1;
pub const CTL_DEBUG = 5;
@@ -274,30 +347,71 @@ pub const X_OK = 1; // test for execute or search permission
pub const W_OK = 2; // test for write permission
pub const R_OK = 4; // test for read permission
-pub const O_RDONLY = 0x0000;
-pub const O_WRONLY = 0x0001;
-pub const O_RDWR = 0x0002;
-pub const O_ACCMODE = 0x0003;
-
-pub const O_CREAT = 0x0200;
-pub const O_EXCL = 0x0800;
-pub const O_NOCTTY = 0x8000;
-pub const O_TRUNC = 0x0400;
-pub const O_APPEND = 0x0008;
-pub const O_NONBLOCK = 0x0004;
+/// open for reading only
+pub const O_RDONLY = 0x00000000;
+
+/// open for writing only
+pub const O_WRONLY = 0x00000001;
+
+/// open for reading and writing
+pub const O_RDWR = 0x00000002;
+
+/// mask for above modes
+pub const O_ACCMODE = 0x00000003;
+
+/// no delay
+pub const O_NONBLOCK = 0x00000004;
+
+/// set append mode
+pub const O_APPEND = 0x00000008;
+
+/// open with shared file lock
+pub const O_SHLOCK = 0x00000010;
+
+/// open with exclusive file lock
+pub const O_EXLOCK = 0x00000020;
+
+/// signal pgrp when data ready
+pub const O_ASYNC = 0x00000040;
+
+/// synchronous writes
+pub const O_SYNC = 0x00000080;
+
+/// don't follow symlinks on the last
+pub const O_NOFOLLOW = 0x00000100;
+
+/// create if nonexistent
+pub const O_CREAT = 0x00000200;
+
+/// truncate to zero length
+pub const O_TRUNC = 0x00000400;
+
+/// error if already exists
+pub const O_EXCL = 0x00000800;
+
+/// don't assign controlling terminal
+pub const O_NOCTTY = 0x00008000;
+
+/// write: I/O data completion
pub const O_DSYNC = 0x00010000;
-pub const O_SYNC = 0x0080;
+
+/// read: I/O completion as for write
pub const O_RSYNC = 0x00020000;
-pub const O_DIRECTORY = 0x00080000;
-pub const O_NOFOLLOW = 0x00000100;
-pub const O_CLOEXEC = 0x00400000;
-pub const O_ASYNC = 0x0040;
+/// use alternate i/o semantics
+pub const O_ALT_IO = 0x00040000;
+
+/// direct I/O hint
pub const O_DIRECT = 0x00080000;
-pub const O_NOATIME = 0;
-pub const O_PATH = 0;
-pub const O_TMPFILE = 0;
-pub const O_NDELAY = O_NONBLOCK;
+
+/// fail if not a directory
+pub const O_DIRECTORY = 0x00200000;
+
+/// set close on exec
+pub const O_CLOEXEC = 0x00400000;
+
+/// skip search permission checks
+pub const O_SEARCH = 0x00800000;
pub const F_DUPFD = 0;
pub const F_GETFD = 1;