Subject: Re: closefrom()
To: Matt Thomas <matt@3am-software.com>
From: mouss <usebsd@free.fr>
List: tech-userlevel
Date: 05/28/2004 19:38:00
Matt Thomas wrote:

> At 02:48 PM 5/26/2004, mouss wrote:
  > stdlib.h includes non O/S specific interfaces (malloc, free, getopt).
> closefrom is definitely O/S specific (Unix-Like), so it doesn't
> belong there.

sure, but stdlib.h contains functions like ttyslot(), getloadavg(), 
daemon(), setproctitle(), while unistd.h includes crypt() and swab().
or are these just exceptions to confirm the rule?

Besides, I prefer a situation where all OSes use the same wrong file, 
than using the right one when others don't. As goes the saying:
"There are fewer inconveniences in being a fool with the fools than in 
being wise all alone."


> It's easy to look back and say header files are dumb.  But that was 30
> (or 15 depending on your view) years and the computing world was very
> very different.  Hindsight is easy, foresight is not.

<humour>
yes but: conservatism is easy, progress is not ;-p
... and vice versa of course. it all depends on the context.
</humour>

But yes, "Criticism is easy, art is difficult."
Anyway, I wasn't after what happened at the beginning but after what has 
_not_ happened afterwards. (I do respect both the original contributors 
and their successors, but I think they deserve a better respect: if the 
work is improved, people will be more grateful to the original creators 
and their successors).

More precisely, I am concerned about things like:
- if HAVE_MALLOC_H, if <foo is in thisheader>, ... obfuscating thousands 
of source code.
- include <pthreads.h> (or curses.h, or any file for which multiple 
implementations exist) and have a hard time figuring out whether it's 
the one in /usr/include or /usr/pkg/include (or /usr/local/include, 
/opt/.., ... depending on where you put your hands).
- the difficulty of automatic dependencies mgmt with regard to header files.
- and possibly other things I don't remember (which may of course be 
irrelevant).


> I strong disagree.  <unistd.h> is a better choice since that's where
> open/close/dup live.

then go for unistd.h. After all, compat with openbsd is more important 
than with solaris.

and heh: putting it in the right header "is a detail, but details make 
perfection, and perfection isn't a detail" :-)
(I hope you like this one).


cheers,
mouss