| Index: sysdeps/nacl/fxstat.c
|
| diff --git a/sysdeps/nacl/fxstat.c b/sysdeps/nacl/fxstat.c
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4531746a0db52f2d99a99be1aec01cc008470e09
|
| --- /dev/null
|
| +++ b/sysdeps/nacl/fxstat.c
|
| @@ -0,0 +1,54 @@
|
| +#include <errno.h>
|
| +#include <stddef.h>
|
| +#include <sys/stat.h>
|
| +
|
| +#include <kernel_stat.h>
|
| +#include <nacl_stat.h>
|
| +#include <nacl_syscalls.h>
|
| +
|
| +void __nacl_abi_stat_to_stat (struct nacl_abi_stat *nacl_st,
|
| + struct stat *st)
|
| +{
|
| + st->st_dev = nacl_st->nacl_abi_st_dev;
|
| +#ifdef _HAVE_STAT___PAD1
|
| + st->__pad1 = 0;
|
| +#endif
|
| +#ifdef _HAVE_STAT___ST_INO
|
| + st->__st_ino = nacl_st->nacl_abi_st_ino;
|
| +#endif
|
| + st->st_mode = nacl_st->nacl_abi_st_mode;
|
| + st->st_nlink = nacl_st->nacl_abi_st_nlink;
|
| + st->st_uid = nacl_st->nacl_abi_st_uid;
|
| + st->st_gid = nacl_st->nacl_abi_st_gid;
|
| + st->st_rdev = nacl_st->nacl_abi_st_rdev;
|
| +#ifdef _HAVE_STAT___PAD2
|
| + st->__pad2 = 0;
|
| +#endif
|
| + st->st_size = nacl_st->nacl_abi_st_size;
|
| + st->st_blksize = nacl_st->nacl_abi_st_blksize;
|
| + st->st_blocks = nacl_st->nacl_abi_st_blocks;
|
| + st->st_atim.tv_sec = nacl_st->nacl_abi_st_atime;
|
| + st->st_atim.tv_nsec = 0;
|
| + st->st_mtim.tv_sec = nacl_st->nacl_abi_st_mtime;
|
| + st->st_mtim.tv_nsec = 0;
|
| + st->st_ctim.tv_sec = nacl_st->nacl_abi_st_ctime;
|
| + st->st_ctim.tv_nsec = 0;
|
| + st->st_ino = nacl_st->nacl_abi_st_ino;
|
| +}
|
| +
|
| +int __fxstat (int vers, int fd, struct stat *buf)
|
| +{
|
| + if (buf == NULL) {
|
| + errno = EFAULT;
|
| + return -1;
|
| + }
|
| + struct nacl_abi_stat nacl_buf;
|
| + int result = NACL_SYSCALL (fstat) (fd, &nacl_buf);
|
| + if (result < 0) {
|
| + errno = -result;
|
| + return -1;
|
| + }
|
| + __nacl_abi_stat_to_stat (&nacl_buf, buf);
|
| + return result;
|
| +}
|
| +hidden_def (__fxstat)
|
|
|