Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 21 Oct 2012 02:13:47 +0200
From: Abdoulaye Walsimou GAYE <>
Subject: Re: [PATCH 2/4] Add basic sys/cdefs.h found on most unix

On 10/21/2012 01:38 AM, Rich Felker wrote:
> On Sun, Oct 21, 2012 at 01:38:52AM +0200, Abdoulaye Walsimou GAYE wrote:
>> On 10/21/2012 01:18 AM, Isaac Dunham wrote:
>>> On Sat, 20 Oct 2012 22:15:43 +0200
>>> Abdoulaye Walsimou Gaye <> wrote:
>>>> Signed-off-by: Abdoulaye Walsimou Gaye <>
>>>> ---
>>>>   include/sys/cdefs.h |   22 ++++++++++++++++++++++
>>>>   1 file changed, 22 insertions(+)
>>>>   create mode 100644 include/sys/cdefs.h
>>> I'm pretty sure that the last three times sys/cdefs.h was proposed,
>>> it was rejected.
>> Unfortunately many packages (wrongly?) use to rely on macros defined there,
> I've found it's really very few; an equivalent sys/cdefs.h does not
> exist on most systems. It was never intended for use by applications;
> it's an internal part of glibc (and perhaps also some BSDs?) used for
> handling backwardsness like pre-ANSI C compilers (abstracting const
> away as __const, or abstracting away prototypes with __P()) and
> optional use of GCC-specific features.

But applications borrowed from systems internal and ported to others
systems tend to use these macros (libtirpc, libbsd come in mind).
Major BSD systems have it (FreeBSD, NetBSD, OpenBSD, PCBSD), it not
a reason to have it on linux systems but it helps/simplifies packages porting
from these OS.

> For things like 'extern "C"', there's no reason to use sys/cdefs.h;
> the just writing the code it expands to inline is much more
> clear/informative and provides better performance as a nice side
> effect.
>> sometimes indirectly via <features.h>.
> I don't see what you mean by this.
> Rich

some applications use <features.h> to get macros defined in <sys/cdefs.h>
as on glibc, eglibc, uClibc <features.h> have a #include <sys/cdefs.h>


Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.