From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] [PATCH liburcu 3/5] Added a compat layer for 'syscall.h'
Date: Wed, 27 Nov 2013 16:29:40 +0000 (UTC) [thread overview]
Message-ID: <1311213495.76736.1385569780668.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <1385567313-8138-3-git-send-email-charlesbriere.flatzo@gmail.com>
----- Original Message -----
> From: "Charles Briere" <charlesbriere.flatzo@gmail.com>
> To: "mathieu desnoyers" <mathieu.desnoyers at efficios.com>
> Cc: lttng-dev at lists.lttng.org, "Pierre-Luc St-Charles" <pierre-luc.st-charles at polymtl.ca>, "Charles Briere"
> <charlesbriere.flatzo at gmail.com>
> Sent: Wednesday, November 27, 2013 10:48:31 AM
> Subject: [PATCH liburcu 3/5] Added a compat layer for 'syscall.h'
>
> From: Pierre-Luc St-Charles <pierre-luc.st-charles@polymtl.ca>
>
> Path to include syscall.h is different on Android
>
> Signed-off-by: Charles Briere <charlesbriere.flatzo at gmail.com>
> ---
> Makefile.am | 2 +-
> tests/common/thread-id.h | 5 ++---
> urcu.c | 2 +-
> urcu/futex.h | 2 +-
> urcu/syscall-compat.h | 36 ++++++++++++++++++++++++++++++++++++
> 5 files changed, 41 insertions(+), 6 deletions(-)
> create mode 100644 urcu/syscall-compat.h
>
> diff --git a/Makefile.am b/Makefile.am
> index baac8b9..64073a1 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -20,7 +20,7 @@ nobase_dist_include_HEADERS = urcu/compiler.h urcu/hlist.h
> urcu/list.h \
> urcu/wfqueue.h urcu/rculfstack.h urcu/rculfqueue.h \
> urcu/ref.h urcu/cds.h urcu/urcu_ref.h urcu/urcu-futex.h \
> urcu/uatomic_arch.h urcu/rculfhash.h urcu/wfcqueue.h \
> - urcu/lfstack.h \
> + urcu/lfstack.h urcu/syscall-compat.h \
> $(top_srcdir)/urcu/map/*.h \
> $(top_srcdir)/urcu/static/*.h \
> urcu/tls-compat.h
> diff --git a/tests/common/thread-id.h b/tests/common/thread-id.h
> index 9378edc..bad3006 100644
> --- a/tests/common/thread-id.h
> +++ b/tests/common/thread-id.h
> @@ -17,9 +17,8 @@
> * provided the above notices are retained, and a notice that the code was
> * modified is included with the above copyright notice.
> */
> -
> -#ifdef __linux__
> -# include <syscall.h>
> +#ifdef __Linux__
Changing from __linux__ to __Linux__ breaks things here on non-Android.
Why are you changing this ?
In file included from test_rwlock.c:39:0:
../../tests/common/thread-id.h:46:3: warning: #warning "use pid as thread ID" [-Wcpp]
Thanks,
Mathieu
> +# include <urcu/syscall-compat.h>
>
> # if defined(_syscall0)
> _syscall0(pid_t, gettid)
> diff --git a/urcu.c b/urcu.c
> index 759b94b..69ebcaa 100644
> --- a/urcu.c
> +++ b/urcu.c
> @@ -66,7 +66,7 @@
> * RCU_MEMBARRIER is only possibly available on Linux.
> */
> #if defined(RCU_MEMBARRIER) && defined(__linux__)
> -#include <syscall.h>
> +#include <urcu/syscall-compat.h>
> #endif
>
> /* If the headers do not support SYS_membarrier, fall back on RCU_MB */
> diff --git a/urcu/futex.h b/urcu/futex.h
> index cdaa430..bb270c2 100644
> --- a/urcu/futex.h
> +++ b/urcu/futex.h
> @@ -45,7 +45,7 @@ extern "C" {
> */
>
> #ifdef CONFIG_RCU_HAVE_FUTEX
> -#include <syscall.h>
> +#include <urcu/syscall-compat.h>
> #define futex(...) syscall(__NR_futex, __VA_ARGS__)
> #define futex_noasync(uaddr, op, val, timeout, uaddr2, val3) \
> futex(uaddr, op, val, timeout, uaddr2, val3)
> diff --git a/urcu/syscall-compat.h b/urcu/syscall-compat.h
> new file mode 100644
> index 0000000..55576f0
> --- /dev/null
> +++ b/urcu/syscall-compat.h
> @@ -0,0 +1,36 @@
> +#ifndef _URCU_SYSCALL_COMPAT_H
> +#define _URCU_SYSCALL_COMPAT_H
> +
> +/*
> + * urcu/syscall-compat.h
> + *
> + * Userspace RCU library - Syscall Compatibility Header
> + *
> + * Copyright 2013 - Pierre-Luc St-Charles <pierre-luc.st-charles at polymtl.ca>
> + *
> + * Note: this file is only used to simplify the code required to
> + * include the 'syscall.h' system header across multiple platforms,
> + * which might not always be located at the same place (or needed at all).
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
> USA
> + */
> +
> +#if defined(__ANDROID__)
> +#include <sys/syscall.h>
> +#elif defined(__linux__)
> +#include <syscall.h>
> +#endif
> +
> +#endif /* _URCU_SYSCALL_COMPAT_H */
> --
> 1.8.4.2
>
>
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2013-11-27 16:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-27 15:48 [lttng-dev] [PATCH liburcu 1/5] configure.ac Android check Charles Briere
2013-11-27 15:48 ` [lttng-dev] [PATCH liburcu 2/5] Dont link pthread on Android Charles Briere
2013-11-27 16:10 ` Mathieu Desnoyers
2013-11-28 9:30 ` Thomas Petazzoni
2013-11-29 0:10 ` Charles Brière
2013-11-29 6:01 ` Mathieu Desnoyers
2013-11-27 15:48 ` [lttng-dev] [PATCH liburcu 3/5] Added a compat layer for 'syscall.h' Charles Briere
2013-11-27 16:29 ` Mathieu Desnoyers [this message]
2013-11-27 17:20 ` Charles Brière
2013-11-27 17:38 ` Mathieu Desnoyers
2013-11-27 15:48 ` [lttng-dev] [PATCH liburcu 4/5] Fix: Do not redefine gettid on Android Charles Briere
2013-11-27 16:09 ` Mathieu Desnoyers
2013-11-27 15:48 ` [lttng-dev] [PATCH liburcu 5/5] Added implementation for rand_r() Charles Briere
-- strict thread matches above, loose matches on Subject: below --
2013-11-27 5:08 [lttng-dev] [PATCH liburcu 1/5] configure.ac Android check Charles Briere
2013-11-27 5:08 ` [lttng-dev] [PATCH liburcu 3/5] Added a compat layer for 'syscall.h' Charles Briere
2013-11-27 9:35 ` Mathieu Desnoyers
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=1311213495.76736.1385569780668.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox