Skip to content

Commit 4ad7970

Browse files
committed
NetBSD: Introduce types.rs, correct the definition of lwpid_t
This is currently defined as an `unsigned int` but should be `int32_t`. Also move some related definitions `new`. Link: https://github.com/NetBSD/src/blob/6ace5fed3bd010695a1b88ca6c1f8a5af7793ffb/sys/sys/types.h#L200 (backport <#4782>) (cherry picked from commit 2946483)
1 parent a9c8fc9 commit 4ad7970

File tree

6 files changed

+23
-9
lines changed

6 files changed

+23
-9
lines changed

src/new/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ cfg_if! {
185185
} else if #[cfg(target_os = "netbsd")] {
186186
pub use sys::ipc::*;
187187
pub use sys::statvfs::*;
188+
pub use sys::types::*;
188189
pub use utmp_::*;
189190
pub use utmpx_::*;
190191
} else if #[cfg(target_os = "openbsd")] {

src/new/netbsd/sys/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
55
pub(crate) mod ipc;
66
pub(crate) mod statvfs;
7+
pub(crate) mod types;

src/new/netbsd/sys/types.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//! Header: `sys/types.h`
2+
//!
3+
//! <https://github.com/NetBSD/src/blob/trunk/sys/sys/types.h>
4+
5+
use crate::prelude::*;
6+
7+
pub type dev_t = u64;
8+
9+
pub type lwpid_t = i32;
10+
11+
pub type mqd_t = c_int;
12+
pub type cpuid_t = c_ulong;
13+
14+
pub type clock_t = c_uint;
15+
pub type timer_t = c_int;
16+
pub type suseconds_t = c_int;

src/unix/bsd/netbsdlike/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,8 @@ extern "C" {
704704
pub fn getpriority(which: c_int, who: crate::id_t) -> c_int;
705705
pub fn setpriority(which: c_int, who: crate::id_t, prio: c_int) -> c_int;
706706

707-
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int;
707+
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: crate::dev_t)
708+
-> c_int;
708709
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
709710
pub fn sem_timedwait(sem: *mut sem_t, abstime: *const crate::timespec) -> c_int;
710711
pub fn sem_getvalue(sem: *mut sem_t, sval: *mut c_int) -> c_int;

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
use crate::prelude::*;
22
use crate::{
33
cmsghdr,
4+
cpuid_t,
5+
lwpid_t,
46
off_t,
57
};
68

7-
pub type clock_t = c_uint;
8-
pub type suseconds_t = c_int;
9-
pub type dev_t = u64;
109
pub type blksize_t = i32;
1110
pub type fsblkcnt_t = u64;
1211
pub type fsfilcnt_t = u64;
1312
pub type idtype_t = c_int;
14-
pub type mqd_t = c_int;
1513
type __pthread_spin_t = __cpu_simple_lock_nv_t;
16-
pub type lwpid_t = c_uint;
1714
pub type shmatt_t = c_uint;
18-
pub type cpuid_t = c_ulong;
1915
pub type cpuset_t = _cpuset;
2016
pub type pthread_spin_t = c_uchar;
21-
pub type timer_t = c_int;
2217

2318
// elf.h
2419

src/unix/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ s! {
6060
pub struct timeval {
6161
pub tv_sec: time_t,
6262
#[cfg(not(gnu_time_bits64))]
63-
pub tv_usec: suseconds_t,
63+
pub tv_usec: crate::suseconds_t,
6464
// For 64 bit time on 32 bit linux glibc, suseconds_t is still
6565
// a 32 bit type. Use __suseconds64_t instead
6666
#[cfg(gnu_time_bits64)]

0 commit comments

Comments
 (0)