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 */ |
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 } | 1332 } |
1333 | 1333 |
1334 return 0; | 1334 return 0; |
1335 } | 1335 } |
1336 | 1336 |
1337 int NaClHostDescIsatty(struct NaClHostDesc *d) { | 1337 int NaClHostDescIsatty(struct NaClHostDesc *d) { |
1338 int retval; | 1338 int retval; |
1339 | 1339 |
1340 NaClHostDescCheckValidity("NaClHostDescIsatty", d); | 1340 NaClHostDescCheckValidity("NaClHostDescIsatty", d); |
1341 retval = _isatty(d->d); | 1341 retval = _isatty(d->d); |
1342 /* When _isatty fails it returns zero and sets errno. */ | 1342 /* When windows _isatty fails it returns zero, but does not set errno. */ |
1343 return (0 == retval) ? -NaClXlateErrno(errno) : 1; | 1343 return (0 == retval) ? -NACL_ABI_ENOTTY : 1; |
1344 } | 1344 } |
1345 | 1345 |
1346 int NaClHostDescClose(struct NaClHostDesc *d) { | 1346 int NaClHostDescClose(struct NaClHostDesc *d) { |
1347 int retval; | 1347 int retval; |
1348 | 1348 |
1349 NaClHostDescCheckValidity("NaClHostDescClose", d); | 1349 NaClHostDescCheckValidity("NaClHostDescClose", d); |
1350 if (-1 != d->d) { | 1350 if (-1 != d->d) { |
1351 retval = _close(d->d); | 1351 retval = _close(d->d); |
1352 if (-1 == retval) { | 1352 if (-1 == retval) { |
1353 return -GetErrno(); | 1353 return -GetErrno(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 if (_getcwd(path, (int) len) == NULL) | 1394 if (_getcwd(path, (int) len) == NULL) |
1395 return -NaClXlateErrno(errno); | 1395 return -NaClXlateErrno(errno); |
1396 return 0; | 1396 return 0; |
1397 } | 1397 } |
1398 | 1398 |
1399 int NaClHostDescUnlink(const char *path) { | 1399 int NaClHostDescUnlink(const char *path) { |
1400 if (_unlink(path) != 0) | 1400 if (_unlink(path) != 0) |
1401 return -errno; | 1401 return -errno; |
1402 return 0; | 1402 return 0; |
1403 } | 1403 } |
OLD | NEW |