diff options
| author | Barosl Lee <vcs@barosl.com> | 2015-08-17 09:10:26 +0900 |
|---|---|---|
| committer | Barosl Lee <vcs@barosl.com> | 2015-08-28 03:15:15 +0900 |
| commit | 4ff44ff8faabb7e0545dfefa96b0d601f0f17b94 (patch) | |
| tree | 7dbdd15b4f2b9db1a68fb3d337cbaeec78813e2d /src | |
| parent | ccf831769459fb1b306387e6796a0155d63eb012 (diff) | |
| download | rust-4ff44ff8faabb7e0545dfefa96b0d601f0f17b94.tar.gz rust-4ff44ff8faabb7e0545dfefa96b0d601f0f17b94.zip | |
libc: Fix constants used by `libc::pathconf`
`_PC_NAME_MAX` is necessary to use `libc::pathconf`. Its value is fixed to 3 currently, but actually it varies with the platform. * _PC_NAME_MAX == 3 Linux (glibc): https://sourceware.org/git/?p=glibc.git;a=blob;f=bits/confname.h;h=1c714dfbf9398b8a600f9b69426a7ad8c7e89ab4;hb=HEAD#l32 NaCl (newlib): https://chromium.googlesource.com/native_client/nacl-newlib/+/373135ec5241d09138aa56603742b94b3b64ea1d/newlib/libc/include/sys/unistd.h#430 * _PC_NAME_MAX == 4 Android (Bionic): https://github.com/android/platform_bionic/blob/7e919daeaad62515ebbbf7b06badc77625a14d90/libc/include/unistd.h#L59 FreeBSD: https://svnweb.freebsd.org/base/head/sys/sys/unistd.h?revision=239347&view=markup#l127 NetBSD: http://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/unistd.h OS X: http://opensource.apple.com/source/xnu/xnu-2782.10.72/bsd/sys/unistd.h This commit fixes this, and also addes the `_PC_PATH_MAX` constant needed by further commits.
Diffstat (limited to 'src')
| -rw-r--r-- | src/liblibc/lib.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 5cd806dc9e3..c4d2dc83894 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -3920,6 +3920,8 @@ pub mod consts { pub const _SC_XBS5_ILP32_OFFBIG : c_int = 126; pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 128; + pub const _PC_NAME_MAX: c_int = 3; + pub const _PC_PATH_MAX: c_int = 4; } #[cfg(target_os = "nacl")] pub mod sysconf { @@ -3928,6 +3930,9 @@ pub mod consts { pub static _SC_SENDMSG_MAX_SIZE : c_int = 0; pub static _SC_NPROCESSORS_ONLN : c_int = 1; pub static _SC_PAGESIZE : c_int = 2; + + pub const _PC_NAME_MAX: c_int = 3; + pub const _PC_PATH_MAX: c_int = 4; } #[cfg(target_os = "android")] @@ -3963,6 +3968,9 @@ pub mod consts { pub const _SC_STREAM_MAX : c_int = 27; pub const _SC_TZNAME_MAX : c_int = 28; pub const _SC_PAGESIZE : c_int = 39; + + pub const _PC_NAME_MAX: c_int = 4; + pub const _PC_PATH_MAX: c_int = 5; } } @@ -4433,6 +4441,9 @@ pub mod consts { pub const _SC_SEM_VALUE_MAX : c_int = 50; pub const _SC_SIGQUEUE_MAX : c_int = 51; pub const _SC_TIMER_MAX : c_int = 52; + + pub const _PC_NAME_MAX: c_int = 4; + pub const _PC_PATH_MAX: c_int = 5; } } @@ -4868,6 +4879,9 @@ pub mod consts { pub const _SC_SYNCHRONIZED_IO : c_int = 75; pub const _SC_TIMER_MAX : c_int = 93; pub const _SC_TIMERS : c_int = 94; + + pub const _PC_NAME_MAX: c_int = 4; + pub const _PC_PATH_MAX: c_int = 5; } } @@ -5379,6 +5393,9 @@ pub mod consts { pub const _SC_TRACE_SYS_MAX : c_int = 129; pub const _SC_TRACE_USER_EVENT_MAX : c_int = 130; pub const _SC_PASS_MAX : c_int = 131; + + pub const _PC_NAME_MAX: c_int = 4; + pub const _PC_PATH_MAX: c_int = 5; } } } @@ -5835,8 +5852,6 @@ pub mod funcs { use types::os::arch::posix88::{gid_t, off_t, pid_t}; use types::os::arch::posix88::{ssize_t, uid_t}; - pub const _PC_NAME_MAX: c_int = 4; - #[cfg(not(target_os = "nacl"))] extern { pub fn access(path: *const c_char, amode: c_int) -> c_int; |
