mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: [PATCH 0/4] Fix function definitions.
Date: Fri, 9 Mar 2012 03:33:58 -0500	[thread overview]
Message-ID: <20120309083358.GA184@brightrain.aerifal.cx> (raw)
In-Reply-To: <4F59BD70.9020105@unixsol.org>

On Fri, Mar 09, 2012 at 10:21:04AM +0200, Georgi Chorbadzhiyski wrote:
> Subject: Re: [musl] [PATCH 0/4] Fix function definitions.

I think you mean declarations. :-)

> Hmm...it seems this is not enough. See include/unistd.h
> 
> #ifdef _GNU_SOURCE
> int brk(void *);
> void *sbrk(intptr_t);
> pid_t forkall(void);
> int vhangup(void);
> int getpagesize(void);
> int usleep(unsigned);
> unsigned ualarm(unsigned, unsigned);
> int setgroups(size_t, const gid_t []);
> int setresuid(uid_t, uid_t, uid_t);
> int setresgid(gid_t, gid_t, gid_t);
> char *get_current_dir_name(void);
> #endif
> 
> Most of the above according to their man pages should be defined if
> _BSD_SOURCE is set.

At present musl makes no attempt to support(*) the _BSD_SOURCE or
_SVID_SOURCE feature test macros; every nonstandard (non-POSIX)
extention offered by glibc is grouped together under _GNU_SOURCE, and
this works for musl because (unlike with glibc), musl's _GNU_SOURCE
only enables features; it does not alter standard interfaces like
strerror_r or basename to be broken GNU versions of the functions.

I think there's a good (nontrivial) discussion to be had about whether
it's worthwhile to have the _BSD_SOURCE and _SVID_SOURCE feature test
macros supported in musl. The main benefit I can see is that
applications which define _BSD_SOURCE or _SVID_SOURCE in their default
CFLAGS for the sake of getting certain important traditional
interfaces (like MAP_ANONYMOUS) but without bringing in broken GNU
behavior could perhaps be made to work out-of-the-box on musl without
manually adding -D_GNU_SOURCE to the CFLAGS. On the other hand, since
musl's _GNU_SOURCE is "non-destructive", I'm not sure that's a huge
benefit.


(*) _BSD_SOURCE appears in some places in musl's headers now, but that
was due to a (rather ill-thought-out) attempt to add some BSD
functions like strlcpy which glibc refuses to support, and avoid
making them visible when just _GNU_SOURCE is used. I'm largely
convinced this approach was a mistake, but how it should work is still
a topic for discussion...

> Should the headers be filled with feature checks (that would make them
> quite ugly) or assume we have _GNU_SOURCE defined and remove any _GNU_SOURCE
> checks?

I'm confused what you mean by "assume we have _GNU_SOURCE defined".

Rich


  parent reply	other threads:[~2012-03-09  8:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09  8:14 Georgi Chorbadzhiyski
2012-03-09  8:14 ` [PATCH 1/4] include/stdlib.h: Define clearenv() if (_SVID_SOURCE || _BSD_SOURCE) is set Georgi Chorbadzhiyski
2012-03-09  8:14 ` [PATCH 2/4] include/unistd.h: Define sethostname() if _BSD_SOURCE " Georgi Chorbadzhiyski
2012-03-09  8:14 ` [PATCH 3/4] include/unistd.h: Define vfork() " Georgi Chorbadzhiyski
2012-03-09  8:14 ` [PATCH 4/4] include/sys/types.h: major(), minor() and makedev() should be defined " Georgi Chorbadzhiyski
2012-03-09  8:21 ` [PATCH 0/4] Fix function definitions Georgi Chorbadzhiyski
2012-03-09  8:22   ` Georgi Chorbadzhiyski
2012-03-09  8:33   ` Rich Felker [this message]
2012-03-09  9:16     ` Georgi Chorbadzhiyski
2012-03-09 15:11       ` Rob Landley
2012-03-09 16:38         ` Rich Felker
2012-03-16 19:05           ` Isaac Dunham
2012-03-16 22:48             ` Rich Felker
2012-04-05 21:06               ` Isaac Dunham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120309083358.GA184@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).