From owner-freebsd-current Sun Aug 11 19:46:31 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6659337B400 for ; Sun, 11 Aug 2002 19:46:22 -0700 (PDT) Received: from web20902.mail.yahoo.com (web20902.mail.yahoo.com [216.136.226.224]) by mx1.FreeBSD.org (Postfix) with SMTP id 26DB643E5E for ; Sun, 11 Aug 2002 19:46:22 -0700 (PDT) (envelope-from bsddiy@yahoo.com) Message-ID: <20020812024621.12191.qmail@web20902.mail.yahoo.com> Received: from [218.97.164.167] by web20902.mail.yahoo.com via HTTP; Sun, 11 Aug 2002 19:46:21 PDT Date: Sun, 11 Aug 2002 19:46:21 -0700 (PDT) From: David Xu Subject: Re: cvs commit: src/sys/kern kern_sig.c (fwd) To: "Andrey A. Chernov" Cc: Julian Elischer , FreeBSD CURRENT In-Reply-To: <20020811140248.GA4497@nagual.pp.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --- "Andrey A. Chernov" 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 #include #include #include #include #include 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 majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message