From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: [PATCH]_BSD_SOURCE for musl, take 2.
Date: Tue, 22 May 2012 11:22:56 -0400 [thread overview]
Message-ID: <20120522152256.GS163@brightrain.aerifal.cx> (raw)
In-Reply-To: <20120521113158.70ce8b36@newbook>
On Mon, May 21, 2012 at 11:31:58AM -0700, Isaac Dunham wrote:
> Here's a second verion of the patch, with all the issues below
> addressed.
Looks good. A few more things, mostly just questions to make sure
stuff is ok..
> I'm still declaring bsd_signal if _BSD_SOURCE is defined, because it
> uses the signature of BSD signal().
Is there a reason for this? bsd_signal was a legacy SUSv3 function
removed in SUSv4/POSIX-2008, which was originally added mainly so that
programs written for BSD signal semantics could do:
#define signal bsd_signal
on non-BSD systems and still work. On glibc and musl it's utterly
useless since signal, by default, has BSD semantics. (POSIX allows
either and only BSD is sane.)
I doubt any code for BSD would ever be calling bsd_signal, as the
whole purpose of it is to provide an alternate function with BSD
behavior on non-BSD systems.
> diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h
> index c8a1a4b..797ce68 100644
> --- a/include/netinet/tcp.h
> +++ b/include/netinet/tcp.h
> @@ -2,5 +2,22 @@
> #define _NETINET_TCP_H
>
> #define TCP_NODELAY 1
> +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
> +#include <sys/types.h>
> +#include <sys/socket.h>
> +#define TCP_MAXSEG 2
> +#define TCP_CORK 3
> +#define TCP_KEEPIDLE 4
> [...]
TCP_* is in the reserved namespace for this header, so I think it
would be reasonable to define all the macros unconditionally. What
about the two includes, though? If they're needed to make GNU/BSD
programs work, we should still keep the check just for them.
> diff --git a/include/setjmp.h b/include/setjmp.h
> index b024c44..88fb950 100644
> --- a/include/setjmp.h
> +++ b/include/setjmp.h
> @@ -9,7 +9,8 @@ extern "C" {
>
>
> #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
> - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
> + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
> + || defined(_BSD_SOURCE)
> typedef unsigned long sigjmp_buf[(128+sizeof(jmp_buf))/sizeof(long)];
> #ifdef _GNU_SOURCE
> #define jmp_buf sigjmp_buf
^^^^^^^^^^^^^^^^^^^^^^^^^^
Just reminding myself this define is at best useless and at worst
harmful (big bloat). But changing it is separate; I'll do it after the
BSD commit.
> +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
> +void (*bsd_signal(int, void (*)(int)))(int);
> +#endif
See comments at the top of this email. Unless there's a really good
reason to declare this with BSD_SOURCE I'd like to leave it just under
_GNU_SOURCE.
> diff --git a/include/unistd.h b/include/unistd.h
> index b1a84d7..0112276 100644
> --- a/include/unistd.h
> +++ b/include/unistd.h
> @@ -16,6 +16,12 @@ extern "C" {
> #define SEEK_CUR 1
> #define SEEK_END 2
>
> +#if defined(_BSD_SOURCE) && !defined(L_SET)
> +#define L_SET SEEK_SET
> +#define L_INCR SEEK_CUR
> +#define L_XTND SEEK_END
Is L_SET defined somewhere else?
> +#ifdef _GNU_SOURCE
> +pid_t forkall(void);
Also mainly a reminder to me: forkall is actually no longer supported
(and was never in glibc) and should just be removed, but I'll do that
in a separate patch too. (The semantics the function intends to meet
are just logically contradictory/impossible).
Rich
next prev parent reply other threads:[~2012-05-22 15:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-21 6:26 _BSD_SOURCE support for musl ready Isaac Dunham
2012-05-21 12:42 ` Isaac Dunham
2012-05-21 13:36 ` Rich Felker
2012-05-21 17:19 ` Isaac Dunham
2012-05-21 17:43 ` Rich Felker
2012-05-21 18:31 ` [PATCH]_BSD_SOURCE for musl, take 2 Isaac Dunham
2012-05-22 15:22 ` Rich Felker [this message]
2012-05-22 23:19 ` 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=20120522152256.GS163@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).