OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ | 5 #ifndef BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ |
6 #define BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ | 6 #define BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/base_export.h" | 13 #include "base/base_export.h" |
14 #include "base/files/scoped_file.h" | 14 #include "base/files/scoped_file.h" |
15 #include "base/process/process_handle.h" | 15 #include "base/process/process_handle.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 | 19 |
20 class Pickle; | 20 class Pickle; |
21 | 21 |
| 22 #if !defined(OS_NACL_NONSFI) |
| 23 // Creates a connected pair of UNIX-domain SOCK_SEQPACKET sockets, and passes |
| 24 // ownership of the newly allocated file descriptors to |one| and |two|. |
| 25 // Returns true on success. |
| 26 bool BASE_EXPORT CreateSocketPair(ScopedFD* one, ScopedFD* two); |
| 27 #endif |
| 28 |
22 class BASE_EXPORT UnixDomainSocket { | 29 class BASE_EXPORT UnixDomainSocket { |
23 public: | 30 public: |
24 // Maximum number of file descriptors that can be read by RecvMsg(). | 31 // Maximum number of file descriptors that can be read by RecvMsg(). |
25 static const size_t kMaxFileDescriptors; | 32 static const size_t kMaxFileDescriptors; |
26 | 33 |
27 #if !defined(OS_NACL_NONSFI) | 34 #if !defined(OS_NACL_NONSFI) |
28 // Use to enable receiving process IDs in RecvMsgWithPid. Should be called on | 35 // Use to enable receiving process IDs in RecvMsgWithPid. Should be called on |
29 // the receiving socket (i.e., the socket passed to RecvMsgWithPid). Returns | 36 // the receiving socket (i.e., the socket passed to RecvMsgWithPid). Returns |
30 // true if successful. | 37 // true if successful. |
31 static bool EnableReceiveProcessId(int fd); | 38 static bool EnableReceiveProcessId(int fd); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void* msg, | 102 void* msg, |
96 size_t length, | 103 size_t length, |
97 int flags, | 104 int flags, |
98 std::vector<ScopedFD>* fds, | 105 std::vector<ScopedFD>* fds, |
99 ProcessId* pid); | 106 ProcessId* pid); |
100 }; | 107 }; |
101 | 108 |
102 } // namespace base | 109 } // namespace base |
103 | 110 |
104 #endif // BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ | 111 #endif // BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ |
OLD | NEW |