summaryrefslogtreecommitdiff
path: root/src/libstddjb/selfpipe_internal.c
blob: 34bdd51d11cd40794e9daad43c80300e9e9a12f4 (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
/* ISC license. */

/* MT-unsafe */

#include <signal.h>

#include <skalibs/sysdeps.h>
#include "selfpipe-internal.h"

sigset_t selfpipe_caught ;

#ifdef SKALIBS_HASSIGNALFD

int selfpipe_fd = -1 ;

#else

#include <unistd.h>

#include <skalibs/allreadwrite.h>

int selfpipe[2] = { -1, -1 } ;

void selfpipe_tophalf (int s)
{
  unsigned char c = (unsigned char)s ;
  write(selfpipe[1], (char *)&c, 1) ;
}

#endif