Merge branch 'split-modet' into 'master'
split out mode_t type from sys_types header See merge request redox-os/relibc!1318
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_types.h.html
|
||||
#
|
||||
# This type is split out to prevent importing all of sys/types.h into other headers.
|
||||
#
|
||||
# POSIX headers that require mode_t:
|
||||
# - fcntl.h
|
||||
# - ndbm.h (TODO not present in relibc)
|
||||
# - spawn.h (TODO not present in relibc)
|
||||
# - sys/ipc.h (TODO not present in relibc)
|
||||
# - sys/mman.h
|
||||
# - sys/stat.h
|
||||
# - sys/types.h (where it should be defined)
|
||||
sys_includes = []
|
||||
include_guard = "_RELIBC_BITS_MODE_T_H"
|
||||
language = "C"
|
||||
style = "type"
|
||||
no_includes = true
|
||||
cpp_compat = true
|
||||
[export]
|
||||
include = ["mode_t"]
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
@@ -0,0 +1,14 @@
|
||||
#[cfg(target_os = "linux")]
|
||||
use crate::platform::types::c_uint;
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
use crate::platform::types::c_int;
|
||||
|
||||
/// Used for some file attributes.
|
||||
#[allow(non_camel_case_types)]
|
||||
#[cfg(target_os = "linux")]
|
||||
pub type mode_t = c_uint;
|
||||
/// Used for some file attributes.
|
||||
#[allow(non_camel_case_types)]
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
pub type mode_t = c_int;
|
||||
@@ -16,6 +16,8 @@ pub mod bits_id_t;
|
||||
pub mod bits_iovec;
|
||||
#[path = "bits_locale-t/mod.rs"]
|
||||
pub mod bits_locale_t;
|
||||
#[path = "bits_mode-t/mod.rs"]
|
||||
pub mod bits_mode_t;
|
||||
#[path = "bits_off-t/mod.rs"]
|
||||
pub mod bits_off_t;
|
||||
#[path = "bits_pid-t/mod.rs"]
|
||||
|
||||
@@ -6,6 +6,7 @@ after_includes = """
|
||||
#include <bits/clockid-t.h>
|
||||
#include <bits/gid-t.h>
|
||||
#include <bits/id-t.h>
|
||||
#include <bits/mode-t.h>
|
||||
#include <bits/off-t.h>
|
||||
#include <bits/pid-t.h>
|
||||
#include <bits/ssize-t.h>
|
||||
@@ -26,7 +27,6 @@ include = [
|
||||
"dev_t",
|
||||
"ino_t",
|
||||
"reclen_t",
|
||||
"mode_t",
|
||||
"nlink_t",
|
||||
"useconds_t",
|
||||
"blkcnt_t",
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
|
||||
pub use crate::header::{
|
||||
bits_clock_t::clock_t, bits_clockid_t::clockid_t, bits_gid_t::gid_t, bits_id_t::id_t,
|
||||
bits_off_t::off_t, bits_pid_t::pid_t, bits_ssize_t::ssize_t, bits_suseconds_t::suseconds_t,
|
||||
bits_time_t::time_t, bits_uid_t::uid_t,
|
||||
bits_mode_t::mode_t, bits_off_t::off_t, bits_pid_t::pid_t, bits_ssize_t::ssize_t,
|
||||
bits_suseconds_t::suseconds_t, bits_time_t::time_t, bits_uid_t::uid_t,
|
||||
};
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
use crate::platform::types::c_int;
|
||||
use crate::platform::types::{
|
||||
c_char, c_long, c_longlong, c_uchar, c_uint, c_ulong, c_ulonglong, c_ushort,
|
||||
};
|
||||
@@ -26,12 +24,6 @@ pub type dev_t = c_ulonglong;
|
||||
pub type ino_t = c_ulonglong;
|
||||
/// Used for directory entry lengths.
|
||||
pub type reclen_t = c_ushort;
|
||||
/// Used for some file attributes.
|
||||
#[cfg(target_os = "linux")]
|
||||
pub type mode_t = c_uint;
|
||||
/// Used for some file attributes.
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
pub type mode_t = c_int;
|
||||
/// Used for link counts.
|
||||
pub type nlink_t = c_ulong;
|
||||
pub type useconds_t = c_uint;
|
||||
|
||||
Reference in New Issue
Block a user