Index: base/posix/unix_domain_socket_linux.h |
diff --git a/base/posix/unix_domain_socket_linux.h b/base/posix/unix_domain_socket_linux.h |
index 66fb8bb1bf629894c5badb4564cf517a5e4ded71..c22dd46ceb1237ec979bd965e047316fcb3fe0bc 100644 |
--- a/base/posix/unix_domain_socket_linux.h |
+++ b/base/posix/unix_domain_socket_linux.h |
@@ -10,6 +10,7 @@ |
#include <vector> |
#include "base/base_export.h" |
+#include "base/process/process_handle.h" |
class Pickle; |
@@ -18,6 +19,9 @@ class BASE_EXPORT UnixDomainSocket { |
// Maximum number of file descriptors that can be read by RecvMsg(). |
static const size_t kMaxFileDescriptors; |
+ // Use to enable receiving pids in RecvMsg. Returns true if successful. |
+ static bool EnableReceiveProcessId(int fd); |
jln (very slow on Chromium)
2014/04/24 18:32:58
Perhaps make it clear that this should be used on
mdempsky
2014/04/24 19:00:34
Done.
|
+ |
// Use sendmsg to write the given msg and include a vector of file |
// descriptors. Returns true if successful. |
static bool SendMsg(int fd, |
@@ -32,6 +36,15 @@ class BASE_EXPORT UnixDomainSocket { |
size_t length, |
std::vector<int>* fds); |
+ // Same as RecvMsg above, but also returns the sender's PID (as seen from |
+ // the caller's namespace). However, before using this function to receive |
+ // PIDs, EnableReceiveProcessId() should be called on the socket. |
+ static ssize_t RecvMsgWithPid(int fd, |
+ void* msg, |
+ size_t length, |
+ std::vector<int>* fds, |
+ base::ProcessId* pid); |
+ |
// Perform a sendmsg/recvmsg pair. |
// 1. This process creates a UNIX SEQPACKET socketpair. Using |
// connection-oriented sockets (SEQPACKET or STREAM) is critical here, |
@@ -70,7 +83,8 @@ class BASE_EXPORT UnixDomainSocket { |
void* msg, |
size_t length, |
int flags, |
- std::vector<int>* fds); |
+ std::vector<int>* fds, |
+ base::ProcessId* pid); |
jln (very slow on Chromium)
2014/04/24 18:32:58
You didn't have to modify any caller? I was pretty
mdempsky
2014/04/24 19:00:34
It has 'private' visibility, so it's only used wit
|
}; |
#endif // BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ |