diff options
author | Filipe Brandenburger <filbranden@google.com> | 2018-07-24 18:46:01 -0700 |
---|---|---|
committer | Filipe Brandenburger <filbranden@google.com> | 2018-08-02 09:25:04 -0700 |
commit | d34673ecb825aa9ecf6958b0caab792f5061c56a (patch) | |
tree | f3d4e3a2700e37048cda9358043148d1477ee4e3 /src/basic/socket-util.h | |
parent | 27d4866ad8dcbe95cfc4d59357c65c559737c1ae (diff) | |
download | systemd-d34673ecb825aa9ecf6958b0caab792f5061c56a.tar.gz |
socket-util: Introduce send_one_fd_iov() and receive_one_fd_iov()
These take a struct iovec to send data together with the passed FD.
The receive function returns the FD through an output argument. In case data is
received, but no FD is passed, the receive function will set the output
argument to -1 explicitly.
Update code in dynamic-user to use the new helpers.
Diffstat (limited to 'src/basic/socket-util.h')
-rw-r--r-- | src/basic/socket-util.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h index 8e23cf2dbd..82781a0de1 100644 --- a/src/basic/socket-util.h +++ b/src/basic/socket-util.h @@ -130,11 +130,19 @@ int getpeercred(int fd, struct ucred *ucred); int getpeersec(int fd, char **ret); int getpeergroups(int fd, gid_t **ret); +ssize_t send_one_fd_iov_sa( + int transport_fd, + int fd, + struct iovec *iov, size_t iovlen, + const struct sockaddr *sa, socklen_t len, + int flags); int send_one_fd_sa(int transport_fd, int fd, const struct sockaddr *sa, socklen_t len, int flags); -#define send_one_fd(transport_fd, fd, flags) send_one_fd_sa(transport_fd, fd, NULL, 0, flags) +#define send_one_fd_iov(transport_fd, fd, iov, iovlen, flags) send_one_fd_iov_sa(transport_fd, fd, iov, iovlen, NULL, 0, flags) +#define send_one_fd(transport_fd, fd, flags) send_one_fd_iov_sa(transport_fd, fd, NULL, 0, NULL, 0, flags) +ssize_t receive_one_fd_iov(int transport_fd, struct iovec *iov, size_t iovlen, int flags, int *ret_fd); int receive_one_fd(int transport_fd, int flags); ssize_t next_datagram_size_fd(int fd); |