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

Unified 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: fixing comments, spacing and some other minor stuff. Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: sysdeps/nacl/fxstat.c
diff --git a/sysdeps/nacl/fxstat.c b/sysdeps/nacl/fxstat.c
new file mode 100644
index 0000000000000000000000000000000000000000..ab3a8af1a37577952391a0cec903198005fc67ca
--- /dev/null
+++ b/sysdeps/nacl/fxstat.c
@@ -0,0 +1,50 @@
+
+#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;
+ 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;
+ 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)
+#ifdef SHARED
+extern __typeof (__fxstat64) __fxstat64 __attribute__ ((alias ("__GI___fxstat")));
+#endif
+extern __typeof (__nacl_abi_stat_to_stat64) __nacl_abi_stat_to_stat64 __attribute__ ((alias ("__nacl_abi_stat_to_stat")));
khim 2011/01/13 13:12:38 Why do we need both __nacl_abi_stat_to_stat64 and
« no previous file with comments | « io/sys/stat.h ('k') | sysdeps/nacl/fxstat64.c » ('j') | sysdeps/unix/sysv/linux/bits/stat.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698