From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9116 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] add _DIRENT_HAVE_D_* constants to dirent.h Date: Thu, 14 Jan 2016 17:44:49 -0500 Message-ID: <20160114224449.GX238@brightrain.aerifal.cx> References: <20160113180919.GA11433@nyan> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1452811506 906 80.91.229.3 (14 Jan 2016 22:45:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Jan 2016 22:45:06 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9129-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jan 14 23:45:06 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aJqdc-0006MP-P6 for gllmg-musl@m.gmane.org; Thu, 14 Jan 2016 23:45:04 +0100 Original-Received: (qmail 28658 invoked by uid 550); 14 Jan 2016 22:45:02 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 28636 invoked from network); 14 Jan 2016 22:45:02 -0000 Content-Disposition: inline In-Reply-To: <20160113180919.GA11433@nyan> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:9116 Archived-At: On Wed, Jan 13, 2016 at 07:09:19PM +0100, Felix Janda wrote: > they can be used for checking existence of non-standard fields of > struct dirent, are used by various programs to avoid configure > checks and are at least present on glibc, uclibc, dietlibc and > newlib. > --- > The motivation for this patch is > > http://oss.sgi.com/archives/xfs/2016-01/msg00388.html > --- > include/dirent.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/include/dirent.h b/include/dirent.h > index 5aa8510..b2ffe8a 100644 > --- a/include/dirent.h > +++ b/include/dirent.h > @@ -57,6 +57,9 @@ int getdents(int, struct dirent *, size_t); > #endif > > #ifdef _GNU_SOURCE > +#define _DIRENT_HAVE_D_OFF > +#define _DIRENT_HAVE_D_RECLEN > +#define _DIRENT_HAVE_D_TYPE > int versionsort(const struct dirent **, const struct dirent **); > #endif I like the concept of defining macros to publish the availability of extensions like this, but I don't think they should be dependent on _GNU_SOURCE. At the very least they should also be available under _DEFAULT_SOURCE (_BSD_SOURCE), but since they're in the reserved namespace (underscore followed by capital) I'd prefer to have them exposed unconditionally. I'm also skeptical of whether d_off and d_reclen should be promoted as public APIs. They don't seem to be useful (unlike d_type which is highly useful) and may lock down some assumptions about implementation. Rich