13#include <sys/select.h>
19#include <sys/socket.h>
28#ifndef SINGULAR_SI_SIGNALS_H
29#define SINGULAR_SI_SIGNALS_H
31#define SI_EINTR_SAVE_FUNC_TEMPLATE(return_type, newfunc, func, decl, args, err_domain) \
32static inline return_type newfunc decl \
38 } while((res err_domain) && (errno == EINTR));\
42#define SI_EINTR_SAVE_FUNC(return_type, func, decl, args) \
43 SI_EINTR_SAVE_FUNC_TEMPLATE(return_type, si_##func, func, decl, args, < 0)
45#define SI_EINTR_SAVE_SCANF(return_type, func, decl, args) \
46 SI_EINTR_SAVE_FUNC_TEMPLATE(return_type, si_##func, func, decl, args, == EOF)
49 (
int nfds, fd_set *readfds, fd_set *writefds,
50 fd_set *exceptfds,
struct timeval *timeout),
51 (nfds,readfds, writefds, exceptfds, timeout)
56 (
struct pollfd *fds, nfds_t nfds,
int timeout),
90#define SI_GET_FIFTH(_4,_3, _2, _1, N, ...) N
91#define si_open(...) SI_GET_FIFTH(X,##__VA_ARGS__, si_open2, si_open1)(__VA_ARGS__)
100 (
int sockfd,
struct sockaddr *addr, socklen_t *addrlen),
101 (sockfd, addr, addrlen))
104 (
int sockfd,
const struct sockaddr *addr, socklen_t addrlen),
105 (sockfd, addr, addrlen))
112si_nanosleep(
const struct timespec *req,
struct timespec *
rem)
117 res = nanosleep(req,
rem);
118 }
while((
rem !=
NULL) && (
res < 0) && (errno == EINTR));
123static inline unsigned int
124si_sleep(
unsigned int seconds)
128 seconds = sleep(seconds);
129 }
while(seconds != 0);
141 (
const char *format, va_list
ap),
145int si_scanf(
const char *format, ...)
148 va_start(argptr, format);
149 int res = si_vscanf(format, argptr);
155 (FILE *stream,
const char *format, va_list
ap),
156 (stream, format,
ap))
159si_fscanf(FILE *stream,
const char *format, ...)
162 va_start(argptr, format);
163 int res = si_vfscanf(stream, format, argptr);
169 (
const char *str,
const char *format, va_list
ap),
173si_sscanf(
const char *str,
const char *format, ...)
176 va_start(argptr, format);
177 int res = si_vsscanf(str, format, argptr);
191 (
int signum,
const struct sigaction *
act,
192 struct sigaction *oldact),
193 (signum,
act, oldact))
196#ifdef HAVE_SIGINTERRUPT
200#define si_siginterrupt(arg1, arg2)
211#undef SI_EINTR_SAVE_FUNC
void select(const ListCFList &ppi, int length, ListCFList &ppi1, ListCFList &ppi2)
void rem(unsigned long *a, unsigned long *q, unsigned long p, int °a, int degq)
#define SI_EINTR_SAVE_FUNC(return_type, func, decl, args)
#define SI_EINTR_SAVE_SCANF(return_type, func, decl, args)
#define SI_EINTR_SAVE_FUNC_TEMPLATE(return_type, newfunc, func, decl, args, err_domain)
int status int void size_t count const char int flags
int status int void size_t count open
int status int void size_t count si_open1
int status int void size_t count
int status int void size_t count const char * pathname
int status int void * buf