X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flibelogind%2Fsd-daemon%2Fsd-daemon.c;h=7639b6d3bfe5ae8d833b4696945fc1d200d6fd46;hp=d230a48dafbb99d6bfc6b8d03a2417c4962eb1c4;hb=9277945f9aca8ed56f8575ab3c6bab5ace859d3a;hpb=1132ca3c6fc46f7606044be926d06f8ef94fd2ba diff --git a/src/libelogind/sd-daemon/sd-daemon.c b/src/libelogind/sd-daemon/sd-daemon.c index d230a48da..7639b6d3b 100644 --- a/src/libelogind/sd-daemon/sd-daemon.c +++ b/src/libelogind/sd-daemon/sd-daemon.c @@ -31,13 +31,15 @@ #include #include #include -#include +//#include #include "util.h" #include "path-util.h" #include "socket-util.h" #include "sd-daemon.h" +/// UNNEEDED by elogind +#if 0 _public_ int sd_listen_fds(int unset_environment) { const char *e; unsigned n; @@ -151,6 +153,7 @@ _public_ int sd_is_special(int fd, const char *path) { return 1; } +#endif // 0 static int sd_is_socket_internal(int fd, int type, int listening) { struct stat st_fd; @@ -221,6 +224,8 @@ _public_ int sd_is_socket(int fd, int family, int type, int listening) { return 1; } +/// UNNEEDED by elogind +#if 0 _public_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) { union sockaddr_union sockaddr = {}; socklen_t l = sizeof(sockaddr); @@ -310,10 +315,15 @@ _public_ int sd_is_socket_unix(int fd, int type, int listening, const char *path _public_ int sd_is_mq(int fd, const char *path) { struct mq_attr attr; - assert_return(fd >= 0, -EBADF); + /* Check that the fd is valid */ + assert_return(fcntl(fd, F_GETFD) >= 0, -errno); - if (mq_getattr(fd, &attr) < 0) + if (mq_getattr(fd, &attr) < 0) { + if (errno == EBADF) + /* A non-mq fd (or an invalid one, but we ruled that out above) */ + return 0; return -errno; + } if (path) { char fpath[PATH_MAX]; @@ -337,6 +347,7 @@ _public_ int sd_is_mq(int fd, const char *path) { return 1; } +#endif // 0 _public_ int sd_pid_notify_with_fds(pid_t pid, int unset_environment, const char *state, const int *fds, unsigned n_fds) { union sockaddr_union sockaddr = { @@ -460,6 +471,8 @@ _public_ int sd_notify(int unset_environment, const char *state) { return sd_pid_notify_with_fds(0, unset_environment, state, NULL, 0); } +/// UNNEEDED by elogind +#if 0 _public_ int sd_pid_notifyf(pid_t pid, int unset_environment, const char *format, ...) { _cleanup_free_ char *p = NULL; int r; @@ -508,6 +521,7 @@ _public_ int sd_booted(void) { return !!S_ISDIR(st.st_mode); } +#endif // 0 _public_ int sd_watchdog_enabled(int unset_environment, uint64_t *usec) { const char *s, *p = ""; /* p is set to dummy value to do unsetting */