On 12/27/2010 07:16 PM, David Kuehling wrote:
>>>>>> "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?

thanks for the answer. 

> 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
> 

just create another commit:
"using STDOUT_FILENO, remove tcsetpgrp" http://qi-hw.com/p/gmenu2x/bfe772b

> 
> cheers,
> 
> David


-- 
Best Regards
Xiangfu
-- Qi RSS feed, http://en.qi-hardware.com/feed/rss20.xml --

_______________________________________________
Qi Hardware Discussion List
Mail to list (members only): [email protected]
Subscribe or Unsubscribe: 
http://lists.en.qi-hardware.com/mailman/listinfo/discussion

Reply via email to