summaryrefslogtreecommitdiff
path: root/src/libs6/s6_fdholder_start.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-11-27 12:44:40 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-11-27 12:44:40 +0000
commitc3150e36d6e3d8392c5801a19b7f63daa5551f37 (patch)
tree6fa1e3579c275898c964dace54184116d7d256e5 /src/libs6/s6_fdholder_start.c
parentb40d48d8fe2b7ff838d8e57482cd02f83987b7fd (diff)
downloads6-c3150e36d6e3d8392c5801a19b7f63daa5551f37.tar.xz
Add s6_fdholder_start/end, prepare for 2.6.2.0
Diffstat (limited to 'src/libs6/s6_fdholder_start.c')
-rw-r--r--src/libs6/s6_fdholder_start.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libs6/s6_fdholder_start.c b/src/libs6/s6_fdholder_start.c
new file mode 100644
index 0000000..d887247
--- /dev/null
+++ b/src/libs6/s6_fdholder_start.c
@@ -0,0 +1,19 @@
+/* ISC license. */
+
+#include <skalibs/djbunix.h>
+#include <skalibs/webipc.h>
+#include <skalibs/unixconnection.h>
+#include <s6/s6-fdholder.h>
+
+int s6_fdholder_start (s6_fdholder_t *a, char const *path, tain_t const *deadline, tain_t *stamp)
+{
+ int fd = ipc_stream_nb() ;
+ if (fd < 0) return 0 ;
+ if (!ipc_timed_connect(fd, path, deadline, stamp))
+ {
+ fd_close(fd) ;
+ return 0 ;
+ }
+ unixconnection_init(&a->connection, fd, fd) ;
+ return 1 ;
+}