aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/bsd/netbsdlike/openbsdlike
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/unix/bsd/netbsdlike/openbsdlike')
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs (renamed from libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig.rs)14
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86.rs (renamed from libc/src/unix/bsd/netbsdlike/openbsdlike/other/b32/mod.rs)0
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs (renamed from libc/src/unix/bsd/netbsdlike/openbsdlike/other/b64/mod.rs)0
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs116
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs3
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs (renamed from libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs)15
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs3
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs3
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/other/mod.rs11
9 files changed, 150 insertions, 15 deletions
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs
index 695cf68..ac4acad 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs
@@ -1,3 +1,5 @@
+pub type c_char = i8;
+
s! {
pub struct lconv {
pub decimal_point: *mut ::c_char,
@@ -73,3 +75,15 @@ extern {
pub fn uselocale(loc: ::locale_t) -> ::locale_t;
pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
}
+
+cfg_if! {
+ if #[cfg(target_arch = "x86")] {
+ mod x86;
+ pub use self::x86::*;
+ } else if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
+ } else {
+ // Unknown target_arch
+ }
+}
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/other/b32/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86.rs
index 9b0b338..9b0b338 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/other/b32/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86.rs
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/other/b64/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs
index b07c476..b07c476 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/other/b64/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
index 37c7708..1f40e34 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
@@ -176,6 +176,17 @@ s! {
pub ifm_xflags: ::c_int,
pub ifm_data: if_data,
}
+
+ pub struct sockaddr_dl {
+ pub sdl_len: ::c_uchar,
+ pub sdl_family: ::c_uchar,
+ pub sdl_index: ::c_ushort,
+ pub sdl_type: ::c_uchar,
+ pub sdl_nlen: ::c_uchar,
+ pub sdl_alen: ::c_uchar,
+ pub sdl_slen: ::c_uchar,
+ pub sdl_data: [::c_char; 24],
+ }
}
pub const UT_NAMESIZE: usize = 32;
@@ -200,7 +211,11 @@ pub const ECANCELED : ::c_int = 88;
pub const EIDRM : ::c_int = 89;
pub const ENOMSG : ::c_int = 90;
pub const ENOTSUP : ::c_int = 91;
-pub const ELAST : ::c_int = 91;
+pub const EBADMSG : ::c_int = 92;
+pub const ENOTRECOVERABLE : ::c_int = 93;
+pub const EOWNERDEAD : ::c_int = 94;
+pub const EPROTO : ::c_int = 95;
+pub const ELAST : ::c_int = 95;
pub const F_DUPFD_CLOEXEC : ::c_int = 10;
@@ -221,6 +236,90 @@ pub const SO_RTABLE: ::c_int = 0x1021;
pub const SO_PEERCRED: ::c_int = 0x1022;
pub const SO_SPLICE: ::c_int = 0x1023;
+// https://github.com/openbsd/src/blob/master/sys/net/if.h#L187
+pub const IFF_UP: ::c_int = 0x1; // interface is up
+pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
+pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging
+pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net
+pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link
+pub const IFF_NOTRAILERS: ::c_int = 0x20; // avoid use of trailers
+pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated
+pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol
+pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets
+pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets
+pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress
+pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions
+pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
+pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
+pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
+pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
+
+// sys/netinet/in.h
+// Protocols (RFC 1700)
+// NOTE: These are in addition to the constants defined in src/unix/mod.rs
+
+// IPPROTO_IP defined in src/unix/mod.rs
+/// Hop-by-hop option header
+pub const IPPROTO_HOPOPTS: ::c_int = 0;
+// IPPROTO_ICMP defined in src/unix/mod.rs
+/// group mgmt protocol
+pub const IPPROTO_IGMP: ::c_int = 2;
+/// gateway^2 (deprecated)
+pub const IPPROTO_GGP: ::c_int = 3;
+/// for compatibility
+pub const IPPROTO_IPIP: ::c_int = 4;
+// IPPROTO_TCP defined in src/unix/mod.rs
+/// exterior gateway protocol
+pub const IPPROTO_EGP: ::c_int = 8;
+/// pup
+pub const IPPROTO_PUP: ::c_int = 12;
+// IPPROTO_UDP defined in src/unix/mod.rs
+/// xns idp
+pub const IPPROTO_IDP: ::c_int = 22;
+/// tp-4 w/ class negotiation
+pub const IPPROTO_TP: ::c_int = 29;
+// IPPROTO_IPV6 defined in src/unix/mod.rs
+/// IP6 routing header
+pub const IPPROTO_ROUTING: ::c_int = 43;
+/// IP6 fragmentation header
+pub const IPPROTO_FRAGMENT: ::c_int = 44;
+/// resource reservation
+pub const IPPROTO_RSVP: ::c_int = 46;
+/// General Routing Encap.
+pub const IPPROTO_GRE: ::c_int = 47;
+/// IP6 Encap Sec. Payload
+pub const IPPROTO_ESP: ::c_int = 50;
+/// IP6 Auth Header
+pub const IPPROTO_AH: ::c_int = 51;
+/// IP Mobility RFC 2004
+pub const IPPROTO_MOBILE: ::c_int = 55;
+// IPPROTO_ICMPV6 defined in src/unix/mod.rs
+/// IP6 no next header
+pub const IPPROTO_NONE: ::c_int = 59;
+/// IP6 destination option
+pub const IPPROTO_DSTOPTS: ::c_int = 60;
+/// ISO cnlp
+pub const IPPROTO_EON: ::c_int = 80;
+/// Ethernet-in-IP
+pub const IPPROTO_ETHERIP: ::c_int = 97;
+/// encapsulation header
+pub const IPPROTO_ENCAP: ::c_int = 98;
+/// Protocol indep. multicast
+pub const IPPROTO_PIM: ::c_int = 103;
+/// IP Payload Comp. Protocol
+pub const IPPROTO_IPCOMP: ::c_int = 108;
+/// CARP
+pub const IPPROTO_CARP: ::c_int = 112;
+/// unicast MPLS packet
+pub const IPPROTO_MPLS: ::c_int = 137;
+/// PFSYNC
+pub const IPPROTO_PFSYNC: ::c_int = 240;
+pub const IPPROTO_MAX: ::c_int = 256;
+
+/* Only used internally, so it can be outside the range of valid IP protocols */
+/// Divert sockets
+pub const IPPROTO_DIVERT: ::c_int = 258;
+
pub const AF_ECMA: ::c_int = 8;
pub const AF_ROUTE: ::c_int = 17;
pub const AF_ENCAP: ::c_int = 28;
@@ -273,7 +372,17 @@ pub const EIPSEC : ::c_int = 82;
pub const ENOMEDIUM : ::c_int = 85;
pub const EMEDIUMTYPE : ::c_int = 86;
+pub const EAI_BADFLAGS: ::c_int = -1;
+pub const EAI_NONAME: ::c_int = -2;
+pub const EAI_AGAIN: ::c_int = -3;
+pub const EAI_FAIL: ::c_int = -4;
+pub const EAI_NODATA: ::c_int = -5;
+pub const EAI_FAMILY: ::c_int = -6;
+pub const EAI_SOCKTYPE: ::c_int = -7;
+pub const EAI_SERVICE: ::c_int = -8;
+pub const EAI_MEMORY: ::c_int = -10;
pub const EAI_SYSTEM: ::c_int = -11;
+pub const EAI_OVERFLOW: ::c_int = -14;
pub const RUSAGE_THREAD: ::c_int = 1;
@@ -585,6 +694,8 @@ pub const SOCK_CLOEXEC: ::c_int = 0x8000;
pub const SOCK_NONBLOCK: ::c_int = 0x4000;
pub const SOCK_DNS: ::c_int = 0x1000;
+pub const WCONTINUED: ::c_int = 8;
+
f! {
pub fn WIFCONTINUED(status: ::c_int) -> bool {
status & 0o177777 == 0o177777
@@ -637,6 +748,3 @@ cfg_if! {
// Unknown target_os
}
}
-
-mod other;
-pub use self::other::*;
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs
new file mode 100644
index 0000000..6aa9950
--- /dev/null
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs
@@ -0,0 +1,3 @@
+pub type c_long = i64;
+pub type c_ulong = u64;
+pub type c_char = u8;
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs
index 5c80447..e7e5876 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs
@@ -33,3 +33,18 @@ extern {
pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
envp: *const *const ::c_char) -> ::c_int;
}
+
+cfg_if! {
+ if #[cfg(target_arch = "x86")] {
+ mod x86;
+ pub use self::x86::*;
+ } else if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
+ } else if #[cfg(target_arch = "aarch64")] {
+ mod aarch64;
+ pub use self::aarch64::*;
+ } else {
+ // Unknown target_arch
+ }
+}
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs
new file mode 100644
index 0000000..a00e333
--- /dev/null
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs
@@ -0,0 +1,3 @@
+pub type c_long = i32;
+pub type c_ulong = u32;
+pub type c_char = i8;
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs
new file mode 100644
index 0000000..27b9412
--- /dev/null
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs
@@ -0,0 +1,3 @@
+pub type c_long = i64;
+pub type c_ulong = u64;
+pub type c_char = i8;
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/other/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/other/mod.rs
deleted file mode 100644
index e4087da..0000000
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/other/mod.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-cfg_if! {
- if #[cfg(target_arch = "x86_64")] {
- mod b64;
- pub use self::b64::*;
- } else if #[cfg(target_arch = "x86")] {
- mod b32;
- pub use self::b32::*;
- } else {
- // Unknown target_arch
- }
-}