socket-util: introduce socket_autobind() helper

Prompted by https://github.com/systemd/systemd/pull/36858#discussion_r2017719305
and #36833
This commit is contained in:
Mike Yuan
2025-03-31 18:11:37 +02:00
parent ddbbc98bd5
commit 1eeb4f9f47
3 changed files with 35 additions and 9 deletions
+2
View File
@@ -322,6 +322,8 @@ static inline int getsockopt_int(int fd, int level, int optname, int *ret) {
int socket_bind_to_ifname(int fd, const char *ifname);
int socket_bind_to_ifindex(int fd, int ifindex);
int socket_autobind(int fd, char **ret_name);
/* Define a 64-bit version of timeval/timespec in any case, even on 32-bit userspace. */
struct timeval_large {
uint64_t tvl_sec, tvl_usec;