[1.20.0] getty: setsid: Operation not permitted (dissected)
Denys Vlasenko
vda.linux at googlemail.com
Tue Apr 24 20:42:25 UTC 2012
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?
>
> starting pid 1, tty '/dev/ttyS0': '/sbin/getty -L ttyS0 115200 vt102'
> getty: pid:1078
> getty: sid:1078
> process '/sbin/getty -L ttyS0 115200 vt102' (pid 1078) exited. Scheduling
> for restart.
> starting pid 1, tty '/dev/ttyS0': '/sbin/getty -L ttyS0 115200 vt102'
> getty: pid:1079
> getty: sid:1079
> process '/sbin/getty -L ttyS0 115200 vt102' (pid 1079) exited. Scheduling
> for restart.
> starting pid 1, tty '/dev/ttyS0': '/sbin/getty -L ttyS0 115200 vt102'
> getty: pid:1080
> getty: sid:1080
> process '/sbin/getty -L ttyS0 115200 vt102' (pid 1080) exited. Scheduling
> for restart.
> starting pid 1, tty '/dev/ttyS0': '/sbin/getty -L ttyS0 115200 vt102'
> getty: pid:1081
> getty: sid:1081
> ...
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");
}
--
vda
More information about the busybox
mailing list