From 236fe11e9cb17cffa557c976cae7a983f8933c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Marie?= Date: Tue, 13 Sep 2022 18:24:41 +0000 Subject: [PATCH] openbsd: add getmntinfo(3) and getfsstat(2) support --- libc-test/semver/openbsd.txt | 5 +++++ src/unix/bsd/netbsdlike/openbsd/mod.rs | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index c9585a87ec559..cf9d73c58638f 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -497,6 +497,9 @@ MSG_CMSG_CLOEXEC MSG_DONTWAIT MSG_MCAST MSG_NOSIGNAL +MNT_LAZY +MNT_NOWAIT +MNT_WAIT NET_RT_DUMP NET_RT_FLAGS NET_RT_IFLIST @@ -999,6 +1002,7 @@ futimes getdomainname getdtablesize getentropy +getfsstat getgrent getgrgid getgrgid_r @@ -1010,6 +1014,7 @@ getifaddrs getitimer getline getloadavg +getmntinfo getnameinfo getpeereid getpriority diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index ba26f92431d78..506306e9f7928 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1639,6 +1639,10 @@ pub const SF_ARCHIVED: ::c_uint = 0x00010000; pub const SF_IMMUTABLE: ::c_uint = 0x00020000; pub const SF_APPEND: ::c_uint = 0x00040000; +pub const MNT_WAIT: ::c_int = 1; +pub const MNT_NOWAIT: ::c_int = 2; +pub const MNT_LAZY: ::c_int = 3; + const_fn! { {const} fn _ALIGN(p: usize) -> usize { (p + _ALIGNBYTES) & !_ALIGNBYTES @@ -1880,6 +1884,8 @@ cfg_if! { // these functions use statfs which uses the union mount_info: pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; + pub fn getmntinfo(mntbufp: *mut *mut ::statfs, flags: ::c_int) -> ::c_int; + pub fn getfsstat(buf: *mut statfs, bufsize: ::size_t, flags: ::c_int) -> ::c_int; } } }