| 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 * Note that we avoid using the thread-specific data / thread local | 11 * Note that we avoid using the thread-specific data / thread local |
| 12 * storage access to the "errno" variable, and instead use the raw | 12 * storage access to the "errno" variable, and instead use the raw |
| 13 * system call return interface of small negative numbers as errors. | 13 * system call return interface of small negative numbers as errors. |
| 14 */ | 14 */ |
| 15 | 15 |
| 16 #include <stdint.h> | 16 #include <stdint.h> |
| 17 #include <stdio.h> | 17 #include <stdio.h> |
| 18 #include <sys/types.h> | 18 #include <sys/types.h> |
| 19 #include <sys/stat.h> | 19 #include <sys/stat.h> |
| 20 #include <fcntl.h> | 20 #include <fcntl.h> |
| 21 #include <errno.h> | 21 #include <errno.h> |
| 22 #include <sys/mman.h> | 22 #include <sys/mman.h> |
| 23 #include <unistd.h> | 23 #include <unistd.h> |
| 24 #include "native_client/src/include/nacl_defines.h" |
| 24 | 25 |
| 25 #if NACL_LINUX | 26 #if NACL_LINUX |
| 26 # include <pthread.h> | 27 # include <pthread.h> |
| 27 /* pthread_once for NaClHostDescInit, which is no-op on other OSes */ | 28 /* pthread_once for NaClHostDescInit, which is no-op on other OSes */ |
| 28 #endif | 29 #endif |
| 29 | 30 |
| 30 #include "native_client/src/include/nacl_platform.h" | 31 #include "native_client/src/include/nacl_platform.h" |
| 31 #include "native_client/src/include/portability.h" | 32 #include "native_client/src/include/portability.h" |
| 32 | 33 |
| 33 #include "native_client/src/shared/platform/nacl_check.h" | 34 #include "native_client/src/shared/platform/nacl_check.h" |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 return -NaClXlateErrno(errno); | 726 return -NaClXlateErrno(errno); |
| 726 return 0; | 727 return 0; |
| 727 } | 728 } |
| 728 | 729 |
| 729 int NaClHostDescReadlink(const char *path, char *buf, size_t bufsize) { | 730 int NaClHostDescReadlink(const char *path, char *buf, size_t bufsize) { |
| 730 int retval = readlink(path, buf, bufsize); | 731 int retval = readlink(path, buf, bufsize); |
| 731 if (retval < 0) | 732 if (retval < 0) |
| 732 return -NaClXlateErrno(errno); | 733 return -NaClXlateErrno(errno); |
| 733 return retval; | 734 return retval; |
| 734 } | 735 } |
| OLD | NEW |