From: Michael Jeanson Date: Thu, 23 Jun 2016 18:28:22 +0000 (-0400) Subject: Fix: Move rand-compat to private src dir X-Git-Tag: v0.10.0~25 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=094c8c59183be7b084e4faf061dc23faab1f13b1;p=userspace-rcu.git Fix: Move rand-compat to private src dir Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/include/Makefile.am b/include/Makefile.am index 61301c2..2792f99 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -7,7 +7,6 @@ nobase_dist_include_HEADERS = urcu/compiler.h urcu/hlist.h urcu/list.h \ urcu/lfstack.h urcu/syscall-compat.h \ $(top_srcdir)/include/urcu/map/*.h \ $(top_srcdir)/include/urcu/static/*.h \ - urcu/rand-compat.h \ urcu/tls-compat.h urcu/debug.h # Don't distribute generated headers diff --git a/include/urcu/rand-compat.h b/include/urcu/rand-compat.h deleted file mode 100644 index 2c57751..0000000 --- a/include/urcu/rand-compat.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef _URCU_RAND_COMPAT_H -#define _URCU_RAND_COMPAT_H - -/* - * urcu/rand-compat.h - * - * Userspace RCU library - rand/rand_r Compatibility Header - * - * Copyright 1996 - Ulrich Drepper - * Copyright 2013 - Pierre-Luc St-Charles - * - * Note: this file is only used to simplify the code required to - * use the 'rand_r(...)' system function across multiple platforms, - * which might not always be referenced the same way. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef __ANDROID__ -/* - * Reentrant random function from POSIX.1c. - * Copyright (C) 1996, 1999 Free Software Foundation, Inc. - * This file is part of the GNU C Library. - * Contributed by Ulrich Drepper >, 1996. - */ -static inline int rand_r(unsigned int *seed) -{ - unsigned int next = *seed; - int result; - - next *= 1103515245; - next += 12345; - result = (unsigned int) (next / 65536) % 2048; - - next *= 1103515245; - next += 12345; - result <<= 10; - result ^= (unsigned int) (next / 65536) % 1024; - - next *= 1103515245; - next += 12345; - result <<= 10; - result ^= (unsigned int) (next / 65536) % 1024; - - *seed = next; - - return result; -} -#endif /* __ANDROID__ */ - -#endif /* _URCU_RAND_COMPAT_H */ diff --git a/include/urcu/static/urcu.h b/include/urcu/static/urcu.h index 9082af7..7048f99 100644 --- a/include/urcu/static/urcu.h +++ b/include/urcu/static/urcu.h @@ -41,7 +41,6 @@ #include #include #include -#include #include #ifdef __cplusplus diff --git a/src/Makefile.am b/src/Makefile.am index e7eb2bc..6a2fd7a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,8 @@ AM_CFLAGS=-Wall include_HEADERS = urcu.h urcu-bp.h urcu-call-rcu.h urcu-defer.h \ urcu-pointer.h urcu-qsbr.h urcu-flavor.h -dist_noinst_HEADERS = urcu-die.h urcu-wait.h compat-getcpu.h +dist_noinst_HEADERS = urcu-die.h urcu-wait.h compat-getcpu.h \ + compat-rand.h if COMPAT_ARCH diff --git a/src/compat-rand.h b/src/compat-rand.h new file mode 100644 index 0000000..7c6acde --- /dev/null +++ b/src/compat-rand.h @@ -0,0 +1,63 @@ +#ifndef _COMPAT_RAND_H +#define _COMPAT_RAND_H + +/* + * compat-rand.h + * + * Userspace RCU library - rand/rand_r Compatibility Header + * + * Copyright 1996 - Ulrich Drepper + * Copyright 2013 - Pierre-Luc St-Charles + * + * Note: this file is only used to simplify the code required to + * use the 'rand_r(...)' system function across multiple platforms, + * which might not always be referenced the same way. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifdef __ANDROID__ +/* + * Reentrant random function from POSIX.1c. + * Copyright (C) 1996, 1999 Free Software Foundation, Inc. + * This file is part of the GNU C Library. + * Contributed by Ulrich Drepper >, 1996. + */ +static inline int rand_r(unsigned int *seed) +{ + unsigned int next = *seed; + int result; + + next *= 1103515245; + next += 12345; + result = (unsigned int) (next / 65536) % 2048; + + next *= 1103515245; + next += 12345; + result <<= 10; + result ^= (unsigned int) (next / 65536) % 1024; + + next *= 1103515245; + next += 12345; + result <<= 10; + result ^= (unsigned int) (next / 65536) % 1024; + + *seed = next; + + return result; +} +#endif /* __ANDROID__ */ + +#endif /* _COMPAT_RAND_H */ diff --git a/tests/benchmark/test_urcu_hash.h b/tests/benchmark/test_urcu_hash.h index f2e23f2..2f708a1 100644 --- a/tests/benchmark/test_urcu_hash.h +++ b/tests/benchmark/test_urcu_hash.h @@ -36,7 +36,7 @@ #include #include -#include +#include #include "cpuset.h" #include "thread-id.h" #include "../common/debug-yield.h" diff --git a/tests/common/debug-yield.h b/tests/common/debug-yield.h index c60e4e0..b48561c 100644 --- a/tests/common/debug-yield.h +++ b/tests/common/debug-yield.h @@ -31,6 +31,8 @@ #include #include +#include + #define RCU_YIELD_READ (1 << 0) #define RCU_YIELD_WRITE (1 << 1)