[gpm]open trick
Anders Torger
torger@ludd.luth.se
Sat, 4 Jan 2003 23:48:29 +0100
When studying the gpm code, I notice that the mouse fd is opened first
with O_NDELAY, and then directly after it is reset using fcntl, like
this:
if(!strcmp(opt_dev,"-")) fd=0; /* use stdin */
else if( (fd=open(opt_dev,O_RDWR | O_NDELAY)) < 0)
gpm_report(GPM_PR_OOPS,GPM_MESS_OPEN,opt_dev);
/* and then reset the flag */
fcntl(fd,F_SETFL,fcntl(fd,F_GETFL) & ~O_NDELAY);
I really curious about why this is done.
/Anders Torger