Skip to content

Commit bd3b68d

Browse files
committed
backtrace definitions and support for getmntinfo and getvfsstat
1 parent 9593176 commit bd3b68d

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

libc-test/semver/netbsd.txt

+10
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,9 @@ MNT_RELATIME
671671
MNT_SOFTDEP
672672
MNT_SYMPERM
673673
MNT_UNION
674+
MNT_WAIT
675+
MNT_NOWAIT
676+
MNT_LAZY
674677
MOD_CLKA
675678
MOD_CLKB
676679
MOD_ESTERROR
@@ -1188,6 +1191,11 @@ arc4random
11881191
arc4random_buf
11891192
arc4random_uniform
11901193
arphdr
1194+
backtrace
1195+
backtrace_symbols
1196+
backtrace_symbols_fd
1197+
backtrace_symbols_fmt
1198+
backtrace_symbols_fd_fmt
11911199
bsearch
11921200
chflags
11931201
chroot
@@ -1275,6 +1283,7 @@ getitimer
12751283
getlastlogx
12761284
getline
12771285
getloadavg
1286+
getmntinfo
12781287
getnameinfo
12791288
getopt_long
12801289
getpeereid
@@ -1295,6 +1304,7 @@ getutmpx
12951304
getutxent
12961305
getutxid
12971306
getutxline
1307+
getvfsstat
12981308
getxattr
12991309
glob
13001310
glob_t

src/unix/bsd/netbsdlike/netbsd/mod.rs

+35
Original file line numberDiff line numberDiff line change
@@ -1852,6 +1852,9 @@ pub const MNT_NODEVMTIME: ::c_int = 0x40000000;
18521852
pub const MNT_SOFTDEP: ::c_int = 0x80000000;
18531853
pub const MNT_POSIX1EACLS: ::c_int = 0x00000800;
18541854
pub const MNT_ACLS: ::c_int = MNT_POSIX1EACLS;
1855+
pub const MNT_WAIT: ::c_int = 1;
1856+
pub const MNT_NOWAIT: ::c_int = 2;
1857+
pub const MNT_LAZY: ::c_int = 3;
18551858

18561859
//<sys/timex.h>
18571860
pub const NTP_API: ::c_int = 4;
@@ -3154,6 +3157,38 @@ extern "C" {
31543157
pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
31553158
}
31563159

3160+
#[link(name = "execinfo")]
3161+
extern "C" {
3162+
pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
3163+
pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
3164+
pub fn backtrace_symbols_fd(
3165+
addrlist: *const *mut ::c_void,
3166+
len: ::size_t,
3167+
fd: ::c_int,
3168+
) -> ::c_int;
3169+
pub fn backtrace_symbols_fmt(
3170+
addrlist: *const *mut ::c_void,
3171+
len: ::size_t,
3172+
fmt: *const ::c_char,
3173+
) -> *mut *mut ::c_char;
3174+
pub fn backtrace_symbols_fd_fmt(
3175+
addrlist: *const *mut ::c_void,
3176+
len: ::size_t,
3177+
fd: ::c_int,
3178+
fmt: *const ::c_char,
3179+
) -> ::c_int;
3180+
}
3181+
3182+
cfg_if! {
3183+
if #[cfg(libc_union)] {
3184+
extern {
3185+
// these functions use statvfs:
3186+
pub fn getmntinfo(mntbufp: *mut *mut ::statvfs, flags: ::c_int) -> ::c_int;
3187+
pub fn getvfsstat(buf: *mut statvfs, bufsize: ::size_t, flags: ::c_int) -> ::c_int;
3188+
}
3189+
}
3190+
}
3191+
31573192
cfg_if! {
31583193
if #[cfg(target_arch = "aarch64")] {
31593194
mod aarch64;

0 commit comments

Comments
 (0)