Skip to content

Commit 8f13ec7

Browse files
ericktgraydon
authored andcommitted
---
yaml --- r: 33784 b: refs/heads/snap-stage3 c: 20c11ca h: refs/heads/master v: v3
1 parent 44a5346 commit 8f13ec7

File tree

2 files changed

+177
-5
lines changed

2 files changed

+177
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 28745ce7c8d23444130b10cf101875ddbb4e174d
4+
refs/heads/snap-stage3: 20c11ca7577480baadd2fb905bdeff3c1c17604a
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libcore/libc.rs

Lines changed: 176 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub use types::common::posix88::*;
4848
pub use types::common::posix01::*;
4949
pub use types::common::posix08::*;
5050
pub use types::common::bsd44::*;
51+
pub use types::os::common::posix01::*;
5152
pub use types::os::arch::c95::*;
5253
pub use types::os::arch::c99::*;
5354
pub use types::os::arch::posix88::*;
@@ -69,12 +70,13 @@ pub use funcs::c95::stdio::*;
6970
pub use funcs::c95::stdlib::*;
7071
pub use funcs::c95::string::*;
7172

72-
pub use funcs::posix88::stat::*;
73+
pub use funcs::posix88::stat_::*;
7374
pub use funcs::posix88::stdio::*;
7475
pub use funcs::posix88::fcntl::*;
7576
pub use funcs::posix88::dirent::*;
7677
pub use funcs::posix88::unistd::*;
7778

79+
pub use funcs::posix01::stat_::*;
7880
pub use funcs::posix01::unistd::*;
7981
pub use funcs::posix08::unistd::*;
8082

@@ -122,6 +124,8 @@ pub use open, creat;
122124
pub use access, chdir, close, dup, dup2, execv, execve, execvp, getcwd,
123125
getpid, isatty, lseek, pipe, read, rmdir, unlink, write;
124126

127+
pub use fstat, lstat, stat;
128+
125129

126130
mod types {
127131

@@ -158,6 +162,10 @@ mod types {
158162

159163
#[cfg(target_os = "linux")]
160164
pub mod os {
165+
pub mod common {
166+
pub mod posix01 {}
167+
}
168+
161169
#[cfg(target_arch = "x86")]
162170
pub mod arch {
163171
pub mod c95 {
@@ -195,7 +203,33 @@ mod types {
195203
pub type mode_t = u32;
196204
pub type ssize_t = i32;
197205
}
198-
pub mod posix01 {}
206+
pub mod posix01 {
207+
pub type nlink_t = u32;
208+
pub type blksize_t = i32;
209+
pub type blkcnt_t = i32;
210+
pub struct stat {
211+
st_dev: dev_t,
212+
__pad1: c_short,
213+
st_ino: ino_t,
214+
st_mode: mode_t,
215+
st_nlink: nlink_t,
216+
st_uid: uid_t,
217+
st_gid: gid_t,
218+
st_rdev: dev_t,
219+
__pad2: c_short,
220+
st_size: off_t,
221+
st_blksize: blksize_t,
222+
st_blocks: blkcnt_t,
223+
st_atime: time_t,
224+
st_atime_nsec: c_long,
225+
st_mtime: time_t,
226+
st_mtime_nsec: c_long,
227+
st_ctime: time_t,
228+
st_ctime_nsec: c_long,
229+
__unused4: c_long,
230+
__unused5: c_long,
231+
}
232+
}
199233
pub mod posix08 {}
200234
pub mod bsd44 {}
201235
pub mod extra {}
@@ -239,6 +273,29 @@ mod types {
239273
pub type ssize_t = i64;
240274
}
241275
pub mod posix01 {
276+
pub type nlink_t = u64;
277+
pub type blksize_t = i64;
278+
pub type blkcnt_t = i64;
279+
pub struct stat {
280+
st_dev: dev_t,
281+
st_ino: ino_t,
282+
st_nlink: nlink_t,
283+
st_mode: mode_t,
284+
st_uid: uid_t,
285+
st_gid: gid_t,
286+
__pad0: c_int,
287+
st_rdev: dev_t,
288+
st_size: off_t,
289+
st_blksize: blksize_t,
290+
st_blocks: blkcnt_t,
291+
st_atime: time_t,
292+
st_atime_nsec: c_long,
293+
st_mtime: time_t,
294+
st_mtime_nsec: c_long,
295+
st_ctime: time_t,
296+
st_ctime_nsec: c_long,
297+
__unused: [c_long * 3],
298+
}
242299
}
243300
pub mod posix08 {
244301
}
@@ -251,6 +308,10 @@ mod types {
251308

252309
#[cfg(target_os = "freebsd")]
253310
pub mod os {
311+
pub mod common {
312+
pub mod posix01 {}
313+
}
314+
254315
#[cfg(target_arch = "x86_64")]
255316
pub mod arch {
256317
pub mod c95 {
@@ -289,6 +350,34 @@ mod types {
289350
pub type ssize_t = i64;
290351
}
291352
pub mod posix01 {
353+
pub type nlink_t = u16;
354+
pub type blksize_t = i64;
355+
pub type blkcnt_t = i64;
356+
pub type fflags_t = u32;
357+
pub struct stat {
358+
st_dev: dev_t,
359+
st_ino: ino_t,
360+
st_mode: mode_t,
361+
st_nlink: nlink_t,
362+
st_uid: uid_t,
363+
st_gid: gid_t,
364+
st_rdev: dev_t,
365+
st_atime: time_t,
366+
st_atime_nsec: c_long,
367+
st_mtime: time_t,
368+
st_mtime_nsec: c_long,
369+
st_ctime: time_t,
370+
st_ctime_nsec: c_long,
371+
st_size: off_t,
372+
st_blocks: blkcnt_t,
373+
st_blksize: blksize_t,
374+
st_flags: fflags_t,
375+
st_gen: uint32_t,
376+
st_lspare: int32_t,
377+
st_birthtime: time_t,
378+
st_birthtime_nsec: c_long,
379+
__unused: [uint8_t * 2],
380+
}
292381
}
293382
pub mod posix08 {
294383
}
@@ -301,6 +390,24 @@ mod types {
301390

302391
#[cfg(target_os = "win32")]
303392
pub mod os {
393+
pub mod common {
394+
pub mod posix01 {
395+
pub struct stat {
396+
st_dev: dev_t,
397+
st_ino: ino_t,
398+
st_mode: mode_t,
399+
st_nlink: c_short,
400+
st_uid: c_short,
401+
st_gid: c_short,
402+
st_rdev: dev_t,
403+
st_size: int64_t,
404+
st_atime: time64_t,
405+
st_mtime: time64_t,
406+
st_c_time: time64_t,
407+
}
408+
}
409+
}
410+
304411
#[cfg(target_arch = "x86")]
305412
pub mod arch {
306413
pub mod c95 {
@@ -378,6 +485,38 @@ mod types {
378485

379486
#[cfg(target_os = "macos")]
380487
pub mod os {
488+
pub mod common {
489+
pub mod posix01 {
490+
pub type nlink_t = u16;
491+
pub type blksize_t = i64;
492+
pub type blkcnt_t = i32;
493+
pub struct stat {
494+
st_dev: dev_t,
495+
st_mode: mode_t,
496+
st_nlink: nlink_t,
497+
st_ino: ino_t,
498+
st_uid: uid_t,
499+
st_gid: gid_t,
500+
st_rdev: dev_t,
501+
st_atime: time_t,
502+
st_atime_nsec: c_long,
503+
st_mtime: time_t,
504+
st_mtime_nsec: c_long,
505+
st_ctime: time_t,
506+
st_ctime_nsec: c_long,
507+
st_birthtime: time_t,
508+
st_birthtime_nsec: c_long,
509+
st_size: off_t,
510+
st_blocks: blkcnt_t,
511+
st_blksize: blksize_t,
512+
st_flags: uint32_t,
513+
st_gen: uint32_t,
514+
st_lspare: int32_t,
515+
st_qspare: [int64_t * 2],
516+
}
517+
}
518+
}
519+
381520
#[cfg(target_arch = "x86")]
382521
pub mod arch {
383522
pub mod c95 {
@@ -880,7 +1019,7 @@ pub mod funcs {
8801019
pub mod posix88 {
8811020
#[nolink]
8821021
#[abi = "cdecl"]
883-
pub extern mod stat {
1022+
pub extern mod stat_ {
8841023
#[link_name = "_chmod"]
8851024
fn chmod(path: *c_char, mode: c_int) -> c_int;
8861025

@@ -990,11 +1129,28 @@ pub mod funcs {
9901129
pub mod posix88 {
9911130
#[nolink]
9921131
#[abi = "cdecl"]
993-
pub extern mod stat {
1132+
pub extern mod stat_ {
9941133
fn chmod(path: *c_char, mode: mode_t) -> c_int;
9951134
fn fchmod(fd: c_int, mode: mode_t) -> c_int;
1135+
1136+
#[cfg(target_os = "linux")]
1137+
#[cfg(target_os = "freebsd")]
1138+
fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
1139+
1140+
#[cfg(target_os = "macos")]
1141+
#[link_name = "fstat64"]
1142+
fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
1143+
9961144
fn mkdir(path: *c_char, mode: mode_t) -> c_int;
9971145
fn mkfifo(path: *c_char, mode: mode_t) -> c_int;
1146+
1147+
#[cfg(target_os = "linux")]
1148+
#[cfg(target_os = "freebsd")]
1149+
fn stat(path: *c_char, buf: *mut stat) -> c_int;
1150+
1151+
#[cfg(target_os = "macos")]
1152+
#[link_name = "stat64"]
1153+
fn stat(path: *c_char, buf: *mut stat) -> c_int;
9981154
}
9991155

10001156
#[nolink]
@@ -1079,6 +1235,18 @@ pub mod funcs {
10791235
#[cfg(target_os = "macos")]
10801236
#[cfg(target_os = "freebsd")]
10811237
pub mod posix01 {
1238+
#[nolink]
1239+
#[abi = "cdecl"]
1240+
pub extern mod stat_ {
1241+
#[cfg(target_os = "linux")]
1242+
#[cfg(target_os = "freebsd")]
1243+
fn lstat(path: *c_char, buf: *mut stat) -> c_int;
1244+
1245+
#[cfg(target_os = "macos")]
1246+
#[link_name = "lstat64"]
1247+
fn lstat(path: *c_char, buf: *mut stat) -> c_int;
1248+
}
1249+
10821250
#[nolink]
10831251
#[abi = "cdecl"]
10841252
pub extern mod unistd {
@@ -1106,6 +1274,10 @@ pub mod funcs {
11061274

11071275
#[cfg(target_os = "win32")]
11081276
pub mod posix01 {
1277+
#[nolink]
1278+
pub extern mod stat_ {
1279+
}
1280+
11091281
#[nolink]
11101282
pub extern mod unistd {
11111283
}

0 commit comments

Comments
 (0)