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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 NaClLog(LOG_FATAL, "NaClHostDirClose: 'this' is NULL\n"); | 140 NaClLog(LOG_FATAL, "NaClHostDirClose: 'this' is NULL\n"); |
141 } | 141 } |
142 NaClLog(3, "NaClHostDirClose(0x%08"NACL_PRIxPTR")\n", (uintptr_t) d->dirp); | 142 NaClLog(3, "NaClHostDirClose(0x%08"NACL_PRIxPTR")\n", (uintptr_t) d->dirp); |
143 retval = closedir(d->dirp); | 143 retval = closedir(d->dirp); |
144 if (-1 != retval) { | 144 if (-1 != retval) { |
145 d->dirp = NULL; | 145 d->dirp = NULL; |
146 } | 146 } |
147 NaClMutexDtor(&d->mu); | 147 NaClMutexDtor(&d->mu); |
148 return (-1 == retval) ? -NaClXlateErrno(errno) : retval; | 148 return (-1 == retval) ? -NaClXlateErrno(errno) : retval; |
149 } | 149 } |
| 150 |
| 151 int NaClHostDirFchdir(struct NaClHostDir *d) { |
| 152 if (-1 == fchdir(d->fd)) { |
| 153 return -NaClXlateErrno(errno); |
| 154 } |
| 155 return 0; |
| 156 } |
| 157 |
| 158 int NaClHostDirFchmod(struct NaClHostDir *d, int mode) { |
| 159 if (-1 == fchmod(d->fd, mode)) { |
| 160 return -NaClXlateErrno(errno); |
| 161 } |
| 162 return 0; |
| 163 } |
| 164 |
| 165 int NaClHostDirFsync(struct NaClHostDir *d) { |
| 166 if (-1 == fsync(d->fd)) { |
| 167 return -NaClXlateErrno(errno); |
| 168 } |
| 169 return 0; |
| 170 } |
| 171 |
| 172 int NaClHostDirFdatasync(struct NaClHostDir *d) { |
| 173 if (-1 == fdatasync(d->fd)) { |
| 174 return -NaClXlateErrno(errno); |
| 175 } |
| 176 return 0; |
| 177 } |
OLD | NEW |