timeoutwrite.h (385B)
1 #ifndef TIMEOUTWRITE_H 2 #define TIMEOUTWRITE_H 3 4 #include <sys/types.h> 5 6 extern ssize_t timeoutwrite(int t, int fd, const void *buf, size_t len); 7 8 #define GEN_SAFE_TIMEOUTWRITE(funcname,tout,writefd,doexit) \ 9 ssize_t funcname(int fd, const void *buf, size_t len) \ 10 { \ 11 ssize_t r; \ 12 r = timeoutwrite(tout,writefd,buf,len); \ 13 if (r == 0 || r == -1) doexit; \ 14 return r; \ 15 } 16 17 #endif