Subject: Re: The sys_errlist[] screw
To: Charles M. Hannum <mycroft@mit.edu>
From: Todd Vierling <tv@NetBSD.ORG>
List: tech-userlevel
Date: 03/02/1998 13:59:29
On Sat, 21 Feb 1998, Charles M. Hannum wrote:

: Do the symbol renaming hack for both sys_errlist and sys_nerr, making
: the new version of sys_errlist a *pointer* to the table (i.e. a `char
: **').  Any application using sys_errlist[] that was compiled before
: this change or does not use errno.h, will not be able to see the
: messages for new errors.

How about:

extern __const char *__const (*__sys_errlist14) [];
#define sys_errlist (*__sys_errlist14)

The difference here is that a program which later does a

extern const char *sys_errlist[];

will still compile and link as if nothing changed.  Here, it would use an
explicit pointer to the table instead of implying the dereference when the
array operator is used.  Therefore the typing of "sys_errlist" would remain
"char * []" as it has historically been instead of becoming "char **".

: BTW, there's a subtlety here I should point out:
: 
: Even with this change, an application explicitly referring to sys_nerr
: will have the value copied into its data segment.  Said application
: will never be able to see new error strings unless it is recompiled.

You're just meaning that we have to version-hack sys_nerr so old programs
will not get a bogus number for sys_nerr, right?  Sounds great to me, since
we can't see the new messages on old binaries thanks to segfaults anyway. 

-- 
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)