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 .BI "int fdflags(int " fd ,
23 .BI " unsigned " fbic ", unsigned " fxor ,
24 .BI " unsigned " fdbic ", unsigned " fdxor );
28 is a convenience function for setting file and file descriptor flags
32 The file flags are read using
34 the new flags are calculated as
46 and the result written back using
49 Similarly the file descriptor flags are read using
51 the new flags calculated as
63 and the result written back using
68 returns zero; if there was an error, \-1 is returned.
70 To set the non-blocking and close-on-exec flags:
72 fdflags(fd, O_NONBLOCK, O_NONBLOCK, FD_CLOEXEC, FD_CLOEXEC);
74 To clear the non-blocking and close-on-exec flags:
76 fdflags(fd, O_NONBLOCK, 0, FD_CLOEXEC, 0);
82 Mark Wooding, <mdw@nsict.org>