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

Add NetBSD CI #3965

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
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
28 changes: 28 additions & 0 deletions .github/workflows/full_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +209 to +211
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be best to just adjust ci/install-rust.sh as needed (if at all) to do what is needed here.

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
Expand Down
6 changes: 6 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,7 @@ fn test_netbsd(target: &str) {
"limits.h",
"link.h",
"locale.h",
"spawn.h",
"stddef.h",
"stdint.h",
"stdio.h",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions libc-test/semver/netbsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,6 @@ _UTX_PADSIZE
_UTX_USERSIZE
__cpu_simple_lock_nv_t
__errno
__exit_status
_cpuset_clr
_cpuset_create
_cpuset_destroy
Expand Down Expand Up @@ -1229,6 +1228,7 @@ consttime_memequal
daemon
difftime
dirfd
dl_addr
dl_iterate_phdr
dl_phdr_info
dqblk
Expand All @@ -1241,7 +1241,6 @@ emalloc
erand48
erealloc
ereallocarr
esetfunc
estrdup
estrndup
estrlcat
Expand Down Expand Up @@ -1594,7 +1593,6 @@ utmpxname
utpname
utrace
uucred
vm_size_t
wait4
waitid
dirname
Expand Down
14 changes: 0 additions & 14 deletions src/unix/bsd/netbsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down
49 changes: 32 additions & 17 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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],
}

Expand All @@ -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 {
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -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<unsafe extern "C" fn(::c_int, *const ::c_char, ...)>,
) -> ::Option<unsafe extern "C" fn(::c_int, *const ::c_char, ...)>;
*/
pub fn secure_path(path: *const ::c_char) -> ::c_int;
pub fn snprintb(
buf: *mut ::c_char,
Expand Down
14 changes: 14 additions & 0 deletions src/unix/bsd/netbsdlike/openbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
Loading