Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backtrace definitions and support for getmntinfo and getvfsstat #3368

Merged
merged 1 commit into from
Sep 29, 2023
Merged
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
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