cthulhu@freja.diku.dk (Stefan Krabbe) (01/26/91)
Hi there, I am programming in a 4.3BSD environment. And I have a problem I hope that somebody here can help me with. In a program I am currently writing I make a filedescriptor unblocking this way: fcntl(filedescriptor, F_SETFL, FNDELAY); .. and it works just fine. But what do I do if I want it make it block- ing again ? I have noticed that if I from within my program do system( ... ); -then all my previously un-blocking filedescriptors become blocking again !?! If you know how to make an un-blocking filedescriptor blocking again, then please mail me. Best Regards Stefan ___ Name: Stefan Krabbe .......(o o)....... Email: cthulhu@diku.dk ---vvv---U---vvv--- Institute of Computer Science, University of Copenhagen.
rbj@uunet.UU.NET (Root Boy Jim) (01/27/91)
In article <1991Jan25.235221.21868@odin.diku.dk> cthulhu@freja.diku.dk (Stefan Krabbe) writes: >I am programming in a 4.3BSD environment... > In a program I am currently writing I make a filedescriptor unblocking >this way: > fcntl(filedescriptor, F_SETFL, FNDELAY); What you really want to do to make it unblocking is something like: flags = fcntl(fd, F_GETFL, 0); /* get old flags */ flags |= FNDELAY; /* add no delay */ fcntl(fd, F_SETFL, flags); /* set new flags */ Your code sets the flags to FNDELAY, and clears any existing flags. My code adds FNDELAY to the existing flag set. > But what do I do if I want it make it blocking again? I think you can take it from here. -- Root Boy Jim Cottrell <rbj@uunet.uu.net> Close the gap of the dark year in between