Skip to content

Commit 8094c09

Browse files
committed
NetBSD: Correct ipc_perm, split from OpenBSD as ipc.rs
The field ordering is incorrect on NetBSD. Move it to the `new` module for NetBSD and OpenBSD and fix the mismatch on NetBSD. Link: https://github.com/NetBSD/src/blob/6ace5fed3bd010695a1b88ca6c1f8a5af7793ffb/sys/sys/ipc.h#L54-L68 Link: https://github.com/openbsd/src/blob/9abc5df53d8ad6b65dbd35b89ed94f73e2fc58da/sys/sys/ipc.h#L53-L61 (backport <#4782>) (cherry picked from commit 066e702)
1 parent 89cb041 commit 8094c09

File tree

7 files changed

+44
-16
lines changed

7 files changed

+44
-16
lines changed

src/new/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,10 @@ cfg_if! {
183183
} else if #[cfg(target_vendor = "apple")] {
184184
pub use signal::*;
185185
} else if #[cfg(target_os = "netbsd")] {
186+
pub use sys::ipc::*;
186187
pub use sys::statvfs::*;
188+
} else if #[cfg(target_os = "openbsd")] {
189+
pub use sys::ipc::*;
187190
}
188191
}
189192

src/new/netbsd/sys/ipc.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//! Header: `sys/ipc.h`
2+
//!
3+
//! <https://github.com/NetBSD/src/blob/trunk/sys/sys/ipc.h>
4+
5+
use crate::prelude::*;
6+
7+
s! {
8+
pub struct ipc_perm {
9+
pub uid: crate::uid_t,
10+
pub gid: crate::gid_t,
11+
pub cuid: crate::uid_t,
12+
pub cgid: crate::gid_t,
13+
pub mode: crate::mode_t,
14+
pub _seq: c_ushort,
15+
pub _key: crate::key_t,
16+
}
17+
}

src/new/netbsd/sys/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
//!
33
//! https://github.com/NetBSD/src/tree/trunk/sys/sys
44
5+
pub(crate) mod ipc;
56
pub(crate) mod statvfs;

src/new/openbsd/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
//! * Headers: <https://github.com/openbsd/src>
44
//! * Manual pages: <https://man.openbsd.org/>
55
6+
pub(crate) mod sys;
67
pub(crate) mod unistd;

src/new/openbsd/sys/ipc.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//! Header: `sys/ipc.h`
2+
//!
3+
//! <https://github.com/openbsd/src/blob/master/sys/sys/ipc.h>
4+
5+
use crate::prelude::*;
6+
7+
s! {
8+
pub struct ipc_perm {
9+
pub cuid: crate::uid_t,
10+
pub cgid: crate::gid_t,
11+
pub uid: crate::uid_t,
12+
pub gid: crate::gid_t,
13+
pub mode: crate::mode_t,
14+
pub seq: c_ushort,
15+
pub key: crate::key_t,
16+
}
17+
}

src/new/openbsd/sys/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//! Directory: `sys/`
2+
//!
3+
//! https://github.com/openbsd/src/tree/trunk/sys/sys
4+
5+
pub(crate) mod ipc;

src/unix/bsd/netbsdlike/mod.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,6 @@ s! {
6161
pub l_whence: c_short,
6262
}
6363

64-
pub struct ipc_perm {
65-
pub cuid: crate::uid_t,
66-
pub cgid: crate::gid_t,
67-
pub uid: crate::uid_t,
68-
pub gid: crate::gid_t,
69-
pub mode: mode_t,
70-
#[cfg(target_os = "openbsd")]
71-
pub seq: c_ushort,
72-
#[cfg(target_os = "netbsd")]
73-
pub _seq: c_ushort,
74-
#[cfg(target_os = "openbsd")]
75-
pub key: crate::key_t,
76-
#[cfg(target_os = "netbsd")]
77-
pub _key: crate::key_t,
78-
}
79-
8064
pub struct ptrace_io_desc {
8165
pub piod_op: c_int,
8266
pub piod_offs: *mut c_void,

0 commit comments

Comments
 (0)