diff --git a/include/limits.h b/include/limits.h index c85b58fa1d4eefffb917906dea099ae6526839c8..a8a750bb490bf8124f181bfa892971bafce8c21c 100644 --- a/include/limits.h +++ b/include/limits.h @@ -23,3 +23,5 @@ #define ULONG_MAX ((1 << 64) - 1) #define USHRT_MAX ((1 << 16) - 1) #define WORD_BIT 32 + +#define PATH_MAX 4096 diff --git a/src/unistd/src/getopt.rs b/src/unistd/src/getopt.rs index 84b774c952afa14931ea06c0697d849889ad3552..044d70c37944481402a4968da295f24722d960d7 100644 --- a/src/unistd/src/getopt.rs +++ b/src/unistd/src/getopt.rs @@ -1,10 +1,11 @@ //! getopt implementation for Redox, following http://pubs.opengroup.org/onlinepubs/009695399/functions/getopt.html -use super::platform::types::*; -use super::stdio; -use super::string; use core::ptr; +use platform::types::*; +use stdio; +use string; + #[allow(non_upper_case_globals)] #[no_mangle] pub static mut optarg: *mut c_char = ptr::null_mut(); diff --git a/src/unistd/src/lib.rs b/src/unistd/src/lib.rs index 908be1cc1457108bfd2349678671020c39585ae8..a07735fba1cf149d1aa0022ef9dd58bc7c2ee0e3 100644 --- a/src/unistd/src/lib.rs +++ b/src/unistd/src/lib.rs @@ -11,14 +11,17 @@ extern crate stdio; extern crate string; extern crate sys_utsname; +use core::ptr; + +use platform::types::*; + pub use brk::*; pub use getopt::*; -pub use platform::types::*; - -use core::ptr; +pub use pathconf::*; mod brk; mod getopt; +mod pathconf; pub const R_OK: c_int = 1; pub const W_OK: c_int = 2; @@ -39,7 +42,7 @@ pub const STDOUT_FILENO: c_int = 1; pub const STDERR_FILENO: c_int = 2; #[no_mangle] -pub static mut environ: *const *mut c_char = ptr::null(); +pub static mut environ: *mut *mut c_char = ptr::null(); #[no_mangle] pub extern "C" fn _exit(status: c_int) { @@ -159,11 +162,6 @@ pub extern "C" fn fork() -> pid_t { platform::fork() } -#[no_mangle] -pub extern "C" fn fpathconf(fildes: c_int, name: c_int) -> c_long { - unimplemented!(); -} - #[no_mangle] pub extern "C" fn fsync(fildes: c_int) -> c_int { platform::fsync(fildes) @@ -346,11 +344,6 @@ pub extern "C" fn nice(incr: c_int) -> c_int { unimplemented!(); } -#[no_mangle] -pub extern "C" fn pathconf(path: *const c_char, name: c_int) -> c_long { - unimplemented!(); -} - #[no_mangle] pub extern "C" fn pause() -> c_int { unimplemented!(); diff --git a/src/unistd/src/pathconf.rs b/src/unistd/src/pathconf.rs new file mode 100644 index 0000000000000000000000000000000000000000..9376853753513b6f85952463774b1a001e659576 --- /dev/null +++ b/src/unistd/src/pathconf.rs @@ -0,0 +1,33 @@ +use platform::types::*; + +pub const _PC_LINK_MAX: c_int = 0; +pub const _PC_MAX_CANON: c_int = 1; +pub const _PC_MAX_INPUT: c_int = 2; +pub const _PC_NAME_MAX: c_int = 3; +pub const _PC_PATH_MAX: c_int = 4; +pub const _PC_PIPE_BUF: c_int = 5; +pub const _PC_CHOWN_RESTRICTED: c_int = 6; +pub const _PC_NO_TRUNC: c_int = 7; +pub const _PC_VDISABLE: c_int = 8; +pub const _PC_SYNC_IO: c_int = 9; +pub const _PC_ASYNC_IO: c_int = 10; +pub const _PC_PRIO_IO: c_int = 11; +pub const _PC_SOCK_MAXBUF: c_int = 12; +pub const _PC_FILESIZEBITS: c_int = 13; +pub const _PC_REC_INCR_XFER_SIZE: c_int = 14; +pub const _PC_REC_MAX_XFER_SIZE: c_int = 15; +pub const _PC_REC_MIN_XFER_SIZE: c_int = 16; +pub const _PC_REC_XFER_ALIGN: c_int = 17; +pub const _PC_ALLOC_SIZE_MIN: c_int = 18; +pub const _PC_SYMLINK_MAX: c_int = 19; +pub const _PC_2_SYMLINKS: c_int = 20; + +#[no_mangle] +pub extern "C" fn fpathconf(fildes: c_int, name: c_int) -> c_long { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn pathconf(path: *const c_char, name: c_int) -> c_long { + unimplemented!(); +}