| OLD | NEW |
| 1 // Copyright (c) 2012 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2012 The Native Client 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 <limits> | 5 #include <limits> |
| 6 #include <new> | 6 #include <new> |
| 7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
| 8 #include "base/sync_socket.h" | 8 #include "base/sync_socket.h" |
| 9 #include "native_client/src/include/portability.h" | 9 #include "native_client/src/include/portability.h" |
| 10 #include "native_client/src/include/portability_string.h" | 10 #include "native_client/src/include/portability_string.h" |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 int DescWrapper::Signal() { | 569 int DescWrapper::Signal() { |
| 570 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> | 570 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> |
| 571 Signal(desc_); | 571 Signal(desc_); |
| 572 } | 572 } |
| 573 | 573 |
| 574 int DescWrapper::Broadcast() { | 574 int DescWrapper::Broadcast() { |
| 575 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> | 575 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> |
| 576 Broadcast(desc_); | 576 Broadcast(desc_); |
| 577 } | 577 } |
| 578 | 578 |
| 579 ssize_t DescWrapper::LowLevelSendMsg(const MsgHeader* dgram, int flags) { | 579 ssize_t DescWrapper::SendMsg(const MsgHeader* dgram, int flags) { |
| 580 struct NaClImcTypedMsgHdr header; | 580 struct NaClImcTypedMsgHdr header; |
| 581 ssize_t ret = -NACL_ABI_ENOMEM; | 581 ssize_t ret = -NACL_ABI_ENOMEM; |
| 582 nacl_abi_size_t diov_length = dgram->iov_length; | 582 nacl_abi_size_t diov_length = dgram->iov_length; |
| 583 nacl_abi_size_t ddescv_length = dgram->ndescv_length; | 583 nacl_abi_size_t ddescv_length = dgram->ndescv_length; |
| 584 nacl_abi_size_t i; | 584 nacl_abi_size_t i; |
| 585 | 585 |
| 586 // Initialize to allow simple cleanups. | 586 // Initialize to allow simple cleanups. |
| 587 header.ndescv = NULL; | 587 header.ndescv = NULL; |
| 588 // Allocate and copy IOV. | 588 // Allocate and copy IOV. |
| 589 if (kSizeTMax / sizeof(NaClImcMsgIoVec) <= diov_length) { | 589 if (kSizeTMax / sizeof(NaClImcMsgIoVec) <= diov_length) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 617 } | 617 } |
| 618 // Send the message. | 618 // Send the message. |
| 619 ret = NaClImcSendTypedMessage(desc_, &header, flags); | 619 ret = NaClImcSendTypedMessage(desc_, &header, flags); |
| 620 | 620 |
| 621 cleanup: | 621 cleanup: |
| 622 free(header.ndescv); | 622 free(header.ndescv); |
| 623 free(header.iov); | 623 free(header.iov); |
| 624 return ret; | 624 return ret; |
| 625 } | 625 } |
| 626 | 626 |
| 627 ssize_t DescWrapper::LowLevelRecvMsg( | 627 ssize_t DescWrapper::RecvMsg(MsgHeader* dgram, int flags, |
| 628 MsgHeader* dgram, int flags, | 628 struct NaClDescQuotaInterface *quota_interface) { |
| 629 struct NaClDescQuotaInterface *quota_interface) { | |
| 630 struct NaClImcTypedMsgHdr header; | 629 struct NaClImcTypedMsgHdr header; |
| 631 ssize_t ret = -NACL_ABI_ENOMEM; | 630 ssize_t ret = -NACL_ABI_ENOMEM; |
| 632 nacl_abi_size_t diov_length = dgram->iov_length; | 631 nacl_abi_size_t diov_length = dgram->iov_length; |
| 633 nacl_abi_size_t ddescv_length = dgram->ndescv_length; | 632 nacl_abi_size_t ddescv_length = dgram->ndescv_length; |
| 634 nacl_abi_size_t i; | 633 nacl_abi_size_t i; |
| 635 | 634 |
| 636 // Initialize to allow simple cleanups. | 635 // Initialize to allow simple cleanups. |
| 637 header.ndescv = NULL; | 636 header.ndescv = NULL; |
| 638 for (i = 0; i < dgram->ndescv_length; ++i) { | 637 for (i = 0; i < dgram->ndescv_length; ++i) { |
| 639 dgram->ndescv[i] = NULL; | 638 dgram->ndescv[i] = NULL; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> | 735 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> |
| 737 SemWait(desc_); | 736 SemWait(desc_); |
| 738 } | 737 } |
| 739 | 738 |
| 740 int DescWrapper::GetValue() { | 739 int DescWrapper::GetValue() { |
| 741 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> | 740 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> |
| 742 GetValue(desc_); | 741 GetValue(desc_); |
| 743 } | 742 } |
| 744 | 743 |
| 745 } // namespace nacl | 744 } // namespace nacl |
| OLD | NEW |