13#include <sys/select.h>
19#include <sys/socket.h>
25#ifndef SINGULAR_SI_SIGNALS_H
26#define SINGULAR_SI_SIGNALS_H
28#define SI_EINTR_SAVE_FUNC_TEMPLATE(return_type, newfunc, func, decl, args, err_domain) \
29static inline return_type newfunc decl \
35 } while((res err_domain) && (errno == EINTR));\
39#define SI_EINTR_SAVE_FUNC(return_type, func, decl, args) \
40 SI_EINTR_SAVE_FUNC_TEMPLATE(return_type, si_##func, func, decl, args, < 0)
42#define SI_EINTR_SAVE_SCANF(return_type, func, decl, args) \
43 SI_EINTR_SAVE_FUNC_TEMPLATE(return_type, si_##func, func, decl, args, == EOF)
46 (
int nfds, fd_set *readfds, fd_set *writefds,
47 fd_set *exceptfds,
struct timeval *timeout),
48 (nfds,readfds, writefds, exceptfds, timeout)
64 (
int fd,
const struct iovec *iov,
int iovcnt),
80#define SI_GET_FIFTH(_4,_3, _2, _1, N, ...) N
81#define si_open(...) SI_GET_FIFTH(X,##__VA_ARGS__, si_open2, si_open1)(__VA_ARGS__)
90 (
int sockfd,
struct sockaddr *addr, socklen_t *addrlen),
91 (sockfd, addr, addrlen))
94 (
int sockfd,
const struct sockaddr *addr, socklen_t addrlen),
95 (sockfd, addr, addrlen))
101si_nanosleep(
const struct timespec *req,
struct timespec *
rem) {
106 res = nanosleep(req,
rem);
107 }
while((
rem !=
NULL) && (
res < 0) && (errno == EINTR));
111static inline unsigned int
112si_sleep(
unsigned int seconds)
116 seconds = sleep(seconds);
117 }
while(seconds != 0);
129 (
const char *format, va_list
ap),
133int si_scanf(
const char *format, ...)
136 va_start(argptr, format);
137 int res = si_vscanf(format, argptr);
143 (FILE *stream,
const char *format, va_list
ap),
144 (stream, format,
ap))
147si_fscanf(FILE *stream,
const char *format, ...)
150 va_start(argptr, format);
151 int res = si_vfscanf(stream, format, argptr);
157 (
const char *str,
const char *format, va_list
ap),
161si_sscanf(
const char *str,
const char *format, ...)
164 va_start(argptr, format);
165 int res = si_vsscanf(str, format, argptr);
179 (
int signum,
const struct sigaction *
act,
180 struct sigaction *oldact),
181 (signum,
act, oldact))
184#ifdef HAVE_SIGINTERRUPT
188#define si_siginterrupt(arg1, arg2)
199#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)
int status int void size_t count write
#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 int const void size_t count const char int flags
int status int void size_t count
int status int void * buf
int status int void size_t count int const void size_t count open
int status int void size_t count int const void size_t count si_open1
int status int void size_t count int const void size_t count const char * pathname