blob: 7af8eb4e6d462ab95bbd06d1c30fb38564c5484c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
/* ISC license. */
#include <errno.h>
#include <skalibs/allreadwrite.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 const *deadline, tain *stamp)
{
unixmessage 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 (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return -1 ;
if (!s6_fdholder_retrieve_cb(&m, &res)) return -1 ;
if (res.err) return (errno = res.err, -1) ;
return res.fd ;
}
|