blob: 92adf02abf96785f793abb99a6d5a3a94681e090 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/* ISC license. */
/* MT-unsafe */
#include <skalibs/sysdeps.h>
#include <sys/types.h>
#include <skalibs/allreadwrite.h>
#include "selfpipe-internal.h"
#include <skalibs/selfpipe.h>
#ifdef SKALIBS_HASSIGNALFD
#include <sys/signalfd.h>
int selfpipe_read (void)
{
struct signalfd_siginfo buf ;
ssize_t r = sanitize_read(fd_read(selfpipe_fd, (char *)&buf, sizeof(struct signalfd_siginfo))) ;
return (r <= 0) ? r : buf.ssi_signo ;
}
#else
int selfpipe_read (void)
{
char c ;
ssize_t r = sanitize_read((fd_read(selfpipe_fd, &c, 1))) ;
return (r <= 0) ? r : c ;
}
#endif
|