Skip to content

Commit 8dbd2c9

Browse files
committed
Auto merge of #2841 - asomers:openbsd-chflags, r=Amanieu
Fix the type of file flags on OpenBSD In C they're defined as macros, but since they're used with chflags(2) they should have the same type as that function's flags argument.
2 parents 8fdcb90 + 27264ed commit 8dbd2c9

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

src/unix/bsd/netbsdlike/mod.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -639,17 +639,6 @@ pub const TIOCM_DSR: ::c_int = 0o0400;
639639
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
640640
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
641641

642-
// Flags for chflags(2)
643-
pub const UF_SETTABLE: ::c_ulong = 0x0000ffff;
644-
pub const UF_NODUMP: ::c_ulong = 0x00000001;
645-
pub const UF_IMMUTABLE: ::c_ulong = 0x00000002;
646-
pub const UF_APPEND: ::c_ulong = 0x00000004;
647-
pub const UF_OPAQUE: ::c_ulong = 0x00000008;
648-
pub const SF_SETTABLE: ::c_ulong = 0xffff0000;
649-
pub const SF_ARCHIVED: ::c_ulong = 0x00010000;
650-
pub const SF_IMMUTABLE: ::c_ulong = 0x00020000;
651-
pub const SF_APPEND: ::c_ulong = 0x00040000;
652-
653642
pub const TIMER_ABSTIME: ::c_int = 1;
654643

655644
#[link(name = "util")]

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2228,9 +2228,18 @@ pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20;
22282228
pub const POSIX_SPAWN_RETURNERROR: ::c_int = 0x40;
22292229

22302230
// Flags for chflags(2)
2231-
pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
2231+
pub const SF_APPEND: ::c_ulong = 0x00040000;
2232+
pub const SF_ARCHIVED: ::c_ulong = 0x00010000;
2233+
pub const SF_IMMUTABLE: ::c_ulong = 0x00020000;
22322234
pub const SF_LOG: ::c_ulong = 0x00400000;
2235+
pub const SF_SETTABLE: ::c_ulong = 0xffff0000;
22332236
pub const SF_SNAPINVAL: ::c_ulong = 0x00800000;
2237+
pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
2238+
pub const UF_APPEND: ::c_ulong = 0x00000004;
2239+
pub const UF_IMMUTABLE: ::c_ulong = 0x00000002;
2240+
pub const UF_NODUMP: ::c_ulong = 0x00000001;
2241+
pub const UF_OPAQUE: ::c_ulong = 0x00000008;
2242+
pub const UF_SETTABLE: ::c_ulong = 0x0000ffff;
22342243

22352244
// sys/sysctl.h
22362245
pub const KVME_PROT_READ: ::c_int = 0x00000001;

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,17 @@ pub const EPROC_SLEADER: i32 = 0x02; // session leader
16281628
pub const EPROC_UNVEIL: i32 = 0x04; // has unveil settings
16291629
pub const EPROC_LKUNVEIL: i32 = 0x08; // unveil is locked
16301630

1631+
// Flags for chflags(2)
1632+
pub const UF_SETTABLE: ::c_uint = 0x0000ffff;
1633+
pub const UF_NODUMP: ::c_uint = 0x00000001;
1634+
pub const UF_IMMUTABLE: ::c_uint = 0x00000002;
1635+
pub const UF_APPEND: ::c_uint = 0x00000004;
1636+
pub const UF_OPAQUE: ::c_uint = 0x00000008;
1637+
pub const SF_SETTABLE: ::c_uint = 0xffff0000;
1638+
pub const SF_ARCHIVED: ::c_uint = 0x00010000;
1639+
pub const SF_IMMUTABLE: ::c_uint = 0x00020000;
1640+
pub const SF_APPEND: ::c_uint = 0x00040000;
1641+
16311642
const_fn! {
16321643
{const} fn _ALIGN(p: usize) -> usize {
16331644
(p + _ALIGNBYTES) & !_ALIGNBYTES

0 commit comments

Comments
 (0)