DragonFly BSD
DragonFly kernel List (threaded) for 2004-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

sys/ types policy


From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Tue, 2 Mar 2004 17:22:44 +0100

Hi all,
I had some discussion with Hiten yesterday about the use of types in
system headers and want to discuss our consensus.

At the moment most header files depend on the inclusion of sys/types.h
and the file included there. The types defined there fall in one of following
categories:
- POSIX complaient types used both by system-dependent and portable code
- BSD specific types (e.g. u_intN_t), not needed by portable code
- machine dependent types of interest only for kernel apps (e.g. vm_size_t)

My proposal is to split sys/types.h in two part:
- sys/_types.h which defined only POSIX types and includes only those
  files necessary for general userland applications or files which have
  proper _KERNEL/_KERNEL_STRUCTURES guard
- sys/types.h which includes sys/_types.h and defines the rest

Afterwards all system headers must either depend on _KERNEL/_KERNEL_STRUCTURES
to be defined or only use types defined in other sytem headers or _types.h.
Esp. the use of historic BSD types like u_short, u_intN_t and similiar has
to be exchanged by either protected names like __u_short or POSIX types.

The rational is that most header file will break anyway if your programs
don't follow POSIX, so obfuscating the system headers for POSIX types is
unnecessary. The situation is somewhat different for types not defined there.

Joerg



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]