| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2008 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 * Note that we avoid using the thread-specific data / thread local | 10 * Note that we avoid using the thread-specific data / thread local |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 NaClLog(LOG_FATAL, "NaClHostDirClose: 'this' is NULL\n"); | 149 NaClLog(LOG_FATAL, "NaClHostDirClose: 'this' is NULL\n"); |
| 150 } | 150 } |
| 151 NaClLog(3, "NaClHostDirClose(0x%08"NACL_PRIxPTR")\n", (uintptr_t) d->dirp); | 151 NaClLog(3, "NaClHostDirClose(0x%08"NACL_PRIxPTR")\n", (uintptr_t) d->dirp); |
| 152 retval = closedir(d->dirp); | 152 retval = closedir(d->dirp); |
| 153 if (-1 != retval) { | 153 if (-1 != retval) { |
| 154 d->dirp = NULL; | 154 d->dirp = NULL; |
| 155 } | 155 } |
| 156 NaClMutexDtor(&d->mu); | 156 NaClMutexDtor(&d->mu); |
| 157 return (-1 == retval) ? -NaClXlateErrno(errno) : retval; | 157 return (-1 == retval) ? -NaClXlateErrno(errno) : retval; |
| 158 } | 158 } |
| 159 |
| 160 int NaClHostDirFchdir(struct NaClHostDir *d) { |
| 161 if (-1 == fchdir(d->fd)) { |
| 162 return -NaClXlateErrno(errno); |
| 163 } |
| 164 return 0; |
| 165 } |
| 166 |
| 167 int NaClHostDirFchmod(struct NaClHostDir *d, int mode) { |
| 168 if (-1 == fchmod(d->fd, mode)) { |
| 169 return -NaClXlateErrno(errno); |
| 170 } |
| 171 return 0; |
| 172 } |
| 173 |
| 174 int NaClHostDirFsync(struct NaClHostDir *d) { |
| 175 if (-1 == fsync(d->fd)) { |
| 176 return -NaClXlateErrno(errno); |
| 177 } |
| 178 return 0; |
| 179 } |
| 180 |
| 181 int NaClHostDirFdatasync(struct NaClHostDir *d) { |
| 182 if (-1 == fdatasync(d->fd)) { |
| 183 return -NaClXlateErrno(errno); |
| 184 } |
| 185 return 0; |
| 186 } |
| OLD | NEW |