#include <vector>
#include "base/base_export.h"
+#include "base/files/scoped_file.h"
+#include "base/memory/scoped_vector.h"
+#include "base/process/process_handle.h"
class Pickle;
// Maximum number of file descriptors that can be read by RecvMsg().
static const size_t kMaxFileDescriptors;
+ // Use to enable receiving process IDs in RecvMsgWithPid. Should be called on
+ // the receiving socket (i.e., the socket passed to RecvMsgWithPid). Returns
+ // true if successful.
+ static bool EnableReceiveProcessId(int fd);
+
// Use sendmsg to write the given msg and include a vector of file
// descriptors. Returns true if successful.
static bool SendMsg(int fd,
static ssize_t RecvMsg(int fd,
void* msg,
size_t length,
- std::vector<int>* fds);
+ ScopedVector<base::ScopedFD>* fds);
+
+ // Same as RecvMsg above, but also returns the sender's process ID (as seen
+ // from the caller's namespace). However, before using this function to
+ // receive process IDs, EnableReceiveProcessId() should be called on the
+ // receiving socket.
+ static ssize_t RecvMsgWithPid(int fd,
+ void* msg,
+ size_t length,
+ ScopedVector<base::ScopedFD>* fds,
+ base::ProcessId* pid);
// Perform a sendmsg/recvmsg pair.
// 1. This process creates a UNIX SEQPACKET socketpair. Using
void* msg,
size_t length,
int flags,
- std::vector<int>* fds);
+ ScopedVector<base::ScopedFD>* fds,
+ base::ProcessId* pid);
};
#endif // BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_