Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1826,6 +1826,8 @@ backtrace_symbols_fd
basename
boolean_t
bpf_hdr
bpf_insn
bpf_program
brk
bsearch
chflags
Expand Down
14 changes: 14 additions & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,20 @@ DAY_5
DAY_6
DAY_7
DEAD_PROCESS
DLT_ARCNET
DLT_ATM_RFC1483
DLT_AX25
DLT_CHAOS
DLT_EN10MB
DLT_EN3MB
DLT_FDDI
DLT_IEEE802
DLT_LOOP
DLT_NULL
DLT_PPP
DLT_PRONET
DLT_RAW
DLT_SLIP
DT_UNKNOWN
D_FMT
D_MD_ORDER
Expand Down
2 changes: 2 additions & 0 deletions src/new/apple/xnu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ pub(crate) mod machine {
pub(crate) mod _mcontext;
}

pub(crate) mod net;

pub(crate) mod sys;
44 changes: 44 additions & 0 deletions src/new/apple/xnu/net/bpf.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//! Header: `net/bpf.h`
//!
//! <https://github.com/apple-oss-distributions/xnu/blob/main/bsd/net/bpf.h>

use crate::prelude::*;

s! {
pub struct bpf_insn {
pub code: c_ushort,
pub jt: c_uchar,
pub jf: c_uchar,
pub k: u32,
}

pub struct bpf_program {
pub bf_len: c_uint,
pub bf_insns: *mut bpf_insn,
}
}

pub const DLT_NULL: c_uint = 0; // no link-layer encapsulation
pub const DLT_EN10MB: c_uint = 1; // Ethernet (10Mb)
pub const DLT_EN3MB: c_uint = 2; // Experimental Ethernet (3Mb)
pub const DLT_AX25: c_uint = 3; // Amateur Radio AX.25
pub const DLT_PRONET: c_uint = 4; // Proteon ProNET Token Ring
pub const DLT_CHAOS: c_uint = 5; // Chaos
pub const DLT_IEEE802: c_uint = 6; // IEEE 802 Networks
pub const DLT_ARCNET: c_uint = 7; // ARCNET
pub const DLT_SLIP: c_uint = 8; // Serial Line IP
pub const DLT_PPP: c_uint = 9; // Point-to-point Protocol
pub const DLT_FDDI: c_uint = 10; // FDDI
pub const DLT_ATM_RFC1483: c_uint = 11; // LLC/SNAP encapsulated atm
pub const DLT_RAW: c_uint = 12; // raw IP
pub const DLT_LOOP: c_uint = 108;

// sizeof(i32)
pub const BPF_ALIGNMENT: c_int = 4;

pub const BIOCGRSIG: c_ulong = 0x40044272;
pub const BIOCSRSIG: c_ulong = 0x80044273;
pub const BIOCSDLT: c_ulong = 0x80044278;
pub const BIOCGSEESENT: c_ulong = 0x40044276;
pub const BIOCSSEESENT: c_ulong = 0x80044277;
pub const BIOCGDLTLIST: c_ulong = 0xc00c4279;
5 changes: 5 additions & 0 deletions src/new/apple/xnu/net/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//! Directory: `net/`
//!
//! <https://github.com/apple-oss-distributions/xnu/tree/main/bsd/net>

pub(crate) mod bpf;
1 change: 1 addition & 0 deletions src/new/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
//! * Headers: <https://github.com/freebsd/freebsd-src/blob/main/sys/riscv/include/ucontext.h>
//! * Symbol map: <https://github.com/freebsd/freebsd-src/blob/main/lib/libc/gen/Symbol.map>

pub(crate) mod net;
pub(crate) mod sys;
pub(crate) mod unistd;
20 changes: 20 additions & 0 deletions src/new/freebsd/net/dlt.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! Header: `net/dlt.h`
//!
//! https://github.com/freebsd/freebsd-src/blob/main/sys/net/dlt.h

use crate::prelude::*;

pub const DLT_NULL: c_uint = 0; // no link-layer encapsulation
pub const DLT_EN10MB: c_uint = 1; // Ethernet (10Mb)
pub const DLT_EN3MB: c_uint = 2; // Experimental Ethernet (3Mb)
pub const DLT_AX25: c_uint = 3; // Amateur Radio AX.25
pub const DLT_PRONET: c_uint = 4; // Proteon ProNET Token Ring
pub const DLT_CHAOS: c_uint = 5; // Chaos
pub const DLT_IEEE802: c_uint = 6; // IEEE 802 Networks
pub const DLT_ARCNET: c_uint = 7; // ARCNET
pub const DLT_SLIP: c_uint = 8; // Serial Line IP
pub const DLT_PPP: c_uint = 9; // Point-to-point Protocol
pub const DLT_FDDI: c_uint = 10; // FDDI
pub const DLT_ATM_RFC1483: c_uint = 11; // LLC/SNAP encapsulated atm
pub const DLT_RAW: c_uint = 12; // raw IP
pub const DLT_LOOP: c_uint = 108;
5 changes: 5 additions & 0 deletions src/new/freebsd/net/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//! Directory: `net/`
//!
//! https://github.com/freebsd/freebsd-src/tree/main/sys/net

pub(crate) mod dlt;
2 changes: 2 additions & 0 deletions src/new/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ cfg_if! {
#[cfg(target_env = "gnu")]
pub use net::route::*;
} else if #[cfg(target_vendor = "apple")] {
pub use net::bpf::*;
pub use pthread_::introspection::*;
pub use pthread_::pthread_spis::*;
pub use pthread_::spawn::*;
Expand All @@ -221,6 +222,7 @@ cfg_if! {
pub use net::bpf::*;
pub use net::if_::*;
} else if #[cfg(target_os = "freebsd")] {
pub use net::dlt::*;
pub use sys::file::*;
}
}
Expand Down
27 changes: 0 additions & 27 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2307,13 +2307,6 @@ pub const TIOCSETA: c_ulong = 0x80487414;
pub const TIOCSETAW: c_ulong = 0x80487415;
pub const TIOCSETAF: c_ulong = 0x80487416;

pub const BIOCGRSIG: c_ulong = 0x40044272;
pub const BIOCSRSIG: c_ulong = 0x80044273;
pub const BIOCSDLT: c_ulong = 0x80044278;
pub const BIOCGSEESENT: c_ulong = 0x40044276;
pub const BIOCSSEESENT: c_ulong = 0x80044277;
pub const BIOCGDLTLIST: c_ulong = 0xc00c4279;

pub const FIODTYPE: c_ulong = 0x4004667a;

pub const B0: speed_t = 0;
Expand Down Expand Up @@ -3634,26 +3627,6 @@ pub const MH_MAGIC_64: u32 = 0xfeedfacf;
pub const UTUN_OPT_FLAGS: c_int = 1;
pub const UTUN_OPT_IFNAME: c_int = 2;

// net/bpf.h
pub const DLT_NULL: c_uint = 0; // no link-layer encapsulation
pub const DLT_EN10MB: c_uint = 1; // Ethernet (10Mb)
pub const DLT_EN3MB: c_uint = 2; // Experimental Ethernet (3Mb)
pub const DLT_AX25: c_uint = 3; // Amateur Radio AX.25
pub const DLT_PRONET: c_uint = 4; // Proteon ProNET Token Ring
pub const DLT_CHAOS: c_uint = 5; // Chaos
pub const DLT_IEEE802: c_uint = 6; // IEEE 802 Networks
pub const DLT_ARCNET: c_uint = 7; // ARCNET
pub const DLT_SLIP: c_uint = 8; // Serial Line IP
pub const DLT_PPP: c_uint = 9; // Point-to-point Protocol
pub const DLT_FDDI: c_uint = 10; // FDDI
pub const DLT_ATM_RFC1483: c_uint = 11; // LLC/SNAP encapsulated atm
pub const DLT_RAW: c_uint = 12; // raw IP
pub const DLT_LOOP: c_uint = 108;

// https://github.com/apple/darwin-xnu/blob/HEAD/bsd/net/bpf.h#L100
// sizeof(i32)
pub const BPF_ALIGNMENT: c_int = 4;

// sys/mount.h
pub const MNT_NODEV: c_int = 0x00000010;
pub const MNT_UNION: c_int = 0x00000020;
Expand Down