14 .TH fdflags 3 "23 July 1999" "Straylight/Edgeware" "mLib utilities library"
16 fdflags \- set file and file descriptor flags
20 .B "#include <mLib/fdflags.h>"
22 .ds mT \fBint fdflags(
24 .BI "\h'\w'\*(mT'u'unsigned " fbic ", unsigned " fxor ,
25 .BI "\h'\w'\*(mT'u'unsigned " fdbic ", unsigned " fdxor );
29 is a convenience function for setting file and file descriptor flags
33 The file flags are read using
35 the new flags are calculated as
47 and the result written back using
50 Similarly the file descriptor flags are read using
52 the new flags calculated as
64 and the result written back using
69 returns zero; if there was an error, \-1 is returned.
71 To set the non-blocking and close-on-exec flags:
73 fdflags(fd, O_NONBLOCK, O_NONBLOCK, FD_CLOEXEC, FD_CLOEXEC);
75 To clear the non-blocking and close-on-exec flags:
77 fdflags(fd, O_NONBLOCK, 0, FD_CLOEXEC, 0);
83 Mark Wooding, <mdw@distorted.org.uk>