Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: sandbox/linux/syscall_broker/broker_client.cc

Issue 1146813011: Move UnixDomainSocket to base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sandbox/linux/syscall_broker/broker_client.h" 5 #include "sandbox/linux/syscall_broker/broker_client.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 write_pickle.WriteInt(flags); 71 write_pickle.WriteInt(flags);
72 RAW_CHECK(write_pickle.size() <= kMaxMessageLength); 72 RAW_CHECK(write_pickle.size() <= kMaxMessageLength);
73 73
74 int returned_fd = -1; 74 int returned_fd = -1;
75 uint8_t reply_buf[kMaxMessageLength]; 75 uint8_t reply_buf[kMaxMessageLength];
76 76
77 // Send a request (in write_pickle) as well that will include a new 77 // Send a request (in write_pickle) as well that will include a new
78 // temporary socketpair (created internally by SendRecvMsg()). 78 // temporary socketpair (created internally by SendRecvMsg()).
79 // Then read the reply on this new socketpair in reply_buf and put an 79 // Then read the reply on this new socketpair in reply_buf and put an
80 // eventual attached file descriptor in |returned_fd|. 80 // eventual attached file descriptor in |returned_fd|.
81 ssize_t msg_len = UnixDomainSocket::SendRecvMsgWithFlags( 81 ssize_t msg_len = base::UnixDomainSocket::SendRecvMsgWithFlags(
82 ipc_channel_.get(), reply_buf, sizeof(reply_buf), recvmsg_flags, 82 ipc_channel_.get(), reply_buf, sizeof(reply_buf), recvmsg_flags,
83 &returned_fd, write_pickle); 83 &returned_fd, write_pickle);
84 if (msg_len <= 0) { 84 if (msg_len <= 0) {
85 if (!quiet_failures_for_tests_) 85 if (!quiet_failures_for_tests_)
86 RAW_LOG(ERROR, "Could not make request to broker process"); 86 RAW_LOG(ERROR, "Could not make request to broker process");
87 return -ENOMEM; 87 return -ENOMEM;
88 } 88 }
89 89
90 Pickle read_pickle(reinterpret_cast<char*>(reply_buf), msg_len); 90 Pickle read_pickle(reinterpret_cast<char*>(reply_buf), msg_len);
91 PickleIterator iter(read_pickle); 91 PickleIterator iter(read_pickle);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 return PathAndFlagsSyscall(COMMAND_ACCESS, pathname, mode); 135 return PathAndFlagsSyscall(COMMAND_ACCESS, pathname, mode);
136 } 136 }
137 137
138 int BrokerClient::Open(const char* pathname, int flags) const { 138 int BrokerClient::Open(const char* pathname, int flags) const {
139 return PathAndFlagsSyscall(COMMAND_OPEN, pathname, flags); 139 return PathAndFlagsSyscall(COMMAND_OPEN, pathname, flags);
140 } 140 }
141 141
142 } // namespace syscall_broker 142 } // namespace syscall_broker
143 143
144 } // namespace sandbox 144 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/linux/integration_tests/namespace_unix_domain_socket_unittest.cc ('k') | sandbox/linux/syscall_broker/broker_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698