[comp.unix.internals] Unblocking filedescriptor

moss@cs.umass.edu (Eliot Moss) (01/27/91)

Note that the arguments to fcntl are bit encoded, so to clear FNDELAY simply
do fctnl(fd, F_SETFL, 0). If the file may have other properties you want to
preserve, then do something like this:

	int i = fcntl (fd, F_GETFL);	/* get properties */
	i &= ~FNDELAY;			/* clear FNDELAY  */
	fcntl (fd, F_SETFL, i);		/* set properties */

Note that you can just as well use an ioctl (FIONBIO). Perhaps the set/clear
effects are more obvious here. Both routes eventually end up in the same code
in the kernel ....						Eliot
--

		J. Eliot B. Moss, Assistant Professor
		Department of Computer and Information Science
		Lederle Graduate Research Center
		University of Massachusetts
		Amherst, MA  01003
		(413) 545-4206, 545-1249 (fax); Moss@cs.umass.edu