Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!mcnc!gatech!mcdchg!usenet From: usenet@mcdchg.UUCP Newsgroups: mod.os.unix Subject: Re: How does close() make dup() work in getty?? Message-ID: <284@mcdchg.UUCP> Date: Thu, 26-Mar-87 18:15:25 EST Article-I.D.: mcdchg.284 Posted: Thu Mar 26 18:15:25 1987 Date-Received: Sat, 28-Mar-87 06:11:22 EST References: <233@mcdchg.UUCP> Sender: usenet@mcdchg.UUCP Organization: Astronautics Technology Cntr, Madison, WI Lines: 49 Approved: usenet@mcdchg.UUCP in /usr/src/sys/sys/tty.c fuction "ttyopen" there is the following code: pp = u.u_procp; -- proc table entry if (pp->p_pgrp == 0) { -- no proc-group ?? u.u_ttyp = tp; -- set /dev/tty pointer if (tp->t_pgrp == 0) -- no tty-proc-group ?? tp->t_pgrp = pp->p_pid; -- effectivly create new group-leader pp->p_pgrp = tp->t_pgrp; -- alwasy set proc-group } in ttyclose(), which is only called for the *FINAL* close, we have: tp->t_pgrp = 0; tp is always a pointer to the tty struct. t_prgp is the process group used for keyboard signals, and p_pgrp is the process group shown by ps l (t_* are fields in the tty struct; p_* are fields in the proc struct.) As far as I know, u_ttyp can only be cleared by doing an ioctl (TIOCNOTTY) on /dev/tty (see the ioctl routine in .../tty_tty.c) Your process group can be controlled by ioctls too (see tty(4) for details on those.) Check your login program carefully, and make *SURE* that t_pgrp is set *BEFORE* login becomes csh!!! (If not, and you're useing version #2, then I think that the users csh will be in the p-group of init (or whoever you have starting getty!!!!! It would not be nice for a user to send a keyboard-quit-signal to init, would it?? Whenever in doubt, read the source!!!!! (We'll make a hacker out of you yet!!) Hope this is of some help -- John W - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name: John F. Wardale UUCP: ... {seismo | harvard | ihnp4} !uwvax!astroatc!johnw arpa: astroatc!johnw@rsch.wisc.edu snail: 5800 Cottage Gr. Rd. ;;; Madison WI 53716 audio: 608-221-9001 eXt 110 To err is human, to really foul up world news requires the net!