diff --git a/.github/workflows/full_ci.yml b/.github/workflows/full_ci.yml index 662f3921ef502..fe796325da4b5 100644 --- a/.github/workflows/full_ci.yml +++ b/.github/workflows/full_ci.yml @@ -186,6 +186,34 @@ jobs: - name: Execute run-docker.sh run: sh ./ci/run-docker.sh ${{ matrix.target }} + build_channels_netbsd: + permissions: + contents: read # to fetch code (actions/checkout) + + name: Build Channels NetBSD + runs-on: ubuntu-latest + env: + OS: netbsd + strategy: + fail-fast: true + steps: + - uses: actions/checkout@v4 + - name: Run netbsd vm + id: netbsd-ci + uses: vmactions/netbsd-vm@v1 + with: + envs: 'OS' + usesh: true + prepare: | + /usr/sbin/pkg_add curl + curl https://sh.rustup.rs -sSf --output rustup.sh + sh rustup.sh -y --default-toolchain nightly --profile=minimal + . $HOME/.cargo/env + run: | + . $HOME/.cargo/env + LIBC_CI=1 sh ci/run.sh x86_64-unknown-netbsd + sh ci/run.sh x86_64-unknown-netbsd + check_cfg: name: "Check #[cfg]s" runs-on: ubuntu-22.04 diff --git a/libc-test/build.rs b/libc-test/build.rs index 743f9f28404db..d521a6214e3ba 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1035,6 +1035,7 @@ fn test_netbsd(target: &str) { "limits.h", "link.h", "locale.h", + "spawn.h", "stddef.h", "stdint.h", "stdio.h", @@ -1103,6 +1104,7 @@ fn test_netbsd(target: &str) { "unistd.h", "util.h", "utime.h", + "utmp.h", "mqueue.h", "netinet/dccp.h", "sys/event.h", @@ -1150,6 +1152,10 @@ fn test_netbsd(target: &str) { return true; } match ty { + // pthread_spin_t is a volatile uchar + "pthread_spin_t" => true, + // cpuset_t is an incomplete/opaque type that is only used in the context of pointers + "cpuset_t" => true, // FIXME: sighandler_t is crazy across platforms "sighandler_t" => true, _ => false, diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index e07a7dbf08ae6..c15fe2eb7c9d2 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -1185,7 +1185,6 @@ _UTX_PADSIZE _UTX_USERSIZE __cpu_simple_lock_nv_t __errno -__exit_status _cpuset_clr _cpuset_create _cpuset_destroy @@ -1229,6 +1228,7 @@ consttime_memequal daemon difftime dirfd +dl_addr dl_iterate_phdr dl_phdr_info dqblk @@ -1241,7 +1241,6 @@ emalloc erand48 erealloc ereallocarr -esetfunc estrdup estrndup estrlcat @@ -1594,7 +1593,6 @@ utmpxname utpname utrace uucred -vm_size_t wait4 waitid dirname diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index 29f54b92cd48b..af38eec669d36 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -852,20 +852,6 @@ extern "C" { pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; pub fn basename(path: *mut ::c_char) -> *mut ::c_char; pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; - - pub fn sendmmsg( - sockfd: ::c_int, - mmsg: *mut ::mmsghdr, - vlen: ::c_uint, - flags: ::c_int, - ) -> ::c_int; - pub fn recvmmsg( - sockfd: ::c_int, - mmsg: *mut ::mmsghdr, - vlen: ::c_uint, - flags: ::c_int, - timeout: *mut ::timespec, - ) -> ::c_int; } cfg_if! { diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 318557daf52b8..b3c66a56d577c 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -7,11 +7,10 @@ pub type fsfilcnt_t = u64; pub type idtype_t = ::c_int; pub type mqd_t = ::c_int; type __pthread_spin_t = __cpu_simple_lock_nv_t; -pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time pub type lwpid_t = ::c_uint; pub type shmatt_t = ::c_uint; pub type cpuid_t = ::c_ulong; -pub type cpuset_t = _cpuset; +pub type cpuset_t = ::c_void; pub type pthread_spin_t = ::c_uchar; pub type timer_t = ::c_int; @@ -286,7 +285,7 @@ s! { pub flags: u32, pub fflags: u32, pub data: i64, - pub udata: ::intptr_t, /* FIXME: NetBSD 10.0 will finally have same layout as other BSD */ + pub udata: *mut ::c_void, } pub struct dqblk { @@ -380,7 +379,7 @@ s! { pub cr_unused: ::c_ushort, pub cr_uid: ::uid_t, pub cr_gid: ::gid_t, - pub cr_ngroups: ::c_int, + pub cr_ngroups: ::c_short, pub cr_groups: [::gid_t; NGROUPS_MAX as usize], } @@ -394,16 +393,15 @@ s! { pub sdl_len: ::c_uchar, pub sdl_family: ::c_uchar, pub sdl_index: ::c_ushort, - pub sdl_type: u8, - pub sdl_nlen: u8, - pub sdl_alen: u8, - pub sdl_slen: u8, - pub sdl_data: [::c_char; 12], + pub sdl_addr: ::dl_addr, } - pub struct __exit_status { - pub e_termination: u16, - pub e_exit: u16, + pub struct dl_addr { + pub dl_type: u8, + pub dl_nlen: u8, + pub dl_alen: u8, + pub dl_slen: u8, + pub dl_data: [::c_char; 24], } pub struct shmid_ds { @@ -506,10 +504,6 @@ s! { pub dlpi_tls_data: *mut ::c_void, } - pub struct _cpuset { - bits: [u32; 0] - } - pub struct accept_filter_arg { pub af_name: [::c_char; 16], af_arg: [[::c_char; 10]; 24], @@ -789,12 +783,17 @@ s_no_extra_traits! { pub ut_session: u16, pub ut_type: u16, pub ut_pid: ::pid_t, - pub ut_exit: __exit_status, // FIXME: when anonymous struct are supported + pub ut_exit: ::__c_anonymous_ut_exit, pub ut_ss: sockaddr_storage, pub ut_tv: ::timeval, pub ut_pad: [u8; _UTX_PADSIZE], } + pub struct __c_anonymous_ut_exit { + pub e_termination: u16, + pub e_exit: u16, + } + pub struct lastlogx { pub ll_tv: ::timeval, pub ll_line: [::c_char; _UTX_LINESIZE], @@ -2866,6 +2865,19 @@ extern "C" { ntargets: ::size_t, hint: *const ::c_void, ) -> ::c_int; + pub fn sendmmsg( + sockfd: ::c_int, + mmsg: *mut ::mmsghdr, + vlen: ::c_uint, + flags: ::c_uint, + ) -> ::c_int; + pub fn recvmmsg( + sockfd: ::c_int, + mmsg: *mut ::mmsghdr, + vlen: ::c_uint, + flags: ::c_uint, + timeout: *mut ::timespec, + ) -> ::c_int; } #[link(name = "rt")] @@ -2950,9 +2962,12 @@ extern "C" { ) -> ::uintmax_t; pub fn easprintf(string: *mut *mut ::c_char, fmt: *const ::c_char, ...) -> ::c_int; pub fn evasprintf(string: *mut *mut ::c_char, fmt: *const ::c_char, ...) -> ::c_int; + // FIXME: re-add with semver once https://github.com/JohnTitor/ctest2/issues/58 is resolved + /* pub fn esetfunc( cb: ::Option, ) -> ::Option; + */ pub fn secure_path(path: *const ::c_char) -> ::c_int; pub fn snprintb( buf: *mut ::c_char, diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 357662547b8e3..5957509aa789c 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -2110,6 +2110,20 @@ extern "C" { pub fn mimmutable(addr: *mut ::c_void, len: ::size_t) -> ::c_int; pub fn reboot(mode: ::c_int) -> ::c_int; + + pub fn sendmmsg( + sockfd: ::c_int, + mmsg: *mut ::mmsghdr, + vlen: ::c_uint, + flags: ::c_int, + ) -> ::c_int; + pub fn recvmmsg( + sockfd: ::c_int, + mmsg: *mut ::mmsghdr, + vlen: ::c_uint, + flags: ::c_int, + timeout: *mut ::timespec, + ) -> ::c_int; } #[link(name = "execinfo")]