cvs commit: src/sys/sys errno.h

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Sun Jul 3 07:11:52 PDT 2005


Lately Joerg Sonnenberger <joerg at xxxxxxxxxxxxxxxxx> said:
> >     The change stays in for now.  As was said earlier... we've run into a
> >     concrete wall.  Too many third party programs are being broken.  This 
> >     is the only way we can make errno use TLS storage and still remain sane.
> > 
> >     We may be able to remove it a year or two or three from now, or if 
> >     someone wants to make a concerted effort to get all the third party
> >     software sources to fix their code... then we can remove it.  But for
> >     now we need to move on.
> Oh, come one Matt. I know that you know that the world doesn't work that way.
> most programmers work follow the principle of least resistence. It ain't broken
> since it compiles fine.

you want to fight and fix all occurences of browkn programs out there?
happy hacking. i prefer to fix *our* code.

> I object this chance for three reasons:
> (a) it hides problems. that's *never* a good thing and that will result in
> upstream code not getting fixed.

This is true. If you find a way to emit a warning if somebody declares
	extern int errno;
it would be really good!

> (b) It violates POLA. Why is "extern int errno;\n#include <errno.h>" different
> from the reverse version?

because errno is a define. Like in *all* other major open source operating
systems i could check (*BSD, Linux, OpenSolaris). why do i need to include
sys/types.h before everything else? because.

> (c) It violates ISO C for those programs it tries to "fix". Yes, read again.
> It just doesn't work this way.
> 
> #include <errno.h>
> 
> extern int errno;
> 
> expands to something like this:
> static inline int *
> __error(void)
> {
> }
> 
> extern int *__error();
> 
> That's invalid C, since the same symbol has both static and extern visibility.

our compiler doesn't complain. So maybe we should as well "fix" the compiler
to deal with this issue.

> Speaking about breakage, this is a typical example of bitrot and with the exception
> of perhaps Perl all other programs simple don't need the define at all.

This is no bitrot. It restores the status quo we had (and all other systems have):
being able to compile most programs out there without breakage.
yes, and they don't suffer from it. It is a no-op.

cheers
  simon

-- 
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low $$$ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \
Attachment:
pgp00002.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00002.pgp
Type: application/octet-stream
Size: 189 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/commits/attachments/20050703/b379184a/attachment-0022.obj>


More information about the Commits mailing list