OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include <errno.h> | 5 #include "platform/globals.h" |
6 #include <fcntl.h> | 6 #if defined(TARGET_OS_MACOS) |
7 #include <unistd.h> | 7 |
8 #include <sys/ioctl.h> | 8 #include <errno.h> // NOLINT |
| 9 #include <fcntl.h> // NOLINT |
| 10 #include <unistd.h> // NOLINT |
| 11 #include <sys/ioctl.h> // NOLINT |
9 | 12 |
10 #include "bin/fdutils.h" | 13 #include "bin/fdutils.h" |
11 | 14 |
12 | 15 |
13 bool FDUtils::SetCloseOnExec(intptr_t fd) { | 16 bool FDUtils::SetCloseOnExec(intptr_t fd) { |
14 intptr_t status; | 17 intptr_t status; |
15 status = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFD)); | 18 status = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFD)); |
16 if (status < 0) { | 19 if (status < 0) { |
17 perror("fcntl F_GETFD failed"); | 20 perror("fcntl F_GETFD failed"); |
18 return false; | 21 return false; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 ASSERT(errno != EWOULDBLOCK); | 129 ASSERT(errno != EWOULDBLOCK); |
127 return -1; | 130 return -1; |
128 } else { | 131 } else { |
129 ASSERT(bytes_written > 0); | 132 ASSERT(bytes_written > 0); |
130 remaining -= bytes_written; | 133 remaining -= bytes_written; |
131 buffer_pos += bytes_written; | 134 buffer_pos += bytes_written; |
132 } | 135 } |
133 } | 136 } |
134 return count; | 137 return count; |
135 } | 138 } |
| 139 |
| 140 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |