summaryrefslogtreecommitdiff
path: root/src/libs6/s6_fdholder_retrieve.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs6/s6_fdholder_retrieve.c')
-rw-r--r--src/libs6/s6_fdholder_retrieve.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libs6/s6_fdholder_retrieve.c b/src/libs6/s6_fdholder_retrieve.c
new file mode 100644
index 0000000..e2888a9
--- /dev/null
+++ b/src/libs6/s6_fdholder_retrieve.c
@@ -0,0 +1,18 @@
+ /* ISC license. */
+
+#include <errno.h>
+#include <skalibs/tai.h>
+#include <skalibs/unixmessage.h>
+#include <s6/s6-fdholder.h>
+
+int s6_fdholder_retrieve_maybe_delete (s6_fdholder_t *a, char const *id, int dodelete, tain_t const *deadline, tain_t *stamp)
+{
+ unixmessage_t m ;
+ s6_fdholder_retrieve_result_t res ;
+ if (!s6_fdholder_retrieve_maybe_delete_async(a, id, dodelete)) return -1 ;
+ if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return -1 ;
+ if (!unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) return -1 ;
+ if (!s6_fdholder_retrieve_cb(&m, &res)) return -1 ;
+ if (res.err) return (errno = res.err, -1) ;
+ return res.fd ;
+}