Browse Source

Check for signalfd() function in configure.ac

Serj Kalichev 3 years ago
parent
commit
80c5f3601a
3 changed files with 20 additions and 1 deletions
  1. 7 1
      configure.ac
  2. 1 0
      faux/net.h
  3. 12 0
      faux/net/net.c

+ 7 - 1
configure.ac

@@ -146,7 +146,7 @@ AC_CHECK_HEADERS(grp.h, [],
     AC_MSG_WARN([grp.h not found: the grp operations is not supported]))
 
 ################################
-# Check for dlopen
+# Check for dlopen()
 ################################
 AC_CHECK_HEADERS(dlfcn.h, [
         AC_SEARCH_LIBS([dlopen], [dl dld], [], [
@@ -161,6 +161,12 @@ AC_CHECK_HEADERS(dlfcn.h, [
 ################################
 AX_PTHREAD
 
+################################
+# Check for signalfd()
+################################
+AC_CHECK_FUNCS(signalfd, [],
+    AC_MSG_WARN([signalfd() not found: more complex mechanism will be used]))
+
 
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT

+ 1 - 0
faux/net.h

@@ -40,6 +40,7 @@ ssize_t faux_recvv_block(int fd, struct iovec *iov, int iovcnt,
 faux_net_t *faux_net_new(void);
 void faux_net_free(faux_net_t *faux_net);
 void faux_net_set_fd(faux_net_t *faux_net, int fd);
+void faux_net_unset_fd(faux_net_t *faux_net);
 int faux_net_get_fd(faux_net_t *faux_net);
 void faux_net_set_send_timeout(faux_net_t *faux_net, struct timespec *send_timeout);
 void faux_net_set_recv_timeout(faux_net_t *faux_net, struct timespec *recv_timeout);

+ 12 - 0
faux/net/net.c

@@ -80,6 +80,18 @@ void faux_net_set_fd(faux_net_t *faux_net, int fd)
 }
 
 
+/** @brief Unsets socket descriptor.
+ *
+ * @param [in] faux_net The faux_net_t object.
+ */
+void faux_net_unset_fd(faux_net_t *faux_net)
+{
+	if (!faux_net)
+		return;
+	faux_net->fd = -1;
+}
+
+
 /** @brief Gets file descriptor from object.
  *
  * @param [in] faux_net The faux_net_t object.