From e9ca7f7296a836dc2b5beb46bf41d8aa28df7e1f Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Wed, 25 Aug 2010 16:49:51 -0700 Subject: [PATCH] refresh (create temporary patch) --- meta | 5 +-- patches/refresh-temp | 77 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 patches/refresh-temp diff --git a/meta b/meta index 2195f54..ffec739 100644 --- a/meta +++ b/meta @@ -1,7 +1,8 @@ Version: 1 -Previous: b75334f8dc2448d4cb9bbe148a65b1f19cf2f701 -Head: 7b8e47f55413b6756b2fa378c16f5e21b98f4690 +Previous: c7ff2c5ccd80c7ad711bcb4f0742963b63fefde5 +Head: 96a23da3a4b575a108d653346bc033c8bb4d4270 Applied: atomic: 7b8e47f55413b6756b2fa378c16f5e21b98f4690 + refresh-temp: 96a23da3a4b575a108d653346bc033c8bb4d4270 Unapplied: Hidden: diff --git a/patches/refresh-temp b/patches/refresh-temp new file mode 100644 index 0000000..be5fd6a --- /dev/null +++ b/patches/refresh-temp @@ -0,0 +1,77 @@ +Bottom: 59952986bf11b417c6da864108e5278e0fbca08a +Top: b4ed043a0fc86707acda56000b3096e59867bfbe +Author: Sean Hefty +Date: 2010-08-25 16:49:51 -0700 + +Refresh of atomic + +--- + +diff --git a/Makefile.am b/Makefile.am +index 4bd4bd5..f443091 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -2,10 +2,6 @@ INCLUDES = -I$(srcdir)/include -I$(srcdir)/linux + + AM_CFLAGS = -g -Wall -D_GNU_SOURCE + +-if DEFINE_ATOMICS +- AM_CFLAGS += -DDEFINE_ATOMICS +-endif +- + bin_PROGRAMS = util/ib_acme + sbin_PROGRAMS = svc/ib_acm + svc_ib_acm_SOURCES = src/acm.c +diff --git a/configure.in b/configure.in +index ce55f75..dfddeac 100755 +--- a/configure.in ++++ b/configure.in +@@ -41,15 +41,12 @@ fi + + dnl Check for gcc atomic intrinsics + AC_MSG_CHECKING(compiler support for atomics) +-AC_TRY_LINK([], ++AC_TRY_LINK([int i = 0;], ++ [ return __sync_add_and_fetch(&i, 1) != __sync_sub_and_fetch(&i, 1); ], ++ [ AC_MSG_RESULT(yes) ], + [ +- int i = 0; +- return __sync_add_and_fetch(&i, 1) == __sync_sub_and_fetch(&i, 1) + 1; +- ], +- AC_MSG_RESULT(yes), +- [ +- AC_MSG_RESULT(no - defining atomics) +- AC_DEFINE(DEFINE_ATOMICS, [], [Set to 1 to implement atomics]) ++ AC_MSG_RESULT(no) ++ AC_DEFINE(DEFINE_ATOMICS, 1, [Set to 1 to implement atomics]) + ]) + + AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script, +diff --git a/linux/osd.h b/linux/osd.h +index 9a167a7..9dacab9 100644 +--- a/linux/osd.h ++++ b/linux/osd.h +@@ -68,17 +68,17 @@ + #if DEFINE_ATOMICS + typedef struct { pthread_mutex_t mut; int val; } atomic_t; + #define atomic_inc(v) { \ +- int v; ++ int x; + pthread_mutex_lock(&(v)->mut); \ +- v = ++val; \ ++ x = ++val; \ + pthread_mutex_unlock(&(v)->mut); \ +- return v; } ++ return x; } + #define atomic_dec(v) { \ +- int v; ++ int x; + pthread_mutex_lock(&(v)->mut); \ +- v = --val; \ ++ x = --val; \ + pthread_mutex_unlock(&(v)->mut); \ +- return v; } ++ return x; } + #define atomic_init(v) { pthread_mutex_init(&(v)->mut, NULL); (v)->val = 0); } + #else + typedef struct { volatile int val; } atomic_t; -- 2.41.0