]> Sergey Matveev's repositories - public-inbox.git/commit
cmd_ipc: send FDs with buffer payload
authorEric Wong <e@80x24.org>
Sun, 10 Jan 2021 12:15:02 +0000 (12:15 +0000)
committerEric Wong <e@80x24.org>
Tue, 12 Jan 2021 03:51:42 +0000 (03:51 +0000)
commitc17c44d9e0ef28f0f0521656f335f836ad8b7754
tree32ee54ba703a76adbdb91beeba761f18a3d0884b
parenta7e6a8cd68fb6d700337d8dbc7ee2c65ff3d2fc1
cmd_ipc: send FDs with buffer payload

For another step in in syscall reduction, we'll support
transferring 3 FDs and a buffer with a single sendmsg/recvmsg
syscall using Socket::MsgHdr if available.

Beyond script/lei itself, this will be used for internal IPC
between search backends (perhaps with SOCK_SEQPACKET).  There's
a chance this could make it to the public-facing daemons, too.

This adds an optional dependency on the Socket::MsgHdr package,
available as libsocket-msghdr-perl on Debian-based distros
(but not CentOS 7.x and FreeBSD 11.x, at least).

Our Inline::C version in PublicInbox::Spawn remains the last
choice for script/lei due to the high startup time, and
IO::FDPass remains supported for non-Debian distros.

Since the socket name prefix changes from 3 to 4, we'll also
take this opportunity to make the argv+env buffer transfer less
error-prone by relying on argc instead of designated delimiters.
MANIFEST
lib/PublicInbox/CmdIPC1.pm [new file with mode: 0644]
lib/PublicInbox/CmdIPC4.pm [new file with mode: 0644]
lib/PublicInbox/LEI.pm
lib/PublicInbox/Spawn.pm
script/lei
t/cmd_ipc.t [new file with mode: 0644]
t/lei.t
t/spawn.t