OLD | NEW |
---|---|
(Empty) | |
1 | |
2 #include <errno.h> | |
3 #include <stddef.h> | |
4 #include <sys/stat.h> | |
5 | |
6 #include <kernel_stat.h> | |
7 #include <nacl_stat.h> | |
8 #include <nacl_syscalls.h> | |
9 | |
10 void __nacl_abi_stat_to_stat (struct nacl_abi_stat *nacl_st, | |
11 struct stat *st) | |
12 { | |
13 st->st_dev = nacl_st->nacl_abi_st_dev; | |
14 st->st_mode = nacl_st->nacl_abi_st_mode; | |
15 st->st_nlink = nacl_st->nacl_abi_st_nlink; | |
16 st->st_uid = nacl_st->nacl_abi_st_uid; | |
17 st->st_gid = nacl_st->nacl_abi_st_gid; | |
18 st->st_rdev = nacl_st->nacl_abi_st_rdev; | |
19 st->st_size = nacl_st->nacl_abi_st_size; | |
20 st->st_blksize = nacl_st->nacl_abi_st_blksize; | |
21 st->st_blocks = nacl_st->nacl_abi_st_blocks; | |
22 st->st_atim.tv_sec = nacl_st->nacl_abi_st_atime; | |
23 st->st_atim.tv_nsec = 0; | |
24 st->st_mtim.tv_sec = nacl_st->nacl_abi_st_mtime; | |
25 st->st_mtim.tv_nsec = 0; | |
26 st->st_ctim.tv_sec = nacl_st->nacl_abi_st_ctime; | |
27 st->st_ctim.tv_nsec = 0; | |
28 st->st_ino = nacl_st->nacl_abi_st_ino; | |
29 } | |
30 | |
31 int __fxstat (int vers, int fd, struct stat *buf) | |
32 { | |
33 if (buf == NULL) { | |
34 errno = EFAULT; | |
35 return -1; | |
36 } | |
37 struct nacl_abi_stat nacl_buf; | |
38 int result = NACL_SYSCALL (fstat) (fd, &nacl_buf); | |
39 if (result < 0) { | |
40 errno = -result; | |
41 return -1; | |
42 } | |
43 __nacl_abi_stat_to_stat (&nacl_buf, buf); | |
44 return result; | |
45 } | |
46 hidden_def(__fxstat) | |
47 #ifdef SHARED | |
48 extern __typeof (__fxstat64) __fxstat64 __attribute__ ((alias ("__GI___fxstat")) ); | |
49 #endif | |
50 extern __typeof (__nacl_abi_stat_to_stat64) __nacl_abi_stat_to_stat64 __attribut e__ ((alias ("__nacl_abi_stat_to_stat"))); | |
khim
2011/01/13 13:12:38
Why do we need both __nacl_abi_stat_to_stat64 and
| |
OLD | NEW |