Keyboard input / init + questions

Jerome Martin tramjoe.merin at gmail.com
Sun Sep 26 14:42:52 PDT 2010


Weird, I found some refs to TIOCSCTTY-based tty stealing, and it seems that
at least at some point in the past, this does not trigger a clean hangup on
the previous controlled session side. Is this still the case or do you have
any means of detecting the situation ? Can I force plymouth splash to use
any tty I want it to, or am I locked into tty1 ?

On Sun, Sep 26, 2010 at 11:35 PM, Jerome Martin <tramjoe.merin at gmail.com>wrote:

> FYI, just finished that test, commenting out the two TIOCSCTTY force-steals
> in init code solves the issue.
> I wonder what kind of init you normally use ? This is plain old sysvinit
> ...
>
> On Sun, Sep 26, 2010 at 11:29 PM, Jerome Martin <tramjoe.merin at gmail.com>wrote:
>
>> ok, will do.
>> But meanwhile I have checked sysvinit sources, and since the very first
>> release this code is in, so I assumed you have a workaround for this, but I
>> find it strange that it works, because not only init steal the tty when
>> starting, but it does so in a separate process every time it spawns a child
>> too....
>>
>> if ((f = console_open(O_RDWR|O_NOCTTY)) >= 0) {
>> /* Take over controlling tty by force */
>>  (void)ioctl(f, TIOCSCTTY, 1);
>>    dup(f);
>>    dup(f);
>>  }
>> SETSIG(sa, SIGCHLD, SIG_DFL, SA_RESTART);
>> if ((pid = fork()) < 0) {
>>    initlog(L_VB, "cannot fork: %s",
>> strerror(errno));
>> exit(1);
>>  }
>> if (pid > 0) {
>> /*
>>  * Ignore keyboard signals etc.
>>  * Then wait for child to exit.
>>  */
>> SETSIG(sa, SIGINT, SIG_IGN, SA_RESTART);
>> SETSIG(sa, SIGTSTP, SIG_IGN, SA_RESTART);
>>  SETSIG(sa, SIGQUIT, SIG_IGN, SA_RESTART);
>>
>> while ((rc = waitpid(pid, &st, 0)) != pid)
>>  if (rc < 0 && errno == ECHILD)
>> break;
>>
>> /*
>>  * Small optimization. See if stealing
>>  * controlling tty back is needed.
>>  */
>> pgrp = tcgetpgrp(f);
>> if (pgrp != getpid())
>>  exit(0);
>>
>> /*
>>  * Steal controlling tty away. We do
>>  * this with a temporary process.
>>  */
>>  if ((pid = fork()) < 0) {
>>    initlog(L_VB, "cannot fork: %s",
>>  strerror(errno));
>> exit(1);
>> }
>>  if (pid == 0) {
>> setsid();
>> (void)ioctl(f, TIOCSCTTY, 1);
>>  exit(0);
>> }
>>
>>
>> On Sun, Sep 26, 2010 at 11:26 PM, Ray Strode <halfline at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> > Is the debug logged saved somewhere ? Because with my setup copying it
>>> from
>>> > the console is going to be tedious...
>>> Yes, should be in /var/log/plymouth-debug.log
>>>
>>> alternatively you can just cat /dev/vcs1
>>>
>>> --Ray
>>>
>>
>>
>>
>> --
>> Jérôme Martin
>>
>
>
>
> --
> Jérôme Martin
>



-- 
Jérôme Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/plymouth/attachments/20100926/c35ecb98/attachment-0001.htm>


More information about the plymouth mailing list