From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/875 Path: news.gmane.org!not-for-mail From: Isaac Dunham Newsgroups: gmane.linux.lib.musl.general Subject: Re: _BSD_SOURCE support for musl ready Date: Mon, 21 May 2012 10:19:26 -0700 Message-ID: <20120521101926.52f4aab2@newbook> References: <20120520232651.4ed2d315@newbook> <20120521133629.GA9215@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1337620795 30287 80.91.229.3 (21 May 2012 17:19:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 21 May 2012 17:19:55 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-876-gllmg-musl=m.gmane.org@lists.openwall.com Mon May 21 19:19:54 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1SWWGl-0007Dc-Og for gllmg-musl@plane.gmane.org; Mon, 21 May 2012 19:19:43 +0200 Original-Received: (qmail 20371 invoked by uid 550); 21 May 2012 17:19:43 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 20363 invoked from network); 21 May 2012 17:19:42 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=SMvvOwG/02zlbBGe43sHDu/hisheRd5+sHTHPkxbQOOpWjae4cLH0ND7/nlurPGpkKZFrELwVmBlIU9oYl0XXjWGgmXwfFyzFplx9+owtUZoBD8MprPzBxvLbcEgpekDusrWImUJScJilBwDGTh+MEFAaYF16Zg++P/61nd1mC4=; h=Date:From:To:Subject:Message-ID:In-Reply-To:References:X-Mailer:Mime-Version:Content-Type:Content-Transfer-Encoding; In-Reply-To: <20120521133629.GA9215@brightrain.aerifal.cx> X-Mailer: Claws Mail 3.7.4 (GTK+ 2.20.1; i486-pc-linux-gnu) Xref: news.gmane.org gmane.linux.lib.musl.general:875 Archived-At: On Mon, 21 May 2012 09:36:29 -0400 Rich Felker wrote: > On Sun, May 20, 2012 at 11:26:51PM -0700, Isaac Dunham wrote: > > I think the _BSD_SOURCE support is ready to merge now. > > Great. Quick review; not sure I caught all the issues... > > > diff --git a/include/fcntl.h b/include/fcntl.h > > index 63f1beb..b776d38 100644 > > --- a/include/fcntl.h > > +++ b/include/fcntl.h > > [...] > > + > > +#ifndef _UNISTD_H > > +#define F_OK 0 > > +#define R_OK 4 > > [...] > > All _XXX_H macros should be considered entirely internal to the header > they're used to protect. Aside from that, this sort of mechanism makes > the logic in unistd.h very ugly (since it would have to check if > fcntl.h was already included with _GNU_SOURCE or _BSD_SOURCE defined). > > Since the definitions are exactly the same, multiple #defines are > legal in C. If they work in C++ too, and if the compiler does not > issue ugly warnings, I would just leave it be. Otherwise you could > #undef them all first, or use #ifdef F_OK. Will use #ifdef F_OK, I think. > > diff --git a/include/netdb.h b/include/netdb.h > > index 33b7a0a..d1fe9a8 100644 > > --- a/include/netdb.h > > +++ b/include/netdb.h > > @@ -5,7 +5,7 @@ > > [...] > > + > > +int innetgr(const char *, const char *, const char *, const char > > *); > > This should be a separate patch, and should add stubs for the rest of > the netgr functions at the same time (weak aliases in ent.c). Of > course innetgr needs to be in its own file since it's not a weak alias > and would pollute the standard namespace if put in ent.c. OK. I've put innetgr in its own file under src/stubs/ This probably means I'd need to change logwtmp, also (I had it in stubs/utmpx.c) > > diff --git a/include/signal.h b/include/signal.h > > [...] > > -#ifdef _GNU_SOURCE > > +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) > > typedef void (*sighandler_t)(int); > > +typedef sighandler_t sig_t; > > void (*bsd_signal(int, void (*)(int)))(int); > > +#endif > > I think sig_t should be BSD-only. That's how it is in glibc, and since > it's so illogically named and short, I'd rather keep it out of the > namespace even with _GNU_SOURCE. > > In glibc, sighandler_t is GNU-only (not in BSD). So it might make > sense to just have these be separate #ifdefs. Maybe. > > diff --git a/include/string.h b/include/string.h > > index 8cf0ee9..9715713 100644 > > --- a/include/string.h > > +++ b/include/string.h > > [...] > > > > +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) > > +int bcmp (const void *, const void *, size_t); > > +void bcopy (const void *, void *, size_t); > > +void bzero (void *, size_t); > > +int strcasecmp (const char *, const char *); > > +int strncasecmp (const char *, const char *, size_t); > > +char *index (const char *, int); > > +char *rindex (const char *, int); > > +int ffs (int); > > +#endif > > Wasn't all of this already coming from strings.h? I think I did that before _GNU_SOURCE included strings.h ... By the way, I noticed that strings.h seems to be specified (without bzero & co.) in X/Open 2008. I'm inclined to test like so: #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) \ || !defined(_XOPEN_SOURCE) That way, the X/Open namespace is respected, but -D_BSD_SOURCE -D_XOPEN_SOURCE will get everything. > That was just from a quick glance, so there might be some other issues > remaining, but overall it looks good. Thanks! Whitespace, I think. Iswaac Dunham