diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-09 14:41:53 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-09 14:41:53 +0200 |
commit | 5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b (patch) | |
tree | 684758441f5b431d0008253243034b6a4a29417c /src/timeout.c | |
parent | 249866e3d1e11dc72eaa1305f4bb479ded92ef38 (diff) |
initial clang-format
Diffstat (limited to 'src/timeout.c')
-rw-r--r-- | src/timeout.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/timeout.c b/src/timeout.c index e721b66..bdc2949 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -1,7 +1,9 @@ +#include "timeout.h" + #include <unistd.h> + #include "error.h" #include "iopause.h" -#include "timeout.h" /** @file timeout.c @@ -10,50 +12,50 @@ @brief read/write timeout handling */ -int timeoutread(int t,int fd,char *buf,int len) +int timeoutread(int t, int fd, char *buf, int len) { struct taia now; struct taia deadline; iopause_fd x; taia_now(&now); - taia_uint(&deadline,t); - taia_add(&deadline,&now,&deadline); + taia_uint(&deadline, t); + taia_add(&deadline, &now, &deadline); x.fd = fd; x.events = IOPAUSE_READ; for (;;) { taia_now(&now); - iopause(&x,1,&deadline,&now); + iopause(&x, 1, &deadline, &now); if (x.revents) break; - if (taia_less(&deadline,&now)) { + if (taia_less(&deadline, &now)) { errno = ETIMEDOUT; return -1; } } - return read(fd,buf,len); + return read(fd, buf, len); } -int timeoutwrite(int t,int fd,char *buf,int len) +int timeoutwrite(int t, int fd, char *buf, int len) { struct taia now; struct taia deadline; iopause_fd x; taia_now(&now); - taia_uint(&deadline,t); - taia_add(&deadline,&now,&deadline); + taia_uint(&deadline, t); + taia_add(&deadline, &now, &deadline); x.fd = fd; x.events = IOPAUSE_WRITE; for (;;) { taia_now(&now); - iopause(&x,1,&deadline,&now); + iopause(&x, 1, &deadline, &now); if (x.revents) break; - if (taia_less(&deadline,&now)) { + if (taia_less(&deadline, &now)) { errno = ETIMEDOUT; return -1; } } - return write(fd,buf,len); + return write(fd, buf, len); } |