blob: b31c6bdebb9c7482de6796e0671f91eaf3810454 (
plain) (
blame)
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 : (int)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 : (int)c ;
}
#endif
|