| 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. Directory descriptor / Handle abstraction. | 8 * NaCl Service Runtime. Directory descriptor / Handle abstraction. |
| 9 */ | 9 */ |
| 10 #include "native_client/src/include/portability.h" | 10 #include "native_client/src/include/portability.h" |
| 11 #include <windows.h> | 11 #include <windows.h> |
| 12 #include <io.h> | 12 #include <io.h> |
| 13 #include <fcntl.h> | 13 #include <fcntl.h> |
| 14 #include <sys/types.h> | 14 #include <sys/types.h> |
| 15 #include <sys/stat.h> | 15 #include <sys/stat.h> |
| 16 #include <share.h> | 16 #include <share.h> |
| 17 | 17 |
| 18 #include "native_client/src/include/nacl_platform.h" | 18 #include "native_client/src/include/nacl_platform.h" |
| 19 #include "native_client/src/shared/platform/nacl_check.h" | 19 #include "native_client/src/shared/platform/nacl_check.h" |
| 20 #include "native_client/src/shared/platform/nacl_host_desc.h" | 20 #include "native_client/src/shared/platform/nacl_host_desc.h" |
| 21 #include "native_client/src/shared/platform/nacl_host_dir.h" | 21 #include "native_client/src/shared/platform/nacl_host_dir.h" |
| 22 #include "native_client/src/shared/platform/nacl_log.h" | 22 #include "native_client/src/shared/platform/nacl_log.h" |
| 23 #include "native_client/src/shared/platform/nacl_sync.h" | 23 #include "native_client/src/shared/platform/nacl_sync.h" |
| 24 #include "native_client/src/shared/platform/nacl_sync_checked.h" | 24 #include "native_client/src/shared/platform/nacl_sync_checked.h" |
| 25 #include "native_client/src/shared/platform/win/xlate_system_error.h" | 25 #include "native_client/src/shared/platform/win/xlate_system_error.h" |
| 26 | 26 |
| 27 #include "native_client/src/trusted/service_runtime/nacl_config.h" | 27 #include "native_client/src/trusted/service_runtime/nacl_config.h" |
| 28 #include "native_client/src/trusted/service_runtime/internal_errno.h" | 28 #include "native_client/src/trusted/service_runtime/internal_errno.h" |
| 29 | 29 |
| 30 #include "native_client/src/trusted/service_runtime/include/bits/mman.h" |
| 30 #include "native_client/src/trusted/service_runtime/include/sys/dirent.h" | 31 #include "native_client/src/trusted/service_runtime/include/sys/dirent.h" |
| 31 #include "native_client/src/trusted/service_runtime/include/sys/errno.h" | 32 #include "native_client/src/trusted/service_runtime/include/sys/errno.h" |
| 32 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" | 33 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" |
| 33 #include "native_client/src/trusted/service_runtime/include/sys/mman.h" | |
| 34 #include "native_client/src/trusted/service_runtime/include/sys/stat.h" | 34 #include "native_client/src/trusted/service_runtime/include/sys/stat.h" |
| 35 | 35 |
| 36 | 36 |
| 37 #define SSIZE_T_MAX ((ssize_t) ((~(size_t) 0) >> 1)) | 37 #define SSIZE_T_MAX ((ssize_t) ((~(size_t) 0) >> 1)) |
| 38 | 38 |
| 39 | 39 |
| 40 int NaClHostDirOpen(struct NaClHostDir *d, | 40 int NaClHostDirOpen(struct NaClHostDir *d, |
| 41 char *path) { | 41 char *path) { |
| 42 wchar_t pattern[NACL_CONFIG_PATH_MAX + 1]; | 42 wchar_t pattern[NACL_CONFIG_PATH_MAX + 1]; |
| 43 int err; | 43 int err; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 int NaClHostDirClose(struct NaClHostDir *d) { | 221 int NaClHostDirClose(struct NaClHostDir *d) { |
| 222 if (NULL == d) { | 222 if (NULL == d) { |
| 223 NaClLog(LOG_FATAL, "NaClHostDirClose: 'this' is NULL\n"); | 223 NaClLog(LOG_FATAL, "NaClHostDirClose: 'this' is NULL\n"); |
| 224 } | 224 } |
| 225 NaClMutexDtor(&d->mu); | 225 NaClMutexDtor(&d->mu); |
| 226 if (!FindClose(d->handle)) { | 226 if (!FindClose(d->handle)) { |
| 227 return -NaClXlateSystemError(GetLastError()); | 227 return -NaClXlateSystemError(GetLastError()); |
| 228 } | 228 } |
| 229 return 0; | 229 return 0; |
| 230 } | 230 } |
| OLD | NEW |