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

Unified Diff: src/untrusted/nacl/sys_private.c

Issue 1065963002: Add utime implementation to libnacl (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 years, 8 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: src/untrusted/nacl/sys_private.c
diff --git a/src/untrusted/nacl/sys_private.c b/src/untrusted/nacl/sys_private.c
index c9d31f3a9e315d2683a4c040580d9ae60af8056b..3e40f2a7e7352261291c1e4af66c74fdbd227115 100644
--- a/src/untrusted/nacl/sys_private.c
+++ b/src/untrusted/nacl/sys_private.c
@@ -23,10 +23,11 @@
#include <sched.h>
#include <stdarg.h>
#include <stdint.h>
+#include <sys/mman.h>
+#include <sys/types.h>
#include <time.h>
#include <unistd.h>
-#include <sys/types.h>
-#include <sys/mman.h>
+#include <utime.h>
#include "native_client/src/include/elf32.h"
#include "native_client/src/untrusted/nacl/getcwd.h"
@@ -252,6 +253,19 @@ int readlink(const char *path, char *buf, int bufsize) {
return errno_value_call(NACL_SYSCALL(readlink)(path, buf, bufsize));
}
+int utime(const char *path, const struct utimbuf *buf) {
Mark Seaborn 2015/04/07 19:08:43 If utime.c calls utimes(), you don't need this her
Sam Clegg 2015/04/10 21:18:55 Good idea. Done.
+ struct timeval times[2];
+ struct timeval* tv = NULL;
Mark Seaborn 2015/04/07 19:08:43 Use " *" spacing
Sam Clegg 2015/04/10 21:18:55 Acknowledged.
+ if (buf != NULL) {
+ times[0].tv_sec = buf->actime;
+ times[1].tv_sec = buf->modtime;
+ times[0].tv_usec = 0;
+ times[1].tv_usec = 0;
+ tv = times;
+ }
+ return errno_value_call(NACL_SYSCALL(utimes)(path, tv));
+}
+
int utimes(const char *path, const struct timeval times[2]) {
return errno_value_call(NACL_SYSCALL(utimes)(path, times));
}

Powered by Google App Engine
This is Rietveld 408576698