home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.programmer:5335 comp.sys.sun.misc:5316
- Path: sparky!uunet!auspex-gw!guy
- From: guy@Auspex.COM (Guy Harris)
- Newsgroups: comp.unix.programmer,comp.sys.sun.misc
- Subject: Re: Installing a shared library without screwing up.
- Keywords: libc.so replacing
- Message-ID: <15541@auspex-gw.auspex.com>
- Date: 18 Nov 92 08:30:53 GMT
- References: <mark.722062866@coombs>
- Sender: news@auspex-gw.auspex.com
- Followup-To: comp.unix.programmer
- Organization: Auspex Systems, Santa Clara
- Lines: 38
- Nntp-Posting-Host: auspex-gw.auspex.com
- Nntp-Posting-Host: auspex.auspex.com
- Originator: news@auspex-gw.Auspex.COM
-
- >What is the right/best way to replace a libc.so with your site customised
- >version? I dont want to have to go find the installation tape everytime
- >I attempt it. Do I use 'cp' or 'cat mylib > /usr/lib/libc.so' or what?
-
- Nope!
-
- Doing so will be at least as catastrophic as copying on top of a
- demand-page executable that's in use.
-
- I'd be inclined to do:
-
- cp my_libc.so /usr/lib/libc.so.X.Y.new
- mv /usr/lib/libc.so.X.Y /usr/lib/libc.so.X.Y.save
- mv /usr/lib/libc.so.X.Y.new /usr/lib/libc.so.X.Y
-
- where X and Y are the major and minor version numbers of the current
- "libc" shared library.
-
- >Im a
- >bit worried that a context switch will happen halfway through it and bugger
- >it all up.
-
- UNIX context switches won't make a bit of difference if you use "mv";
- processes that attached to the old "libc.so.X.Y" will stay attached to
- it as long as they live.
-
- Assuming your new "libc.so" works, the only "window of vulnerability" is
- the period when *no* "/usr/lib/libc.so.X.Y" exists - i.e., between the
- first "mv" and the second.
-
- "mv" itself is statically linked:
-
- auspex$ file /usr/bin/mv
- /usr/bin/mv: sparc pure executable
-
- so it will work even if there's no "libc.so.X.Y". (In fact, that's
- precisely *why* it's statically-linked - so that it can, for example, be
- used to restore the old "libc.so.X.Y" if the new one doesn't work.)
-