Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 21 Aug 2013 14:07:00 -0400
From: Rich Felker <>
Subject: Re: SUN_LEN

On Thu, Aug 22, 2013 at 02:58:28AM +0900, Yu Kobayashi wrote:
> >> Why is it a bad thing to include <string.h>?
> >> Worry about cyclic dependency?
> > Well it puts a lot more stuff into the namespace and has a much larger
> > parsing cost
> How about this.
> #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
> #define SUN_LEN(s) __sun_len(s)
> #endif
> And add __sun_len.c like this.
> #include <string.h>
> #include <sys/un.h>
> size_t __sun_len(struct sockaddr_un *s)
> {
>     return sizeof(sa_family_t) + strlen(s->sun_path);
> }
> I think this solve the problem.

No, this is worse. It enlarges for an interface that's
essentially never-used, and more importantly, adds a new symbol to the
ABI that we have to keep forever.


Powered by blists - more mailing lists

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