diff options
Diffstat (limited to 'src/libstddjb/ndelay_on.c')
-rw-r--r-- | src/libstddjb/ndelay_on.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libstddjb/ndelay_on.c b/src/libstddjb/ndelay_on.c new file mode 100644 index 0000000..186590b --- /dev/null +++ b/src/libstddjb/ndelay_on.c @@ -0,0 +1,11 @@ +/* ISC license. */ + +#include <sys/types.h> +#include <fcntl.h> +#include <skalibs/djbunix.h> + +int ndelay_on (int fd) +{ + register int got = fcntl(fd, F_GETFL) ; + return (got == -1) ? -1 : fcntl(fd, F_SETFL, got | O_NONBLOCK) ; +} |