You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by David Reid <da...@kosh.jetnet.co.uk> on 2003/10/31 13:22:31 UTC

[PATCH] FreeBSD atomics

This changes i386 freeBSD to use the linux implementation. This gets
round the fact that the actual FreeBSD functions return void, which
doesn't gel with our api.

Tested on FreeBSD 4.8 and it allows all the tests to pass.

david


Index: include/apr_atomic.h
===================================================================
RCS file: /home/cvs/apr/include/apr_atomic.h,v
retrieving revision 1.60
diff -u -r1.60 apr_atomic.h
--- include/apr_atomic.h	15 Oct 2003 21:33:22 -0000	1.60
+++ include/apr_atomic.h	31 Oct 2003 11:50:47 -0000
@@ -70,7 +70,7 @@
 /* Platform includes for atomics */
 #if defined(NETWARE) || defined(__MVS__) /* OS/390 */
 #include <stdlib.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) && !defined(__i386__)
 #include <machine/atomic.h>
 #endif
 
@@ -325,7 +325,7 @@
 #define APR_OVERRIDE_ATOMIC_DEC     1
 #define APR_OVERRIDE_ATOMIC_CAS     1
 
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) && !defined(__i386__)
 
 #define apr_atomic_t apr_uint32_t
 #define apr_atomic_add(mem, val)     atomic_add_int(mem,val)
@@ -337,10 +337,11 @@
 #define apr_atomic_add32(mem, val)        apr_atomic_add(mem, val)
 #define apr_atomic_dec32(mem)             apr_atomic_dec(mem)
 #define apr_atomic_inc32(mem)             apr_atomic_inc(mem)
-#define apr_atomic_set32(mem)             apr_atomic_set(mem)
+#define apr_atomic_set32(mem, val)        apr_atomic_set(mem, val)
 #define apr_atomic_read32(mem)            apr_atomic_read(mem)
 
-#elif (defined(__linux__) || defined(__EMX__)) && defined(__i386__) && !APR_FORCE_ATOMIC_GENERIC
+#elif (defined(__linux__) || defined(__EMX__) || defined(__FreeBSD__)) \
+        && defined(__i386__) && !APR_FORCE_ATOMIC_GENERIC
 
 #define apr_atomic_t apr_uint32_t
 #define apr_atomic_cas(mem,with,cmp) \


Re: [PATCH] FreeBSD atomics

Posted by Jim Jagielski <ji...@jagunet.com>.
Confirmed on 4.9 as well.

On Oct 31, 2003, at 7:22 AM, David Reid wrote:

> This changes i386 freeBSD to use the linux implementation. This gets
> round the fact that the actual FreeBSD functions return void, which
> doesn't gel with our api.
>
> Tested on FreeBSD 4.8 and it allows all the tests to pass.
>
> david
>
>
> Index: include/apr_atomic.h
> ===================================================================
> RCS file: /home/cvs/apr/include/apr_atomic.h,v
> retrieving revision 1.60
> diff -u -r1.60 apr_atomic.h
> --- include/apr_atomic.h	15 Oct 2003 21:33:22 -0000	1.60
> +++ include/apr_atomic.h	31 Oct 2003 11:50:47 -0000
> @@ -70,7 +70,7 @@
>  /* Platform includes for atomics */
>  #if defined(NETWARE) || defined(__MVS__) /* OS/390 */
>  #include <stdlib.h>
> -#elif defined(__FreeBSD__)
> +#elif defined(__FreeBSD__) && !defined(__i386__)
>  #include <machine/atomic.h>
>  #endif
>
> @@ -325,7 +325,7 @@
>  #define APR_OVERRIDE_ATOMIC_DEC     1
>  #define APR_OVERRIDE_ATOMIC_CAS     1
>
> -#elif defined(__FreeBSD__)
> +#elif defined(__FreeBSD__) && !defined(__i386__)
>
>  #define apr_atomic_t apr_uint32_t
>  #define apr_atomic_add(mem, val)     atomic_add_int(mem,val)
> @@ -337,10 +337,11 @@
>  #define apr_atomic_add32(mem, val)        apr_atomic_add(mem, val)
>  #define apr_atomic_dec32(mem)             apr_atomic_dec(mem)
>  #define apr_atomic_inc32(mem)             apr_atomic_inc(mem)
> -#define apr_atomic_set32(mem)             apr_atomic_set(mem)
> +#define apr_atomic_set32(mem, val)        apr_atomic_set(mem, val)
>  #define apr_atomic_read32(mem)            apr_atomic_read(mem)
>
> -#elif (defined(__linux__) || defined(__EMX__)) && defined(__i386__) 
> && !APR_FORCE_ATOMIC_GENERIC
> +#elif (defined(__linux__) || defined(__EMX__) || 
> defined(__FreeBSD__)) \
> +        && defined(__i386__) && !APR_FORCE_ATOMIC_GENERIC
>
>  #define apr_atomic_t apr_uint32_t
>  #define apr_atomic_cas(mem,with,cmp) \
>


Re: [PATCH] FreeBSD atomics

Posted by David Reid <da...@jetnet.co.uk>.
If no objections I'll commit tomorrow when I get home.

david

----- Original Message ----- 
From: "Paul Querna" <ch...@force-elite.com>
To: <de...@apr.apache.org>
Sent: Sunday, November 02, 2003 5:14 AM
Subject: Re: [PATCH] FreeBSD atomics


> On Fri, 31 Oct 2003 12:22:31 +0000, David Reid wrote
> > This changes i386 freeBSD to use the linux implementation. This gets
> > round the fact that the actual FreeBSD functions return void, which
> > doesn't gel with our api.
> > 
> > Tested on FreeBSD 4.8 and it allows all the tests to pass.
> > 
> > david
> 
> This also fixes Atomics on FreeBSD-CURRENT and 5.1 for me.
> 
> -chip
> 


Re: [PATCH] FreeBSD atomics

Posted by Paul Querna <ch...@force-elite.com>.
On Fri, 31 Oct 2003 12:22:31 +0000, David Reid wrote
> This changes i386 freeBSD to use the linux implementation. This gets
> round the fact that the actual FreeBSD functions return void, which
> doesn't gel with our api.
> 
> Tested on FreeBSD 4.8 and it allows all the tests to pass.
> 
> david

This also fixes Atomics on FreeBSD-CURRENT and 5.1 for me.

-chip