OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 317 |
318 if (NULL == d) { | 318 if (NULL == d) { |
319 NaClLog(LOG_FATAL, "NaClHostDirClose: 'this' is NULL\n"); | 319 NaClLog(LOG_FATAL, "NaClHostDirClose: 'this' is NULL\n"); |
320 } | 320 } |
321 NaClLog(3, "NaClHostDirClose(%d)\n", d->fd); | 321 NaClLog(3, "NaClHostDirClose(%d)\n", d->fd); |
322 retval = close(d->fd); | 322 retval = close(d->fd); |
323 d->fd = -1; | 323 d->fd = -1; |
324 NaClMutexDtor(&d->mu); | 324 NaClMutexDtor(&d->mu); |
325 return (-1 == retval) ? -NaClXlateErrno(errno) : retval; | 325 return (-1 == retval) ? -NaClXlateErrno(errno) : retval; |
326 } | 326 } |
| 327 |
| 328 int NaClHostDirFchdir(struct NaClHostDir *d) { |
| 329 if (-1 == fchdir(d->fd)) { |
| 330 return -NaClXlateErrno(errno); |
| 331 } |
| 332 return 0; |
| 333 } |
| 334 |
| 335 int NaClHostDirFchmod(struct NaClHostDir *d, int mode) { |
| 336 if (-1 == fchmod(d->fd, mode)) { |
| 337 return -NaClXlateErrno(errno); |
| 338 } |
| 339 return 0; |
| 340 } |
| 341 |
| 342 int NaClHostDirFsync(struct NaClHostDir *d) { |
| 343 if (-1 == fsync(d->fd)) { |
| 344 return -NaClXlateErrno(errno); |
| 345 } |
| 346 return 0; |
| 347 } |
| 348 |
| 349 int NaClHostDirFdatasync(struct NaClHostDir *d) { |
| 350 if (-1 == fdatasync(d->fd)) { |
| 351 return -NaClXlateErrno(errno); |
| 352 } |
| 353 return 0; |
| 354 } |
OLD | NEW |