Merge branch 'fcntl-bits' into 'master'
split out stdio constants for fcntl header See merge request redox-os/relibc!1417
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html
|
||||
#
|
||||
# These constants are split out to prevent including all of stdio.h into fcntl.h
|
||||
include_guard = "_RELIBC_BITS_FCNTL_H"
|
||||
language = "C"
|
||||
no_includes = true
|
||||
cpp_compat = true
|
||||
@@ -0,0 +1,8 @@
|
||||
use crate::platform::types::c_int;
|
||||
|
||||
/// Seek relative to start-of-file.
|
||||
pub const SEEK_SET: c_int = 0;
|
||||
/// Seek relative to current position.
|
||||
pub const SEEK_CUR: c_int = 1;
|
||||
/// Seek relative to end-of-file.
|
||||
pub const SEEK_END: c_int = 2;
|
||||
@@ -10,12 +10,12 @@
|
||||
# This approach was chosen because unistd.h requires parts of fcntl.h but not the other way around.
|
||||
#
|
||||
# stdarg.h brings in va_list for ...
|
||||
# stdio.h brings in SEEK_SET, SEEK_CUR, and SEEK_END
|
||||
# sys/stat.h brings in mode_t, off_t and file mode constants
|
||||
sys_includes = ["stdarg.h", "stdio.h", "sys/stat.h"]
|
||||
sys_includes = ["stdarg.h", "sys/stat.h"]
|
||||
include_guard = "_RELIBC_FCNTL_H"
|
||||
after_includes = """
|
||||
#include <bits/pid-t.h> // for pid_t from sys/types.h
|
||||
#include <bits/fcntl.h> // for SEEK_CUR, SEEK_END and SEEK_SET from stdio.h
|
||||
"""
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
|
||||
@@ -11,6 +11,7 @@ pub mod bits_clock_t;
|
||||
pub mod bits_clockid_t;
|
||||
#[path = "bits_dev-t/mod.rs"]
|
||||
pub mod bits_dev_t;
|
||||
pub mod bits_fcntl;
|
||||
#[path = "bits_gid-t/mod.rs"]
|
||||
pub mod bits_gid_t;
|
||||
#[path = "bits_id-t/mod.rs"]
|
||||
|
||||
@@ -3,6 +3,7 @@ sys_includes = ["stdarg.h", "stddef.h", "stdint.h", "features.h"]
|
||||
after_includes = """
|
||||
#include <bits/off-t.h> // for off_t from sys/types.h
|
||||
#include <bits/ssize-t.h> // for ssize_t from sys/types.h
|
||||
#include <bits/fcntl.h> // for SEEK_CUR, SEEK_END and SEEK_SET
|
||||
"""
|
||||
include_guard = "_RELIBC_STDIO_H"
|
||||
trailer = """
|
||||
|
||||
@@ -16,9 +16,7 @@ pub const F_SVB: c_int = 64;
|
||||
pub const F_APP: c_int = 128;
|
||||
pub const F_BADJ: c_int = 256;
|
||||
|
||||
pub const SEEK_SET: c_int = 0;
|
||||
pub const SEEK_CUR: c_int = 1;
|
||||
pub const SEEK_END: c_int = 2;
|
||||
/// SEEK_SET, SEEK_CUR and SEEK_END defined in fcntl bits header
|
||||
|
||||
pub const _IOFBF: c_int = 0;
|
||||
pub const _IOLBF: c_int = 1;
|
||||
|
||||
@@ -39,6 +39,7 @@ use crate::{
|
||||
use reader::Reader;
|
||||
|
||||
pub use self::constants::*;
|
||||
pub use crate::header::bits_fcntl::{SEEK_CUR, SEEK_END, SEEK_SET};
|
||||
mod constants;
|
||||
|
||||
pub use self::default::*;
|
||||
|
||||
@@ -11,10 +11,8 @@
|
||||
# Note that unistd.h may include fcntl.h and fcntl.h may include unistd.h thus creating a cycle.
|
||||
# Relibc decides that unistd.h will include fcntl.h and fcntl.h will not include unistd.h.
|
||||
#
|
||||
# TODO fctnl.h shouldn't include all of stdio.h (split out some bits)
|
||||
#
|
||||
# stddef.h brings in size_t and NULL
|
||||
# fcntl.h brings in stdio.h bringing in SEEK_CUR, SEEK_END and SEEK_SET
|
||||
# fcntl.h brings in bits/fcntl.h bringing in SEEK_CUR, SEEK_END and SEEK_SET
|
||||
# fcntl.h brings in sys/stat.h bringing in off_t, gid_t and uid_t
|
||||
# fcntl.h brings in pid_t
|
||||
# bits/useconds-t.h brings in features.h (for deprecated annotations)
|
||||
|
||||
Reference in New Issue
Block a user