Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: sysdeps/nacl/fxstat.c

Issue 6026005: Fix __fxstat which is called from fstat. Remove obsolete fstat64. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/nacl-glibc.git@master
Patch Set: Fix __fxstat, unificating struct stat and struct stat64. Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 hidden_def (__fxstat64)
48 /* stat and stat64 are the same in nacl. */
49 /* Next lines are for true believers. */
50 extern __typeof (__fxstat64) __fxstat64 __attribute__ ((alias ("__fxstat")));
51 extern __typeof (__nacl_abi_stat_to_stat64) __nacl_abi_stat_to_stat64 __attribut e__ ((alias ("__nacl_abi_stat_to_stat")));
OLDNEW
« no previous file with comments | « bits/typesizes.h ('k') | sysdeps/nacl/fxstat64.c » ('j') | sysdeps/nacl/nacl_stat.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698