[133] in Zephyr Mailing List

home help back first fref pref prev next nref lref last post

Re: zwgc question...

daemon@ATHENA.MIT.EDU (Roland J. Schemers III)
Mon Jun 20 19:47:59 1994

From: "Roland J. Schemers III" <schemers@Slapshot.Stanford.EDU>
Date: Mon, 20 Jun 1994 16:44:44 -0700
In-Reply-To: Marc Horowitz <marc@cam.ov.com>
        "Re: zwgc question..." (Jun 20,  6:52pm)
To: Marc Horowitz <marc@cam.ov.com>
Cc: zephyr@MIT.EDU

On Jun 20,  6:52pm, Marc Horowitz wrote:
>
> Don't background it.  zwgc forks by itself, and tries very hard to
> make sure it dies when you log out.  Nothing you background with &
> dies automatically when you log out.
>

That didn't work either. It looks like (on a SunOS system):

elaine10:~ 15# ps -jxww
 PPID   PID  PGID   SID TT TPGID  STAT   UID  TIME COMMAND
23396 23398 23398 23392 p3 23398   IWE  4337  0:00 -scsh (tcsh)
    1 23409 23398 23392 p3 23398    IW  4337  0:00 /usr/leland/etc/zwgc
-ttymode
23314 23315 23315 23313 p9 23491    SE  4337  0:01 -scsh (tcsh)
23315 23491 23491 23313 p9 23491    RE  4337  0:00 ps -jxww

After logging out on tty p3:

elaine10:~ 16# ps -jxww
 PPID   PID  PGID   SID TT TPGID  STAT   UID  TIME COMMAND
    1 23409 23398 23392 ?     -1   IWO  4337  0:00 /usr/leland/etc/zwgc
-ttymode
23314 23315 23315 23313 p9 23501    SE  4337  0:01 -scsh (tcsh)
23315 23501 23501 23313 p9 23501    RE  4337  0:00 ps -jxww

It looks like the process group and the session are the same as tcsh, but
after logging out the process doesn't die. Sending it a "kill -HUP" will
kill it.

I've tried it under SunOS 4.1.2, Solaris 2.3, OSF 1.3, IRIX 5.2, AIX 3.2.3,
and Ultrix 4.4. Only Ultrix 4.4 seemed to work.

I can see what the code is supposed to be doing in detach() (zwgc/main.c).
I'll have to poke around some more I guess.

thanks about the no "-nofork" tip. I had forgotten about "&"'s behavior.

Roland

ps. Speaking of detach.c, I'm looking at three different sources, and I see
three different things being done:

CMU.022:

  (void) setpgrp(0, getpgrp(getppid())); /* to try to get SIGHUP on user
                                            logout */

  ..fork...

DECathena:

#ifdef POSIX
  (void) setpgid(getpid(), getppid()); /* to try to get SIGHUP on user
                                            logout */
#else
  (void) setpgrp(0, getpgrp(pid)); /* to try to get SIGHUP on user
                                            logout */
#endif

...fork....

#ifdef POSIX
  setpgid(0,pid);
#endif

And MIT.940217:

#ifdef POSIX
  (void) setpgid(0, tcgetpgrp(1));
#else
  (void) setpgrp(0, getpgrp(getppid()));
#endif

...fork....


Any idea which one is right?

thanks, Roland



-- 
Roland J. Schemers III             |    Networking Systems 
Authentication Services Programmer |    414 Sweet Hall  +1 (415) 723-6740 
Distributed Computing Operations   |    Stanford, CA 94305-3090
Stanford University                |    schemers@Slapshot.Stanford.EDU 

home help back first fref pref prev next nref lref last post