[PATCH] Fix get_proc_path

Jakub Jelinek jakub@redhat.com
Thu Apr 3 11:02:00 GMT 2003


Hi!

atomic_compare_and_exchange_bool_acq returns non-zero if it failed to
exchange. This fixes getconf _NPROCESSORS_ONLN on my box.

2003-04-03  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/getsysstats.c (get_proc_path): Reverse test
	for atomic_compare_and_exchange_bool_acq failure.

--- libc/sysdeps/unix/sysv/linux/getsysstats.c.jj	2003-03-21 05:17:37.000000000 -0500
+++ libc/sysdeps/unix/sysv/linux/getsysstats.c	2003-04-03 05:31:09.000000000 -0500
@@ -85,7 +85,7 @@ get_proc_path (char *buffer, size_t bufs
 
   /* Now store the copied value.  But do it atomically.  */
   assert (sizeof (long int) == sizeof (void *__unbounded));
-  if (! atomic_compare_and_exchange_bool_acq (&mount_proc, copy_result, NULL))
+  if (atomic_compare_and_exchange_bool_acq (&mount_proc, copy_result, NULL))
     /* Replacing the value failed.  This means another thread was
        faster and we don't need the copy anymore.  */
     free (copy_result);

	Jakub



More information about the Libc-hacker mailing list