socket-util: add new connect_unix_path() helper

This is a short helper for connecting to AF_UNIX sockets in the file
system. It works around the 108ch limit of sockaddr_un, and supports
"at" style fds.

This doesn't come with a test of its own, but the next patch will add
that.
This commit is contained in:
Lennart Poettering
2022-05-14 05:01:38 +09:00
committed by Yu Watanabe
parent bf7a24e50f
commit 2679aee440
2 changed files with 50 additions and 0 deletions
+2
View File
@@ -332,3 +332,5 @@ int socket_get_mtu(int fd, int af, size_t *ret);
/* an initializer for struct ucred that initialized all fields to the invalid value appropriate for each */
#define UCRED_INVALID { .pid = 0, .uid = UID_INVALID, .gid = GID_INVALID }
int connect_unix_path(int fd, int dir_fd, const char *path);