home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / shell / 3787 < prev    next >
Encoding:
Text File  |  1992-09-02  |  2.1 KB  |  61 lines

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