>>>>> "Xiangfu" == Xiangfu Liu <[email protected]> writes:
> On 12/27/2010 05:30 PM, David Kuehling wrote: >>> > one question about ioctl(1, TIOCSCTTY, (char *)1); the first "1" >>> means > /dev/tty1, right?? what is the meaning of "(char *)1"? >> It means stdout (the file descriptor, not the stream). As Alan >> pointed out, we could (and should) replace this with constant >> STDOUT_FILENO as defined in unistd.h >> > then I have another question. :) why you pass "STDOUT" to "ioctl(1, > TIOCSCTTY, ...)", I cann't find any document about "ioctl(1, > TIOCSCTTY, ...)" . Because standard input/output is connected to the linux terminal device (in this case /dev/tty0 since gmenu2x was started by init for the first terminal). When SDL initialized its keyboard input system, it issues ioctl(fd,TIOSCTTY,0) to the terminal device, disabling it as controlling terminal. ioctl(1,TIOSCTTY,1) undoes that, but seems to only work if we create a new session via setsid() first. does that answer your question? cheers, David -- GnuPG public key: http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg Fingerprint: B17A DC95 D293 657B 4205 D016 7DEF 5323 C174 7D40
pgpJxHr8ydOw2.pgp
Description: PGP signature
_______________________________________________ Qi Hardware Discussion List Mail to list (members only): [email protected] Subscribe or Unsubscribe: http://lists.en.qi-hardware.com/mailman/listinfo/discussion

