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

Unified Diff: src/shared/platform/posix/nacl_host_desc.c

Issue 1235633004: DON'T USE THIS -- Providing some missing POSIX File syscalls. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « src/shared/platform/osx/nacl_host_dir.c ('k') | src/shared/platform/win/nacl_host_desc.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/shared/platform/posix/nacl_host_desc.c
diff --git a/src/shared/platform/posix/nacl_host_desc.c b/src/shared/platform/posix/nacl_host_desc.c
index 26728ccc012a1f160a9f4284a59f8ab4e02c3ab2..feccc125075c314e326d148893d8a261eb2d16e9 100644
--- a/src/shared/platform/posix/nacl_host_desc.c
+++ b/src/shared/platform/posix/nacl_host_desc.c
@@ -21,6 +21,7 @@
#include <errno.h>
#include <sys/mman.h>
#include <unistd.h>
+#include <utime.h>
#include "native_client/src/include/build_config.h"
@@ -719,3 +720,66 @@ int NaClHostDescReadlink(const char *path, char *buf, size_t bufsize) {
return -NaClXlateErrno(errno);
return retval;
}
+
+int NaClHostDescUtimes(const char *filename,
+ const struct nacl_abi_timeval times[2]) {
+ struct timeval host_times[2];
+ if (times != NULL) {
+ host_times[0].tv_sec = times[0].nacl_abi_tv_sec;
+ host_times[0].tv_usec = times[0].nacl_abi_tv_usec;
+ host_times[1].tv_sec = times[1].nacl_abi_tv_sec;
+ host_times[1].tv_usec = times[1].nacl_abi_tv_usec;
+ }
+ if (-1 == utimes(filename, (times != NULL ? host_times : NULL))) {
+ return -NaClXlateErrno(errno);
+ }
+ return 0;
+}
+
+int NaClHostDescFchdir(struct NaClHostDesc *d) {
+ NaClHostDescCheckValidity("NaClHostDescFchdir", d);
+ if (-1 == fchdir(d->d)) {
+ return -NaClXlateErrno(errno);
+ }
+ return 0;
+}
+
+int NaClHostDescFchmod(struct NaClHostDesc *d, nacl_abi_mode_t mode) {
+ NaClHostDescCheckValidity("NaClHostDescFchmod", d);
+ if (-1 == fchmod(d->d, mode)) {
+ return -NaClXlateErrno(errno);
+ }
+ return 0;
+}
+
+int NaClHostDescFsync(struct NaClHostDesc *d) {
+ NaClHostDescCheckValidity("NaClHostDescFsync", d);
+ if (-1 == fsync(d->d)) {
+ return -NaClXlateErrno(errno);
+ }
+ return 0;
+}
+
+int NaClHostDescFdatasync(struct NaClHostDesc *d) {
+ NaClHostDescCheckValidity("NaClHostDescFdatasync", d);
+ if (-1 == fdatasync(d->d)) {
+ return -NaClXlateErrno(errno);
+ }
+ return 0;
+}
+
+int NaClHostDescFtruncate(struct NaClHostDesc *d, nacl_off64_t length) {
+ NaClHostDescCheckValidity("NaClHostDescFtruncate", d);
+#if NACL_LINUX
+ if (-1 == ftruncate64(d->d, length)) {
+ return -NaClXlateErrno(errno);
+ }
+#elif NACL_OSX
+ if (-1 == ftruncate(d->d, length)) {
+ return -NaClXlateErrno(errno);
+ }
+#else
+# error Unsupported platform
+#endif
+ return 0;
+}
« no previous file with comments | « src/shared/platform/osx/nacl_host_dir.c ('k') | src/shared/platform/win/nacl_host_desc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698