On Thu, 22 Mar 2007, Richard L. Hamilton wrote:
And to try to answer my own question, Draft 2 says
(about dirfd() among others):
...shall be declared as functions and may also be defined as macros. Function
prototypes shall be provided.
and specifically about dirfd():
The dirfd( ) function may fail if:
[EINVAL] The dirp argument does not refer to a valid directory stream.
Will they really go for that ?
I mean, the explicit "NULL exception" is one thing, but claiming that the
function may not crash for any random pointer passed in, but return EINVAL
instead, forces either a system call (to error out on copyin() failure) or
a horrid "check against all previously opened DIR*" userland hack.
That sounds like one of the cases where the standardization efforts are
going too far.
So: it has to be a function and not just a macro. A prototype is needed in
dirent.h.
dirfd() may apparently check whether its argument is not a valid directory
stream,
returning -1 with errno set to EINVAL if not.
As said, I think they're going too far there. What happened to "garbage in
garbage out" ?
FrankH.
I don't happen to know the "correct" way to set errno within a function
intended to
be part of libc, but I'm sure someone does. Other than that, it looks
straightforward.
This message posted from opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org