home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / programm / 5335 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  1.9 KB

  1. Xref: sparky comp.unix.programmer:5335 comp.sys.sun.misc:5316
  2. Path: sparky!uunet!auspex-gw!guy
  3. From: guy@Auspex.COM (Guy Harris)
  4. Newsgroups: comp.unix.programmer,comp.sys.sun.misc
  5. Subject: Re: Installing a shared library without screwing up.
  6. Keywords: libc.so replacing
  7. Message-ID: <15541@auspex-gw.auspex.com>
  8. Date: 18 Nov 92 08:30:53 GMT
  9. References: <mark.722062866@coombs>
  10. Sender: news@auspex-gw.auspex.com
  11. Followup-To: comp.unix.programmer
  12. Organization: Auspex Systems, Santa Clara
  13. Lines: 38
  14. Nntp-Posting-Host: auspex-gw.auspex.com
  15. Nntp-Posting-Host: auspex.auspex.com
  16. Originator: news@auspex-gw.Auspex.COM
  17.  
  18. >What is the right/best way to replace a libc.so with your site customised
  19. >version? I dont want to have to go find the installation tape everytime
  20. >I attempt it. Do I use 'cp' or 'cat mylib > /usr/lib/libc.so' or what?
  21.  
  22. Nope!
  23.  
  24. Doing so will be at least as catastrophic as copying on top of a
  25. demand-page executable that's in use.
  26.  
  27. I'd be inclined to do:
  28.  
  29.     cp my_libc.so /usr/lib/libc.so.X.Y.new
  30.     mv /usr/lib/libc.so.X.Y /usr/lib/libc.so.X.Y.save
  31.     mv /usr/lib/libc.so.X.Y.new /usr/lib/libc.so.X.Y
  32.  
  33. where X and Y are the major and minor version numbers of the current
  34. "libc" shared library.
  35.  
  36. >Im a
  37. >bit worried that a context switch will happen halfway through it and bugger
  38. >it all up.
  39.  
  40. UNIX context switches won't make a bit of difference if you use "mv";
  41. processes that attached to the old "libc.so.X.Y" will stay attached to
  42. it as long as they live.
  43.  
  44. Assuming your new "libc.so" works, the only "window of vulnerability" is
  45. the period when *no* "/usr/lib/libc.so.X.Y" exists - i.e., between the
  46. first "mv" and the second.
  47.  
  48. "mv" itself is statically linked:
  49.  
  50.     auspex$ file /usr/bin/mv
  51.     /usr/bin/mv:    sparc pure executable
  52.  
  53. so it will work even if there's no "libc.so.X.Y".  (In fact, that's
  54. precisely *why* it's statically-linked - so that it can, for example, be
  55. used to restore the old "libc.so.X.Y" if the new one doesn't work.)
  56.