mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Isaac Dunham <idunham@lavabit.com>
To: musl@lists.openwall.com
Subject: [PATCH] _BSD_SOURCE for unistd.h, take 2
Date: Thu, 5 Apr 2012 18:45:34 -0700	[thread overview]
Message-ID: <20120405184534.77ad0b4b@newbook> (raw)
In-Reply-To: <20120406001049.GA8803@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

This is what was left from the comments.

This adds L_SET & co., and defines 5 functions that had been under
_GNU_SOURCE only, when _BSD_SOURCE is defined.
If I wanted to make things a little easier on those porting, I might
add something like this when _BSD_SOURCE is defined:
#warn "BSD setpgrp should be changed to setpgid"
That's not essential, though.

[-- Attachment #2: unistd.diff --]
[-- Type: text/x-patch, Size: 1029 bytes --]

diff --git a/include/unistd.h b/include/unistd.h
index 7662e51..d924886 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
+#endif
+
 #undef NULL
 #ifdef __cplusplus
 #define NULL 0
@@ -144,17 +150,20 @@ void sync(void);
 int getdtablesize(void);
 #endif
 
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+pid_t vfork(void);
+int vhangup(void);
+int chroot(const char *);
+int usleep(unsigned);
+unsigned ualarm(unsigned, unsigned);
+#endif
+
 #ifdef _GNU_SOURCE
 int brk(void *);
 void *sbrk(intptr_t);
 pid_t forkall(void);
-pid_t vfork(void);
-int vhangup(void);
-int chroot(const char *);
 int getpagesize(void);
 int sethostname(const char *, size_t);
-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);

  parent reply	other threads:[~2012-04-06  1:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-05 22:55 Namespace issues, missing functions, _BSD_SOURCE for unistd.h Isaac Dunham
2012-04-06  0:10 ` Rich Felker
2012-04-06  1:03   ` Isaac Dunham
2012-04-06  1:52     ` Rich Felker
2012-04-06  1:45   ` Isaac Dunham [this message]
2012-04-06  2:04     ` [PATCH] _BSD_SOURCE for unistd.h, take 2 Rich Felker
2012-04-06  2:40       ` Isaac Dunham
2012-04-06  2:51         ` Rich Felker
2012-04-06 14:48     ` Rich Felker
2012-04-06 15:48       ` Isaac Dunham
2012-04-06 23:32         ` Rich Felker
2012-04-07  5:47           ` 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=20120405184534.77ad0b4b@newbook \
    --to=idunham@lavabit.com \
    --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).