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 * Native Client Resource Descriptor Transfer protocol for trusted code. | 8 * Native Client Resource Descriptor Transfer protocol for trusted code. |
9 */ | 9 */ |
10 | 10 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 retval = (*((struct NaClDescVtbl const *) channel->base.vtbl)-> | 351 retval = (*((struct NaClDescVtbl const *) channel->base.vtbl)-> |
352 SendMsg)(channel, &kern_msg_hdr, flags); | 352 SendMsg)(channel, &kern_msg_hdr, flags); |
353 NaClLog(4, "SendMsg returned %"NACL_PRIdS"\n", retval); | 353 NaClLog(4, "SendMsg returned %"NACL_PRIdS"\n", retval); |
354 if (NaClIsNegErrno(retval)) { | 354 if (NaClIsNegErrno(retval)) { |
355 /* | 355 /* |
356 * NaClWouldBlock uses TSD (for both the errno-based and | 356 * NaClWouldBlock uses TSD (for both the errno-based and |
357 * GetLastError()-based implementations), so this is threadsafe. | 357 * GetLastError()-based implementations), so this is threadsafe. |
358 */ | 358 */ |
359 if (0 != (flags & NACL_DONT_WAIT) && NaClWouldBlock()) { | 359 if (0 != (flags & NACL_DONT_WAIT) && NaClWouldBlock()) { |
360 retval = -NACL_ABI_EAGAIN; | 360 retval = -NACL_ABI_EAGAIN; |
| 361 } else if (-NACL_ABI_EMSGSIZE == retval) { |
| 362 /* |
| 363 * Allow the above layer to process when imc_sendmsg calls fail due |
| 364 * to the OS not supporting a large enough buffer. |
| 365 */ |
| 366 retval = -NACL_ABI_EMSGSIZE; |
361 } else { | 367 } else { |
362 /* | 368 /* |
363 * TODO(bsy): the else case is some mysterious internal error. | 369 * TODO(bsy): the else case is some mysterious internal error. |
364 * should we destroy the channel? Was the failure atomic? Did | 370 * should we destroy the channel? Was the failure atomic? Did |
365 * it send some partial data? Linux implementation appears | 371 * it send some partial data? Linux implementation appears |
366 * okay. | 372 * okay. |
367 * | 373 * |
368 * We return EIO and let the caller deal with it. | 374 * We return EIO and let the caller deal with it. |
369 */ | 375 */ |
370 retval = -NACL_ABI_EIO; | 376 retval = -NACL_ABI_EIO; |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 } | 772 } |
767 if (NACL_INVALID_HANDLE != sock_pair[1]) { | 773 if (NACL_INVALID_HANDLE != sock_pair[1]) { |
768 (void) NaClClose(sock_pair[1]); | 774 (void) NaClClose(sock_pair[1]); |
769 } | 775 } |
770 | 776 |
771 free(d0); | 777 free(d0); |
772 free(d1); | 778 free(d1); |
773 | 779 |
774 return retval; | 780 return retval; |
775 } | 781 } |
OLD | NEW |