| 1 |
//! Header: `sys/stat.h` |
| 2 |
|
| 3 |
use super::super::*; |
| 4 |
use crate::prelude::*; |
| 5 |
|
| 6 |
// File type constants for stat.st_mode |
| 7 |
pub const S_IFMT: mode_t = 0o170000; |
| 8 |
pub const S_IFSOCK: mode_t = 0o140000; |
| 9 |
pub const S_IFLNK: mode_t = 0o120000; |
| 10 |
pub const S_IFREG: mode_t = 0o100000; |
| 11 |
pub const S_IFBLK: mode_t = 0o060000; |
| 12 |
pub const S_IFDIR: mode_t = 0o040000; |
| 13 |
pub const S_IFCHR: mode_t = 0o020000; |
| 14 |
pub const S_IFIFO: mode_t = 0o010000; |
| 15 |
|
| 16 |
// File permission constants |
| 17 |
pub const S_ISUID: mode_t = 0o4000; |
| 18 |
pub const S_ISGID: mode_t = 0o2000; |
| 19 |
pub const S_ISVTX: mode_t = 0o1000; |
| 20 |
pub const S_IRWXU: mode_t = 0o0700; |
| 21 |
pub const S_IRUSR: mode_t = 0o0400; |
| 22 |
pub const S_IWUSR: mode_t = 0o0200; |
| 23 |
pub const S_IXUSR: mode_t = 0o0100; |
| 24 |
pub const S_IRWXG: mode_t = 0o0070; |
| 25 |
pub const S_IRGRP: mode_t = 0o0040; |
| 26 |
pub const S_IWGRP: mode_t = 0o0020; |
| 27 |
pub const S_IXGRP: mode_t = 0o0010; |
| 28 |
pub const S_IRWXO: mode_t = 0o0007; |
| 29 |
pub const S_IROTH: mode_t = 0o0004; |
| 30 |
pub const S_IWOTH: mode_t = 0o0002; |
| 31 |
pub const S_IXOTH: mode_t = 0o0001; |
| 32 |
|
| 33 |
extern "C" { |
| 34 |
pub fn stat(pathname: *const c_char, statbuf: *mut stat) -> c_int; |
| 35 |
pub fn fstat(fd: c_int, statbuf: *mut stat) -> c_int; |
| 36 |
pub fn lstat(pathname: *const c_char, statbuf: *mut stat) -> c_int; |
| 37 |
pub fn chmod(pathname: *const c_char, mode: mode_t) -> c_int; |
| 38 |
pub fn fchmod(fd: c_int, mode: mode_t) -> c_int; |
| 39 |
pub fn mkdir(pathname: *const c_char, mode: mode_t) -> c_int; |
| 40 |
pub fn mkfifo(pathname: *const c_char, mode: mode_t) -> c_int; |
| 41 |
pub fn umask(mask: mode_t) -> mode_t; |
| 42 |
} |