OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Native Client Authors. All rights reserved. | 2 * Copyright 2008 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 * NaCl Service Runtime. I/O Descriptor / Handle abstraction. | 8 * NaCl Service Runtime. I/O Descriptor / Handle abstraction. |
9 */ | 9 */ |
10 | 10 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 int result; | 195 int result; |
196 | 196 |
197 NaClXMutexLock(&self->sendmsg_mu); | 197 NaClXMutexLock(&self->sendmsg_mu); |
198 result = NaClSendDatagram(self->base.h, dgram, flags); | 198 result = NaClSendDatagram(self->base.h, dgram, flags); |
199 NaClXMutexUnlock(&self->sendmsg_mu); | 199 NaClXMutexUnlock(&self->sendmsg_mu); |
200 | 200 |
201 if (-1 == result) { | 201 if (-1 == result) { |
202 #if NACL_WINDOWS | 202 #if NACL_WINDOWS |
203 return -NaClXlateSystemError(GetLastError()); | 203 return -NaClXlateSystemError(GetLastError()); |
204 #elif NACL_LINUX || NACL_OSX | 204 #elif NACL_LINUX || NACL_OSX |
205 return -errno; | 205 return -NaClXlateErrno(errno); |
206 #else | 206 #else |
207 # error "Unknown target platform: cannot translate error code(s) from SendMsg" | 207 # error "Unknown target platform: cannot translate error code(s) from SendMsg" |
208 #endif | 208 #endif |
209 } | 209 } |
210 return result; | 210 return result; |
211 } | 211 } |
212 | 212 |
213 | 213 |
214 /* | 214 /* |
215 * NaClDescXferableDataDescSendMsg implements imc_sendmsg For | 215 * NaClDescXferableDataDescSendMsg implements imc_sendmsg For |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 " non-zero handle_count\n")); | 248 " non-zero handle_count\n")); |
249 return -NACL_ABI_EINVAL; | 249 return -NACL_ABI_EINVAL; |
250 } | 250 } |
251 | 251 |
252 result = NaClSendDatagram(self->base.h, dgram, flags); | 252 result = NaClSendDatagram(self->base.h, dgram, flags); |
253 | 253 |
254 if (-1 == result) { | 254 if (-1 == result) { |
255 #if NACL_WINDOWS | 255 #if NACL_WINDOWS |
256 return -NaClXlateSystemError(GetLastError()); | 256 return -NaClXlateSystemError(GetLastError()); |
257 #elif NACL_LINUX || NACL_OSX | 257 #elif NACL_LINUX || NACL_OSX |
258 return -errno; | 258 return -NaClXlateErrno(errno); |
259 #else | 259 #else |
260 # error "Unknown target platform: cannot translate error code(s) from SendMsg" | 260 # error "Unknown target platform: cannot translate error code(s) from SendMsg" |
261 #endif | 261 #endif |
262 } | 262 } |
263 return result; | 263 return result; |
264 } | 264 } |
265 | 265 |
266 | 266 |
267 /* | 267 /* |
268 * See discussion at NaClDescImcDescSendMsg for details. An | 268 * See discussion at NaClDescImcDescSendMsg for details. An |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 *xfer->next_handle++ = NACL_INVALID_HANDLE; | 467 *xfer->next_handle++ = NACL_INVALID_HANDLE; |
468 *baseptr = (struct NaClDesc *) ndxdp; | 468 *baseptr = (struct NaClDesc *) ndxdp; |
469 rv = 0; | 469 rv = 0; |
470 | 470 |
471 cleanup: | 471 cleanup: |
472 if (rv < 0) { | 472 if (rv < 0) { |
473 free(ndxdp); | 473 free(ndxdp); |
474 } | 474 } |
475 return rv; | 475 return rv; |
476 } | 476 } |
OLD | NEW |