home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!stanford.edu!kronos.arc.nasa.gov!iscnvx!rahner
- From: rahner@iscnvx.lmsc.lockheed.com (Mark Rahner)
- Subject: Re: rshing Ultrix xterms
- Message-ID: <1992Sep2.213341.5519@iscnvx.lmsc.lockheed.com>
- Organization: Lockheed Missiles and Space Co.
- X-Newsreader: Tin 1.1 PL4
- References: <1992Sep1.192315.24302@iscnvx.lmsc.lockheed.com>
- Date: Wed, 2 Sep 92 21:33:41 GMT
- Lines: 49
-
- Hello Again,
-
- I would like to thank all of those kind souls who took the time to
- respond to my post. Allow me to summarize what I now know about
- rshing xterms. For many if not most systems, the following works:
-
- rsh remote_host "/usr/bin/X11/xterm -ls -display $DISPLAY </dev/null >/dev/null 2>&1"
-
- On many Ultrix systems, and possibly on some Sun systems, the rsh
- daemon leaves other files open. There is great confusion as to
- which file descriptors might be associated with these files. Several
- people suggested that file descriptors 6 and 7 were the culprits.
- Another implicated file descriptors 4, 6, 8, 10, 11 and 12. On our
- Ultrix systems, file descriptor 8 was found guilty. The safest
- ksh or sh shell-only solution is to use something like
-
- rsh remote_host "/usr/bin/X11/xterm -ls -display $DISPLAY </dev/null >/dev/null 2>&1 3>&- 4>&- 5>&- 6>&- 7>&- 8>&- 9>&-"
-
- Of course, this doesn't help if the problem involves file descriptors
- greater than 9. In this case, you should either use a shell like bash
- that allows you to close two digit file descriptors as well or use
- something like
-
- rsh remote_host "closeall /usr/bin/X11/xterm -ls -display $DISPLAY"
-
- where the following closeall.c is provided courtesy of Michael Cook:
-
- #include <sys/param.h>
- #include <fcntl.h>
-
- int main(int argc, char **argv)
- {
- int i;
-
- for (i = 0; i < NOFILE; i++)
- close(i);
- open("/dev/null", O_RDONLY);
- open("/dev/null", O_WRONLY);
- dup(1);
- execvp(argv[1], argv + 1);
- }
-
- Finally, IMHO, the answer to FAQ 3.2 should be ammended to include
- this information about possible additional open files.
-
- Thanks again to all. You are a great resource.
-
- --
- Mark V. Rahner rahner@lmsc.lockheed.com
-