It seems to me like if it is in TSD data then the macro for setting it should be in errno.h.

I'm surprised that it is defined as a function in errno.h.... since functions can't be lvalues.

Of course, assignment to errno from a separate library probably isn't such a hot idea. Better, IMO, to pass an error number on a stack somewhere (or in a register) than relying on global variables...

   -- Garrett

Richard L. Hamilton wrote:
Sometimes library functions as well as system calls need to set errno.

Depending on whether something is linked with _REENTRANT or not, errno
may be per-thread, or global.

libc has internal magic to do the right thing regardless of whether or not what 
it is
dynamically linked to was compiled with _REENTRANT.

But it does not appear to make that magic publically available.

How could one create a public routine meant to be in a shared (or static) 
library, that needs
to set errno, and do it properly regardless of whether or not what it was 
linked with set _REENTRANT
(and included errno.h)?

Anyone know how (or whether) other OSs handle this?
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to