[Fedora-directory-commits] ldapserver/ldap/servers/plugins/acl acllas.c, 1.11, 1.12
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/acl
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26759
Modified Files:
acllas.c
Log Message:
Resolves: #469243
Summary: ACL: support group filter
Description: extended userattr #GROUPDN value to support LDAPURL
Index: acllas.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/acl/acllas.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- acllas.c 24 Oct 2007 18:41:15 -0000 1.11
+++ acllas.c 31 Oct 2008 00:16:02 -0000 1.12
@@ -2355,36 +2355,90 @@
Slapi_Attr *attr;
char *s, *p;
- char *str, *s_str, *base, *groupattr;
+ char *str, *s_str, *base, *groupattr = NULL;
int i,j,k,matched, enumerate_groups;
aclUserGroup *u_group;
char ebuf [ BUFSIZ ];
Slapi_Value *sval=NULL;
const struct berval *attrVal;
-
- /* Parse the URL -- We can't use the ldap_url_parse()
- ** we don't follow thw complete url naming scheme
- */
+ int qcnt = 0;
+ Slapi_PBlock *myPb = NULL;
+ Slapi_Entry **grpentries = NULL;
+
+ /* Parse the URL -- getting the group attr and counting up '?'s.
+ * If there is no group attr and there are 3 '?' marks,
+ * we parse the URL with ldap_url_parse to get base dn and filter.
+ */
s_str = str = slapi_ch_strdup(attrName);
while (str && ldap_utf8isspace(str)) LDAP_UTF8INC( str );
str +=8;
s = strchr (str, '?');
if (s) {
+ qcnt++;
p = s;
p++;
*s = '\0';
base = str;
s = strchr (p, '?');
- if (s) *s = '\0';
+ if (s) {
+ qcnt++;
+ *s = '\0';
+ if (NULL != strchr (++s, '?')) {
+ qcnt++;
+ }
+ }
groupattr = p;
} else {
slapi_ch_free ( (void **)&s_str );
return ACL_FALSE;
}
+
+ /* Full LDAPURL is given? */
+ if ((NULL == groupattr || 0 == strlen(groupattr)) && 3 == qcnt) {
+ LDAPURLDesc *ludp = NULL;
+ int rval;
+
+ if ( 0 != ldap_url_parse( attrName, &ludp) ) {
+ slapi_ch_free ( (void **)&s_str );
+ return ACL_FALSE;
+ }
+
+ /* Use new search internal API */
+ myPb = slapi_pblock_new ();
+ slapi_search_internal_set_pb(
+ myPb,
+ ludp->lud_dn,
+ ludp->lud_scope,
+ ludp->lud_filter,
+ NULL,
+ 0,
+ NULL /* controls */,
+ NULL /* uniqueid */,
+ aclplugin_get_identity (ACL_PLUGIN_IDENTITY),
+ 0 );
+ slapi_search_internal_pb(myPb);
+ ldap_free_urldesc( ludp );
+
+ slapi_pblock_get(myPb, SLAPI_PLUGIN_INTOP_RESULT, &rval);
+ if (rval != LDAP_SUCCESS) {
+ slapi_ch_free ( (void **)&s_str );
+ slapi_free_search_results_internal(myPb);
+ slapi_pblock_destroy (myPb);
+ return ACL_FALSE;
+ }
+ slapi_pblock_get(myPb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &grpentries);
+ if ((grpentries == NULL) || (grpentries[0] == NULL)) {
+ slapi_ch_free ( (void **)&s_str );
+ slapi_free_search_results_internal(myPb);
+ slapi_pblock_destroy (myPb);
+ return ACL_FALSE;
+ }
+ }
+
if ( (u_group = aclg_get_usersGroup ( aclpb , n_clientdn )) == NULL) {
- slapi_log_error( SLAPI_LOG_ACL, plugin_name,
+ slapi_log_error( SLAPI_LOG_ACL, plugin_name,
"Failed to find/allocate a usergroup--aborting evaluation\n", 0, 0);
slapi_ch_free ( (void **)&s_str );
return(ACL_DONT_KNOW);
@@ -2540,12 +2594,28 @@
j, ACL_ESCAPE_STRING_WITH_PUNCTUATION (u_group->aclug_member_groups[j], ebuf),0);
matched = ACL_FALSE;
- slapi_entry_attr_find( e, groupattr, &attr);
- if (attr == NULL) {
- slapi_ch_free ( (void **)&s_str );
- return ACL_FALSE;
- }
- {
+ if ((NULL == groupattr || 0 == strlen(groupattr)) && 3 == qcnt) {
+ /* Full LDAPURL case */
+ for (k = 0; u_group->aclug_member_groups[k]; k++) { /* groups the bind
+ user belong to */
+ Slapi_Entry **ep;
+ for (ep = grpentries; *ep; ep++) { /* groups having ACI */
+ char *n_edn = slapi_entry_get_ndn(*ep);
+ if (slapi_utf8casecmp((ACLUCHP)u_group->aclug_member_groups[k],
+ (ACLUCHP)n_edn) == 0) {
+ matched = ACL_TRUE;
+ break;
+ }
+ }
+ }
+ slapi_free_search_results_internal(myPb);
+ slapi_pblock_destroy(myPb);
+ } else {
+ slapi_entry_attr_find( e, groupattr, &attr);
+ if (attr == NULL) {
+ slapi_ch_free ( (void **)&s_str );
+ return ACL_FALSE;
+ }
k = slapi_attr_first_value ( attr,&sval );
while ( k != -1 ) {
char *n_attrval;
14 years, 11 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd slapi_counter.c, 1.4, 1.5
by Nathan Kinder
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv18274/ldap/servers/slapd
Modified Files:
slapi_counter.c
Log Message:
Resolves: 207457
Summary: Removed static specifier from __sync_*_8 atomic functions.
Index: slapi_counter.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi_counter.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- slapi_counter.c 29 Oct 2008 19:16:29 -0000 1.4
+++ slapi_counter.c 30 Oct 2008 19:06:55 -0000 1.5
@@ -56,8 +56,8 @@
#if defined LINUX && (defined CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH)
/* On systems that don't have the 64-bit GCC atomic builtins, we need to
* implement our own atomic functions using inline assembly code. */
-static PRUint64 __sync_add_and_fetch_8(PRUint64 *ptr, PRUint64 addval);
-static PRUint64 __sync_sub_and_fetch_8(PRUint64 *ptr, PRUint64 subval);
+PRUint64 __sync_add_and_fetch_8(PRUint64 *ptr, PRUint64 addval);
+PRUint64 __sync_sub_and_fetch_8(PRUint64 *ptr, PRUint64 subval);
#endif
#if defined LINUX && !HAVE_DECL___SYNC_ADD_AND_FETCH
@@ -432,7 +432,7 @@
/* On systems that don't have the 64-bit GCC atomic builtins, we need to
* implement our own atomic add and subtract functions using inline
* assembly code. */
-static PRUint64 __sync_add_and_fetch_8(PRUint64 *ptr, PRUint64 addval)
+PRUint64 __sync_add_and_fetch_8(PRUint64 *ptr, PRUint64 addval)
{
PRUint64 retval = 0;
@@ -476,7 +476,7 @@
return retval;
}
-static PRUint64 __sync_sub_and_fetch_8(PRUint64 *ptr, PRUint64 subval)
+PRUint64 __sync_sub_and_fetch_8(PRUint64 *ptr, PRUint64 subval)
{
PRUint64 retval = 0;
14 years, 11 months
[Fedora-directory-commits] ldapserver config.h.in, 1.24, 1.25 configure, 1.96, 1.97 configure.ac, 1.55, 1.56
by Nathan Kinder
Author: nkinder
Update of /cvs/dirsec/ldapserver
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27022
Modified Files:
config.h.in configure configure.ac
Log Message:
Resolves: 207457
Summary: Added 64-bit atomic functions for platforms lacking built-ins.
Index: config.h.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/config.h.in,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- config.h.in 24 Oct 2008 22:36:57 -0000 1.24
+++ config.h.in 29 Oct 2008 19:16:29 -0000 1.25
@@ -15,6 +15,12 @@
/* cpu type sparc */
#undef CPU_sparc
+/* cpu type x86 */
+#undef CPU_x86
+
+/* cpu type x86_64 */
+#undef CPU_x86_64
+
/* enable ldapi auto bind support in the server */
#undef ENABLE_AUTOBIND
@@ -43,6 +49,10 @@
don't. */
#undef HAVE_DECL_STRERROR_R
+/* Define to 1 if you have the declaration of `__sync_add_and_fetch', and to 0
+ if you don't. */
+#undef HAVE_DECL___SYNC_ADD_AND_FETCH
+
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
Index: configure
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- configure 24 Oct 2008 22:36:57 -0000 1.96
+++ configure 29 Oct 2008 19:16:29 -0000 1.97
@@ -23358,7 +23358,7 @@
# those with our 64 bit compiled product.
perlexec='/usr/bin/env perl'
case $host in
- *-*-linux*)
+ i*86-*-linux*)
cat >>confdefs.h <<\_ACEOF
#define XP_UNIX 1
@@ -23391,6 +23391,133 @@
cat >>confdefs.h <<\_ACEOF
+#define CPU_x86
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _GNU_SOURCE 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define ATOMIC_64BIT_OPERATIONS 1
+_ACEOF
+
+ echo "$as_me:$LINENO: checking whether __sync_add_and_fetch is declared" >&5
+echo $ECHO_N "checking whether __sync_add_and_fetch is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl___sync_add_and_fetch+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef __sync_add_and_fetch
+ char *p = (char *) __sync_add_and_fetch;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl___sync_add_and_fetch=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl___sync_add_and_fetch=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl___sync_add_and_fetch" >&5
+echo "${ECHO_T}$ac_cv_have_decl___sync_add_and_fetch" >&6
+if test $ac_cv_have_decl___sync_add_and_fetch = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL___SYNC_ADD_AND_FETCH 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL___SYNC_ADD_AND_FETCH 0
+_ACEOF
+
+
+fi
+
+
+ platform="linux"
+ # relative to sysconfdir
+ initdir=/rc.d/init.d
+ ;;
+ x86_64-*-linux*)
+
+cat >>confdefs.h <<\_ACEOF
+#define XP_UNIX 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define Linux 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define LINUX 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define LINUX2_0 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define LINUX2_2 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define LINUX2_4 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define CPU_x86_64
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
#define _GNU_SOURCE 1
_ACEOF
@@ -23399,6 +23526,78 @@
#define ATOMIC_64BIT_OPERATIONS 1
_ACEOF
+ echo "$as_me:$LINENO: checking whether __sync_add_and_fetch is declared" >&5
+echo $ECHO_N "checking whether __sync_add_and_fetch is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl___sync_add_and_fetch+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef __sync_add_and_fetch
+ char *p = (char *) __sync_add_and_fetch;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl___sync_add_and_fetch=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl___sync_add_and_fetch=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl___sync_add_and_fetch" >&5
+echo "${ECHO_T}$ac_cv_have_decl___sync_add_and_fetch" >&6
+if test $ac_cv_have_decl___sync_add_and_fetch = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL___SYNC_ADD_AND_FETCH 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL___SYNC_ADD_AND_FETCH 0
+_ACEOF
+
+
+fi
+
+
platform="linux"
# relative to sysconfdir
initdir=/rc.d/init.d
Index: configure.ac
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure.ac,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- configure.ac 24 Oct 2008 22:36:58 -0000 1.55
+++ configure.ac 29 Oct 2008 19:16:29 -0000 1.56
@@ -294,15 +294,32 @@
# those with our 64 bit compiled product.
perlexec='/usr/bin/env perl'
case $host in
- *-*-linux*)
+ i*86-*-linux*)
AC_DEFINE([XP_UNIX], [1], [UNIX])
AC_DEFINE([Linux], [1], [Linux])
AC_DEFINE([LINUX], [1], [Linux])
AC_DEFINE([LINUX2_0], [1], [Linux 2.0])
AC_DEFINE([LINUX2_2], [1], [Linux 2.2])
AC_DEFINE([LINUX2_4], [1], [Linux 2.4])
+ AC_DEFINE([CPU_x86], [], [cpu type x86])
AC_DEFINE([_GNU_SOURCE], [1], [GNU Source])
AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
+ AC_CHECK_DECLS([__sync_add_and_fetch])
+ platform="linux"
+ # relative to sysconfdir
+ initdir=/rc.d/init.d
+ ;;
+ x86_64-*-linux*)
+ AC_DEFINE([XP_UNIX], [1], [UNIX])
+ AC_DEFINE([Linux], [1], [Linux])
+ AC_DEFINE([LINUX], [1], [Linux])
+ AC_DEFINE([LINUX2_0], [1], [Linux 2.0])
+ AC_DEFINE([LINUX2_2], [1], [Linux 2.2])
+ AC_DEFINE([LINUX2_4], [1], [Linux 2.4])
+ AC_DEFINE([CPU_x86_64], [], [cpu type x86_64])
+ AC_DEFINE([_GNU_SOURCE], [1], [GNU Source])
+ AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
+ AC_CHECK_DECLS([__sync_add_and_fetch])
platform="linux"
# relative to sysconfdir
initdir=/rc.d/init.d
14 years, 11 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd result.c, 1.15, 1.16 slapi_counter.c, 1.3, 1.4
by Nathan Kinder
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27022/ldap/servers/slapd
Modified Files:
result.c slapi_counter.c
Log Message:
Resolves: 207457
Summary: Added 64-bit atomic functions for platforms lacking built-ins.
Index: result.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/result.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- result.c 24 Oct 2008 22:36:58 -0000 1.15
+++ result.c 29 Oct 2008 19:16:29 -0000 1.16
@@ -60,8 +60,8 @@
#include <ssl.h>
-Slapi_Counter *num_entries_sent;
-Slapi_Counter *num_bytes_sent;
+static Slapi_Counter *num_entries_sent;
+static Slapi_Counter *num_bytes_sent;
static long current_conn_count;
static PRLock *current_conn_count_mutex;
Index: slapi_counter.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi_counter.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- slapi_counter.c 25 Oct 2008 17:22:52 -0000 1.3
+++ slapi_counter.c 29 Oct 2008 19:16:29 -0000 1.4
@@ -52,6 +52,24 @@
#include <machine/sys/inline.h>
#endif
#endif
+
+#if defined LINUX && (defined CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH)
+/* On systems that don't have the 64-bit GCC atomic builtins, we need to
+ * implement our own atomic functions using inline assembly code. */
+static PRUint64 __sync_add_and_fetch_8(PRUint64 *ptr, PRUint64 addval);
+static PRUint64 __sync_sub_and_fetch_8(PRUint64 *ptr, PRUint64 subval);
+#endif
+
+#if defined LINUX && !HAVE_DECL___SYNC_ADD_AND_FETCH
+/* Systems that have the atomic builtins defined, but don't have
+ * implementations for 64-bit values will automatically try to
+ * call the __sync_*_8 versions we provide. If the atomic builtins
+ * are not defined at all, we define them here to use our local
+ * functions. */
+#define __sync_add_and_fetch __sync_add_and_fetch_8
+#define __sync_sub_and_fetch __sync_sub_and_fetch_8
+#endif
+
/*
* Counter Structure
*/
@@ -271,12 +289,49 @@
return newvalue;
#else
#ifdef LINUX
+/* Use our own inline assembly for an atomic set if
+ * the builtins aren't available. */
+#if defined CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH
+ /*
+ * %0 = counter->value
+ * %1 = newvalue
+ */
+ __asm__ __volatile__(
+#ifdef CPU_x86
+ /* Save the PIC register */
+ " pushl %%ebx;"
+#endif /* CPU_x86 */
+ /* Put value of counter->value in EDX:EAX */
+ "retryset: movl %0, %%eax;"
+ " movl 4%0, %%edx;"
+ /* Put newval in ECX:EBX */
+ " movl %1, %%ebx;"
+ " movl 4%1, %%ecx;"
+ /* If EDX:EAX and counter-> are the same,
+ * replace *ptr with ECX:EBX */
+ " lock; cmpxchg8b %0;"
+ " jnz retryset;"
+#ifdef CPU_x86
+ /* Restore the PIC register */
+ " popl %%ebx"
+#endif /* CPU_x86 */
+ : "+o" (counter->value)
+ : "m" (newvalue)
+#ifdef CPU_x86
+ : "memory", "eax", "ecx", "edx", "cc");
+#else
+ : "memory", "eax", "ebx", "ecx", "edx", "cc");
+#endif
+
+ return newvalue;
+#else
while (1) {
value = counter->value;
if (__sync_bool_compare_and_swap(&(counter->value), value, newvalue)) {
return newvalue;
}
}
+#endif /* CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH */
#elif defined(SOLARIS)
_sparcv9_AtomicSet(&(counter->value), newvalue);
return newvalue;
@@ -310,12 +365,50 @@
slapi_unlock_mutex(counter->lock);
#else
#ifdef LINUX
+/* Use our own inline assembly for an atomic get if
+ * the builtins aren't available. */
+#if defined CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH
+ /*
+ * %0 = counter->value
+ * %1 = value
+ */
+ __asm__ __volatile__(
+#ifdef CPU_x86
+ /* Save the PIC register */
+ " pushl %%ebx;"
+#endif /* CPU_x86 */
+ /* Put value of counter->value in EDX:EAX */
+ "retryget: movl %0, %%eax;"
+ " movl 4%0, %%edx;"
+ /* Copy EDX:EAX to ECX:EBX */
+ " movl %%eax, %%ebx;"
+ " movl %%edx, %%ecx;"
+ /* If EDX:EAX and counter->value are the same,
+ * replace *ptr with ECX:EBX */
+ " lock; cmpxchg8b %0;"
+ " jnz retryget;"
+ /* Put retreived value into value */
+ " movl %%ebx, %1;"
+ " movl %%ecx, 4%1;"
+#ifdef CPU_x86
+ /* Restore the PIC register */
+ " popl %%ebx"
+#endif /* CPU_x86 */
+ : "+o" (counter->value), "=m" (value)
+ :
+#ifdef CPU_x86
+ : "memory", "eax", "ecx", "edx", "cc");
+#else
+ : "memory", "eax", "ebx", "ecx", "edx", "cc");
+#endif
+#else
while (1) {
value = counter->value;
if (__sync_bool_compare_and_swap(&(counter->value), value, value)) {
break;
}
}
+#endif /* CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH */
#elif defined(SOLARIS)
while (1) {
value = counter->value;
@@ -334,3 +427,96 @@
return value;
}
+
+#if defined LINUX && (defined CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH)
+/* On systems that don't have the 64-bit GCC atomic builtins, we need to
+ * implement our own atomic add and subtract functions using inline
+ * assembly code. */
+static PRUint64 __sync_add_and_fetch_8(PRUint64 *ptr, PRUint64 addval)
+{
+ PRUint64 retval = 0;
+
+ /*
+ * %0 = *ptr
+ * %1 = retval
+ * %2 = addval
+ */
+ __asm__ __volatile__(
+#ifdef CPU_x86
+ /* Save the PIC register */
+ " pushl %%ebx;"
+#endif /* CPU_x86 */
+ /* Put value of *ptr in EDX:EAX */
+ "retryadd: movl %0, %%eax;"
+ " movl 4%0, %%edx;"
+ /* Put addval in ECX:EBX */
+ " movl %2, %%ebx;"
+ " movl 4%2, %%ecx;"
+ /* Add value from EDX:EAX to value in ECX:EBX */
+ " addl %%eax, %%ebx;"
+ " adcl %%edx, %%ecx;"
+ /* If EDX:EAX and *ptr are the same, replace ptr with ECX:EBX */
+ " lock; cmpxchg8b %0;"
+ " jnz retryadd;"
+ /* Put new value into retval */
+ " movl %%ebx, %1;"
+ " movl %%ecx, 4%1;"
+#ifdef CPU_x86
+ /* Restore the PIC register */
+ " popl %%ebx"
+#endif /* CPU_x86 */
+ : "+o" (*ptr), "=m" (retval)
+ : "m" (addval)
+#ifdef CPU_x86
+ : "memory", "eax", "ecx", "edx", "cc");
+#else
+ : "memory", "eax", "ebx", "ecx", "edx", "cc");
+#endif
+
+ return retval;
+}
+
+static PRUint64 __sync_sub_and_fetch_8(PRUint64 *ptr, PRUint64 subval)
+{
+ PRUint64 retval = 0;
+
+ /*
+ * %0 = *ptr
+ * %1 = retval
+ * %2 = subval
+ */
+ __asm__ __volatile__(
+#ifdef CPU_x86
+ /* Save the PIC register */
+ " pushl %%ebx;"
+#endif /* CPU_x86 */
+ /* Put value of *ptr in EDX:EAX */
+ "retrysub: movl %0, %%eax;"
+ " movl 4%0, %%edx;"
+ /* Copy EDX:EAX to ECX:EBX */
+ " movl %%eax, %%ebx;"
+ " movl %%edx, %%ecx;"
+ /* Subtract subval from value in ECX:EBX */
+ " subl %2, %%ebx;"
+ " sbbl 4%2, %%ecx;"
+ /* If EDX:EAX and ptr are the same, replace *ptr with ECX:EBX */
+ " lock; cmpxchg8b %0;"
+ " jnz retrysub;"
+ /* Put new value into retval */
+ " movl %%ebx, %1;"
+ " movl %%ecx, 4%1;"
+#ifdef CPU_x86
+ /* Restore the PIC register */
+ " popl %%ebx"
+#endif /* CPU_x86 */
+ : "+o" (*ptr), "=m" (retval)
+ : "m" (subval)
+#ifdef CPU_x86
+ : "memory", "eax", "ecx", "edx", "cc");
+#else
+ : "memory", "eax", "ebx", "ecx", "edx", "cc");
+#endif
+
+ return retval;
+}
+#endif /* LINUX && (defined CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH) */
14 years, 11 months
[Fedora-directory-commits] ldapserver/ldap/servers/snmp ldap-agent.h, 1.11, 1.12
by Nathan Kinder
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/snmp
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27022/ldap/servers/snmp
Modified Files:
ldap-agent.h
Log Message:
Resolves: 207457
Summary: Added 64-bit atomic functions for platforms lacking built-ins.
Index: ldap-agent.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/snmp/ldap-agent.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ldap-agent.h 24 Oct 2008 22:36:59 -0000 1.11
+++ ldap-agent.h 29 Oct 2008 19:16:29 -0000 1.12
@@ -79,7 +79,10 @@
#ifdef HPUX
/* HP-UX doesn't define SEM_FAILED like other platforms, so
- * * we define it ourselves. */
+ * we define it ourselves. We make this define HP-UX specific
+ * since sem_open() doesn't seem to return the same value on
+ * all platforms in a failure case (it's 1 on some platforms,
+ * and 0 on others). */
#define SEM_FAILED ((sem_t *)(-1))
#endif
14 years, 11 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd snmp_collator.c, 1.16, 1.17
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv8774
Modified Files:
snmp_collator.c
Log Message:
Resolves: #207457
Summary: rhds 7.1 - server stats use 32-bit integers - entrycachehitratio 1503%
Description: added '/' at the head of the semaphore name.
Index: snmp_collator.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/snmp_collator.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- snmp_collator.c 24 Oct 2008 22:36:58 -0000 1.16
+++ snmp_collator.c 28 Oct 2008 00:18:27 -0000 1.17
@@ -429,7 +429,7 @@
}
PR_snprintf(szStatsFile, sizeof(szStatsFile), "%s/%s%s",
statspath, instname, AGT_STATS_EXTENSION);
- PR_snprintf(stats_sem_name, sizeof(stats_sem_name), "%s%s",
+ PR_snprintf(stats_sem_name, sizeof(stats_sem_name), "/%s%s",
instname, AGT_STATS_EXTENSION);
tmpstatsfile = szStatsFile;
slapi_ch_free_string(&statspath);
14 years, 11 months
[Fedora-directory-commits] CVSROOT loginfo,1.23,1.24
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/CVSROOT
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv2735
Modified Files:
loginfo
Log Message:
test commit filters
Index: loginfo
===================================================================
RCS file: /cvs/dirsec/CVSROOT/loginfo,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- loginfo 27 Oct 2008 17:33:46 -0000 1.23
+++ loginfo 27 Oct 2008 17:36:09 -0000 1.24
@@ -21,7 +21,7 @@
# v = new version number (post-checkin)
# t = tag or branch name
#
-# test mail filtering6
+# test mail filtering7
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
14 years, 11 months
[Fedora-directory-commits] CVSROOT loginfo,1.21,1.22
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/CVSROOT
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv29267
Modified Files:
loginfo
Log Message:
test commit filters
Index: loginfo
===================================================================
RCS file: /cvs/dirsec/CVSROOT/loginfo,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- loginfo 27 Oct 2008 17:09:17 -0000 1.21
+++ loginfo 27 Oct 2008 17:22:56 -0000 1.22
@@ -21,7 +21,7 @@
# v = new version number (post-checkin)
# t = tag or branch name
#
-# test mail filtering4
+# test mail filtering5
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
14 years, 11 months
[Fedora-directory-commits] CVSROOT loginfo,1.20,1.21
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/CVSROOT
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23958
Modified Files:
loginfo
Log Message:
test commit filters
Index: loginfo
===================================================================
RCS file: /cvs/dirsec/CVSROOT/loginfo,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- loginfo 27 Oct 2008 17:04:31 -0000 1.20
+++ loginfo 27 Oct 2008 17:09:17 -0000 1.21
@@ -21,7 +21,7 @@
# v = new version number (post-checkin)
# t = tag or branch name
#
-# test mail filtering3
+# test mail filtering4
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
14 years, 11 months