Add chflags(2) and friends

This commit is contained in:
Alan Somers 2018-11-19 17:58:54 -07:00
parent 4e5ef22258
commit 3bc400d7c7
7 changed files with 77 additions and 0 deletions

View File

@ -2302,6 +2302,20 @@ pub const SHMLBA: ::c_int = 4096;
pub const SHM_R: ::c_int = IPC_R;
pub const SHM_W: ::c_int = IPC_W;
// Flags for chflags(2)
pub const UF_SETTABLE: ::c_uint = 0x0000ffff;
pub const UF_NODUMP: ::c_uint = 0x00000001;
pub const UF_IMMUTABLE: ::c_uint = 0x00000002;
pub const UF_APPEND: ::c_uint = 0x00000004;
pub const UF_OPAQUE: ::c_uint = 0x00000008;
pub const UF_COMPRESSED: ::c_uint = 0x00000020;
pub const UF_TRACKED: ::c_uint = 0x00000040;
pub const SF_SETTABLE: ::c_uint = 0xffff0000;
pub const SF_ARCHIVED: ::c_uint = 0x00010000;
pub const SF_IMMUTABLE: ::c_uint = 0x00020000;
pub const SF_APPEND: ::c_uint = 0x00040000;
pub const UF_HIDDEN: ::c_uint = 0x00008000;
f! {
pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
status >> 8
@ -2335,6 +2349,8 @@ extern {
pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int,
timeout: *const ::timespec) -> ::c_int;
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
pub fn chflags(path: *const ::c_char, flags: ::c_uint) -> ::c_int;
pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int;
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,

View File

@ -767,6 +767,14 @@ pub const RTP_PRIO_NORMAL: ::c_ushort = 1;
pub const RTP_PRIO_IDLE: ::c_ushort = 2;
pub const RTP_PRIO_THREAD: ::c_ushort = 3;
// Flags for chflags(2)
pub const UF_NOHISTORY: ::c_ulong = 0x00000040;
pub const UF_CACHE: ::c_ulong = 0x00000080;
pub const UF_XLINK: ::c_ulong = 0x00000100;
pub const SF_NOHISTORY: ::c_ulong = 0x00400000;
pub const SF_CACHE: ::c_ulong = 0x00800000;
pub const SF_XLINK: ::c_ulong = 0x01000000;
extern {
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;

View File

@ -928,6 +928,16 @@ pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x08;
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x10;
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20;
// Flags for chflags(2)
pub const UF_SYSTEM: ::c_ulong = 0x00000080;
pub const UF_SPARSE: ::c_ulong = 0x00000100;
pub const UF_OFFLINE: ::c_ulong = 0x00000200;
pub const UF_REPARSE: ::c_ulong = 0x00000400;
pub const UF_ARCHIVE: ::c_ulong = 0x00000800;
pub const UF_READONLY: ::c_ulong = 0x00001000;
pub const UF_HIDDEN: ::c_ulong = 0x00008000;
pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
extern {
pub fn __error() -> *mut ::c_int;

View File

@ -1003,6 +1003,19 @@ pub const RTP_PRIO_MAX: ::c_ushort = 31;
pub const RTP_LOOKUP: ::c_int = 0;
pub const RTP_SET: ::c_int = 1;
// Flags for chflags(2)
pub const UF_SETTABLE: ::c_ulong = 0x0000ffff;
pub const UF_NODUMP: ::c_ulong = 0x00000001;
pub const UF_IMMUTABLE: ::c_ulong = 0x00000002;
pub const UF_APPEND: ::c_ulong = 0x00000004;
pub const UF_OPAQUE: ::c_ulong = 0x00000008;
pub const UF_NOUNLINK: ::c_ulong = 0x00000010;
pub const SF_SETTABLE: ::c_ulong = 0xffff0000;
pub const SF_ARCHIVED: ::c_ulong = 0x00010000;
pub const SF_IMMUTABLE: ::c_ulong = 0x00020000;
pub const SF_APPEND: ::c_ulong = 0x00040000;
pub const SF_NOUNLINK: ::c_ulong = 0x00100000;
f! {
pub fn WIFCONTINUED(status: ::c_int) -> bool {
status == 0x13
@ -1032,9 +1045,13 @@ extern {
pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int,
timeout: *const ::timespec) -> ::c_int;
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
pub fn chflagsat(fd: ::c_int, path: *const ::c_char, flags: ::c_ulong,
atflag: ::c_int) -> ::c_int;
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
pub fn duplocale(base: ::locale_t) -> ::locale_t;
pub fn endutxent();
pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
pub fn getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int;
pub fn getgrent_r(grp: *mut ::group,
@ -1069,6 +1086,7 @@ extern {
eventlist: *mut ::kevent,
nevents: ::c_int,
timeout: *const ::timespec) -> ::c_int;
pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;

View File

@ -580,6 +580,17 @@ pub const TIOCM_DSR: ::c_int = 0o0400;
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
// Flags for chflags(2)
pub const UF_SETTABLE: ::c_ulong = 0x0000ffff;
pub const UF_NODUMP: ::c_ulong = 0x00000001;
pub const UF_IMMUTABLE: ::c_ulong = 0x00000002;
pub const UF_APPEND: ::c_ulong = 0x00000004;
pub const UF_OPAQUE: ::c_ulong = 0x00000008;
pub const SF_SETTABLE: ::c_ulong = 0xffff0000;
pub const SF_ARCHIVED: ::c_ulong = 0x00010000;
pub const SF_IMMUTABLE: ::c_ulong = 0x00020000;
pub const SF_APPEND: ::c_ulong = 0x00040000;
f! {
pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
status >> 8
@ -594,6 +605,11 @@ f! {
}
}
extern {
pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
}
#[link(name = "util")]
extern {
pub fn mincore(addr: *mut ::c_void, len: ::size_t,

View File

@ -992,6 +992,11 @@ pub const PT_GET_EVENT_MASK: ::c_int = 17;
pub const PT_GET_PROCESS_STATE: ::c_int = 18;
pub const PT_FIRSTMACH: ::c_int = 32;
// Flags for chflags(2)
pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
pub const SF_LOG: ::c_ulong = 0x00400000;
pub const SF_SNAPINVAL: ::c_ulong = 0x00800000;
// dirfd() is a macro on netbsd to access
// the first field of the struct where dirp points to:
// http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
@ -1027,6 +1032,8 @@ extern {
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
pub fn extattr_delete_fd(fd: ::c_int,
attrnamespace: ::c_int,
attrname: *const ::c_char) -> ::c_int;

View File

@ -707,6 +707,8 @@ f! {
}
extern {
pub fn chflagsat(fd: ::c_int, path: *const ::c_char, flags: ::c_ulong,
atflag: ::c_int) -> ::c_int;
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,