summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/util.c b/src/util.c
index bf37711..1d0cd90 100644
--- a/src/util.c
+++ b/src/util.c
@@ -31,6 +31,8 @@
#include "util.h"
+#ifdef ENABLE_LEGACY
+
/* Calculate the difference between the two specfified timeval
* timestamsps. */
usec_t timeval_diff(const struct timeval *a, const struct timeval *b) {
@@ -102,19 +104,6 @@ void timeval_add(struct timeval *tv, usec_t v) {
}
}
-int set_cloexec(int fd) {
- int n;
- assert(fd >= 0);
-
- if ((n = fcntl(fd, F_GETFD)) < 0)
- return -1;
-
- if (n & FD_CLOEXEC)
- return 0;
-
- return fcntl(fd, F_SETFD, n|FD_CLOEXEC);
-}
-
int set_nonblock(int fd) {
int n;
assert(fd >= 0);
@@ -203,3 +192,18 @@ int wait_for_read(int fd, struct timeval *end) {
}
}
+#endif
+
+int set_cloexec(int fd) {
+ int n;
+ assert(fd >= 0);
+
+ if ((n = fcntl(fd, F_GETFD)) < 0)
+ return -1;
+
+ if (n & FD_CLOEXEC)
+ return 0;
+
+ return fcntl(fd, F_SETFD, n|FD_CLOEXEC);
+}
+