home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.arch
- Path: sparky!uunet!gatech!darwin.sura.net!bogus.sura.net!pandora.pix.com!stripes
- From: stripes@pix.com (Josh Osborne)
- Subject: Re: <None> (Should be Open Systems, bloody NEWS system...)
- Message-ID: <C011xo.KDu@pix.com>
- Sender: news@pix.com (The News Subsystem)
- Nntp-Posting-Host: pandora.pix.com
- Organization: Pix Technologies -- The company with no adult supervision
- References: <1992Dec23.212321.26522@ryn.mro4.dec.com> <id.SQ3W.IB6@ferranti.com> <1992Dec29.012215.10632@ryn.mro4.dec.com>
- Date: Tue, 29 Dec 1992 15:34:34 GMT
- Lines: 39
-
- In article <1992Dec29.012215.10632@ryn.mro4.dec.com> Peter.Mayne@cao.mts.dec.com writes:
- [...]
- >** I believe that you can also run into problems if you have
- >** a signal handler that gets invoked, and resets errno in the period
- >** between your successful system call and your test for success. It's
- [...]
- >Fixing this kind of problem would involve changing the model of "returning
- >an error flag and a static errno". You could:
- >
- >- return an error status rather than an error flag
- >- signal on errors
- >- call a "callback" routine on errors
- >- fill in a program-provided "status block" (non-static "errno" equivalent)
- >
- >Any one of these would probably be considered incompatible by a large number
- >of UNIX style programmers (including DOS programmers and a lot of VMS
- >programmers).
-
- Yes, this is a big problem with the way Unix does error reporting. However
- you can kludge around it like this:
-
- sighandler(...)
- {
- int old_errno = errno;
- /* do stuff */
- errno = old_errno;
- }
-
- Note: you need to do this even if you exit()/abort() after any syscall failure.
- I beleve that syscalls are allowed to alter errno even on a succesful return.
-
- (also this doesn't magicly make all of libc rentrent, but it does mean that
- if someone has a rentrent libc you can use it and not stomp errno...)
- --
- stripes@pix.com "Security for Unix is like
- Josh_Osborne@Real_World,The Multitasking for MS-DOS"
- "The dyslexic porgramer" - Kevin Lockwood
- We all agree on the necessity of compromise. We just can't agree on
- when it's necessary to compromise. - Larry Wall
-