--- "Andrey A. Chernov" <[EMAIL PROTECTED]> wrote: > On Sun, Aug 11, 2002 at 17:41:20 +0400, Andrey A. Chernov wrote: > > On Sun, Aug 11, 2002 at 06:28:54 -0700, David Xu wrote: > > > does anyone believe that su behaviours correctly? > > > > I not believe in that first, so why I remove tcsetpgrg() in my initial > > commit. It fix suspend/fg, but break stop $$/fg those times. I not test, > > is it break stop $$/fg now too (I'll do it a bit later and send result). > > fork/wait seems to be needed here just for PAM_END. > > Yes, still there. If tcsetpgrp() removed, suspend/fg fixed, but "stop > $$/fg" kills login shell. It means that neither variant is correct, unless > there is a kernel bug. To be 100% sure, we need to test su with old > -current kernel without KSE. Anybody have that thing? I can cvsup early > kernel sources and build from them, but I don't know exact KSE changes > data. Other way is to build su statically and test on -stable. I don't > have any -stable machines around. > > -- > Andrey A. Chernov > http://ache.pp.ru/
Sorry, Andrey, current su's job control mode does not work under STABLE too, I have tested, it has same result as under CURRENT. the following piece of code does not work under STABLE, it mimics what su is doing in CURRENT source tree. #include <err.h> #include <errno.h> #include <signal.h> #include <stdio.h> #include <sys/wait.h> #include <unistd.h> int main() { pid_t ret_pid, statusp, child_pid, child_pgrp; struct sigaction sa, sa_int, sa_quit, sa_tstp; char buf[64]; char* sargv[3]; sa.sa_flags = SA_RESTART; sa.__sigaction_u.__sa_handler = SIG_IGN; sigemptyset(&sa.sa_mask); sigaction(SIGINT, &sa, &sa_int); sigaction(SIGQUIT, &sa, &sa_quit); sigaction(SIGTSTP, &sa, &sa_tstp); child_pid = fork(); switch (child_pid) { default: while ((ret_pid = waitpid(child_pid, &statusp, WUNTRACED)) != -1) { if (WIFSTOPPED(statusp)) { child_pgrp = tcgetpgrp(1); kill(getpid(), SIGSTOP); tcsetpgrp(1, child_pgrp); kill(child_pid, SIGCONT); statusp = 1; continue; } break; } if (ret_pid == -1) err(1, "waitpid"); exit(statusp); case -1: err(1, "fork"); exit(1); case 0: sigaction(SIGINT, &sa_int, NULL); sigaction(SIGQUIT, &sa_quit, NULL); sigaction(SIGTSTP, &sa_tstp, NULL); sargv[0] = "csh"; sargv[1] = NULL; execv("/bin/csh", sargv); printf("hi, there!\n"); break; } return 0; } David __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message