* [lttng-dev] [PATCH lttng-tools 07/24] Fix : need to include config.h if using it's definitions
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (2 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 04/24] Fix : Only link librt if available Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 01/24] Fix : wait.h should be sys/wait.h according to posix and android doesn't redirect wait.h to sys/wait.h Charles Briere
` (20 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
src/common/compat/tid.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/common/compat/tid.h b/src/common/compat/tid.h
index b420914..7645b90 100644
--- a/src/common/compat/tid.h
+++ b/src/common/compat/tid.h
@@ -25,9 +25,7 @@
#ifndef LTTNG_TID_H
#define LTTNG_TID_H
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include <config.h>
#if !HAVE_DECL_GETTID
# if defined(_syscall0)
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 06/24] Fix : Do not redeclare gettid if found
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (4 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 01/24] Fix : wait.h should be sys/wait.h according to posix and android doesn't redirect wait.h to sys/wait.h Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 08/24] Fix : Don't compile ust functions when not enabled Charles Briere
` (18 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 2 ++
src/common/compat/tid.h | 11 +++++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8703284..3460f98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -213,6 +213,8 @@ AC_CHECK_DECL([cmm_smp_mb__before_uatomic_or], [],
[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
)
+AC_CHECK_DECLS([gettid], [], [], [[#include <unistd.h>]])
+
# Check kmod library
AC_ARG_WITH(kmod-prefix,
AS_HELP_STRING([--with-kmod-prefix=PATH],
diff --git a/src/common/compat/tid.h b/src/common/compat/tid.h
index 40f562f..b420914 100644
--- a/src/common/compat/tid.h
+++ b/src/common/compat/tid.h
@@ -29,15 +29,16 @@
#include <syscall.h>
#endif
-#if defined(_syscall0)
+#if !HAVE_DECL_GETTID
+# if defined(_syscall0)
_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
+# elif defined(__NR_gettid)
#include <unistd.h>
static inline pid_t gettid(void)
{
return syscall(__NR_gettid);
}
-#else
+# else
#include <sys/types.h>
#include <unistd.h>
@@ -46,6 +47,8 @@ static inline pid_t gettid(void)
{
return getpid();
}
-#endif
+
+# endif
+#endif /* !HAVE_DECL_GETTID */
#endif /* LTTNG_TID_H */
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 05/24] Fix : Do not use gLibc specific macros
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 02/24] Fix : Include sys/stat.h where needed Charles Briere
` (23 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
src/common/compat/poll.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/common/compat/poll.h b/src/common/compat/poll.h
index f892c83..64ff618 100644
--- a/src/common/compat/poll.h
+++ b/src/common/compat/poll.h
@@ -73,7 +73,7 @@ enum {
LPOLLNVAL = EPOLLHUP,
LPOLLRDHUP = EPOLLRDHUP,
/* Close on exec feature of epoll */
-#if __GLIBC_PREREQ(2, 9)
+#ifdef EPOLL_CLOEXEC
LTTNG_CLOEXEC = EPOLL_CLOEXEC,
#else
/*
@@ -127,7 +127,7 @@ extern int compat_epoll_create(struct lttng_poll_event *events,
#define lttng_poll_create(events, size, flags) \
compat_epoll_create(events, size, flags)
-#if __GLIBC_PREREQ(2, 9)
+#ifdef EPOLL_CLOEXEC
static inline int compat_glibc_epoll_create(int size __attribute__((unused)),
int flags)
{
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] Fixes for Android
@ 2014-10-27 20:49 Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 05/24] Fix : Do not use gLibc specific macros Charles Briere
` (24 more replies)
0 siblings, 25 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
The following patch set allows compilation of lttng-tools for Android.
This have been tested with AOSP and may not work if compiling with
Android's NDK toolchain.
The patch concerning the shm compatibility layer is there in preparation
for patches around lttng-ust which will follow soon.
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 01/24] Fix : wait.h should be sys/wait.h according to posix and android doesn't redirect wait.h to sys/wait.h
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (3 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 07/24] Fix : need to include config.h if using it's definitions Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 06/24] Fix : Do not redeclare gettid if found Charles Briere
` (19 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
src/common/daemonize.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/common/daemonize.c b/src/common/daemonize.c
index a8e2906..5d8f10f 100644
--- a/src/common/daemonize.c
+++ b/src/common/daemonize.c
@@ -20,7 +20,7 @@
#include <unistd.h>
#include <paths.h>
#include <fcntl.h>
-#include <wait.h>
+#include <sys/wait.h>
#include <stdlib.h>
#include <urcu/system.h>
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 04/24] Fix : Only link librt if available
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 05/24] Fix : Do not use gLibc specific macros Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 02/24] Fix : Include sys/stat.h where needed Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 07/24] Fix : need to include config.h if using it's definitions Charles Briere
` (21 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 15 ++++++++++++++-
src/bin/lttng-consumerd/Makefile.am | 2 +-
src/bin/lttng-relayd/Makefile.am | 2 +-
src/bin/lttng-sessiond/Makefile.am | 2 +-
src/common/Makefile.am | 2 +-
src/common/sessiond-comm/Makefile.am | 3 ++-
tests/regression/tools/live/Makefile.am | 3 ++-
tests/unit/Makefile.am | 9 ++++++---
8 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index 487a2b9..8703284 100644
--- a/configure.ac
+++ b/configure.ac
@@ -167,6 +167,19 @@ AC_CHECK_LIB([uuid], [uuid_generate],
])
]
)
+
+# Check for librt
+AC_CHECK_LIB([rt], [shm_open],
+[
+ AC_SUBST(LIBRT, '-lrt')
+ librt='-lrt'
+],
+[
+ AC_SUBST(LIBRT, '')
+ ilibrt=''
+]
+)
+
AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"])
AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid" = "xyes"])
@@ -247,7 +260,7 @@ AS_IF([test "x$lttng_ust_support" = "xyes"], [
lttng_ust_ctl_found=yes
],
[AC_MSG_ERROR([Cannot find LTTng-UST >= 2.2.x. Use --with-lttng-ust-prefix=PREFIX to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])],
- [-lurcu-common -lurcu-bp -lurcu-cds -lrt]
+ [-lurcu-common -lurcu-bp -lurcu-cds $librt]
)
])
AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
diff --git a/src/bin/lttng-consumerd/Makefile.am b/src/bin/lttng-consumerd/Makefile.am
index 28034ca..8d7a675 100644
--- a/src/bin/lttng-consumerd/Makefile.am
+++ b/src/bin/lttng-consumerd/Makefile.am
@@ -14,7 +14,7 @@ lttng_consumerd_LDADD = \
$(top_builddir)/src/common/index/libindex.la \
$(top_builddir)/src/common/health/libhealth.la \
$(top_builddir)/src/common/testpoint/libtestpoint.la \
- -lrt
+ @LIBRT@
if HAVE_LIBLTTNG_UST_CTL
lttng_consumerd_LDADD += -llttng-ust-ctl
diff --git a/src/bin/lttng-relayd/Makefile.am b/src/bin/lttng-relayd/Makefile.am
index 126cdaf..4700f1a 100644
--- a/src/bin/lttng-relayd/Makefile.am
+++ b/src/bin/lttng-relayd/Makefile.am
@@ -20,7 +20,7 @@ lttng_relayd_SOURCES = main.c lttng-relayd.h utils.h utils.c cmd.h \
connection.c connection.h
# link on liblttngctl for check if relayd is already alive.
-lttng_relayd_LDADD = -lrt -lurcu-common -lurcu \
+lttng_relayd_LDADD = @LIBRT@ -lurcu-common -lurcu \
$(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \
$(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la \
$(top_builddir)/src/common/hashtable/libhashtable.la \
diff --git a/src/bin/lttng-sessiond/Makefile.am b/src/bin/lttng-sessiond/Makefile.am
index 7819222..cf75082 100644
--- a/src/bin/lttng-sessiond/Makefile.am
+++ b/src/bin/lttng-sessiond/Makefile.am
@@ -42,7 +42,7 @@ endif
lttng_sessiond_SOURCES += lttng-sessiond.h main.c
# link on liblttngctl for check if sessiond is already alive.
-lttng_sessiond_LDADD = -lrt -lurcu-common -lurcu \
+lttng_sessiond_LDADD = @LIBRT@ -lurcu-common -lurcu \
$(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \
$(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la \
$(top_builddir)/src/common/kernel-ctl/libkernel-ctl.la \
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 3a2f4f0..974ce7c 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -21,7 +21,7 @@ libcommon_la_SOURCES = error.h error.c utils.c utils.h runas.c runas.h \
daemonize.c daemonize.h
libcommon_la_LIBADD = \
-luuid \
- -lrt \
+ @LIBRT@ \
$(top_builddir)/src/common/config/libconfig.la
# Consumer library
diff --git a/src/common/sessiond-comm/Makefile.am b/src/common/sessiond-comm/Makefile.am
index fdffa40..23d8e68 100644
--- a/src/common/sessiond-comm/Makefile.am
+++ b/src/common/sessiond-comm/Makefile.am
@@ -6,4 +6,5 @@ noinst_LTLIBRARIES = libsessiond-comm.la
libsessiond_comm_la_SOURCES = sessiond-comm.c sessiond-comm.h \
unix.c unix.h inet.c inet.h inet6.c inet6.h \
relayd.h agent.h
-libsessiond_comm_la_LIBADD = -lrt
+
+libsessiond_comm_la_LIBADD = @LIBRT@
diff --git a/tests/regression/tools/live/Makefile.am b/tests/regression/tools/live/Makefile.am
index ea5f417..4b99022 100644
--- a/tests/regression/tools/live/Makefile.am
+++ b/tests/regression/tools/live/Makefile.am
@@ -30,7 +30,8 @@ endif
live_test_SOURCES = live_test.c
live_test_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \
- $(LIBHASHTABLE) $(LIBHEALTH) -lrt
+ $(LIBHASHTABLE) $(LIBHEALTH) @LIBRT@
+
live_test_LDADD += $(LIVE) \
$(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la
diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am
index dd3dd8c..169ab68 100644
--- a/tests/unit/Makefile.am
+++ b/tests/unit/Makefile.am
@@ -43,7 +43,8 @@ SESSIONS=$(top_builddir)/src/bin/lttng-sessiond/session.o \
test_session_SOURCES = test_session.c
test_session_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \
- $(LIBHASHTABLE) -lrt
+ $(LIBHASHTABLE) @LIBRT@
+
test_session_LDADD += $(SESSIONS)
# UST data structures unit test
@@ -67,7 +68,8 @@ UST_DATA_TRACE=$(top_builddir)/src/bin/lttng-sessiond/trace-ust.o \
test_ust_data_SOURCES = test_ust_data.c
test_ust_data_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM)\
- $(LIBHASHTABLE) -lrt -llttng-ust-ctl
+ $(LIBHASHTABLE) @LIBRT@ -llttng-ust-ctl
+
test_ust_data_LDADD += $(UST_DATA_TRACE)
endif
@@ -82,7 +84,8 @@ KERN_DATA_TRACE=$(top_builddir)/src/bin/lttng-sessiond/trace-kernel.o \
test_kernel_data_SOURCES = test_kernel_data.c
test_kernel_data_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \
- $(LIBHASHTABLE) -lrt
+ $(LIBHASHTABLE) @LIBRT@
+
test_kernel_data_LDADD += $(KERN_DATA_TRACE)
# utils suffix for unit test
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 03/24] Fix : Wrap variable with URCU_TLS for sizeof
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (6 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 08/24] Fix : Don't compile ust functions when not enabled Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 15/24] Add : Compatibility layer for stat.h Charles Briere
` (16 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
src/common/error.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/common/error.c b/src/common/error.c
index 55d56e6..577070e 100644
--- a/src/common/error.c
+++ b/src/common/error.c
@@ -49,7 +49,7 @@ const char *log_add_time(void)
}
/* Format time in the TLS variable. */
- ret = snprintf(URCU_TLS(error_log_time).str, sizeof(error_log_time.str),
+ ret = snprintf(URCU_TLS(error_log_time).str, sizeof(URCU_TLS(error_log_time).str),
"%02d:%02d:%02d.%06ld",
tm.tm_hour, tm.tm_min, tm.tm_sec, tp.tv_nsec);
if (ret < 0) {
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 02/24] Fix : Include sys/stat.h where needed
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 05/24] Fix : Do not use gLibc specific macros Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 04/24] Fix : Only link librt if available Charles Briere
` (22 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Some definitions from sys/stat.h are used but not included
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
src/bin/lttng-sessiond/save.c | 1 +
src/bin/lttng-sessiond/ust-consumer.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/bin/lttng-sessiond/save.c b/src/bin/lttng-sessiond/save.c
index 908e5f8..6135dae 100644
--- a/src/bin/lttng-sessiond/save.c
+++ b/src/bin/lttng-sessiond/save.c
@@ -21,6 +21,7 @@
#include <string.h>
#include <urcu/uatomic.h>
#include <unistd.h>
+#include <sys/stat.h>
#include <common/defaults.h>
#include <common/error.h>
diff --git a/src/bin/lttng-sessiond/ust-consumer.c b/src/bin/lttng-sessiond/ust-consumer.c
index 4b52d59..9e9d63f 100644
--- a/src/bin/lttng-sessiond/ust-consumer.c
+++ b/src/bin/lttng-sessiond/ust-consumer.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/stat.h>
#include <unistd.h>
#include <inttypes.h>
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 08/24] Fix : Don't compile ust functions when not enabled
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (5 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 06/24] Fix : Do not redeclare gettid if found Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 03/24] Fix : Wrap variable with URCU_TLS for sizeof Charles Briere
` (17 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
src/bin/lttng-sessiond/shm.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/bin/lttng-sessiond/shm.c b/src/bin/lttng-sessiond/shm.c
index a5caa8b..fa3867c 100644
--- a/src/bin/lttng-sessiond/shm.c
+++ b/src/bin/lttng-sessiond/shm.c
@@ -16,6 +16,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if HAVE_LIBLTTNG_UST_CTL
+
#define _GNU_SOURCE
#include <fcntl.h>
#include <limits.h>
@@ -170,3 +172,16 @@ char *shm_ust_get_mmap(char *shm_path, int global)
error:
return NULL;
}
+
+#else
+
+/*
+ * Dummy implementation so we do not need to put
+ * ifdef in main.c
+ */
+char *shm_ust_get_mmap(char *shm_path, int global)
+{
+ return 0;
+}
+
+#endif /* HAVE_LIBLTTNG_UST_CTL */
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 13/24] Add : Compatibility layer for un.h
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (15 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 17/24] Add : Compatibility layer for pthread Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 20/24] Android : %m[^] not supported in fscanf Charles Briere
` (7 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
src/common/compat/un.h | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 src/common/compat/un.h
diff --git a/src/common/compat/un.h b/src/common/compat/un.h
new file mode 100644
index 0000000..6c5479d
--- /dev/null
+++ b/src/common/compat/un.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 - Charles Briere <c.briere at samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _COMPAT_UN_H
+#define _COMPAT_UN_H
+
+# ifdef __ANDROID__
+
+#include <sys/_types.h>
+
+#define UNIX_PATH_MAX 108
+
+struct sockaddr_un {
+ __sa_family_t sun_family;
+ char sun_path[UNIX_PATH_MAX];
+};
+# else /* __ANDROID__ */
+
+#include <sys/un.h>
+
+# endif
+
+#endif /* _COMPAT_UN_H */
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 12/24] Add : Compatibility layer for ulimit.h
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (9 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 14/24] Add : Compatibility layer for signal.h Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 10/24] Add : Compatibility layer for netinet/in.h Charles Briere
` (13 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 1 +
src/bin/lttng-consumerd/health-consumerd.c | 2 +-
src/bin/lttng-consumerd/lttng-consumerd.c | 2 +-
src/bin/lttng-relayd/health-relayd.c | 2 +-
src/common/compat/ulimit.h | 29 +++++++++++++++++++++++++++++
5 files changed, 33 insertions(+), 3 deletions(-)
create mode 100644 src/common/compat/ulimit.h
diff --git a/configure.ac b/configure.ac
index 3b880c9..fc08cc6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,6 +58,7 @@ AC_CHECK_HEADERS([ \
sys/types.h unistd.h fcntl.h string.h pthread.h limits.h \
signal.h stdlib.h sys/un.h sys/socket.h stdlib.h stdio.h \
getopt.h sys/ipc.h sys/shm.h popt.h grp.h syscall.h \
+ ulimit.h \
],[],
[AC_CHECK_HEADERS([sys/syscall.h])]
)
diff --git a/src/bin/lttng-consumerd/health-consumerd.c b/src/bin/lttng-consumerd/health-consumerd.c
index 079a14b..3af18e7 100644
--- a/src/bin/lttng-consumerd/health-consumerd.c
+++ b/src/bin/lttng-consumerd/health-consumerd.c
@@ -38,7 +38,6 @@
#include <assert.h>
#include <config.h>
#include <urcu/compiler.h>
-#include <ulimit.h>
#include <inttypes.h>
#include <common/defaults.h>
@@ -46,6 +45,7 @@
#include <common/consumer.h>
#include <common/consumer-timer.h>
#include <common/compat/poll.h>
+#include <common/compat/ulimit.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/utils.h>
diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c
index bdd8ddc..f1bd287 100644
--- a/src/bin/lttng-consumerd/lttng-consumerd.c
+++ b/src/bin/lttng-consumerd/lttng-consumerd.c
@@ -39,13 +39,13 @@
#include <assert.h>
#include <config.h>
#include <urcu/compiler.h>
-#include <ulimit.h>
#include <common/defaults.h>
#include <common/common.h>
#include <common/consumer.h>
#include <common/consumer-timer.h>
#include <common/compat/poll.h>
+#include <common/compat/ulimit.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/utils.h>
diff --git a/src/bin/lttng-relayd/health-relayd.c b/src/bin/lttng-relayd/health-relayd.c
index 3a5cc90..312edd5 100644
--- a/src/bin/lttng-relayd/health-relayd.c
+++ b/src/bin/lttng-relayd/health-relayd.c
@@ -38,7 +38,6 @@
#include <assert.h>
#include <config.h>
#include <urcu/compiler.h>
-#include <ulimit.h>
#include <inttypes.h>
#include <common/defaults.h>
@@ -46,6 +45,7 @@
#include <common/consumer.h>
#include <common/consumer-timer.h>
#include <common/compat/poll.h>
+#include <common/compat/ulimit.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/utils.h>
diff --git a/src/common/compat/ulimit.h b/src/common/compat/ulimit.h
new file mode 100644
index 0000000..1140c99
--- /dev/null
+++ b/src/common/compat/ulimit.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2014 - Charles Briere <c.briere at samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _COMPAT_ULIMIT_H
+#define _COMPAT_ULIMIT_H
+
+#include <config.h>
+
+# ifdef HAVE_ULIMIT
+# include <ulimit.h>
+# else
+
+# endif /* HAVE_ULIMIT */
+
+#endif /*_COMPAT_ULIMIT_H */
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 10/24] Add : Compatibility layer for netinet/in.h
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (10 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 12/24] Add : Compatibility layer for ulimit.h Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 11/24] Add : Compatibility layer for limit.h Charles Briere
` (12 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Add definition for in_port_t
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 2 ++
src/common/compat/Makefile.am | 3 ++-
src/common/compat/netinet/in.h | 35 +++++++++++++++++++++++++++++++++++
src/common/uri.h | 2 +-
4 files changed, 40 insertions(+), 2 deletions(-)
create mode 100644 src/common/compat/netinet/in.h
diff --git a/configure.ac b/configure.ac
index 1189d8e..3b880c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,8 @@ AC_CHECK_HEADERS([ \
[AC_CHECK_HEADERS([sys/syscall.h])]
)
+AC_CHECK_TYPES([in_port_t], [], [], [[#include <netinet/in.h>]])
+
# Babeltrace viewer check
AC_ARG_WITH([babeltrace-bin],
AS_HELP_STRING([--with-babeltrace-bin],
diff --git a/src/common/compat/Makefile.am b/src/common/compat/Makefile.am
index 537375b..40495ed 100644
--- a/src/common/compat/Makefile.am
+++ b/src/common/compat/Makefile.am
@@ -9,4 +9,5 @@ COMPAT=compat-poll.c
endif
libcompat_la_SOURCES = poll.h fcntl.h endian.h mman.h clone.h \
- socket.h compat-fcntl.c uuid.h tid.h $(COMPAT)
+ socket.h compat-fcntl.c uuid.h tid.h netinet/in.h \
+ $(COMPAT)
diff --git a/src/common/compat/netinet/in.h b/src/common/compat/netinet/in.h
new file mode 100644
index 0000000..96981e2
--- /dev/null
+++ b/src/common/compat/netinet/in.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2014 (c) - Charles Briere <c.briere at samsung.com>
+ *
+ * syscall compatibility layer.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef LTTNG_NETINET_IN_H
+#define LTTNG_NETINET_IN_H
+
+#include <netinet/in.h>
+#include <config.h>
+
+# ifndef HAVE_IN_PORT_T
+typedef uint16_t in_port_t;
+# endif
+
+#endif
diff --git a/src/common/uri.h b/src/common/uri.h
index 3ef6669..7f2f5b6 100644
--- a/src/common/uri.h
+++ b/src/common/uri.h
@@ -18,7 +18,7 @@
#ifndef URI_H
#define URI_H
-#include <netinet/in.h>
+#include <common/compat/netinet/in.h>
#include <lttng/lttng.h>
/* Destination type of lttng URI */
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 15/24] Add : Compatibility layer for stat.h
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (7 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 03/24] Fix : Wrap variable with URCU_TLS for sizeof Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 14/24] Add : Compatibility layer for signal.h Charles Briere
` (15 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
This is required when building from Android NDK,
but not necessary when building from AOSP tree.
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
src/bin/lttng-consumerd/health-consumerd.c | 2 +-
src/bin/lttng-consumerd/lttng-consumerd.c | 2 +-
src/bin/lttng-relayd/health-relayd.c | 2 +-
src/bin/lttng-relayd/live.c | 2 +-
src/bin/lttng-relayd/main.c | 2 +-
src/bin/lttng-sessiond/consumer.c | 2 +-
src/bin/lttng-sessiond/kernel-consumer.c | 2 +-
src/bin/lttng-sessiond/main.c | 2 +-
src/bin/lttng-sessiond/save.c | 2 +-
src/bin/lttng-sessiond/session.c | 2 +-
src/bin/lttng-sessiond/shm.c | 2 +-
src/bin/lttng-sessiond/ust-app.c | 2 +-
src/bin/lttng-sessiond/ust-consumer.c | 2 +-
src/bin/lttng/commands/add_context.c | 2 +-
src/bin/lttng/commands/calibrate.c | 2 +-
src/bin/lttng/commands/create.c | 2 +-
src/bin/lttng/commands/destroy.c | 2 +-
src/bin/lttng/commands/disable_channels.c | 2 +-
src/bin/lttng/commands/disable_events.c | 2 +-
src/bin/lttng/commands/enable_channels.c | 2 +-
src/bin/lttng/commands/enable_events.c | 2 +-
src/bin/lttng/commands/set_session.c | 2 +-
src/bin/lttng/commands/snapshot.c | 2 +-
src/bin/lttng/commands/start.c | 2 +-
src/bin/lttng/commands/stop.c | 2 +-
src/bin/lttng/commands/version.c | 2 +-
src/bin/lttng/commands/view.c | 2 +-
src/bin/lttng/conf.c | 2 +-
src/common/compat/compat-epoll.c | 2 +-
src/common/compat/stat.h | 29 ++++++++++++++++++++++
src/common/config/config.c | 2 +-
src/common/index/index.c | 2 +-
src/common/kernel-consumer/kernel-consumer.c | 2 +-
src/common/relayd/relayd.c | 2 +-
src/common/runas.c | 2 +-
src/common/sessiond-comm/inet.c | 2 +-
src/common/sessiond-comm/inet6.c | 2 +-
src/common/sessiond-comm/sessiond-comm.c | 2 +-
src/common/sessiond-comm/unix.c | 2 +-
src/common/ust-consumer/ust-consumer.c | 2 +-
src/common/utils.c | 2 +-
tests/regression/tools/filtering/gen-ust-events.c | 2 +-
tests/regression/tools/live/live_test.c | 2 +-
tests/regression/tools/mi/validate_xml.c | 2 +-
tests/regression/ust/high-throughput/main.c | 2 +-
tests/regression/ust/linking/demo.c | 2 +-
tests/regression/ust/multi-session/gen-nevents.c | 2 +-
tests/regression/ust/overlap/demo/demo.c | 2 +-
tests/unit/test_utils_expand_path.c | 2 +-
.../utils/testapp/gen-ust-events/gen-ust-events.c | 2 +-
.../testapp/gen-ust-nevents/gen-ust-nevents.c | 2 +-
.../utils/testapp/gen-ust-tracef/gen-ust-tracef.c | 2 +-
52 files changed, 80 insertions(+), 51 deletions(-)
create mode 100644 src/common/compat/stat.h
diff --git a/src/bin/lttng-consumerd/health-consumerd.c b/src/bin/lttng-consumerd/health-consumerd.c
index e826d51..5f2415b 100644
--- a/src/bin/lttng-consumerd/health-consumerd.c
+++ b/src/bin/lttng-consumerd/health-consumerd.c
@@ -29,7 +29,7 @@
#include <sys/resource.h>
#include <sys/shm.h>
#include <sys/socket.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <urcu/list.h>
#include <poll.h>
diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c
index b57d6df..70605bf 100644
--- a/src/bin/lttng-consumerd/lttng-consumerd.c
+++ b/src/bin/lttng-consumerd/lttng-consumerd.c
@@ -30,7 +30,7 @@
#include <sys/resource.h>
#include <sys/shm.h>
#include <sys/socket.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <urcu/list.h>
#include <poll.h>
diff --git a/src/bin/lttng-relayd/health-relayd.c b/src/bin/lttng-relayd/health-relayd.c
index 535f151..812fb03 100644
--- a/src/bin/lttng-relayd/health-relayd.c
+++ b/src/bin/lttng-relayd/health-relayd.c
@@ -29,7 +29,7 @@
#include <sys/resource.h>
#include <sys/shm.h>
#include <sys/socket.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <urcu/list.h>
#include <poll.h>
diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c
index e1f6486..4163e08 100644
--- a/src/bin/lttng-relayd/live.c
+++ b/src/bin/lttng-relayd/live.c
@@ -29,7 +29,7 @@
#include <sys/mount.h>
#include <sys/resource.h>
#include <sys/socket.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <inttypes.h>
diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c
index 6520056..e5f1dde 100644
--- a/src/bin/lttng-relayd/main.c
+++ b/src/bin/lttng-relayd/main.c
@@ -30,7 +30,7 @@
#include <sys/mount.h>
#include <sys/resource.h>
#include <sys/socket.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <inttypes.h>
diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c
index ce3e5da..2c21cc4 100644
--- a/src/bin/lttng-sessiond/consumer.c
+++ b/src/bin/lttng-sessiond/consumer.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <inttypes.h>
diff --git a/src/bin/lttng-sessiond/kernel-consumer.c b/src/bin/lttng-sessiond/kernel-consumer.c
index d71f8ce..33b9159 100644
--- a/src/bin/lttng-sessiond/kernel-consumer.c
+++ b/src/bin/lttng-sessiond/kernel-consumer.c
@@ -19,7 +19,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <unistd.h>
#include <common/common.h>
diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
index 95cfb54..5fe3043 100644
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
@@ -32,7 +32,7 @@
#include <sys/mount.h>
#include <sys/resource.h>
#include <sys/socket.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <urcu/uatomic.h>
diff --git a/src/bin/lttng-sessiond/save.c b/src/bin/lttng-sessiond/save.c
index 6135dae..23e1155 100644
--- a/src/bin/lttng-sessiond/save.c
+++ b/src/bin/lttng-sessiond/save.c
@@ -21,7 +21,7 @@
#include <string.h>
#include <urcu/uatomic.h>
#include <unistd.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <common/defaults.h>
#include <common/error.h>
diff --git a/src/bin/lttng-sessiond/session.c b/src/bin/lttng-sessiond/session.c
index 5c371d6..f1d5218 100644
--- a/src/bin/lttng-sessiond/session.c
+++ b/src/bin/lttng-sessiond/session.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <urcu.h>
#include <common/common.h>
diff --git a/src/bin/lttng-sessiond/shm.c b/src/bin/lttng-sessiond/shm.c
index d6cf3af..e9ed714 100644
--- a/src/bin/lttng-sessiond/shm.c
+++ b/src/bin/lttng-sessiond/shm.c
@@ -22,7 +22,7 @@
#include <fcntl.h>
#include <common/compat/limits.h>
#include <sys/mman.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index f00d292..e85ab76 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <urcu/compiler.h>
diff --git a/src/bin/lttng-sessiond/ust-consumer.c b/src/bin/lttng-sessiond/ust-consumer.c
index 9e9d63f..10903f1 100644
--- a/src/bin/lttng-sessiond/ust-consumer.c
+++ b/src/bin/lttng-sessiond/ust-consumer.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <unistd.h>
#include <inttypes.h>
diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c
index e50ed84..704e8c1 100644
--- a/src/bin/lttng/commands/add_context.c
+++ b/src/bin/lttng/commands/add_context.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/src/bin/lttng/commands/calibrate.c b/src/bin/lttng/commands/calibrate.c
index 567f4a5..5c9a43a 100644
--- a/src/bin/lttng/commands/calibrate.c
+++ b/src/bin/lttng/commands/calibrate.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <inttypes.h>
diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c
index 4f97c86..330eb26 100644
--- a/src/bin/lttng/commands/create.c
+++ b/src/bin/lttng/commands/create.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
diff --git a/src/bin/lttng/commands/destroy.c b/src/bin/lttng/commands/destroy.c
index 50d5bb4..ac998a7 100644
--- a/src/bin/lttng/commands/destroy.c
+++ b/src/bin/lttng/commands/destroy.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/src/bin/lttng/commands/disable_channels.c b/src/bin/lttng/commands/disable_channels.c
index 27f1db5..4f9f032 100644
--- a/src/bin/lttng/commands/disable_channels.c
+++ b/src/bin/lttng/commands/disable_channels.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <assert.h>
diff --git a/src/bin/lttng/commands/disable_events.c b/src/bin/lttng/commands/disable_events.c
index 1ce687a..74d116a 100644
--- a/src/bin/lttng/commands/disable_events.c
+++ b/src/bin/lttng/commands/disable_events.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <assert.h>
diff --git a/src/bin/lttng/commands/enable_channels.c b/src/bin/lttng/commands/enable_channels.c
index a58ebe0..4489bd9 100644
--- a/src/bin/lttng/commands/enable_channels.c
+++ b/src/bin/lttng/commands/enable_channels.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <inttypes.h>
diff --git a/src/bin/lttng/commands/enable_events.c b/src/bin/lttng/commands/enable_events.c
index 8b1215b..50948fc 100644
--- a/src/bin/lttng/commands/enable_events.c
+++ b/src/bin/lttng/commands/enable_events.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <inttypes.h>
diff --git a/src/bin/lttng/commands/set_session.c b/src/bin/lttng/commands/set_session.c
index fd3d9a1..2fbe398 100644
--- a/src/bin/lttng/commands/set_session.c
+++ b/src/bin/lttng/commands/set_session.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <assert.h>
diff --git a/src/bin/lttng/commands/snapshot.c b/src/bin/lttng/commands/snapshot.c
index f3ef3af..5d38356 100644
--- a/src/bin/lttng/commands/snapshot.c
+++ b/src/bin/lttng/commands/snapshot.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <assert.h>
diff --git a/src/bin/lttng/commands/start.c b/src/bin/lttng/commands/start.c
index 5ca92d8..444ce9a 100644
--- a/src/bin/lttng/commands/start.c
+++ b/src/bin/lttng/commands/start.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/src/bin/lttng/commands/stop.c b/src/bin/lttng/commands/stop.c
index a72f313..949433c 100644
--- a/src/bin/lttng/commands/stop.c
+++ b/src/bin/lttng/commands/stop.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <assert.h>
diff --git a/src/bin/lttng/commands/version.c b/src/bin/lttng/commands/version.c
index f4d8963..d79317c 100644
--- a/src/bin/lttng/commands/version.c
+++ b/src/bin/lttng/commands/version.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <config.h>
diff --git a/src/bin/lttng/commands/view.c b/src/bin/lttng/commands/view.c
index 6b0f454..a797dc8 100644
--- a/src/bin/lttng/commands/view.c
+++ b/src/bin/lttng/commands/view.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/src/bin/lttng/conf.c b/src/bin/lttng/conf.c
index 5982215..1e052c5 100644
--- a/src/bin/lttng/conf.c
+++ b/src/bin/lttng/conf.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/src/common/compat/compat-epoll.c b/src/common/compat/compat-epoll.c
index 50b85d2..aad9455 100644
--- a/src/common/compat/compat-epoll.c
+++ b/src/common/compat/compat-epoll.c
@@ -21,7 +21,7 @@
#include <common/compat/limits.h>
#include <stdlib.h>
#include <sys/types.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <unistd.h>
#include <config.h>
diff --git a/src/common/compat/stat.h b/src/common/compat/stat.h
new file mode 100644
index 0000000..67da0a6
--- /dev/null
+++ b/src/common/compat/stat.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2014 - Charles Briere <c.briere at samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _COMPAT_SYS_STAT_H
+#define _COMPAT_SYS_STAT_H
+
+#include <config.h>
+
+# if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+# elif HAVE_LINUX_STAT_H
+# include <linux/stat.h>
+# endif /* HAVE_SYS_STAT_H */
+
+#endif /* _COMPAT_SYS_STAT_H */
diff --git a/src/common/config/config.c b/src/common/config/config.c
index e44710b..1b9a457 100644
--- a/src/common/config/config.c
+++ b/src/common/config/config.c
@@ -25,7 +25,7 @@
#include <dirent.h>
#include <unistd.h>
#include <sys/types.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <common/defaults.h>
#include <common/error.h>
diff --git a/src/common/index/index.c b/src/common/index/index.c
index a462a63..f74e245 100644
--- a/src/common/index/index.c
+++ b/src/common/index/index.c
@@ -18,7 +18,7 @@
#define _GNU_SOURCE
#include <assert.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <fcntl.h>
diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c
index cbd1b5a..d898d66 100644
--- a/src/common/kernel-consumer/kernel-consumer.c
+++ b/src/common/kernel-consumer/kernel-consumer.c
@@ -27,7 +27,7 @@
#include <sys/types.h>
#include <inttypes.h>
#include <unistd.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <bin/lttng-consumerd/health-consumerd.h>
#include <common/common.h>
diff --git a/src/common/relayd/relayd.c b/src/common/relayd/relayd.c
index 38ebdbd..b1a8df8 100644
--- a/src/common/relayd/relayd.c
+++ b/src/common/relayd/relayd.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <inttypes.h>
#include <common/common.h>
diff --git a/src/common/runas.c b/src/common/runas.c
index 5b4c2ec..40304b6 100644
--- a/src/common/runas.c
+++ b/src/common/runas.c
@@ -24,7 +24,7 @@
#include <string.h>
#include <sys/wait.h>
#include <sys/types.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sched.h>
diff --git a/src/common/sessiond-comm/inet.c b/src/common/sessiond-comm/inet.c
index fb2f097..4c94575 100644
--- a/src/common/sessiond-comm/inet.c
+++ b/src/common/sessiond-comm/inet.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
diff --git a/src/common/sessiond-comm/inet6.c b/src/common/sessiond-comm/inet6.c
index c0c307f..566d365 100644
--- a/src/common/sessiond-comm/inet6.c
+++ b/src/common/sessiond-comm/inet6.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
diff --git a/src/common/sessiond-comm/sessiond-comm.c b/src/common/sessiond-comm/sessiond-comm.c
index 2a04a85..abe4493 100644
--- a/src/common/sessiond-comm/sessiond-comm.c
+++ b/src/common/sessiond-comm/sessiond-comm.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
diff --git a/src/common/sessiond-comm/unix.c b/src/common/sessiond-comm/unix.c
index 0dd7f27..6a54f60 100644
--- a/src/common/sessiond-comm/unix.c
+++ b/src/common/sessiond-comm/unix.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c
index d5ff6c7..9e1b633 100644
--- a/src/common/ust-consumer/ust-consumer.c
+++ b/src/common/ust-consumer/ust-consumer.c
@@ -25,7 +25,7 @@
#include <string.h>
#include <sys/mman.h>
#include <sys/socket.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <inttypes.h>
#include <unistd.h>
diff --git a/src/common/utils.c b/src/common/utils.c
index 9a05ea2..eae59cb 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -24,7 +24,7 @@
#include <common/compat/limits.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <inttypes.h>
diff --git a/tests/regression/tools/filtering/gen-ust-events.c b/tests/regression/tools/filtering/gen-ust-events.c
index c789c89..6108ee2 100644
--- a/tests/regression/tools/filtering/gen-ust-events.c
+++ b/tests/regression/tools/filtering/gen-ust-events.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/tests/regression/tools/live/live_test.c b/tests/regression/tools/live/live_test.c
index d2c9050..02d6144 100644
--- a/tests/regression/tools/live/live_test.c
+++ b/tests/regression/tools/live/live_test.c
@@ -31,7 +31,7 @@
#include <netdb.h>
#include <fcntl.h>
#include <sys/mman.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <tap/tap.h>
#include <lttng/lttng.h>
diff --git a/tests/regression/tools/mi/validate_xml.c b/tests/regression/tools/mi/validate_xml.c
index e3c6350..9e1a62d 100644
--- a/tests/regression/tools/mi/validate_xml.c
+++ b/tests/regression/tools/mi/validate_xml.c
@@ -32,7 +32,7 @@
#include <dirent.h>
#include <unistd.h>
#include <sys/types.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <libxml/xmlschemas.h>
#include <libxml/parser.h>
diff --git a/tests/regression/ust/high-throughput/main.c b/tests/regression/ust/high-throughput/main.c
index 27f95de..5a6989b 100644
--- a/tests/regression/ust/high-throughput/main.c
+++ b/tests/regression/ust/high-throughput/main.c
@@ -22,7 +22,7 @@
#include <sys/mman.h>
#include <stdarg.h>
#include <sys/types.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <fcntl.h>
#include <common/compat/signal.h>
#include <string.h>
diff --git a/tests/regression/ust/linking/demo.c b/tests/regression/ust/linking/demo.c
index 2917f26..b167ee1 100644
--- a/tests/regression/ust/linking/demo.c
+++ b/tests/regression/ust/linking/demo.c
@@ -22,7 +22,7 @@
#include <sys/mman.h>
#include <stdarg.h>
#include <sys/types.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <fcntl.h>
#include <common/compat/signal.h>
#include <string.h>
diff --git a/tests/regression/ust/multi-session/gen-nevents.c b/tests/regression/ust/multi-session/gen-nevents.c
index c96fdb5..05cffac 100644
--- a/tests/regression/ust/multi-session/gen-nevents.c
+++ b/tests/regression/ust/multi-session/gen-nevents.c
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/tests/regression/ust/overlap/demo/demo.c b/tests/regression/ust/overlap/demo/demo.c
index f2a8042..661facf 100644
--- a/tests/regression/ust/overlap/demo/demo.c
+++ b/tests/regression/ust/overlap/demo/demo.c
@@ -22,7 +22,7 @@
#include <sys/mman.h>
#include <stdarg.h>
#include <sys/types.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <fcntl.h>
#include <common/compat/signal.h>
#include <string.h>
diff --git a/tests/unit/test_utils_expand_path.c b/tests/unit/test_utils_expand_path.c
index 15e56a1..58961d3 100644
--- a/tests/unit/test_utils_expand_path.c
+++ b/tests/unit/test_utils_expand_path.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <common/compat/limits.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <tap/tap.h>
diff --git a/tests/utils/testapp/gen-ust-events/gen-ust-events.c b/tests/utils/testapp/gen-ust-events/gen-ust-events.c
index 77d88db..759e25e 100644
--- a/tests/utils/testapp/gen-ust-events/gen-ust-events.c
+++ b/tests/utils/testapp/gen-ust-events/gen-ust-events.c
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/tests/utils/testapp/gen-ust-nevents/gen-ust-nevents.c b/tests/utils/testapp/gen-ust-nevents/gen-ust-nevents.c
index c7a5e5f..ef24127 100644
--- a/tests/utils/testapp/gen-ust-nevents/gen-ust-nevents.c
+++ b/tests/utils/testapp/gen-ust-nevents/gen-ust-nevents.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/tests/utils/testapp/gen-ust-tracef/gen-ust-tracef.c b/tests/utils/testapp/gen-ust-tracef/gen-ust-tracef.c
index 1c3493d..cb87e6c 100644
--- a/tests/utils/testapp/gen-ust-tracef/gen-ust-tracef.c
+++ b/tests/utils/testapp/gen-ust-tracef/gen-ust-tracef.c
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
-#include <sys/stat.h>
+#include <common/compat/stat.h>
#include <sys/types.h>
#include <unistd.h>
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 09/24] Add : Compatibility layer for syscall.h
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (12 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 11/24] Add : Compatibility layer for limit.h Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 16/24] Add : Compatibility layer for pwd.h Charles Briere
` (10 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 6 ++++--
src/common/compat/syscall.h | 36 ++++++++++++++++++++++++++++++++++++
src/common/compat/tid.h | 1 +
src/common/futex.c | 2 +-
4 files changed, 42 insertions(+), 3 deletions(-)
create mode 100644 src/common/compat/syscall.h
diff --git a/configure.ac b/configure.ac
index 3460f98..1189d8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,8 +57,10 @@ AM_CONDITIONAL([NO_SHARED], [test x$enable_shared = xno])
AC_CHECK_HEADERS([ \
sys/types.h unistd.h fcntl.h string.h pthread.h limits.h \
signal.h stdlib.h sys/un.h sys/socket.h stdlib.h stdio.h \
- getopt.h sys/ipc.h sys/shm.h popt.h grp.h \
-])
+ getopt.h sys/ipc.h sys/shm.h popt.h grp.h syscall.h \
+ ],[],
+ [AC_CHECK_HEADERS([sys/syscall.h])]
+)
# Babeltrace viewer check
AC_ARG_WITH([babeltrace-bin],
diff --git a/src/common/compat/syscall.h b/src/common/compat/syscall.h
new file mode 100644
index 0000000..62dabf6
--- /dev/null
+++ b/src/common/compat/syscall.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2014 (c) - Charles Briere <c.briere at samsung.com>
+ *
+ * syscall compatibility layer.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef LTTNG_SYSCALL_H
+#define LTTNG_SYSCALL_H
+
+#include <config.h>
+
+# if defined(HAVE_SYSCALL_H)
+# include <syscall.h>
+# elif defined(HAVE_SYS_SYSCALL_H)
+# include <sys/syscall.h>
+# endif
+
+#endif
diff --git a/src/common/compat/tid.h b/src/common/compat/tid.h
index 7645b90..5142ae8 100644
--- a/src/common/compat/tid.h
+++ b/src/common/compat/tid.h
@@ -26,6 +26,7 @@
#define LTTNG_TID_H
#include <config.h>
+#include <common/compat/syscall.h>
#if !HAVE_DECL_GETTID
# if defined(_syscall0)
diff --git a/src/common/futex.c b/src/common/futex.c
index 0b27a5b..b373ed5 100644
--- a/src/common/futex.c
+++ b/src/common/futex.c
@@ -18,7 +18,7 @@
#define _GNU_SOURCE
#include <limits.h>
-#include <sys/syscall.h>
+#include <common/compat/syscall.h>
#include <unistd.h>
#include <urcu.h>
#include <urcu/futex.h>
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 16/24] Add : Compatibility layer for pwd.h
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (13 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 09/24] Add : Compatibility layer for syscall.h Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 17/24] Add : Compatibility layer for pthread Charles Briere
` (9 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
getpwuid_r() is not implemented in BIONIC ( Android's ) libc
As it is only used to get home directtory, only implemented
that part.
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 1 +
src/common/compat/Makefile.am | 2 +-
src/common/compat/compat-pwd.c | 28 ++++++++++++++++++++++++++++
src/common/compat/pwd.h | 38 ++++++++++++++++++++++++++++++++++++++
4 files changed, 68 insertions(+), 1 deletion(-)
create mode 100644 src/common/compat/compat-pwd.c
create mode 100644 src/common/compat/pwd.h
diff --git a/configure.ac b/configure.ac
index 333d172..f372b07 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,7 @@ AC_CHECK_HEADERS([ \
AC_CHECK_TYPES([in_port_t], [], [], [[#include <netinet/in.h>]])
AC_CHECK_DECLS([sigwaitinfo],[],[], [[#include <signal.h>]])
+AC_CHECK_FUNCS([getpwuid_r],[],[])
# Babeltrace viewer check
AC_ARG_WITH([babeltrace-bin],
diff --git a/src/common/compat/Makefile.am b/src/common/compat/Makefile.am
index 5fb04a8..2ebe84f 100644
--- a/src/common/compat/Makefile.am
+++ b/src/common/compat/Makefile.am
@@ -10,4 +10,4 @@ endif
libcompat_la_SOURCES = poll.h fcntl.h endian.h mman.h clone.h \
socket.h compat-fcntl.c uuid.h tid.h netinet/in.h \
- limits.h compat-signal.c $(COMPAT)
+ limits.h compat-signal.c compat-pwd.c $(COMPAT)
diff --git a/src/common/compat/compat-pwd.c b/src/common/compat/compat-pwd.c
new file mode 100644
index 0000000..52fc1fc
--- /dev/null
+++ b/src/common/compat/compat-pwd.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2014 - Charles Briere <c.briere at samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <common/compat/pwd.h>
+
+#ifndef HAVE_GETPWUID_R
+
+int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result)
+{
+ strcpy(pwd->pw_dir, "/sdcard");
+ return 0;
+}
+
+#endif
diff --git a/src/common/compat/pwd.h b/src/common/compat/pwd.h
new file mode 100644
index 0000000..6debf92
--- /dev/null
+++ b/src/common/compat/pwd.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2014 (c) - Charles Briere <c.briere at samsung.com>
+ *
+ * pwd compatibility layer.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <pwd.h>
+
+#ifndef LTTNG_PWD_H
+#define LTTNG_PWD_H
+
+# ifndef HAVE_GETPWUID_R
+
+#include <string.h>
+
+int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result);
+
+# endif
+#endif
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 11/24] Add : Compatibility layer for limit.h
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (11 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 10/24] Add : Compatibility layer for netinet/in.h Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 09/24] Add : Compatibility layer for syscall.h Charles Briere
` (11 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Define the following values if not already defined :
* HOST_NAME_MAX to 64
* NAME_MAX to 255
* PATH_MAX to 4096
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
include/lttng/constant.h | 2 +-
include/lttng/load-internal.h | 2 +-
include/lttng/save-internal.h | 2 +-
include/lttng/snapshot-internal.h | 2 +-
include/lttng/snapshot.h | 2 +-
src/bin/lttng-consumerd/health-consumerd.c | 2 +-
src/bin/lttng-consumerd/lttng-consumerd.c | 2 +-
src/bin/lttng-relayd/connection.h | 2 +-
src/bin/lttng-relayd/health-relayd.c | 2 +-
src/bin/lttng-relayd/health-relayd.h | 2 +-
src/bin/lttng-relayd/live.c | 2 +-
src/bin/lttng-relayd/lttng-relayd.h | 2 +-
src/bin/lttng-relayd/lttng-viewer-abi.h | 2 +-
src/bin/lttng-relayd/main.c | 2 +-
src/bin/lttng-relayd/session.h | 2 +-
src/bin/lttng-relayd/stream.h | 2 +-
src/bin/lttng-relayd/viewer-stream.h | 2 +-
src/bin/lttng-sessiond/lttng-ust-error.h | 2 +-
src/bin/lttng-sessiond/main.c | 2 +-
src/bin/lttng-sessiond/session.c | 2 +-
src/bin/lttng-sessiond/session.h | 2 +-
src/bin/lttng-sessiond/shm.c | 2 +-
src/bin/lttng-sessiond/snapshot.h | 2 +-
src/bin/lttng-sessiond/trace-ust.h | 2 +-
src/bin/lttng-sessiond/ust-metadata.c | 2 +-
src/bin/lttng/commands/view.c | 1 +
src/bin/lttng/conf.c | 2 +-
src/bin/lttng/utils.c | 2 +-
src/common/align.h | 2 +-
src/common/compat/Makefile.am | 2 +-
src/common/compat/compat-epoll.c | 2 +-
src/common/compat/limits.h | 36 ++++++++++++++++++++++++++++++
src/common/consumer.h | 2 +-
src/common/futex.c | 2 +-
src/common/index/ctf-index.h | 2 +-
src/common/readwrite.c | 2 +-
src/common/runas.c | 2 +-
src/common/sessiond-comm/inet.c | 2 +-
src/common/sessiond-comm/inet.h | 2 +-
src/common/sessiond-comm/inet6.c | 2 +-
src/common/sessiond-comm/inet6.h | 2 +-
src/common/sessiond-comm/relayd.h | 2 +-
src/common/sessiond-comm/sessiond-comm.c | 2 +-
src/common/sessiond-comm/sessiond-comm.h | 2 +-
src/common/sessiond-comm/unix.c | 2 +-
src/common/sessiond-comm/unix.h | 2 +-
src/common/utils.c | 2 +-
src/lib/lttng-ctl/lttng-ctl-health.c | 2 +-
tests/unit/test_utils_expand_path.c | 2 +-
49 files changed, 84 insertions(+), 47 deletions(-)
create mode 100644 src/common/compat/limits.h
diff --git a/include/lttng/constant.h b/include/lttng/constant.h
index ed3ebe0..1d6479b 100644
--- a/include/lttng/constant.h
+++ b/include/lttng/constant.h
@@ -28,7 +28,7 @@
#endif /* defined __GNUC__ */
#endif /* LTTNG_DEPRECATED */
-#include <limits.h>
+#include <common/compat/limits.h>
/*
* Necessary to include the fixed width type limits on glibc versions older
* than 2.18 when building with a C++ compiler.
diff --git a/include/lttng/load-internal.h b/include/lttng/load-internal.h
index 85f0afa..84c1ab0 100644
--- a/include/lttng/load-internal.h
+++ b/include/lttng/load-internal.h
@@ -19,7 +19,7 @@
#ifndef LTTNG_LOAD_INTERNAL_ABI_H
#define LTTNG_LOAD_INTERNAL_ABI_H
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdint.h>
#include <common/macros.h>
diff --git a/include/lttng/save-internal.h b/include/lttng/save-internal.h
index f4a56f8..3e22923 100644
--- a/include/lttng/save-internal.h
+++ b/include/lttng/save-internal.h
@@ -18,7 +18,7 @@
#ifndef LTTNG_SAVE_INTERNAL_ABI_H
#define LTTNG_SAVE_INTERNAL_ABI_H
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdint.h>
#include <common/macros.h>
diff --git a/include/lttng/snapshot-internal.h b/include/lttng/snapshot-internal.h
index a14564b..0bcac69 100644
--- a/include/lttng/snapshot-internal.h
+++ b/include/lttng/snapshot-internal.h
@@ -18,7 +18,7 @@
#ifndef LTTNG_SNAPSHOT_INTERNAL_ABI_H
#define LTTNG_SNAPSHOT_INTERNAL_ABI_H
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdint.h>
/*
diff --git a/include/lttng/snapshot.h b/include/lttng/snapshot.h
index 90c712a..8b2749f 100644
--- a/include/lttng/snapshot.h
+++ b/include/lttng/snapshot.h
@@ -18,7 +18,7 @@
#ifndef LTTNG_SNAPSHOT_H
#define LTTNG_SNAPSHOT_H
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdint.h>
#include <sys/types.h>
diff --git a/src/bin/lttng-consumerd/health-consumerd.c b/src/bin/lttng-consumerd/health-consumerd.c
index d1478e5..079a14b 100644
--- a/src/bin/lttng-consumerd/health-consumerd.c
+++ b/src/bin/lttng-consumerd/health-consumerd.c
@@ -19,7 +19,7 @@
#include <fcntl.h>
#include <getopt.h>
#include <grp.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c
index 5d57030..bdd8ddc 100644
--- a/src/bin/lttng-consumerd/lttng-consumerd.c
+++ b/src/bin/lttng-consumerd/lttng-consumerd.c
@@ -20,7 +20,7 @@
#include <fcntl.h>
#include <getopt.h>
#include <grp.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
diff --git a/src/bin/lttng-relayd/connection.h b/src/bin/lttng-relayd/connection.h
index 70fe4ba..9678187 100644
--- a/src/bin/lttng-relayd/connection.h
+++ b/src/bin/lttng-relayd/connection.h
@@ -19,7 +19,7 @@
#ifndef _CONNECTION_H
#define _CONNECTION_H
-#include <limits.h>
+#include <common/compat/limits.h>
#include <inttypes.h>
#include <pthread.h>
#include <urcu.h>
diff --git a/src/bin/lttng-relayd/health-relayd.c b/src/bin/lttng-relayd/health-relayd.c
index 8a5cbdf..3a5cc90 100644
--- a/src/bin/lttng-relayd/health-relayd.c
+++ b/src/bin/lttng-relayd/health-relayd.c
@@ -19,7 +19,7 @@
#include <fcntl.h>
#include <getopt.h>
#include <grp.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
diff --git a/src/bin/lttng-relayd/health-relayd.h b/src/bin/lttng-relayd/health-relayd.h
index 7c7b6e7..911b04a 100644
--- a/src/bin/lttng-relayd/health-relayd.h
+++ b/src/bin/lttng-relayd/health-relayd.h
@@ -19,7 +19,7 @@
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include <limits.h>
+#include <common/compat/limits.h>
#include <lttng/health-internal.h>
#define LTTNG_RELAYD_HEALTH_ENV "LTTNG_RELAYD_HEALTH"
diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c
index 5684608..43fc0fb 100644
--- a/src/bin/lttng-relayd/live.c
+++ b/src/bin/lttng-relayd/live.c
@@ -19,7 +19,7 @@
#define _GNU_SOURCE
#include <getopt.h>
#include <grp.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
diff --git a/src/bin/lttng-relayd/lttng-relayd.h b/src/bin/lttng-relayd/lttng-relayd.h
index 896925f..65ab13a 100644
--- a/src/bin/lttng-relayd/lttng-relayd.h
+++ b/src/bin/lttng-relayd/lttng-relayd.h
@@ -20,7 +20,7 @@
#define LTTNG_RELAYD_H
#define _LGPL_SOURCE
-#include <limits.h>
+#include <common/compat/limits.h>
#include <urcu.h>
#include <urcu/wfcqueue.h>
diff --git a/src/bin/lttng-relayd/lttng-viewer-abi.h b/src/bin/lttng-relayd/lttng-viewer-abi.h
index f9bce98..0bd163a 100644
--- a/src/bin/lttng-relayd/lttng-viewer-abi.h
+++ b/src/bin/lttng-relayd/lttng-viewer-abi.h
@@ -25,7 +25,7 @@
* SOFTWARE.
*/
-#include <limits.h>
+#include <common/compat/limits.h>
#define LTTNG_VIEWER_PATH_MAX 4096
#define LTTNG_VIEWER_NAME_MAX 255
diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c
index 802d7e1..747e023 100644
--- a/src/bin/lttng-relayd/main.c
+++ b/src/bin/lttng-relayd/main.c
@@ -20,7 +20,7 @@
#define _GNU_SOURCE
#include <getopt.h>
#include <grp.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
diff --git a/src/bin/lttng-relayd/session.h b/src/bin/lttng-relayd/session.h
index cb125be..df46eff 100644
--- a/src/bin/lttng-relayd/session.h
+++ b/src/bin/lttng-relayd/session.h
@@ -19,7 +19,7 @@
#ifndef _SESSION_H
#define _SESSION_H
-#include <limits.h>
+#include <common/compat/limits.h>
#include <inttypes.h>
#include <pthread.h>
#include <urcu/list.h>
diff --git a/src/bin/lttng-relayd/stream.h b/src/bin/lttng-relayd/stream.h
index 4dd2e62..2403491 100644
--- a/src/bin/lttng-relayd/stream.h
+++ b/src/bin/lttng-relayd/stream.h
@@ -19,7 +19,7 @@
#ifndef _STREAM_H
#define _STREAM_H
-#include <limits.h>
+#include <common/compat/limits.h>
#include <inttypes.h>
#include <pthread.h>
#include <urcu/list.h>
diff --git a/src/bin/lttng-relayd/viewer-stream.h b/src/bin/lttng-relayd/viewer-stream.h
index 003b119..a9f24b7 100644
--- a/src/bin/lttng-relayd/viewer-stream.h
+++ b/src/bin/lttng-relayd/viewer-stream.h
@@ -19,7 +19,7 @@
#ifndef _VIEWER_STREAM_H
#define _VIEWER_STREAM_H
-#include <limits.h>
+#include <common/compat/limits.h>
#include <inttypes.h>
#include <pthread.h>
diff --git a/src/bin/lttng-sessiond/lttng-ust-error.h b/src/bin/lttng-sessiond/lttng-ust-error.h
index d9062c0..9b8b811 100644
--- a/src/bin/lttng-sessiond/lttng-ust-error.h
+++ b/src/bin/lttng-sessiond/lttng-ust-error.h
@@ -26,7 +26,7 @@
* These declarations should NOT be considered stable API.
*/
-#include <limits.h>
+#include <common/compat/limits.h>
#include <unistd.h>
#include "lttng-ust-abi.h"
diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
index fa09758..7d6d87f 100644
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
@@ -20,7 +20,7 @@
#define _GNU_SOURCE
#include <getopt.h>
#include <grp.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <paths.h>
#include <pthread.h>
#include <signal.h>
diff --git a/src/bin/lttng-sessiond/session.c b/src/bin/lttng-sessiond/session.c
index cd59cb7..5c371d6 100644
--- a/src/bin/lttng-sessiond/session.c
+++ b/src/bin/lttng-sessiond/session.c
@@ -16,7 +16,7 @@
*/
#define _GNU_SOURCE
-#include <limits.h>
+#include <common/compat/limits.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/bin/lttng-sessiond/session.h b/src/bin/lttng-sessiond/session.h
index 368b352..63ade8d 100644
--- a/src/bin/lttng-sessiond/session.h
+++ b/src/bin/lttng-sessiond/session.h
@@ -18,9 +18,9 @@
#ifndef _LTT_SESSION_H
#define _LTT_SESSION_H
-#include <limits.h>
#include <urcu/list.h>
+#include <common/compat/limits.h>
#include <common/hashtable/hashtable.h>
#include "snapshot.h"
diff --git a/src/bin/lttng-sessiond/shm.c b/src/bin/lttng-sessiond/shm.c
index fa3867c..d6cf3af 100644
--- a/src/bin/lttng-sessiond/shm.c
+++ b/src/bin/lttng-sessiond/shm.c
@@ -20,7 +20,7 @@
#define _GNU_SOURCE
#include <fcntl.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
diff --git a/src/bin/lttng-sessiond/snapshot.h b/src/bin/lttng-sessiond/snapshot.h
index bdf0570..116371f 100644
--- a/src/bin/lttng-sessiond/snapshot.h
+++ b/src/bin/lttng-sessiond/snapshot.h
@@ -18,7 +18,7 @@
#ifndef SNAPSHOT_H
#define SNAPSHOT_H
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdint.h>
#include <common/common.h>
diff --git a/src/bin/lttng-sessiond/trace-ust.h b/src/bin/lttng-sessiond/trace-ust.h
index 795389e..d4475b9 100644
--- a/src/bin/lttng-sessiond/trace-ust.h
+++ b/src/bin/lttng-sessiond/trace-ust.h
@@ -19,7 +19,7 @@
#define _LTT_TRACE_UST_H
#include <config.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <urcu/list.h>
#include <lttng/lttng.h>
diff --git a/src/bin/lttng-sessiond/ust-metadata.c b/src/bin/lttng-sessiond/ust-metadata.c
index f430ae1..f70c4b2 100644
--- a/src/bin/lttng-sessiond/ust-metadata.c
+++ b/src/bin/lttng-sessiond/ust-metadata.c
@@ -24,7 +24,7 @@
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <unistd.h>
#include <inttypes.h>
#include <common/common.h>
diff --git a/src/bin/lttng/commands/view.c b/src/bin/lttng/commands/view.c
index dcd4d66..6b0f454 100644
--- a/src/bin/lttng/commands/view.c
+++ b/src/bin/lttng/commands/view.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include "../command.h"
+#include <common/compat/limits.h>
#include <config.h>
static char *opt_session_name;
diff --git a/src/bin/lttng/conf.c b/src/bin/lttng/conf.c
index 55ed635..5982215 100644
--- a/src/bin/lttng/conf.c
+++ b/src/bin/lttng/conf.c
@@ -16,7 +16,7 @@
*/
#define _GNU_SOURCE
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/bin/lttng/utils.c b/src/bin/lttng/utils.c
index fc592eb..78fc830 100644
--- a/src/bin/lttng/utils.c
+++ b/src/bin/lttng/utils.c
@@ -19,7 +19,7 @@
#include <assert.h>
#include <stdlib.h>
#include <ctype.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <signal.h>
diff --git a/src/common/align.h b/src/common/align.h
index fe32673..117aa10 100644
--- a/src/common/align.h
+++ b/src/common/align.h
@@ -19,7 +19,7 @@
#include "bug.h"
#include <unistd.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#ifndef PAGE_SIZE /* Cygwin limits.h defines its own PAGE_SIZE */
#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
diff --git a/src/common/compat/Makefile.am b/src/common/compat/Makefile.am
index 40495ed..caa076c 100644
--- a/src/common/compat/Makefile.am
+++ b/src/common/compat/Makefile.am
@@ -10,4 +10,4 @@ endif
libcompat_la_SOURCES = poll.h fcntl.h endian.h mman.h clone.h \
socket.h compat-fcntl.c uuid.h tid.h netinet/in.h \
- $(COMPAT)
+ limits.h $(COMPAT)
diff --git a/src/common/compat/compat-epoll.c b/src/common/compat/compat-epoll.c
index 368fae1..50b85d2 100644
--- a/src/common/compat/compat-epoll.c
+++ b/src/common/compat/compat-epoll.c
@@ -18,7 +18,7 @@
#define _GNU_SOURCE
#include <assert.h>
#include <fcntl.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/src/common/compat/limits.h b/src/common/compat/limits.h
new file mode 100644
index 0000000..6782949
--- /dev/null
+++ b/src/common/compat/limits.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 - Charles Briere <charlesbriere.flatzo at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _COMPAT_LIMITS_H
+#define _COMPAT_LIMITS_H
+
+#include <limits.h>
+#include <config.h>
+
+#ifndef HOST_NAME_MAX
+# define HOST_NAME_MAX 64
+#endif
+
+#ifndef NAME_MAX
+# define NAME_MAX 255
+#endif
+
+#ifndef PATH_MAX
+# define PATH_MAX 4096
+#endif
+
+#endif /* _COMPAT_LIMITS_H */
diff --git a/src/common/consumer.h b/src/common/consumer.h
index 4ac823c..2be4d71 100644
--- a/src/common/consumer.h
+++ b/src/common/consumer.h
@@ -20,7 +20,7 @@
#ifndef LIB_CONSUMER_H
#define LIB_CONSUMER_H
-#include <limits.h>
+#include <common/compat/limits.h>
#include <poll.h>
#include <unistd.h>
#include <urcu/list.h>
diff --git a/src/common/futex.c b/src/common/futex.c
index b373ed5..e70eb19 100644
--- a/src/common/futex.c
+++ b/src/common/futex.c
@@ -17,7 +17,7 @@
*/
#define _GNU_SOURCE
-#include <limits.h>
+#include <common/compat/limits.h>
#include <common/compat/syscall.h>
#include <unistd.h>
#include <urcu.h>
diff --git a/src/common/index/ctf-index.h b/src/common/index/ctf-index.h
index 0efa888..574f6ef 100644
--- a/src/common/index/ctf-index.h
+++ b/src/common/index/ctf-index.h
@@ -25,7 +25,7 @@
#ifndef LTTNG_INDEX_H
#define LTTNG_INDEX_H
-#include <limits.h>
+#include <common/compat/limits.h>
#define CTF_INDEX_MAGIC 0xC1F1DCC1
#define CTF_INDEX_MAJOR 1
diff --git a/src/common/readwrite.c b/src/common/readwrite.c
index d33e051..2b17868 100644
--- a/src/common/readwrite.c
+++ b/src/common/readwrite.c
@@ -17,7 +17,7 @@
#include <assert.h>
#include <errno.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <unistd.h>
#include "readwrite.h"
diff --git a/src/common/runas.c b/src/common/runas.c
index 5ab4271..c59d722 100644
--- a/src/common/runas.c
+++ b/src/common/runas.c
@@ -18,7 +18,7 @@
#define _GNU_SOURCE
#include <errno.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/common/sessiond-comm/inet.c b/src/common/sessiond-comm/inet.c
index 32a16a6..fb2f097 100644
--- a/src/common/sessiond-comm/inet.c
+++ b/src/common/sessiond-comm/inet.c
@@ -17,7 +17,7 @@
#define _GNU_SOURCE
#include <assert.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/common/sessiond-comm/inet.h b/src/common/sessiond-comm/inet.h
index 83209bb..7b20524 100644
--- a/src/common/sessiond-comm/inet.h
+++ b/src/common/sessiond-comm/inet.h
@@ -19,7 +19,7 @@
#define _LTTCOMM_INET_H
#define _GNU_SOURCE
-#include <limits.h>
+#include <common/compat/limits.h>
#include "sessiond-comm.h"
diff --git a/src/common/sessiond-comm/inet6.c b/src/common/sessiond-comm/inet6.c
index 5b137c4..c0c307f 100644
--- a/src/common/sessiond-comm/inet6.c
+++ b/src/common/sessiond-comm/inet6.c
@@ -17,7 +17,7 @@
#define _GNU_SOURCE
#include <assert.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/common/sessiond-comm/inet6.h b/src/common/sessiond-comm/inet6.h
index 4cb4dca..1d1c8f9 100644
--- a/src/common/sessiond-comm/inet6.h
+++ b/src/common/sessiond-comm/inet6.h
@@ -19,7 +19,7 @@
#define _LTTCOMM_INET6_H
#define _GNU_SOURCE
-#include <limits.h>
+#include <common/compat/limits.h>
#include "sessiond-comm.h"
diff --git a/src/common/sessiond-comm/relayd.h b/src/common/sessiond-comm/relayd.h
index ff56d3a..70f7c73 100644
--- a/src/common/sessiond-comm/relayd.h
+++ b/src/common/sessiond-comm/relayd.h
@@ -21,10 +21,10 @@
#define _GNU_SOURCE
-#include <limits.h>
#include <stdint.h>
#include <lttng/lttng.h>
+#include <common/compat/limits.h>
#include <common/defaults.h>
#include <common/index/ctf-index.h>
#include <config.h>
diff --git a/src/common/sessiond-comm/sessiond-comm.c b/src/common/sessiond-comm/sessiond-comm.c
index 65952b2..2a04a85 100644
--- a/src/common/sessiond-comm/sessiond-comm.c
+++ b/src/common/sessiond-comm/sessiond-comm.c
@@ -18,7 +18,7 @@
#define _GNU_SOURCE
#include <assert.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/common/sessiond-comm/sessiond-comm.h b/src/common/sessiond-comm/sessiond-comm.h
index 9842214..b830abf 100644
--- a/src/common/sessiond-comm/sessiond-comm.h
+++ b/src/common/sessiond-comm/sessiond-comm.h
@@ -26,7 +26,7 @@
#define _LTTNG_SESSIOND_COMM_H
#define _GNU_SOURCE
-#include <limits.h>
+#include <common/compat/limits.h>
#include <lttng/lttng.h>
#include <lttng/snapshot-internal.h>
#include <lttng/save-internal.h>
diff --git a/src/common/sessiond-comm/unix.c b/src/common/sessiond-comm/unix.c
index 2c87b82..0dd7f27 100644
--- a/src/common/sessiond-comm/unix.c
+++ b/src/common/sessiond-comm/unix.c
@@ -18,7 +18,7 @@
#define _GNU_SOURCE
#include <assert.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/common/sessiond-comm/unix.h b/src/common/sessiond-comm/unix.h
index 19b91ce..9b65586 100644
--- a/src/common/sessiond-comm/unix.h
+++ b/src/common/sessiond-comm/unix.h
@@ -19,7 +19,7 @@
#define _LTTCOMM_UNIX_H
#define _GNU_SOURCE
-#include <limits.h>
+#include <common/compat/limits.h>
#include <sys/un.h>
#include <common/compat/socket.h>
diff --git a/src/common/utils.c b/src/common/utils.c
index 1d07cb3..9a05ea2 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -21,7 +21,7 @@
#include <assert.h>
#include <ctype.h>
#include <fcntl.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
diff --git a/src/lib/lttng-ctl/lttng-ctl-health.c b/src/lib/lttng-ctl/lttng-ctl-health.c
index ba9aac0..68e8eb7 100644
--- a/src/lib/lttng-ctl/lttng-ctl-health.c
+++ b/src/lib/lttng-ctl/lttng-ctl-health.c
@@ -23,7 +23,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <stdint.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <errno.h>
#include <lttng/health-internal.h>
diff --git a/tests/unit/test_utils_expand_path.c b/tests/unit/test_utils_expand_path.c
index f863b5d..15e56a1 100644
--- a/tests/unit/test_utils_expand_path.c
+++ b/tests/unit/test_utils_expand_path.c
@@ -19,7 +19,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include <limits.h>
+#include <common/compat/limits.h>
#include <sys/stat.h>
#include <sys/types.h>
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 14/24] Add : Compatibility layer for signal.h
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (8 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 15/24] Add : Compatibility layer for stat.h Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 12/24] Add : Compatibility layer for ulimit.h Charles Briere
` (14 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Provide an implementation of sigwaitinfo() if nonexistant
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 2 ++
extras/core-handler/crash.c | 2 +-
src/bin/lttng-consumerd/health-consumerd.c | 2 +-
src/bin/lttng-consumerd/lttng-consumerd.c | 2 +-
src/bin/lttng-relayd/health-relayd.c | 2 +-
src/bin/lttng-relayd/live.c | 2 +-
src/bin/lttng-relayd/main.c | 2 +-
src/bin/lttng-sessiond/main.c | 2 +-
src/bin/lttng-sessiond/ust-app.c | 2 +-
src/bin/lttng/lttng.c | 2 +-
src/bin/lttng/utils.c | 2 +-
src/common/compat/Makefile.am | 2 +-
src/common/compat/compat-signal.c | 44 ++++++++++++++++++++++++
src/common/compat/signal.h | 37 ++++++++++++++++++++
src/common/consumer-timer.c | 4 +--
src/common/consumer.c | 2 +-
src/common/runas.c | 2 +-
src/common/ust-consumer/ust-consumer.c | 2 +-
tests/regression/ust/exit-fast/exit-fast.c | 2 +-
tests/regression/ust/high-throughput/main.c | 2 +-
tests/regression/ust/linking/demo.c | 2 +-
tests/regression/ust/multi-session/gen-nevents.c | 2 +-
tests/regression/ust/overlap/demo/demo.c | 2 +-
23 files changed, 104 insertions(+), 21 deletions(-)
create mode 100644 src/common/compat/compat-signal.c
create mode 100644 src/common/compat/signal.h
diff --git a/configure.ac b/configure.ac
index fc08cc6..333d172 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,8 @@ AC_CHECK_HEADERS([ \
AC_CHECK_TYPES([in_port_t], [], [], [[#include <netinet/in.h>]])
+AC_CHECK_DECLS([sigwaitinfo],[],[], [[#include <signal.h>]])
+
# Babeltrace viewer check
AC_ARG_WITH([babeltrace-bin],
AS_HELP_STRING([--with-babeltrace-bin],
diff --git a/extras/core-handler/crash.c b/extras/core-handler/crash.c
index 2b9cf4a..e0f7a8f 100644
--- a/extras/core-handler/crash.c
+++ b/extras/core-handler/crash.c
@@ -16,7 +16,7 @@
*/
-#include <signal.h>
+#include <common/compat/signal.h>
int main(int argc, char *argv[])
{
diff --git a/src/bin/lttng-consumerd/health-consumerd.c b/src/bin/lttng-consumerd/health-consumerd.c
index 3af18e7..e826d51 100644
--- a/src/bin/lttng-consumerd/health-consumerd.c
+++ b/src/bin/lttng-consumerd/health-consumerd.c
@@ -21,7 +21,7 @@
#include <grp.h>
#include <common/compat/limits.h>
#include <pthread.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c
index f1bd287..b57d6df 100644
--- a/src/bin/lttng-consumerd/lttng-consumerd.c
+++ b/src/bin/lttng-consumerd/lttng-consumerd.c
@@ -22,7 +22,7 @@
#include <grp.h>
#include <common/compat/limits.h>
#include <pthread.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/bin/lttng-relayd/health-relayd.c b/src/bin/lttng-relayd/health-relayd.c
index 312edd5..535f151 100644
--- a/src/bin/lttng-relayd/health-relayd.c
+++ b/src/bin/lttng-relayd/health-relayd.c
@@ -21,7 +21,7 @@
#include <grp.h>
#include <common/compat/limits.h>
#include <pthread.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c
index 43fc0fb..e1f6486 100644
--- a/src/bin/lttng-relayd/live.c
+++ b/src/bin/lttng-relayd/live.c
@@ -21,7 +21,7 @@
#include <grp.h>
#include <common/compat/limits.h>
#include <pthread.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c
index 747e023..6520056 100644
--- a/src/bin/lttng-relayd/main.c
+++ b/src/bin/lttng-relayd/main.c
@@ -22,7 +22,7 @@
#include <grp.h>
#include <common/compat/limits.h>
#include <pthread.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
index 7d6d87f..95cfb54 100644
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
@@ -23,7 +23,7 @@
#include <common/compat/limits.h>
#include <paths.h>
#include <pthread.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index f8e9693..f00d292 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -27,7 +27,7 @@
#include <unistd.h>
#include <urcu/compiler.h>
#include <lttng/ust-error.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <common/common.h>
#include <common/sessiond-comm/sessiond-comm.h>
diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c
index e4a8fd2..e759e8d 100644
--- a/src/bin/lttng/lttng.c
+++ b/src/bin/lttng/lttng.c
@@ -17,7 +17,7 @@
#define _GNU_SOURCE
#include <getopt.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/bin/lttng/utils.c b/src/bin/lttng/utils.c
index 78fc830..3793b85 100644
--- a/src/bin/lttng/utils.c
+++ b/src/bin/lttng/utils.c
@@ -22,7 +22,7 @@
#include <common/compat/limits.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <netinet/in.h>
#include <arpa/inet.h>
diff --git a/src/common/compat/Makefile.am b/src/common/compat/Makefile.am
index caa076c..5fb04a8 100644
--- a/src/common/compat/Makefile.am
+++ b/src/common/compat/Makefile.am
@@ -10,4 +10,4 @@ endif
libcompat_la_SOURCES = poll.h fcntl.h endian.h mman.h clone.h \
socket.h compat-fcntl.c uuid.h tid.h netinet/in.h \
- limits.h $(COMPAT)
+ limits.h compat-signal.c $(COMPAT)
diff --git a/src/common/compat/compat-signal.c b/src/common/compat/compat-signal.c
new file mode 100644
index 0000000..9f69427
--- /dev/null
+++ b/src/common/compat/compat-signal.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2014 - Charles Briere <c.briere at samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+
+#include <common/compat/signal.h>
+
+#if !HAVE_DECL_SIGWAITINFO
+
+#include <time.h>
+#include <unistd.h>
+#include <common/compat/syscall.h>
+
+#define sigtimedwait(set, info, timeout, n) syscall(__NR_rt_sigtimedwait, set, info, timeout, n)
+
+int sigwaitinfo (sigset_t *__set,
+ siginfo_t *__info)
+{
+ struct timespec timeout = {
+ .tv_sec = 10000,
+ .tv_nsec = 0,
+ };
+ /* Last argument is supposed to be sizeof(sigset_t), but
+ * sigset_t doesn't have the same definition in kernel source
+ * and android bionic includes so verification in the syscall
+ * will fail. This assume _NSIG is correctly defined to the
+ * number of bits for sigset_t. */
+ return sigtimedwait(__set, __info, &timeout, _NSIG/8 );
+}
+
+#endif
diff --git a/src/common/compat/signal.h b/src/common/compat/signal.h
new file mode 100644
index 0000000..965c9bd
--- /dev/null
+++ b/src/common/compat/signal.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2014 (c) - Charles Briere <c.briere at samsung.com>
+ *
+ * signal compatibility layer.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <signal.h>
+#include <config.h>
+
+#ifndef LTTNG_SIGNAL_H
+#define LTTNG_SIGNAL_H
+
+# if !HAVE_DECL_SIGWAITINFO
+int sigwaitinfo (sigset_t *__set,
+ siginfo_t *__info);
+
+# endif
+
+#endif
diff --git a/src/common/consumer-timer.c b/src/common/consumer-timer.c
index 1408052..f137daa 100644
--- a/src/common/consumer-timer.c
+++ b/src/common/consumer-timer.c
@@ -19,7 +19,7 @@
#define _GNU_SOURCE
#include <assert.h>
#include <inttypes.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <bin/lttng-consumerd/health-consumerd.h>
#include <common/common.h>
@@ -504,7 +504,7 @@ void *consumer_timer_thread(void *data)
health_poll_exit();
if (signr == -1) {
if (errno != EINTR) {
- PERROR("sigwaitinfo");
+ PERROR("sigwaitinfo; mask : %x; info : %x", mask, info);
}
continue;
} else if (signr == LTTNG_CONSUMER_SIG_SWITCH) {
diff --git a/src/common/consumer.c b/src/common/consumer.c
index 999e400..68f0cbc 100644
--- a/src/common/consumer.c
+++ b/src/common/consumer.c
@@ -28,7 +28,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <inttypes.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <bin/lttng-consumerd/health-consumerd.h>
#include <common/common.h>
diff --git a/src/common/runas.c b/src/common/runas.c
index c59d722..5b4c2ec 100644
--- a/src/common/runas.c
+++ b/src/common/runas.c
@@ -28,7 +28,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <sched.h>
-#include <sys/signal.h>
+#include <common/compat/signal.h>
#include <common/common.h>
#include <common/utils.h>
diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c
index bff360e..d5ff6c7 100644
--- a/src/common/ust-consumer/ust-consumer.c
+++ b/src/common/ust-consumer/ust-consumer.c
@@ -30,7 +30,7 @@
#include <inttypes.h>
#include <unistd.h>
#include <urcu/list.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <bin/lttng-consumerd/health-consumerd.h>
#include <common/common.h>
diff --git a/tests/regression/ust/exit-fast/exit-fast.c b/tests/regression/ust/exit-fast/exit-fast.c
index 8642656..4f5e957 100644
--- a/tests/regression/ust/exit-fast/exit-fast.c
+++ b/tests/regression/ust/exit-fast/exit-fast.c
@@ -18,7 +18,7 @@
/* This test generates a single event and exits.
*/
-#include <signal.h>
+#include <common/compat/signal.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/tests/regression/ust/high-throughput/main.c b/tests/regression/ust/high-throughput/main.c
index dbd2998..27f95de 100644
--- a/tests/regression/ust/high-throughput/main.c
+++ b/tests/regression/ust/high-throughput/main.c
@@ -24,7 +24,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <string.h>
#include <arpa/inet.h>
#include <stdlib.h>
diff --git a/tests/regression/ust/linking/demo.c b/tests/regression/ust/linking/demo.c
index a02ee80..2917f26 100644
--- a/tests/regression/ust/linking/demo.c
+++ b/tests/regression/ust/linking/demo.c
@@ -24,7 +24,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <string.h>
#include <arpa/inet.h>
#include <stdlib.h>
diff --git a/tests/regression/ust/multi-session/gen-nevents.c b/tests/regression/ust/multi-session/gen-nevents.c
index 7add252..c96fdb5 100644
--- a/tests/regression/ust/multi-session/gen-nevents.c
+++ b/tests/regression/ust/multi-session/gen-nevents.c
@@ -19,7 +19,7 @@
#include <arpa/inet.h>
#include <fcntl.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/regression/ust/overlap/demo/demo.c b/tests/regression/ust/overlap/demo/demo.c
index e2b61c2..f2a8042 100644
--- a/tests/regression/ust/overlap/demo/demo.c
+++ b/tests/regression/ust/overlap/demo/demo.c
@@ -24,7 +24,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <signal.h>
+#include <common/compat/signal.h>
#include <string.h>
#include <arpa/inet.h>
#include <stdlib.h>
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 17/24] Add : Compatibility layer for pthread
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (14 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 16/24] Add : Compatibility layer for pwd.h Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 13/24] Add : Compatibility layer for un.h Charles Briere
` (8 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
pthread_cond_timedwait:
As pthread_cond_timedwait is only used with MONOTONIC
and that Android provides pthread_cond_timedwait_monotonic_np,
use that one in the compatibility layer for now.
pthread_cancel:
pthread_kill with sigkill
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 3 +++
src/bin/lttng-consumerd/health-consumerd.c | 2 +-
src/bin/lttng-consumerd/lttng-consumerd.c | 2 +-
src/bin/lttng-relayd/health-relayd.c | 2 +-
src/common/compat/Makefile.am | 3 ++-
src/common/compat/compat-pthread.c | 30 +++++++++++++++++++++++++++++
src/common/compat/pthread.h | 31 ++++++++++++++++++++++++++++++
7 files changed, 69 insertions(+), 4 deletions(-)
create mode 100644 src/common/compat/compat-pthread.c
create mode 100644 src/common/compat/pthread.h
diff --git a/configure.ac b/configure.ac
index f372b07..e219689 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,8 +66,11 @@ AC_CHECK_HEADERS([ \
AC_CHECK_TYPES([in_port_t], [], [], [[#include <netinet/in.h>]])
AC_CHECK_DECLS([sigwaitinfo],[],[], [[#include <signal.h>]])
+AC_CHECK_DECLS([pthread_cancel], [], [], [[#include <pthread.h>]])
+
AC_CHECK_FUNCS([getpwuid_r],[],[])
+
# Babeltrace viewer check
AC_ARG_WITH([babeltrace-bin],
AS_HELP_STRING([--with-babeltrace-bin],
diff --git a/src/bin/lttng-consumerd/health-consumerd.c b/src/bin/lttng-consumerd/health-consumerd.c
index 5f2415b..618497f 100644
--- a/src/bin/lttng-consumerd/health-consumerd.c
+++ b/src/bin/lttng-consumerd/health-consumerd.c
@@ -27,7 +27,6 @@
#include <string.h>
#include <sys/ipc.h>
#include <sys/resource.h>
-#include <sys/shm.h>
#include <sys/socket.h>
#include <common/compat/stat.h>
#include <sys/types.h>
@@ -46,6 +45,7 @@
#include <common/consumer-timer.h>
#include <common/compat/poll.h>
#include <common/compat/ulimit.h>
+#include <common/compat/shm.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/utils.h>
diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c
index 70605bf..a74ab8b 100644
--- a/src/bin/lttng-consumerd/lttng-consumerd.c
+++ b/src/bin/lttng-consumerd/lttng-consumerd.c
@@ -28,7 +28,6 @@
#include <string.h>
#include <sys/ipc.h>
#include <sys/resource.h>
-#include <sys/shm.h>
#include <sys/socket.h>
#include <common/compat/stat.h>
#include <sys/types.h>
@@ -46,6 +45,7 @@
#include <common/consumer-timer.h>
#include <common/compat/poll.h>
#include <common/compat/ulimit.h>
+#include <common/compat/shm.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/utils.h>
diff --git a/src/bin/lttng-relayd/health-relayd.c b/src/bin/lttng-relayd/health-relayd.c
index 812fb03..4e22f08 100644
--- a/src/bin/lttng-relayd/health-relayd.c
+++ b/src/bin/lttng-relayd/health-relayd.c
@@ -27,7 +27,6 @@
#include <string.h>
#include <sys/ipc.h>
#include <sys/resource.h>
-#include <sys/shm.h>
#include <sys/socket.h>
#include <common/compat/stat.h>
#include <sys/types.h>
@@ -46,6 +45,7 @@
#include <common/consumer-timer.h>
#include <common/compat/poll.h>
#include <common/compat/ulimit.h>
+#include <common/compat/shm.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/utils.h>
diff --git a/src/common/compat/Makefile.am b/src/common/compat/Makefile.am
index 2ebe84f..181a80d 100644
--- a/src/common/compat/Makefile.am
+++ b/src/common/compat/Makefile.am
@@ -10,4 +10,5 @@ endif
libcompat_la_SOURCES = poll.h fcntl.h endian.h mman.h clone.h \
socket.h compat-fcntl.c uuid.h tid.h netinet/in.h \
- limits.h compat-signal.c compat-pwd.c $(COMPAT)
+ limits.h compat-signal.c compat-pwd.c \
+ compat-pthread.c $(COMPAT)
diff --git a/src/common/compat/compat-pthread.c b/src/common/compat/compat-pthread.c
new file mode 100644
index 0000000..1573cfc
--- /dev/null
+++ b/src/common/compat/compat-pthread.c
@@ -0,0 +1,30 @@
+#include <common/compat/pthread.h>
+
+# if !HAVE_DECL_PTHREAD_CANCEL
+int pthread_cancel(pthread_t thread) {
+ pthread_kill(thread, SIGKILL);
+}
+
+/*
+ * As for now, Android doesnt support pthread_cond_timedwait but there is a
+ * commit on master which fixes that, but isnt' available in any relases yet.
+ * As of now, pthead_cond_timedwait is only used with MONOTONIC clock so we
+ * will use pthread_cond_timedwait_monotonic instead.
+ *
+ * https://android-review.googlesource.com/#/c/83881/
+ */
+int pthread_condattr_setclock(pthread_condattr_t* cond, clockid_t clockid)
+{
+ return 0;
+}
+
+int pthread_cond_timedwait(pthread_cond_t *cond,
+ pthread_mutex_t *mutex,
+ const struct timespec *abstime)
+{
+ return pthread_cond_timedwait_monotonic_np(
+ cond,
+ mutex,
+ abstime);
+}
+# endif /* !HAVE_PTHREAD_CANCEL */
diff --git a/src/common/compat/pthread.h b/src/common/compat/pthread.h
new file mode 100644
index 0000000..8f38321
--- /dev/null
+++ b/src/common/compat/pthread.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2014 - Charles Briere <c.briere at samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _COMPAT_PTHREAD_H
+#define _COMPAT_PTHREAD_H
+
+# include <pthread.h>
+
+# if !HAVE_DECL_PTHREAD_CANCEL
+int pthread_cancel(pthread_t);
+int pthread_condattr_setclock(pthread_condattr_t *cond, clockid_t clockid);
+int pthread_cond_timedwait(pthread_cond_t *cond,
+ pthread_mutex_t *mutex,
+ const struct timespec *abstime);
+# endif /* HAVE_PTHREAD_CANCEL */
+
+#endif /* _COMPAT_PTHREAD_H */
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 24/24] Android : Add splice compatibility to fcntl layer
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (21 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 21/24] Android : Adding bswap defintions Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 23/24] Android : Define posix_fadvise Charles Briere
2014-10-27 20:58 ` [lttng-dev] Fixes for Android Karim Yaghmour
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Define splice() as __NR_splice() when not available directly (happens with BIONIC)
Define SPLICE_*_* values
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 2 +-
src/common/compat/fcntl.h | 26 +++++++++++++++++++++++++-
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index ea37ad0..7230e92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,7 +67,7 @@ AC_CHECK_TYPES([in_port_t], [], [], [[#include <netinet/in.h>]])
AC_CHECK_DECLS([sigwaitinfo],[],[], [[#include <signal.h>]])
AC_CHECK_DECLS([pthread_cancel], [], [], [[#include <pthread.h>]])
-AC_CHECK_DECLS([posix_fadvise],[],[], [[#include <fcntl.h>]])
+AC_CHECK_DECLS([posix_fadvise, splice],[],[], [[#include <fcntl.h>]])
AC_CHECK_FUNCS([getpwuid_r],[],[])
diff --git a/src/common/compat/fcntl.h b/src/common/compat/fcntl.h
index 779c942..b3453a2 100644
--- a/src/common/compat/fcntl.h
+++ b/src/common/compat/fcntl.h
@@ -46,9 +46,33 @@ extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
# include <linux/fadvise.h>
# endif
+# if !HAVE_DECL_SPLICE
+# if defined(__NR_splice)
+# define splice(fdin, off_in, fdout, off_out, len, flags) syscall(__NR_splice, fdin, off_in, fdout, off_out, len, flags)
+# endif
+# endif
+
# ifndef SYNC_FILE_RANGE_WRITE
# include <linux/fs.h>
-#endif
+# endif
+
+# ifndef SPLICE_F_MOVE
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# endif
+
+# ifndef SPLICE_F_NONBLOCK
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# endif
+
+# ifndef SPLICE_F_MORE
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# endif
+
+# ifndef SPLICE_F_GIFT
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+# endif
#endif /* __linux__ */
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 22/24] Android : Missing defintion in fcntl.h
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (19 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 19/24] Android : Looking for pthread in libc Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 21/24] Android : Adding bswap defintions Charles Briere
` (3 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Add includes for the missing declarations
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
src/common/compat/fcntl.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/common/compat/fcntl.h b/src/common/compat/fcntl.h
index 04fe03a..1325a3f 100644
--- a/src/common/compat/fcntl.h
+++ b/src/common/compat/fcntl.h
@@ -36,6 +36,14 @@ extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
#define lttng_sync_file_range(fd, offset, nbytes, flags) \
compat_sync_file_range(fd, offset, nbytes, flags)
+# ifndef POSIX_FADV_DONTNEED
+# include <linux/fadvise.h>
+# endif
+
+# ifndef SYNC_FILE_RANGE_WRITE
+# include <linux/fs.h>
+#endif
+
#endif /* __linux__ */
#if (defined(__FreeBSD__) || defined(__CYGWIN__))
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 20/24] Android : %m[^] not supported in fscanf
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (16 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 13/24] Add : Compatibility layer for un.h Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 18/24] Add : Compatibility layer for shm.h Charles Briere
` (6 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Replacing %m[^] and char* by %[^] and char[LTTNG_SYMBOL_NAME_LEN]
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
src/bin/lttng-sessiond/kernel.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c
index 2aeef26..3e1eff3 100644
--- a/src/bin/lttng-sessiond/kernel.c
+++ b/src/bin/lttng-sessiond/kernel.c
@@ -613,7 +613,7 @@ error:
ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
{
int fd, ret;
- char *event;
+ char event[LTTNG_SYMBOL_NAME_LEN];
size_t nbmem, count = 0;
FILE *fp;
struct lttng_event *elist;
@@ -644,7 +644,7 @@ ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
goto end;
}
- while (fscanf(fp, "event { name = %m[^;]; };\n", &event) == 1) {
+ while (fscanf(fp,"event { name = %[^;]; };\n", &event) == 1) {
if (count >= nbmem) {
struct lttng_event *new_elist;
size_t new_nbmem;
@@ -655,7 +655,6 @@ ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
new_elist = realloc(elist, new_nbmem * sizeof(struct lttng_event));
if (new_elist == NULL) {
PERROR("realloc list events");
- free(event);
free(elist);
count = -ENOMEM;
goto end;
@@ -670,7 +669,6 @@ ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
elist[count].name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
elist[count].enabled = -1;
count++;
- free(event);
}
*events = elist;
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 23/24] Android : Define posix_fadvise
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (22 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 24/24] Android : Add splice compatibility to fcntl layer Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:58 ` [lttng-dev] Fixes for Android Karim Yaghmour
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Mapping from __NR_arm_fadvise64_64 to posix_fadvise
is not done within BIONIC
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 1 +
src/common/compat/fcntl.h | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/configure.ac b/configure.ac
index 91efd17..ea37ad0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,7 @@ AC_CHECK_TYPES([in_port_t], [], [], [[#include <netinet/in.h>]])
AC_CHECK_DECLS([sigwaitinfo],[],[], [[#include <signal.h>]])
AC_CHECK_DECLS([pthread_cancel], [], [], [[#include <pthread.h>]])
+AC_CHECK_DECLS([posix_fadvise],[],[], [[#include <fcntl.h>]])
AC_CHECK_FUNCS([getpwuid_r],[],[])
diff --git a/src/common/compat/fcntl.h b/src/common/compat/fcntl.h
index 1325a3f..779c942 100644
--- a/src/common/compat/fcntl.h
+++ b/src/common/compat/fcntl.h
@@ -36,6 +36,12 @@ extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
#define lttng_sync_file_range(fd, offset, nbytes, flags) \
compat_sync_file_range(fd, offset, nbytes, flags)
+# if !HAVE_DECL_POSIX_FADVISE
+# if defined(__NR_arm_fadvise64_64)
+# define posix_fadvise(fd, offset, len, advise) syscall(__NR_arm_fadvise64_64, fd, offset, len, advise)
+# endif
+# endif
+
# ifndef POSIX_FADV_DONTNEED
# include <linux/fadvise.h>
# endif
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 18/24] Add : Compatibility layer for shm.h
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (17 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 20/24] Android : %m[^] not supported in fscanf Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 19/24] Android : Looking for pthread in libc Charles Briere
` (5 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Linking libcutils for Android that uses ashmem
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 14 ++++++++++++++
src/bin/lttng-sessiond/shm.c | 5 +++--
src/common/compat/shm.h | 37 +++++++++++++++++++++++++++++++++++++
src/common/defaults.h | 1 +
4 files changed, 55 insertions(+), 2 deletions(-)
create mode 100644 src/common/compat/shm.h
diff --git a/configure.ac b/configure.ac
index e219689..16852b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -194,6 +194,20 @@ AC_CHECK_LIB([rt], [shm_open],
AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"])
AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid" = "xyes"])
+# Check for libcutils
+AC_CHECK_LIB([cutils], [ashmem_create],
+ [AC_SUBST(LIBCUTILS_LIBS, '-lcutils')],
+ [AC_SUBST(LIBCUTILS_LIBS, '')],
+)
+AC_CHECK_HEADERS([cutils/ashmem.h],
+ [AC_CHECK_DECLS([ashmem_create], [], [], [[#include <cutils/ashmem.h>]])],
+)
+
+AS_CASE([$host],[*-*-linux-androideabi],
+ [AM_CONDITIONAL(TARGET_IS_ANDROID, true)],
+ [AM_CONDITIONAL(TARGET_IS_ANDROID, false)]
+)
+
# URCU library version needed or newer
liburcu_version=">= 0.8.0"
diff --git a/src/bin/lttng-sessiond/shm.c b/src/bin/lttng-sessiond/shm.c
index e9ed714..dba3679 100644
--- a/src/bin/lttng-sessiond/shm.c
+++ b/src/bin/lttng-sessiond/shm.c
@@ -30,7 +30,7 @@
#include <common/error.h>
-#include "shm.h"
+#include <common/compat/shm.h>
/*
* Using fork to set umask in the child process (not multi-thread safe). We
@@ -73,7 +73,8 @@ static int get_wait_shm(char *shm_path, size_t mmap_size, int global)
* Try creating shm (or get rw access). We don't do an exclusive open,
* because we allow other processes to create+ftruncate it concurrently.
*/
- wait_shm_fd = shm_open(shm_path, O_RDWR | O_CREAT, mode);
+ wait_shm_fd = lttng_shm_open(shm_path, O_RDWR | O_CREAT, mode);
+
if (wait_shm_fd < 0) {
PERROR("shm_open wait shm");
goto error;
diff --git a/src/common/compat/shm.h b/src/common/compat/shm.h
new file mode 100644
index 0000000..28e498a
--- /dev/null
+++ b/src/common/compat/shm.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 - Charles Briere <c.briere at samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _COMPAT_SYS_SHM_H
+#define _COMPAT_SYS_SHM_H
+
+# if defined(HAVE_SYS_SHM_H)
+
+#include <sys/shm.h>
+
+#define lttng_shm_open(name, oflag, mode) \
+ shm_open(name, oflag, mode)
+
+# elif defined(HAVE_CUTILS_ASHMEM_H)
+
+#include <cutils/ashmem.h>
+
+#define lttng_shm_open(name, oflag, mode) \
+ open(name, oflag, mode)
+
+# endif /* HAVE_SYS_SHM_H */
+
+#endif /*_COMPAT_SYS_SHM_H */
diff --git a/src/common/defaults.h b/src/common/defaults.h
index 25d7b32..8951179 100644
--- a/src/common/defaults.h
+++ b/src/common/defaults.h
@@ -143,6 +143,7 @@
#define DEFAULT_HOME_APPS_UNIX_SOCK \
DEFAULT_LTTNG_HOME_RUNDIR "/" LTTNG_UST_SOCK_FILENAME
#define DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH \
+ DEFAULT_LTTNG_RUNDIR \
"/" LTTNG_UST_WAIT_FILENAME
#define DEFAULT_HOME_APPS_WAIT_SHM_PATH \
DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH "-%d"
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 21/24] Android : Adding bswap defintions
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (20 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 22/24] Android : Missing defintion in fcntl.h Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 24/24] Android : Add splice compatibility to fcntl layer Charles Briere
` (2 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Mapping of bswap functions based on what's
available on Android's NDK
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 2 ++
src/common/compat/endian.h | 11 ++++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 45c6b30..91efd17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -242,6 +242,8 @@ AC_CHECK_DECL([cmm_smp_mb__before_uatomic_or], [],
AC_CHECK_DECLS([gettid], [], [], [[#include <unistd.h>]])
+AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64], [], [], [[#include <byteswap.h>]])
+
# Check kmod library
AC_ARG_WITH(kmod-prefix,
AS_HELP_STRING([--with-kmod-prefix=PATH],
diff --git a/src/common/compat/endian.h b/src/common/compat/endian.h
index baea531..c03c231 100644
--- a/src/common/compat/endian.h
+++ b/src/common/compat/endian.h
@@ -21,11 +21,20 @@
#ifdef __linux__
#include <endian.h>
+#define HAVE_BSWAP (HAVE_DECL_BSWAP_16 && HAVE_DECL_BSWAP_32 && HAVE_DECL_BSWAP_64)
+#if HAVE_BSWAP
+# ifndef __bswap_16
+# define __bswap_16(x) bswap_16(x)
+# define __bswap_32(x) bswap_32(x)
+# define __bswap_64(x) bswap_64(x)
+# endif
+#endif
+
/*
* htobe/betoh are not defined for glibc <2.9, so add them
* explicitly if they are missing.
*/
-#ifdef __USE_BSD
+#if defined(__USE_BSD) || HAVE_BSWAP
/* Conversion interfaces. */
# include <byteswap.h>
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] [PATCH lttng-tools 19/24] Android : Looking for pthread in libc
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (18 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 18/24] Add : Compatibility layer for shm.h Charles Briere
@ 2014-10-27 20:49 ` Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 22/24] Android : Missing defintion in fcntl.h Charles Briere
` (4 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Charles Briere @ 2014-10-27 20:49 UTC (permalink / raw)
From: Charles Briere <c.briere@samsung.com>
Pthread in included in BIONIC libc
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 16852b1..45c6b30 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,7 +150,9 @@ AC_DEFINE_DIR([CONFIG_LTTNG_SYSTEM_DATADIR],[datadir], [LTTng system data direct
#
# Check for pthread
AC_CHECK_LIB([pthread], [pthread_create], [],
- [AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])]
+ [AC_CHECK_LIB([c], [pthread_create], [],
+ [AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])]
+ )]
)
# Check libpopt
--
2.1.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [lttng-dev] Fixes for Android
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
` (23 preceding siblings ...)
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 23/24] Android : Define posix_fadvise Charles Briere
@ 2014-10-27 20:58 ` Karim Yaghmour
24 siblings, 0 replies; 26+ messages in thread
From: Karim Yaghmour @ 2014-10-27 20:58 UTC (permalink / raw)
On 14-10-27 04:49 PM, Charles Briere wrote:
> The following patch set allows compilation of lttng-tools for Android.
> This have been tested with AOSP and may not work if compiling with
> Android's NDK toolchain.
>
> The patch concerning the shm compatibility layer is there in preparation
> for patches around lttng-ust which will follow soon.
I'll let others judge of the patches in detail, but this is much
appreciated.
--
Karim Yaghmour
CEO - Opersys inc. / www.opersys.com
http://twitter.com/karimyaghmour
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2014-10-27 20:58 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 05/24] Fix : Do not use gLibc specific macros Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 02/24] Fix : Include sys/stat.h where needed Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 04/24] Fix : Only link librt if available Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 07/24] Fix : need to include config.h if using it's definitions Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 01/24] Fix : wait.h should be sys/wait.h according to posix and android doesn't redirect wait.h to sys/wait.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 06/24] Fix : Do not redeclare gettid if found Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 08/24] Fix : Don't compile ust functions when not enabled Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 03/24] Fix : Wrap variable with URCU_TLS for sizeof Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 15/24] Add : Compatibility layer for stat.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 14/24] Add : Compatibility layer for signal.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 12/24] Add : Compatibility layer for ulimit.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 10/24] Add : Compatibility layer for netinet/in.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 11/24] Add : Compatibility layer for limit.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 09/24] Add : Compatibility layer for syscall.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 16/24] Add : Compatibility layer for pwd.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 17/24] Add : Compatibility layer for pthread Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 13/24] Add : Compatibility layer for un.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 20/24] Android : %m[^] not supported in fscanf Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 18/24] Add : Compatibility layer for shm.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 19/24] Android : Looking for pthread in libc Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 22/24] Android : Missing defintion in fcntl.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 21/24] Android : Adding bswap defintions Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 24/24] Android : Add splice compatibility to fcntl layer Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 23/24] Android : Define posix_fadvise Charles Briere
2014-10-27 20:58 ` [lttng-dev] Fixes for Android Karim Yaghmour
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox