OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "nacl_io/kernel_handle.h" | 5 #include "nacl_io/kernel_handle.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <pthread.h> | 8 #include <pthread.h> |
9 | 9 |
10 #include "nacl_io/filesystem.h" | 10 #include "nacl_io/filesystem.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // Attempt to clear O_APPEND. | 144 // Attempt to clear O_APPEND. |
145 return EPERM; | 145 return EPERM; |
146 } | 146 } |
147 // Only certain flags are mutable | 147 // Only certain flags are mutable |
148 const int mutable_flags = O_ASYNC | O_NONBLOCK; | 148 const int mutable_flags = O_ASYNC | O_NONBLOCK; |
149 flags &= mutable_flags; | 149 flags &= mutable_flags; |
150 handle_attr_.flags &= ~mutable_flags; | 150 handle_attr_.flags &= ~mutable_flags; |
151 handle_attr_.flags |= flags; | 151 handle_attr_.flags |= flags; |
152 return 0; | 152 return 0; |
153 } | 153 } |
| 154 default: |
| 155 LOG_ERROR("Unsupported fcntl: %#x", request); |
| 156 break; |
154 } | 157 } |
155 return ENOSYS; | 158 return ENOSYS; |
156 } | 159 } |
157 | 160 |
158 Error KernelHandle::Accept(PP_Resource* new_sock, | 161 Error KernelHandle::Accept(PP_Resource* new_sock, |
159 struct sockaddr* addr, | 162 struct sockaddr* addr, |
160 socklen_t* len) { | 163 socklen_t* len) { |
161 SocketNode* sock = socket_node(); | 164 SocketNode* sock = socket_node(); |
162 if (!sock) | 165 if (!sock) |
163 return ENOTSOCK; | 166 return ENOTSOCK; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 return ENOTSOCK; | 228 return ENOTSOCK; |
226 if (OpenMode() == O_RDONLY) | 229 if (OpenMode() == O_RDONLY) |
227 return EACCES; | 230 return EACCES; |
228 | 231 |
229 AUTO_LOCK(handle_lock_); | 232 AUTO_LOCK(handle_lock_); |
230 return sock->SendTo(handle_attr_, buf, len, flags, dest_addr, addrlen, | 233 return sock->SendTo(handle_attr_, buf, len, flags, dest_addr, addrlen, |
231 out_len); | 234 out_len); |
232 } | 235 } |
233 | 236 |
234 } // namespace nacl_io | 237 } // namespace nacl_io |
OLD | NEW |