Skip to content

Commit

Permalink
backtrace definitions and support for getmntinfo and getvfsstat
Browse files Browse the repository at this point in the history
  • Loading branch information
0323pin committed Sep 27, 2023
1 parent 9593176 commit bd3b68d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libc-test/semver/netbsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,9 @@ MNT_RELATIME
MNT_SOFTDEP
MNT_SYMPERM
MNT_UNION
MNT_WAIT
MNT_NOWAIT
MNT_LAZY
MOD_CLKA
MOD_CLKB
MOD_ESTERROR
Expand Down Expand Up @@ -1188,6 +1191,11 @@ arc4random
arc4random_buf
arc4random_uniform
arphdr
backtrace
backtrace_symbols
backtrace_symbols_fd
backtrace_symbols_fmt
backtrace_symbols_fd_fmt
bsearch
chflags
chroot
Expand Down Expand Up @@ -1275,6 +1283,7 @@ getitimer
getlastlogx
getline
getloadavg
getmntinfo
getnameinfo
getopt_long
getpeereid
Expand All @@ -1295,6 +1304,7 @@ getutmpx
getutxent
getutxid
getutxline
getvfsstat
getxattr
glob
glob_t
Expand Down
35 changes: 35 additions & 0 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1852,6 +1852,9 @@ pub const MNT_NODEVMTIME: ::c_int = 0x40000000;
pub const MNT_SOFTDEP: ::c_int = 0x80000000;
pub const MNT_POSIX1EACLS: ::c_int = 0x00000800;
pub const MNT_ACLS: ::c_int = MNT_POSIX1EACLS;
pub const MNT_WAIT: ::c_int = 1;
pub const MNT_NOWAIT: ::c_int = 2;
pub const MNT_LAZY: ::c_int = 3;

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

#[link(name = "execinfo")]
extern "C" {
pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
pub fn backtrace_symbols_fd(
addrlist: *const *mut ::c_void,
len: ::size_t,
fd: ::c_int,
) -> ::c_int;
pub fn backtrace_symbols_fmt(
addrlist: *const *mut ::c_void,
len: ::size_t,
fmt: *const ::c_char,
) -> *mut *mut ::c_char;
pub fn backtrace_symbols_fd_fmt(
addrlist: *const *mut ::c_void,
len: ::size_t,
fd: ::c_int,
fmt: *const ::c_char,
) -> ::c_int;
}

cfg_if! {
if #[cfg(libc_union)] {
extern {
// these functions use statvfs:
pub fn getmntinfo(mntbufp: *mut *mut ::statvfs, flags: ::c_int) -> ::c_int;
pub fn getvfsstat(buf: *mut statvfs, bufsize: ::size_t, flags: ::c_int) -> ::c_int;
}
}
}

cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
Expand Down

0 comments on commit bd3b68d

Please sign in to comment.