home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!europa.asd.contel.com!awds.imsd.contel.com!mahendo!thyme!kaleb
- From: kaleb@thyme.jpl.nasa.gov (Kaleb Keithley)
- Subject: changing process groups
- Message-ID: <1992Sep9.231540.9783@thyme.jpl.nasa.gov>
- Organization: Jet Propulsion Lab, Pasadena, CA
- Date: Wed, 9 Sep 92 23:15:40 GMT
- Lines: 35
-
- On a Sun SPARC running SunOS 4.1.1 I have two programs, one, a trivial
- daemon is started from rc.local, and the other, an X application is
- started from the window manager. Both programs detach from any controlling
- terminal.
-
- I want to enlist the aid of the kernel to automatically send a signal to
- the X application when the daemon is terminated. To that end, the daemon
- calls setsid() to become a session leader and a process group leader, and
- stores the process group ID (pgid) it returns into shared memory.
-
- The X client reads that pgid from the shared memory, and calls setpgid()
- to attempt to join the daemons process group.
-
- I've read and reread TFM, as well as W. Richard Stevens latest book,
- "Advanced Programming in the UNIX Environment", and can find no documented
- reason why this shouldn't work, yet the call to setpgid() in the X appli-
- cation returns -1 and errno is EPERM.
-
- This error is triggered even when both programs are SGID to the same group.
- Evidently the error is that the programs aren't in the same session initially.
-
- As the daemon runs as root, it can send signals to the X application(s)
- directly, however when I tried that strategy, and there are many (16+) X
- apps, I observe that some of them don't receive the signal. They're all
- the same program, and the daemon *is* sending the signal to all of them
-
- Anyone have an explanation about the wherefor of any of the above?
-
- Thanks.
-
- --
-
- Kaleb Keithley kaleb@thyme.jpl.nasa.gov
-
- Not authorized, in any way, shape, or form, to speak for anyone.
-