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

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

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "sandbox/linux/syscall_broker/broker_channel.h"
6
7 #include <sys/socket.h>
8 #include <sys/types.h>
9
10 #include "base/logging.h"
11
12 namespace sandbox {
13
14 namespace syscall_broker {
15
16 // static
17 void BrokerChannel::CreatePair(EndPoint* reader, EndPoint* writer) {
18 DCHECK(reader);
19 DCHECK(writer);
20 int socket_pair[2];
21 // Use SOCK_SEQPACKET, to preserve message boundaries but we also want to be
22 // notified (recvmsg should return and not block) when the connection has
23 // been broken which could mean that the other end has been closed.
24 PCHECK(0 == socketpair(AF_UNIX, SOCK_SEQPACKET, 0, socket_pair));
25
26 reader->reset(socket_pair[0]);
27 PCHECK(0 == shutdown(reader->get(), SHUT_WR));
28
29 writer->reset(socket_pair[1]);
30 PCHECK(0 == shutdown(writer->get(), SHUT_RD));
31 }
32
33 } // namespace syscall_broker
34
35 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/linux/syscall_broker/broker_channel.h ('k') | sandbox/linux/syscall_broker/broker_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698