diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2016-07-20 19:20:08 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2016-07-20 19:20:08 +0000 |
commit | 885cd198c0be874147a0e98e106a85abf720a7f1 (patch) | |
tree | 97ab9180887860cc98577628fd19ba4537d7651e /src/libunixonacid/ipc_timed_recv.c | |
parent | d68c3647e69cce6aaf4fd3d94e3eb33e3125b31c (diff) | |
download | skalibs-885cd198c0be874147a0e98e106a85abf720a7f1.tar.xz |
Add ipc_timed_recv
Diffstat (limited to 'src/libunixonacid/ipc_timed_recv.c')
-rw-r--r-- | src/libunixonacid/ipc_timed_recv.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libunixonacid/ipc_timed_recv.c b/src/libunixonacid/ipc_timed_recv.c new file mode 100644 index 0000000..bcb991d --- /dev/null +++ b/src/libunixonacid/ipc_timed_recv.c @@ -0,0 +1,30 @@ +/* ISC license. */ + +#include <skalibs/functypes.h> +#include <skalibs/tai.h> +#include <skalibs/webipc.h> +#include <skalibs/unix-timed.h> + +struct blah_s +{ + int fd ; + char *s ; + unsigned int len ; + char *path ; +} ; + +static int getfd (struct blah_s *blah) +{ + return blah->fd ; +} + +static int get (struct blah_s *blah) +{ + return sanitize_read(ipc_recv(blah->fd, blah->s, blah->len, blah->path)) ; +} + +int ipc_timed_get (int fd, char *s, unsigned int len, char *path, tain_t const *deadline, tain_t *stamp) +{ + struct blah_s blah = { .fd = fd, .s = s, .len = len, .path = path } ; + return timed_get(&blah, (initfunc_t_ref)&getfd, (initfunc_t_ref)&get, deadline, stamp) ; +} |