summaryrefslogtreecommitdiffstats
path: root/rubbos/app/httpd-2.0.64/srclib/apr/atomic
diff options
context:
space:
mode:
Diffstat (limited to 'rubbos/app/httpd-2.0.64/srclib/apr/atomic')
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr/atomic/netware/apr_atomic.c26
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr/atomic/os390/Makefile.in14
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr/atomic/os390/atomic.c44
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/.libs/apr_atomic.obin0 -> 11888 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/Makefile13
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/Makefile.in13
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/apr_atomic.c173
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/apr_atomic.lo12
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/apr_atomic.obin0 -> 11832 bytes
9 files changed, 295 insertions, 0 deletions
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr/atomic/netware/apr_atomic.c b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/netware/apr_atomic.c
new file mode 100644
index 00000000..82336cde
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/netware/apr_atomic.c
@@ -0,0 +1,26 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "apr.h"
+#include "apr_atomic.h"
+
+int apr_atomic_dec(apr_atomic_t *mem)
+{
+ atomic_dec(mem);
+ return *mem;
+}
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr/atomic/os390/Makefile.in b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/os390/Makefile.in
new file mode 100644
index 00000000..28cc1b6d
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/os390/Makefile.in
@@ -0,0 +1,14 @@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+TARGETS = atomic.lo
+
+# bring in rules.mk for standard functionality
+@INCLUDE_RULES@
+
+INCDIR=../../include
+OSDIR=$(INCDIR)/arch/@OSDIR@
+DEFOSDIR=$(INCDIR)/arch/@DEFAULT_OSDIR@
+INCLUDES=-I$(INCDIR) -I$(OSDIR) -I$(DEFOSDIR)
+
+# DO NOT REMOVE
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr/atomic/os390/atomic.c b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/os390/atomic.c
new file mode 100644
index 00000000..ce971e3f
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/os390/atomic.c
@@ -0,0 +1,44 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "apr.h"
+#include "apr_atomic.h"
+
+#if APR_HAS_THREADS
+
+apr_int32_t apr_atomic_add(volatile apr_atomic_t *mem, apr_int32_t val)
+{
+ apr_atomic_t old, new_val;
+
+ old = *mem; /* old is automatically updated on cs failure */
+ do {
+ new_val = old + val;
+ } while (__cs(&old, (cs_t *)mem, new_val));
+
+ return new_val;
+}
+
+apr_uint32_t apr_atomic_cas(volatile apr_atomic_t *mem, apr_uint32_t swap,
+ apr_uint32_t cmp)
+{
+ apr_uint32_t old = cmp;
+
+ __cs(&old, (cs_t *)mem, swap);
+ return old; /* old is automatically updated from mem on cs failure */
+}
+
+#endif /* APR_HAS_THREADS */
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/.libs/apr_atomic.o b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/.libs/apr_atomic.o
new file mode 100644
index 00000000..f31389f7
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/.libs/apr_atomic.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/Makefile b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/Makefile
new file mode 100644
index 00000000..b7002192
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/Makefile
@@ -0,0 +1,13 @@
+srcdir = .
+
+
+TARGETS = apr_atomic.lo
+
+# bring in rules.mk for standard functionality
+include /bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr/build/apr_rules.mk
+
+DEFOSDIR=$(INCDIR)/arch/unix
+INCDIR=../../include
+INCLUDES=-I$(INCDIR) -I$(DEFOSDIR)
+
+# DO NOT REMOVE
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/Makefile.in b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/Makefile.in
new file mode 100644
index 00000000..188d0d24
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/Makefile.in
@@ -0,0 +1,13 @@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+TARGETS = apr_atomic.lo
+
+# bring in rules.mk for standard functionality
+@INCLUDE_RULES@
+
+DEFOSDIR=$(INCDIR)/arch/@DEFAULT_OSDIR@
+INCDIR=../../include
+INCLUDES=-I$(INCDIR) -I$(DEFOSDIR)
+
+# DO NOT REMOVE
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/apr_atomic.c b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/apr_atomic.c
new file mode 100644
index 00000000..d7a223a0
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/apr_atomic.c
@@ -0,0 +1,173 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apr.h"
+#include "apr_atomic.h"
+#include "apr_thread_mutex.h"
+
+#if !defined(apr_atomic_init) && !defined(APR_OVERRIDE_ATOMIC_INIT)
+
+#if APR_HAS_THREADS
+#define NUM_ATOMIC_HASH 7
+/* shift by 2 to get rid of alignment issues */
+#define ATOMIC_HASH(x) (unsigned int)(((unsigned long)(x)>>2)%(unsigned int)NUM_ATOMIC_HASH)
+static apr_thread_mutex_t **hash_mutex;
+#endif /* APR_HAS_THREADS */
+
+apr_status_t apr_atomic_init(apr_pool_t *p)
+{
+#if APR_HAS_THREADS
+ int i;
+ apr_status_t rv;
+ hash_mutex = apr_palloc(p, sizeof(apr_thread_mutex_t*) * NUM_ATOMIC_HASH);
+
+ for (i = 0; i < NUM_ATOMIC_HASH; i++) {
+ rv = apr_thread_mutex_create(&(hash_mutex[i]),
+ APR_THREAD_MUTEX_DEFAULT, p);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+ }
+#endif /* APR_HAS_THREADS */
+ return APR_SUCCESS;
+}
+#endif /*!defined(apr_atomic_init) && !defined(APR_OVERRIDE_ATOMIC_INIT) */
+
+#if !defined(apr_atomic_add) && !defined(APR_OVERRIDE_ATOMIC_ADD)
+void apr_atomic_add(volatile apr_atomic_t *mem, apr_uint32_t val)
+{
+#if APR_HAS_THREADS
+ apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
+ apr_uint32_t prev;
+
+ if (apr_thread_mutex_lock(lock) == APR_SUCCESS) {
+ prev = *mem;
+ *mem += val;
+ apr_thread_mutex_unlock(lock);
+ }
+#else
+ *mem += val;
+#endif /* APR_HAS_THREADS */
+}
+#endif /*!defined(apr_atomic_add) && !defined(APR_OVERRIDE_ATOMIC_ADD) */
+
+#if !defined(apr_atomic_set) && !defined(APR_OVERRIDE_ATOMIC_SET)
+void apr_atomic_set(volatile apr_atomic_t *mem, apr_uint32_t val)
+{
+#if APR_HAS_THREADS
+ apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
+ apr_uint32_t prev;
+
+ if (apr_thread_mutex_lock(lock) == APR_SUCCESS) {
+ prev = *mem;
+ *mem = val;
+ apr_thread_mutex_unlock(lock);
+ }
+#else
+ *mem = val;
+#endif /* APR_HAS_THREADS */
+}
+#endif /*!defined(apr_atomic_set) && !defined(APR_OVERRIDE_ATOMIC_SET) */
+
+#if !defined(apr_atomic_inc) && !defined(APR_OVERRIDE_ATOMIC_INC)
+void apr_atomic_inc(volatile apr_uint32_t *mem)
+{
+#if APR_HAS_THREADS
+ apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
+ apr_uint32_t prev;
+
+ if (apr_thread_mutex_lock(lock) == APR_SUCCESS) {
+ prev = *mem;
+ (*mem)++;
+ apr_thread_mutex_unlock(lock);
+ }
+#else
+ (*mem)++;
+#endif /* APR_HAS_THREADS */
+}
+#endif /*!defined(apr_atomic_inc) && !defined(APR_OVERRIDE_ATOMIC_INC) */
+
+#if !defined(apr_atomic_dec) && !defined(APR_OVERRIDE_ATOMIC_DEC)
+int apr_atomic_dec(volatile apr_atomic_t *mem)
+{
+#if APR_HAS_THREADS
+ apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
+ apr_uint32_t new;
+
+ if (apr_thread_mutex_lock(lock) == APR_SUCCESS) {
+ (*mem)--;
+ new = *mem;
+ apr_thread_mutex_unlock(lock);
+ return new;
+ }
+#else
+ (*mem)--;
+#endif /* APR_HAS_THREADS */
+ return *mem;
+}
+#endif /*!defined(apr_atomic_dec) && !defined(APR_OVERRIDE_ATOMIC_DEC) */
+
+#if !defined(apr_atomic_cas) && !defined(APR_OVERRIDE_ATOMIC_CAS)
+apr_uint32_t apr_atomic_cas(volatile apr_uint32_t *mem, long with, long cmp)
+{
+ apr_uint32_t prev;
+#if APR_HAS_THREADS
+ apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
+
+ if (apr_thread_mutex_lock(lock) == APR_SUCCESS) {
+ prev = *mem;
+ if (prev == (apr_uint32_t)cmp) {
+ *mem = (apr_uint32_t)with;
+ }
+ apr_thread_mutex_unlock(lock);
+ return prev;
+ }
+ return *mem;
+#else
+ prev = *mem;
+ if (prev == (apr_uint32_t)cmp) {
+ *mem = (apr_uint32_t)with;
+ }
+ return prev;
+#endif /* APR_HAS_THREADS */
+}
+#endif /*!defined(apr_atomic_cas) && !defined(APR_OVERRIDE_ATOMIC_CAS) */
+
+#if !defined(apr_atomic_casptr) && !defined(APR_OVERRIDE_ATOMIC_CASPTR)
+void *apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
+{
+ void *prev;
+#if APR_HAS_THREADS
+ apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
+
+ if (apr_thread_mutex_lock(lock) == APR_SUCCESS) {
+ prev = *(void **)mem;
+ if (prev == cmp) {
+ *mem = with;
+ }
+ apr_thread_mutex_unlock(lock);
+ return prev;
+ }
+ return *(void **)mem;
+#else
+ prev = *(void **)mem;
+ if (prev == cmp) {
+ *mem = with;
+ }
+ return prev;
+#endif /* APR_HAS_THREADS */
+}
+#endif /*!defined(apr_atomic_cas) && !defined(APR_OVERRIDE_ATOMIC_CAS) */
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/apr_atomic.lo b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/apr_atomic.lo
new file mode 100644
index 00000000..3b16143d
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/apr_atomic.lo
@@ -0,0 +1,12 @@
+# apr_atomic.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/apr_atomic.o'
+
+# Name of the non-PIC object.
+non_pic_object='apr_atomic.o'
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/apr_atomic.o b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/apr_atomic.o
new file mode 100644
index 00000000..f5cb1491
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr/atomic/unix/apr_atomic.o
Binary files differ