class UnixSocketRaw
Defined at line 130 of file ../../third_party/perfetto/include/perfetto/ext/base/unix_socket.h
UnixSocketRaw is a basic wrapper around sockets. It exposes wrapper
methods that take care of most common pitfalls (e.g., marking fd as
O_CLOEXEC, avoiding SIGPIPE, properly handling partial writes). It is used as
a building block for the more sophisticated UnixSocket class which depends
on base::TaskRunner.
Public Methods
UnixSocketRaw CreateMayFail (SockFamily family, SockType type)
Creates a new unconnected unix socket.
std::pair<UnixSocketRaw, UnixSocketRaw> CreatePairPosix (SockFamily , SockType )
Crates a pair of connected sockets.
void UnixSocketRaw ()
Creates an uninitialized unix socket.
void UnixSocketRaw (ScopedSocketHandle , SockFamily , SockType )
Creates a unix socket adopting an existing file descriptor. This is
typically used to inherit fds from init via environment variables.
bool Bind (const std::string & socket_name)
bool Listen ()
bool Connect (const std::string & socket_name)
bool SetTxTimeout (uint32_t timeout_ms)
bool SetRxTimeout (uint32_t timeout_ms)
void Shutdown ()
void SetBlocking (bool )
void DcheckIsBlocking (bool expected)
void SetRetainOnExec (bool retain)
std::string GetSockAddr ()
void ~UnixSocketRaw ()
Defined at line 148 of file ../../third_party/perfetto/include/perfetto/ext/base/unix_socket.h
void UnixSocketRaw (UnixSocketRaw && )
Defined at line 149 of file ../../third_party/perfetto/include/perfetto/ext/base/unix_socket.h
UnixSocketRaw & operator= (UnixSocketRaw && )
Defined at line 150 of file ../../third_party/perfetto/include/perfetto/ext/base/unix_socket.h
SockType type ()
Defined at line 162 of file ../../third_party/perfetto/include/perfetto/ext/base/unix_socket.h
SockFamily family ()
Defined at line 163 of file ../../third_party/perfetto/include/perfetto/ext/base/unix_socket.h
SocketHandle fd ()
Defined at line 164 of file ../../third_party/perfetto/include/perfetto/ext/base/unix_socket.h
bool operator bool ()
Defined at line 165 of file ../../third_party/perfetto/include/perfetto/ext/base/unix_socket.h
PlatformHandle watch_handle ()
This is the handle that passed to TaskRunner.AddFileDescriptorWatch().
On UNIX this is just the socket FD. On Windows, we need to create a
dedicated event object.
Defined at line 170 of file ../../third_party/perfetto/include/perfetto/ext/base/unix_socket.h
ScopedSocketHandle ReleaseFd ()
Defined at line 178 of file ../../third_party/perfetto/include/perfetto/ext/base/unix_socket.h
ssize_t Send (const void * msg, size_t len, const int * send_fds, size_t num_fds)
|send_fds| and |num_fds| are ignored on Windows.
ssize_t Receive (void * msg, size_t len, ScopedFile * fd_vec, size_t max_files)
|fd_vec| and |max_files| are ignored on Windows.
ssize_t SendMsgAllPosix (struct msghdr * msg)
Re-enter sendmsg until all the data has been sent or an error occurs.
TODO(fmayer): Figure out how to do timeouts here for heapprofd.
ssize_t SendStr (const std::string & str)
Defined at line 186 of file ../../third_party/perfetto/include/perfetto/ext/base/unix_socket.h
void ShiftMsgHdrPosix (size_t n, struct msghdr * msg)
Exposed for testing only.
Update msghdr so subsequent sendmsg will send data that remains after n
bytes have already been sent.