scsh-users
[Top] [All Lists]

Re: scsh vs. time(), mktime(), and errno

To: scsh@zurich.ai.mit.edu
Subject: Re: scsh vs. time(), mktime(), and errno
From: Noah Friedman <friedman@splode.com>
Date: Wed, 17 Jan 2001 04:17:38 -0800 (PST)
Newsgroups: comp.lang.scheme.scsh
Reply-to: Noah Friedman <friedman@splode.com>
>Rob> Indeed. You *MUST* be able to store a zero [at least] into "errno",
>Rob> because the Unix kernel does *NOT* clear it on success, and there are
>Rob> some system calls which *can* return "-1" on success! If you could
>Rob> not store a zero into errno, you would have *no* way to tell if those
>Rob> system calls failed.

Every system call that I'm aware of either has a special return value which
indicates whether it failed (which is usually -1), or modifies an argument
appropriately, or has some other kind of indication of failure.  Even
exec(2), which shouldn't return *at all* unless there was a failure, makes
a point of returning -1.  What exceptions do you know of?

(On the other hand, even on systems which do magic with errno to make it
threadsafe, I have not yet encountered a case where errno was not a
modifiable lvalue.  Where is this not the case?  Some specific examples of
nonportability, instead of vague handwaving, would be nice.)

<Prev in Thread] Current Thread [Next in Thread>