Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / sandbox / linux / syscall_broker / broker_channel.cc
blobfa0f7615fcade7f3258834b70d7b973216496d22
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.
5 #include "sandbox/linux/syscall_broker/broker_channel.h"
7 #include <sys/socket.h>
8 #include <sys/types.h>
10 #include "base/logging.h"
12 namespace sandbox {
14 namespace syscall_broker {
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));
26 reader->reset(socket_pair[0]);
27 PCHECK(0 == shutdown(reader->get(), SHUT_WR));
29 writer->reset(socket_pair[1]);
30 PCHECK(0 == shutdown(writer->get(), SHUT_RD));
33 } // namespace syscall_broker
35 } // namespace sandbox