Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130821180700.GE20515@brightrain.aerifal.cx>
Date: Wed, 21 Aug 2013 14:07:00 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com, yukoba@...elart.jp
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 libc.so for an interface that's
essentially never-used, and more importantly, adds a new symbol to the
ABI that we have to keep forever.

Rich

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.