Hello Dunham, Thanks for your comments.
> -----Original Message----- > From: Isaac Dunham [mailto:[email protected]] > Sent: Saturday, May 10, 2014 12:34 PM > To: Luo Zhenhua-B19537 > Cc: [email protected]; Liu Ting-B28495 > Subject: Re: [PATCH] getty: remove the statement of pid and sid > comparison > > On Sat, May 10, 2014 at 10:17:13AM +0800, Zhenhua Luo wrote: > > when setsid failed, the pid and sid doesn't equal, so remove following > > condition statement. > > if (getsid(0) != pid) > > > <snip> > > > > Fix following runtime issue of getty: > > root@p1025:~# getty 115200 /dev/ttyQE1 > > getty: setsid: Operation not permitted > > > > Signed-off-by: Zhenhua Luo <[email protected]> > > --- > > loginutils/getty.c | 9 --------- > > 1 file changed, 9 deletions(-) > > > > diff --git a/loginutils/getty.c b/loginutils/getty.c index > > 0f060ae..6bfdf43 100644 > > --- a/loginutils/getty.c > > +++ b/loginutils/getty.c > > @@ -548,15 +548,6 @@ int getty_main(int argc UNUSED_PARAM, char **argv) > > * a session leader - which is quite possible for getty! > > */ > > pid = getpid(); > > - if (getsid(0) != pid) { > > - //for debugging: > > - //bb_perror_msg_and_die("setsid failed:" > > - // " pid %d ppid %d" > > - // " sid %d pgid %d", > > - // pid, getppid(), > > - // getsid(0), getpgid(0)); > > - bb_perror_msg_and_die("setsid"); > > - } > > /* Looks like we are already a session leader. > > * In this case (setsid failed) we may still have ctty, > > * and it may be different from tty we need to control! > > -- > > 1.9.1 > > You might want to read the comments surrounding this. > If I understand correctly, the behavior you're "fixing" is the intended > behavior. > And even if it weren't correct, the comments would need to be updated. [Luo Zhenhua] Sure, I have read the comments of this code section. My understanding is that, if setsid() fail, it means current process if leading process, the pid should be same as sid. According to the result of my test program, it is not the case, even if setsid failed, current process is not 100% leading process(pid != sid). I tried on both my Linux PC and PowerPC target. Why cann't getty be used when "sedsid fail" + "pid != sid"? In my testing, getty can work well in this scenario. Best Regards, Zhenhua > > Thanks, > Isaac Dunham _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
