11 #include <sys/types.h>
18 #include <sys/socket.h>
21 #include <semaphore.h>
24 #ifndef SINGULAR_SI_SIGNALS_H
25 #define SINGULAR_SI_SIGNALS_H
27 #define SI_EINTR_SAVE_FUNC_TEMPLATE(return_type, newfunc, func, decl, args, err_domain) \
28 static inline return_type newfunc decl \
34 } while((res err_domain) && (errno == EINTR));\
38 #define SI_EINTR_SAVE_FUNC(return_type, func, decl, args) \
39 SI_EINTR_SAVE_FUNC_TEMPLATE(return_type, si_##func, func, decl, args, < 0)
41 #define SI_EINTR_SAVE_SCANF(return_type, func, decl, args) \
42 SI_EINTR_SAVE_FUNC_TEMPLATE(return_type, si_##func, func, decl, args, == EOF)
45 (
int nfds, fd_set *readfds, fd_set *writefds,
46 fd_set *exceptfds,
struct timeval *timeout),
47 (nfds,readfds, writefds, exceptfds, timeout)
52 (pid, status, options))
63 (
int fd,
const struct iovec *iov,
int iovcnt),
73 (pathname, flags), < 0)
75 (
const char *pathname,
int flags, mode_t mode),
76 (pathname, flags, mode), < 0)
79 #define SI_GET_FIFTH(_4,_3, _2, _1, N, ...) N
80 #define si_open(...) SI_GET_FIFTH(X,##__VA_ARGS__, si_open2, si_open1)(__VA_ARGS__)
89 (
int sockfd, struct sockaddr *addr, socklen_t *addrlen),
90 (sockfd, addr, addrlen))
93 (
int sockfd,
const struct sockaddr *addr, socklen_t addrlen),
94 (sockfd, addr, addrlen))
100 si_nanosleep(
const struct timespec *req, struct timespec *
rem) {
105 res = nanosleep(req, rem);
106 }
while((rem !=
NULL) && (res < 0) && (errno == EINTR));
110 static inline unsigned int
111 si_sleep(
unsigned int seconds)
115 seconds = sleep(seconds);
116 }
while(seconds != 0);
128 (
const char *format, va_list ap),
132 int si_scanf(
const char *format, ...)
135 va_start(argptr, format);
136 int res = si_vscanf(format, argptr);
142 (FILE *stream,
const char *format, va_list ap),
143 (stream, format, ap))
146 si_fscanf(FILE *stream,
const char *format, ...)
149 va_start(argptr, format);
150 int res = si_vfscanf(stream, format, argptr);
156 (
const char *str,
const char *format, va_list ap),
160 si_sscanf(
const char *str,
const char *format, ...)
163 va_start(argptr, format);
164 int res = si_vsscanf(str, format, argptr);
178 (
int signum,
const struct sigaction *
act,
179 struct sigaction *oldact),
180 (signum, act, oldact))
183 #ifdef HAVE_SIGINTERRUPT
187 #define si_siginterrupt(arg1, arg2)
198 #undef SI_EINTR_SAVE_FUNC
int status int void size_t count
void rem(unsigned long *a, unsigned long *q, unsigned long p, int °a, int degq)
int status int void size_t count int const void size_t count const char * pathname
#define SI_EINTR_SAVE_FUNC_TEMPLATE(return_type, newfunc, func, decl, args, err_domain)
int status int void size_t count write
int status int void size_t count int const void size_t count si_open1
int status int void * buf
void select(const ListCFList &ppi, int length, ListCFList &ppi1, ListCFList &ppi2)
#define SI_EINTR_SAVE_SCANF(return_type, func, decl, args)
#define SI_EINTR_SAVE_FUNC(return_type, func, decl, args)
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 const char int flags