[1.20.0] getty: setsid: Operation not permitted (dissected)

Tomasz Czapiewski xeros at irc.pl
Wed Apr 25 19:20:25 UTC 2012


On Tue, 24 Apr 2012, Denys Vlasenko wrote:

> On Tue, Apr 24, 2012 at 9:55 PM, Tomasz Czapiewski <xeros at irc.pl> wrote:
>>> Let's verify that.
>>> Can you add a debugging printout in getty_main() here?
>>>
>>>       /* Create new session and pgrp, lose controlling tty */
>>> bb_error_msg("pid:%d", getpid());
>>> bb_error_msg("sid:%d", getsid(0));
>>>       pid = setsid();  /* this also gives us our pid :) */
>>>       if (pid < 0) {
>>> ...
>>>
>>> run it and tell me what do you observe?
>>
>
> Thanks. I need more data. Can you add these printouts?
>
>                fd = open("/dev/tty", O_RDWR | O_NONBLOCK);
> bb_error_msg("dev tty fd:%d", fd);
>                if (fd >= 0) {
> bb_error_msg("doing NOTTY");
>                        ioctl(fd, TIOCNOTTY);
> bb_error_msg("done NOTTY");
>                        close(fd);
>                }
> bb_error_msg("end of if");
>        }
>

starting pid 1, tty '/dev/ttyS0': '/sbin/getty -L ttyS0 115200 vt102'
getty: pid:851
getty: sid:851
getty: dev tty fd:3
getty: doing NOTTY
starting pid 1, tty '/dev/ttyS0': '/sbin/getty -L ttyS0 115200 vt102'
process '/sbin/getty -L ttyS0 115200 vt102' (pid 851) exited. Scheduling for restart.
getty: pid:852
getty: sid:852
getty: dev tty fd:3
getty: doing NOTTY
process '/sbin/getty -L ttyS0 115200 vt102' (pid 852) exited. Scheduling for restart.
starting pid 1, tty '/dev/ttyS0': '/sbin/getty -L ttyS0 115200 vt102'
getty: pid:857
getty: sid:857
getty: dev tty fd:3
getty: doing NOTTY
starting pid 1, tty '/dev/ttyS0': '/sbin/getty -L ttyS0 115200 vt102'
process '/sbin/getty -L ttyS0 115200 vt102' (pid 857) exited. Scheduling for restart.
getty: pid:891
getty: sid:891
getty: dev tty fd:3
getty: doing NOTTY
process '/sbin/getty -L ttyS0 115200 vt102' (pid 891) exited. Scheduling for restart.
starting pid 1, tty '/dev/ttyS0': '/sbin/getty -L ttyS0 115200 vt102'
...


Besides this test, I have tested again BusyBox 1.20.0 + getty.c from 
1.19.3 on this device - everything is fine with such combination.

Thanks in advance.

--
Tom


More information about the busybox mailing list