| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * NaCl Service Runtime. I/O Descriptor / Handle abstraction. Memory | 8 * NaCl Service Runtime. I/O Descriptor / Handle abstraction. Memory |
| 9 * mapping using descriptors. | 9 * mapping using descriptors. |
| 10 */ | 10 */ |
| 11 | 11 |
| 12 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_HOST_DESC_H__ | 12 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_HOST_DESC_H__ |
| 13 #define NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_HOST_DESC_H__ | 13 #define NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_HOST_DESC_H__ |
| 14 | 14 |
| 15 #include <sys/stat.h> | 15 #include <sys/stat.h> |
| 16 | 16 |
| 17 #include "native_client/src/include/build_config.h" | 17 #include "native_client/src/include/build_config.h" |
| 18 #include "native_client/src/include/nacl_compiler_annotations.h" | 18 #include "native_client/src/include/nacl_compiler_annotations.h" |
| 19 #include "native_client/src/include/portability.h" | 19 #include "native_client/src/include/portability.h" |
| 20 #include "native_client/src/shared/platform/nacl_sync.h" | 20 #include "native_client/src/shared/platform/nacl_sync.h" |
| 21 #include "native_client/src/trusted/service_runtime/include/sys/time.h" |
| 21 | 22 |
| 22 #if NACL_LINUX || NACL_OSX | 23 #if NACL_LINUX || NACL_OSX |
| 23 # include "native_client/src/shared/platform/posix/nacl_host_desc_types.h" | 24 # include "native_client/src/shared/platform/posix/nacl_host_desc_types.h" |
| 24 #elif NACL_WINDOWS | 25 #elif NACL_WINDOWS |
| 25 # include "native_client/src/shared/platform/win/nacl_host_desc_types.h" | 26 # include "native_client/src/shared/platform/win/nacl_host_desc_types.h" |
| 26 #endif | 27 #endif |
| 27 | 28 |
| 28 | 29 |
| 29 | 30 |
| 30 /* | 31 /* |
| (...skipping 26 matching lines...) Expand all Loading... |
| 57 # define NACL_HOST_LSTAT64 lstat64 | 58 # define NACL_HOST_LSTAT64 lstat64 |
| 58 #elif NACL_OSX | 59 #elif NACL_OSX |
| 59 typedef struct stat nacl_host_stat_t; | 60 typedef struct stat nacl_host_stat_t; |
| 60 # define NACL_HOST_FSTAT64 fstat | 61 # define NACL_HOST_FSTAT64 fstat |
| 61 # define NACL_HOST_STAT64 stat | 62 # define NACL_HOST_STAT64 stat |
| 62 # define NACL_HOST_LSTAT64 lstat | 63 # define NACL_HOST_LSTAT64 lstat |
| 63 #elif NACL_WINDOWS | 64 #elif NACL_WINDOWS |
| 64 typedef struct _stati64 nacl_host_stat_t; | 65 typedef struct _stati64 nacl_host_stat_t; |
| 65 # define NACL_HOST_FSTAT64 _fstat64 | 66 # define NACL_HOST_FSTAT64 _fstat64 |
| 66 # define NACL_HOST_STAT64 _stati64 | 67 # define NACL_HOST_STAT64 _stati64 |
| 67 # define NACL_HOST_LSTAT64 _lstati64 | |
| 68 #elif defined __native_client__ | 68 #elif defined __native_client__ |
| 69 /* nacl_host_stat_t not exposed to NaCl module code */ | 69 /* nacl_host_stat_t not exposed to NaCl module code */ |
| 70 #else | 70 #else |
| 71 # error "what OS?" | 71 # error "what OS?" |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 /* | 74 /* |
| 75 * TODO(bsy): it seems like these error functions are useful in more | 75 * TODO(bsy): it seems like these error functions are useful in more |
| 76 * places than just the NaClDesc library. Move them to a more central | 76 * places than just the NaClDesc library. Move them to a more central |
| 77 * header. When that's done, it should be possible to include this | 77 * header. When that's done, it should be possible to include this |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 | 352 |
| 353 /* | 353 /* |
| 354 * Rename a file or directory. | 354 * Rename a file or directory. |
| 355 */ | 355 */ |
| 356 extern int NaClHostDescRename(const char *oldpath, | 356 extern int NaClHostDescRename(const char *oldpath, |
| 357 const char *newpath) NACL_WUR; | 357 const char *newpath) NACL_WUR; |
| 358 | 358 |
| 359 /* | 359 /* |
| 360 * Create a new symlink called 'newpath', pointing to 'oldpath'. | 360 * Create a new symlink called 'newpath', pointing to 'oldpath'. |
| 361 */ | 361 */ |
| 362 extern int NaClHostDescSymlink(const char *oldpath, const char *newpath); | 362 extern int NaClHostDescSymlink(const char *oldpath, |
| 363 const char *newpath) NACL_WUR; |
| 363 | 364 |
| 364 extern int NaClHostDescChmod(const char *path, nacl_abi_mode_t amode); | 365 extern int NaClHostDescChmod(const char *path, nacl_abi_mode_t amode) NACL_WUR; |
| 365 | 366 |
| 366 extern int NaClHostDescAccess(const char *path, int amode); | 367 extern int NaClHostDescAccess(const char *path, int amode) NACL_WUR; |
| 367 | 368 |
| 368 /* | 369 /* |
| 369 * Find the target of a symlink. | 370 * Find the target of a symlink. |
| 370 * Like readlink(2) this function writes up to 'bufsize' bytes to 'buf' and | 371 * Like readlink(2) this function writes up to 'bufsize' bytes to 'buf' and |
| 371 * returns the number of bytes written but never writes the NULL terminator. | 372 * returns the number of bytes written but never writes the NULL terminator. |
| 372 * Returns -1 and sets errno on error. | 373 * Returns -1 and sets errno on error. |
| 373 */ | 374 */ |
| 374 extern int NaClHostDescReadlink(const char *path, char *buf, size_t bufsize); | 375 extern int NaClHostDescReadlink(const char *path, char *buf, size_t bufsize); |
| 375 | 376 |
| 377 extern int NaClHostDescUtimes(const char *filename, |
| 378 const struct nacl_abi_timeval *times) NACL_WUR; |
| 379 |
| 380 extern int NaClHostDescFchmod(struct NaClHostDesc *d, nacl_abi_mode_t mode) NACL
_WUR; |
| 381 |
| 382 extern int NaClHostDescFsync(struct NaClHostDesc *d) NACL_WUR; |
| 383 |
| 384 extern int NaClHostDescFdatasync(struct NaClHostDesc *d) NACL_WUR; |
| 385 |
| 386 extern int NaClHostDescFtruncate(struct NaClHostDesc *d, |
| 387 nacl_off64_t length) NACL_WUR; |
| 388 |
| 376 /* | 389 /* |
| 377 * Maps NACI_ABI_ versions of the mmap prot argument to host ABI versions | 390 * Maps NACI_ABI_ versions of the mmap prot argument to host ABI versions |
| 378 * of the bit values | 391 * of the bit values |
| 379 */ | 392 */ |
| 380 extern int NaClProtMap(int abi_prot); | 393 extern int NaClProtMap(int abi_prot); |
| 381 | 394 |
| 382 /* | 395 /* |
| 383 * Utility routine. Checks |d| is non-NULL, and that d->d is not -1. | 396 * Utility routine. Checks |d| is non-NULL, and that d->d is not -1. |
| 384 * If either is true, an appropriate LOG_FATAL message with |fn_name| | 397 * If either is true, an appropriate LOG_FATAL message with |fn_name| |
| 385 * interpolated is generated. | 398 * interpolated is generated. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 397 char const **out_msg); | 410 char const **out_msg); |
| 398 | 411 |
| 399 extern DWORD NaClflProtectMap(int prot); | 412 extern DWORD NaClflProtectMap(int prot); |
| 400 #endif | 413 #endif |
| 401 | 414 |
| 402 EXTERN_C_END | 415 EXTERN_C_END |
| 403 | 416 |
| 404 #endif /* defined __native_client__ */ | 417 #endif /* defined __native_client__ */ |
| 405 | 418 |
| 406 #endif /* NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_HOST_DESC_H__ */ | 419 #endif /* NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_HOST_DESC_H__ */ |
| OLD | NEW |