From a8699a58d8632f21e897ea5c4900a15483a9a8ca Mon Sep 17 00:00:00 2001 From: Toby Goodwin Date: Tue, 2 Sep 2014 08:01:39 +0100 Subject: release: rc-1.7.2 --- nonblock.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 nonblock.c (limited to 'nonblock.c') diff --git a/nonblock.c b/nonblock.c new file mode 100644 index 0000000..dbe31d3 --- /dev/null +++ b/nonblock.c @@ -0,0 +1,14 @@ +/* Set stdin to nonblocking. */ +#include +#include +#include +#include +int main(void) { + int flags; + flags = fcntl(0, F_GETFL); + flags |= O_NONBLOCK; + fcntl(0, F_SETFL, (long) flags); + flags = read(0, &flags, 1); + printf("read returns %d, errno == %d\n", flags, errno); + return 0; +} -- cgit v1.2.3