From 249866e3d1e11dc72eaa1305f4bb479ded92ef38 Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Tue, 9 Jul 2024 13:58:20 +0200 Subject: reorganized file structure Moved c files into src/. Corrected VERSION file. Removed BUILD and FILES. --- src/ndelay.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/ndelay.c (limited to 'src/ndelay.c') diff --git a/src/ndelay.c b/src/ndelay.c new file mode 100644 index 0000000..f4b5eb8 --- /dev/null +++ b/src/ndelay.c @@ -0,0 +1,24 @@ +#include +#include +#include "ndelay.h" + +/** + @file ndelay.c + @author djb + @soure qmail + @brief delaying of IO operations +*/ + +#ifndef O_NONBLOCK +#define O_NONBLOCK O_NDELAY +#endif + +int ndelay_on(int fd) +{ + return fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0) | O_NONBLOCK); +} + +int ndelay_off(int fd) +{ + return fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0) & ~O_NONBLOCK); +} -- cgit v1.2.3