@@ -5,6 +5,12 @@ pub type dev_t = u64;
55pub type socklen_t = u32 ;
66pub type pthread_t = c_ulong ;
77pub type mode_t = u32 ;
8+ pub type ino64_t = u64 ;
9+ pub type off64_t = i64 ;
10+ pub type blkcnt64_t = i64 ;
11+ pub type rlim64_t = u64 ;
12+
13+ pub enum fpos64_t { } // TODO: fill this out with a struct
814
915s ! {
1016 pub struct dirent {
1521 pub d_name: [ :: c_char; 256 ] ,
1622 }
1723
24+ pub struct dirent64 {
25+ pub d_ino: :: ino64_t,
26+ pub d_off: :: off64_t,
27+ pub d_reclen: :: c_ushort,
28+ pub d_type: :: c_uchar,
29+ pub d_name: [ :: c_char; 256 ] ,
30+ }
31+
32+ pub struct rlimit64 {
33+ pub rlim_cur: rlim64_t,
34+ pub rlim_max: rlim64_t,
35+ }
36+
1837 pub struct glob_t {
1938 pub gl_pathc: :: size_t,
2039 pub gl_pathv: * mut * mut c_char,
@@ -226,13 +245,47 @@ extern {
226245 -> :: c_int ;
227246 pub fn __errno_location ( ) -> * mut :: c_int ;
228247
248+ pub fn fopen64 ( filename : * const c_char ,
249+ mode : * const c_char ) -> * mut :: FILE ;
250+ pub fn freopen64 ( filename : * const c_char , mode : * const c_char ,
251+ file : * mut :: FILE ) -> * mut :: FILE ;
252+ pub fn tmpfile64 ( ) -> * mut :: FILE ;
253+ pub fn fgetpos64 ( stream : * mut :: FILE , ptr : * mut fpos64_t ) -> :: c_int ;
254+ pub fn fsetpos64 ( stream : * mut :: FILE , ptr : * const fpos64_t ) -> :: c_int ;
255+ pub fn fstat64 ( fildes : :: c_int , buf : * mut stat64 ) -> :: c_int ;
256+ pub fn stat64 ( path : * const c_char , buf : * mut stat64 ) -> :: c_int ;
257+ pub fn open64 ( path : * const c_char , oflag : :: c_int , ...) -> :: c_int ;
258+ pub fn creat64 ( path : * const c_char , mode : mode_t ) -> :: c_int ;
259+ pub fn lseek64 ( fd : :: c_int , offset : off64_t , whence : :: c_int ) -> off64_t ;
260+ pub fn pread64 ( fd : :: c_int , buf : * mut :: c_void , count : :: size_t ,
261+ offset : off64_t ) -> :: ssize_t ;
262+ pub fn pwrite64 ( fd : :: c_int , buf : * const :: c_void , count : :: size_t ,
263+ offset : off64_t ) -> :: ssize_t ;
264+ pub fn mmap64 ( addr : * mut :: c_void ,
265+ len : :: size_t ,
266+ prot : :: c_int ,
267+ flags : :: c_int ,
268+ fd : :: c_int ,
269+ offset : off64_t )
270+ -> * mut :: c_void ;
271+ pub fn lstat64 ( path : * const c_char , buf : * mut stat64 ) -> :: c_int ;
272+ pub fn ftruncate64 ( fd : :: c_int , length : off64_t ) -> :: c_int ;
273+ pub fn readdir64_r ( dirp : * mut :: DIR , entry : * mut :: dirent64 ,
274+ result : * mut * mut :: dirent64 ) -> :: c_int ;
275+
276+ pub fn getrlimit64 ( resource : :: c_int , rlim : * mut rlimit64 ) -> :: c_int ;
277+ pub fn setrlimit64 ( resource : :: c_int , rlim : * const rlimit64 ) -> :: c_int ;
278+ pub fn fseeko64 ( stream : * mut :: FILE ,
279+ offset : :: off64_t ,
280+ whence : :: c_int ) -> :: c_int ;
281+ pub fn ftello64 ( stream : * mut :: FILE ) -> :: off64_t ;
229282}
230283
231284cfg_if ! {
232285 if #[ cfg( any( target_env = "musl" ) ) ] {
233286 pub const PTHREAD_STACK_MIN : :: size_t = 2048 ;
234287 } else if #[ cfg( any( target_arch = "arm" , target_arch = "x86" ,
235- target_arch = "x86_64" ) ) ] {
288+ target_arch = "x86_64" ) ) ] {
236289 pub const PTHREAD_STACK_MIN : :: size_t = 16384 ;
237290 } else {
238291 pub const PTHREAD_STACK_MIN : :: size_t = 131072 ;
@@ -241,38 +294,11 @@ cfg_if! {
241294
242295cfg_if ! {
243296 if #[ cfg( target_env = "musl" ) ] {
244- pub const BUFSIZ : :: c_uint = 1024 ;
245- pub const TMP_MAX : :: c_uint = 10000 ;
246- pub const FOPEN_MAX : :: c_uint = 1000 ;
247- pub const POSIX_MADV_DONTNEED : :: c_int = 0 ;
248- pub const O_ACCMODE : :: c_int = 0o10000003 ;
249- pub const RUSAGE_CHILDREN : :: c_int = 1 ;
250-
251- extern {
252- pub fn ioctl( fd: :: c_int, request: :: c_int, ...) -> :: c_int;
253- }
297+ mod musl;
298+ pub use self :: musl:: * ;
254299 } else {
255- pub const BUFSIZ : :: c_uint = 8192 ;
256- pub const TMP_MAX : :: c_uint = 238328 ;
257- pub const FOPEN_MAX : :: c_uint = 16 ;
258- pub const POSIX_MADV_DONTNEED : :: c_int = 4 ;
259- pub const _SC_2_C_VERSION: :: c_int = 96 ;
260- pub const RUSAGE_THREAD : :: c_int = 1 ;
261- pub const O_ACCMODE : :: c_int = 3 ;
262- pub const RUSAGE_CHILDREN : :: c_int = -1 ;
263-
264- extern {
265- pub fn sysctl( name: * mut :: c_int,
266- namelen: :: c_int,
267- oldp: * mut :: c_void,
268- oldlenp: * mut :: size_t,
269- newp: * mut :: c_void,
270- newlen: :: size_t)
271- -> :: c_int;
272- pub fn ioctl( fd: :: c_int, request: :: c_ulong, ...) -> :: c_int;
273- pub fn backtrace( buf: * mut * mut :: c_void,
274- sz: :: c_int) -> :: c_int;
275- }
300+ mod notmusl;
301+ pub use self :: notmusl:: * ;
276302 }
277303}
278304
0 commit comments