[ltt-dev] Userspace RCU library relicensed to LGPLv2.1

Evgeniy Polyakov zbr at ioremap.net
Thu May 14 16:14:15 EDT 2009


On Thu, May 14, 2009 at 04:11:03PM -0400, Mathieu Desnoyers (compudj at krystal.dyndns.org) wrote:
> > Patches to extend the userspace RCU code-base to include (ideally)
> > MIT-style or LGPLv2.1-compatible xchg() primitives and also
> > arch-specific memory barriers for other architectures are very welcome.
> > See arch_x86.h and arch_atomic_x86.h for the detailed list of required
> > per-architecture primitives. (note that get_cycles is only needed for
> > the test programs, not the library per se)
> 
> Note, however, that if someone sends a patch allowing selecting the gcc
> atomic operations as a compile-time option, I would be inclined to merge
> it, especially if it is proven useful for Linux distributions.

I use attached m4 to select either libatomic, __sync or posix lock
protected 'atomic' types in elliptics network to determine proper
abstraction implemention. It requires a trivial bit of changes for the
liburcu though.

-- 
	Evgeniy Polyakov
-------------- next part --------------
AC_DEFUN([AC_CHECK_ATOMIC],[
AC_MSG_CHECKING([whether libatomic or __sync are supported])
ATOMIC_LIBS="-latomic"

AC_ARG_WITH([libatomic-path],
	AC_HELP_STRING([--with-libatomic-path=@<:@ARG@:>@],
		[Build with the different path to libatomic (ARG=string)]),
	[
		ATOMIC_LIBS="-L$withval/lib -latomic"
		ATOMIC_CFLAGS="-I$withval/include"
	]
)

saved_CFLAGS="$CFLAGS"
saved_LIBS="$LIBS"
LIBS="$ATOMIC_LIBS $LIBS"
CFLAGS="$ATOMIC_CFLAGS $CFLAGS -Werror-implicit-function-declaration"

ac_atomic_support=no
AC_TRY_LINK([#include <atomic/atomic.h>],
	[atomic_t a; atomic_set(&a, 1); atomic_inc(&a);],
	[
		AC_DEFINE(HAVE_LIBATOMIC_SUPPORT, 1, [Define this if libatomic is installed])
		ac_atomic_support=libatomic
	], [
		ATOMIC_LIBS=""
		ATOMIC_CFLAGS=""
	]
)

AC_SUBST(ATOMIC_LIBS)
AC_SUBST(ATOMIC_CFLAGS)
LIBS="$saved_LIBS"

if test x$ac_atomic_support = xno; then
AC_TRY_LINK([],
	[long var; __sync_add_and_fetch(&var, 1)],
	[
		AC_DEFINE(HAVE_SYNC_ATOMIC_SUPPORT, 1, [Define this if __sync calls are supported])
		ac_atomic_support=__sync
	], []
)
fi

AC_MSG_RESULT([$ac_atomic_support])

CFLAGS="$saved_CFLAGS"
])


More information about the lttng-dev mailing list