fix: handle EINTR correctly in get_cpu_mask_from_sysfs
[urcu.git] / src / compat_arch.c
index 461c7098adc97c74be65d6cc7cdc23915b861e2b..474a832811a4e2935f58d447cc2c3ea519ec89d5 100644 (file)
@@ -1,33 +1,19 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * compat_arch.c
- *
  * Userspace RCU library - architecture compatibility checks
- *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/arch.h>
 
-#if defined(URCU_ARCH_I386)
+#ifdef URCU_ARCH_X86_NO_CAS
 
 #include <stdio.h>
 #include <pthread.h>
 #include <signal.h>
-#include <assert.h>
+#include <urcu/assert.h>
 #include <urcu/uatomic.h>
 
 /*
@@ -41,7 +27,7 @@
 /*
  * It does not really matter if the constructor is called before using
  * the library, as long as the caller checks if __rcu_cas_avail < 0 and calls
- * compat_arch_init() explicitely if needed.
+ * compat_arch_init() explicitly if needed.
  */
 int __attribute__((constructor)) __rcu_cas_init(void);
 
@@ -95,11 +81,11 @@ static void mutex_lock_signal_save(pthread_mutex_t *mutex, sigset_t *oldmask)
 
        /* Disable signals */
        ret = sigfillset(&newmask);
-       assert(!ret);
+       urcu_posix_assert(!ret);
        ret = pthread_sigmask(SIG_BLOCK, &newmask, oldmask);
-       assert(!ret);
+       urcu_posix_assert(!ret);
        ret = pthread_mutex_lock(&__urcu_x86_compat_mutex);
-       assert(!ret);
+       urcu_posix_assert(!ret);
 }
 
 static void mutex_lock_signal_restore(pthread_mutex_t *mutex, sigset_t *oldmask)
@@ -107,9 +93,9 @@ static void mutex_lock_signal_restore(pthread_mutex_t *mutex, sigset_t *oldmask)
        int ret;
 
        ret = pthread_mutex_unlock(&__urcu_x86_compat_mutex);
-       assert(!ret);
+       urcu_posix_assert(!ret);
        ret = pthread_sigmask(SIG_SETMASK, oldmask, NULL);
-       assert(!ret);
+       urcu_posix_assert(!ret);
 }
 
 unsigned long _compat_uatomic_set(void *addr, unsigned long _new, int len)
This page took 0.023423 seconds and 4 git commands to generate.