From: Ruediger Meier <sweet_f_a@gmx.de>
To: util-linux@vger.kernel.org
Subject: [PATCH v2 07/15] include: provide MAP_ANONYMOUS on OSX
Date: Thu, 18 Feb 2016 16:51:48 +0100 [thread overview]
Message-ID: <1455810708-28022-1-git-send-email-sweet_f_a@gmx.de> (raw)
In-Reply-To: <1455801169-10470-8-git-send-email-sweet_f_a@gmx.de>
From: Ruediger Meier <ruediger.meier@ga-group.nl>
Hope there are no side effect when defining _DARWIN_C_SOURCE
globally.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
configure.ac | 6 ++++++
include/c.h | 8 ++++++++
2 files changed, 14 insertions(+)
diff --git a/configure.ac b/configure.ac
index e9c8ef5..dbdcea4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,11 +158,17 @@ bsd_os=no
AS_CASE([${host_os}],
[*linux*],
[linux_os=yes],
+ [*darwin*],
+ [darwin_os=yes],
[*bsd*],
[bsd_os=yes])
AM_CONDITIONAL([LINUX], [test "x$linux_os" = xyes])
+AM_CONDITIONAL([DARWIN], [test "x$darwin_os" = xyes])
AM_CONDITIONAL([BSD], [test "x$bsd_os" = xyes])
+AS_IF([test "x$darwin_os" = xyes], [
+ AC_DEFINE([_DARWIN_C_SOURCE], [1], [Enable MAP_ANON in sys/mman.h on Mac OS X])
+])
dnl define ARCH_<NAME> conditionals
UL_SET_ARCH([I86], [i?86-*])
diff --git a/include/c.h b/include/c.h
index ca028ba..aec3439 100644
--- a/include/c.h
+++ b/include/c.h
@@ -355,4 +355,12 @@ static inline int xusleep(useconds_t usec)
*/
#define UL_GETPW_BUFSIZ (16 * 1024)
+/*
+ * Darwin or other BSDs may only have MAP_ANON. To get it on Darwin we must
+ * define _DARWIN_C_SOURCE before including sys/mman.h. We do this in config.h.
+ */
+#if !defined MAP_ANONYMOUS && defined MAP_ANON
+# define MAP_ANONYMOUS (MAP_ANON)
+#endif
+
#endif /* UTIL_LINUX_C_H */
--
1.8.4.5
next prev parent reply other threads:[~2016-02-18 15:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 13:12 [PATCH 00/15] portability fixes in the mix (OSX) Ruediger Meier
2016-02-18 13:12 ` [PATCH 01/15] travis: minor cleanup Ruediger Meier
2016-02-18 13:12 ` [PATCH 02/15] build-sys: portable usage of find command Ruediger Meier
2016-02-18 13:12 ` [PATCH 03/15] build-sys: check linker support for version scripts Ruediger Meier
2016-02-18 13:12 ` [PATCH 04/15] build-sys: fix [g]libtoolize version for OSX Ruediger Meier
2016-02-18 13:12 ` [PATCH 05/15] tests: fix ts_option helpers Ruediger Meier
2016-02-18 13:12 ` [PATCH 06/15] lib: rename strmode() and setmode() Ruediger Meier
2016-02-18 13:12 ` [PATCH 07/15] include: provide MAP_ANONYMOUS on OSX Ruediger Meier
2016-02-18 13:21 ` Karel Zak
2016-02-18 14:10 ` Ruediger Meier
2016-02-18 14:28 ` Karel Zak
2016-02-18 15:51 ` Ruediger Meier [this message]
2016-02-18 13:12 ` [PATCH 08/15] lib: define LOGIN_NAME_MAX fallback Ruediger Meier
2016-02-18 13:12 ` [PATCH 09/15] include: check for sys/sysmacros.h Ruediger Meier
2016-02-18 13:22 ` [PATCH 10/15] include: remove unused mntent.h Ruediger Meier
2016-02-18 13:22 ` [PATCH 11/15] lsns: use xcalloc() Ruediger Meier
2016-02-18 13:22 ` [PATCH 12/15] lib: remove unused variable Ruediger Meier
2016-02-18 13:23 ` [PATCH 13/15] lib: fix ismounted includes for FreeBSD Ruediger Meier
2016-02-18 13:23 ` [PATCH 14/15] libblkid: don't include endian.h Ruediger Meier
2016-02-18 13:23 ` [PATCH 15/15] include: fix sys/sysinfo.h Ruediger Meier
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=1455810708-28022-1-git-send-email-sweet_f_a@gmx.de \
--to=sweet_f_a@gmx.de \
--cc=util-linux@vger.kernel.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox