summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLLVM libc <llvm-libc@google.com>2024-04-19 09:15:47 -0700
committerCopybara-Service <copybara-worker@google.com>2024-04-20 00:10:23 -0700
commit75a947884d47ca92cea2a2ec06c04d931b5319e8 (patch)
tree42019d6840c8f382463090f2e50cbb59df7e9200
parent33e5bf0487e3fb4aa2ce10ef98f1d4d22c1f5146 (diff)
downloadllvm-libc-75a947884d47ca92cea2a2ec06c04d931b5319e8.tar.gz
Project import generated by Copybara.
GitOrigin-RevId: 854cc8986650267846c5eaf8ba164584a9ea7c01 Change-Id: I4f0a5ca6d39b6ecda10f2765adc24e754f7b6d1a
-rw-r--r--include/llvm-libc-types/pthread_condattr_t.h18
-rw-r--r--libc/hdr/types/fenv_t.h22
-rw-r--r--libc/hdr/types/fexcept_t.h22
-rw-r--r--src/__support/FPUtil/FEnvImpl.h3
-rw-r--r--src/__support/FPUtil/aarch64/FEnvImpl.h2
-rw-r--r--src/__support/FPUtil/aarch64/fenv_darwin_impl.h2
-rw-r--r--src/__support/FPUtil/arm/FEnvImpl.h2
-rw-r--r--src/__support/FPUtil/riscv/FEnvImpl.h2
-rw-r--r--src/__support/FPUtil/x86_64/FEnvImpl.h2
-rw-r--r--src/__support/macros/sanitizer.h5
-rw-r--r--src/fenv/fegetenv.h2
-rw-r--r--src/fenv/fegetexceptflag.cpp3
-rw-r--r--src/fenv/fegetexceptflag.h2
-rw-r--r--src/fenv/feholdexcept.cpp2
-rw-r--r--src/fenv/feholdexcept.h2
-rw-r--r--src/fenv/fesetenv.h2
-rw-r--r--src/fenv/fesetexceptflag.cpp2
-rw-r--r--src/fenv/fesetexceptflag.h2
-rw-r--r--src/fenv/fetestexceptflag.cpp23
-rw-r--r--src/fenv/fetestexceptflag.h20
-rw-r--r--src/fenv/feupdateenv.cpp2
-rw-r--r--src/fenv/feupdateenv.h2
-rw-r--r--src/pthread/pthread_condattr_destroy.cpp24
-rw-r--r--src/pthread/pthread_condattr_destroy.h20
-rw-r--r--src/pthread/pthread_condattr_getclock.cpp25
-rw-r--r--src/pthread/pthread_condattr_getclock.h22
-rw-r--r--src/pthread/pthread_condattr_getpshared.cpp24
-rw-r--r--src/pthread/pthread_condattr_getpshared.h21
-rw-r--r--src/pthread/pthread_condattr_init.cpp24
-rw-r--r--src/pthread/pthread_condattr_init.h20
-rw-r--r--src/pthread/pthread_condattr_setclock.cpp30
-rw-r--r--src/pthread/pthread_condattr_setclock.h21
-rw-r--r--src/pthread/pthread_condattr_setpshared.cpp28
-rw-r--r--src/pthread/pthread_condattr_setpshared.h20
-rw-r--r--src/unistd/linux/pipe.cpp2
-rw-r--r--test/UnitTest/FPExceptMatcher.cpp7
-rw-r--r--test/src/fenv/exception_flags_test.cpp35
-rw-r--r--test/src/fenv/feholdexcept_test.cpp3
-rw-r--r--test/src/fenv/feupdateenv_test.cpp2
-rw-r--r--test/src/fenv/getenv_and_setenv_test.cpp3
-rw-r--r--test/src/pthread/pthread_condattr_test.cpp82
41 files changed, 520 insertions, 37 deletions
diff --git a/include/llvm-libc-types/pthread_condattr_t.h b/include/llvm-libc-types/pthread_condattr_t.h
new file mode 100644
index 000000000000..b91fc2950aa3
--- /dev/null
+++ b/include/llvm-libc-types/pthread_condattr_t.h
@@ -0,0 +1,18 @@
+//===-- Definition of pthread_condattr_t type -----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_LIBC_TYPES_PTHREAD_CONDATTR_T_H
+#define LLVM_LIBC_TYPES_PTHREAD_CONDATTR_T_H
+
+#include "clockid_t.h"
+
+typedef struct {
+ clockid_t clock;
+ int pshared;
+} pthread_condattr_t;
+
+#endif // LLVM_LIBC_TYPES_PTHREAD_CONDATTR_T_H
diff --git a/libc/hdr/types/fenv_t.h b/libc/hdr/types/fenv_t.h
new file mode 100644
index 000000000000..dc2dd0217a16
--- /dev/null
+++ b/libc/hdr/types/fenv_t.h
@@ -0,0 +1,22 @@
+//===-- Definition of macros from fenv_t.h --------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_FENV_T_H
+#define LLVM_LIBC_HDR_FENV_T_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/fenv_t.h"
+
+#else // Overlay mode
+
+#include <fenv.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_FENV_T_H
diff --git a/libc/hdr/types/fexcept_t.h b/libc/hdr/types/fexcept_t.h
new file mode 100644
index 000000000000..7a6702516f0a
--- /dev/null
+++ b/libc/hdr/types/fexcept_t.h
@@ -0,0 +1,22 @@
+//===-- Definition of macros from fexcept_t.h -----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_FEXCEPT_T_H
+#define LLVM_LIBC_HDR_FEXCEPT_T_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/fexcept_t.h"
+
+#else // Overlay mode
+
+#include <fenv.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_FENV_T_H
diff --git a/src/__support/FPUtil/FEnvImpl.h b/src/__support/FPUtil/FEnvImpl.h
index 4be1a57f0f4b..13e668becc65 100644
--- a/src/__support/FPUtil/FEnvImpl.h
+++ b/src/__support/FPUtil/FEnvImpl.h
@@ -9,11 +9,12 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_FPUTIL_FENVIMPL_H
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_FENVIMPL_H
+#include "hdr/fenv_macros.h"
#include "hdr/math_macros.h"
+#include "hdr/types/fenv_t.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/properties/architectures.h"
#include "src/errno/libc_errno.h"
-#include <fenv.h>
#if defined(LIBC_TARGET_ARCH_IS_AARCH64)
#if defined(__APPLE__)
diff --git a/src/__support/FPUtil/aarch64/FEnvImpl.h b/src/__support/FPUtil/aarch64/FEnvImpl.h
index 4b593cdd8cc4..d1d92169475d 100644
--- a/src/__support/FPUtil/aarch64/FEnvImpl.h
+++ b/src/__support/FPUtil/aarch64/FEnvImpl.h
@@ -17,10 +17,10 @@
#endif
#include <arm_acle.h>
-#include <fenv.h>
#include <stdint.h>
#include "hdr/fenv_macros.h"
+#include "hdr/types/fenv_t.h"
#include "src/__support/FPUtil/FPBits.h"
namespace LIBC_NAMESPACE {
diff --git a/src/__support/FPUtil/aarch64/fenv_darwin_impl.h b/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
index 773d6bfe9f89..5b59ba38d67b 100644
--- a/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
+++ b/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
@@ -17,10 +17,10 @@
#endif
#include <arm_acle.h>
-#include <fenv.h>
#include <stdint.h>
#include "hdr/fenv_macros.h"
+#include "hdr/types/fenv_t.h"
#include "src/__support/FPUtil/FPBits.h"
namespace LIBC_NAMESPACE {
diff --git a/src/__support/FPUtil/arm/FEnvImpl.h b/src/__support/FPUtil/arm/FEnvImpl.h
index ddb0edcf8278..78fbda4f7aff 100644
--- a/src/__support/FPUtil/arm/FEnvImpl.h
+++ b/src/__support/FPUtil/arm/FEnvImpl.h
@@ -10,9 +10,9 @@
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_ARM_FENVIMPL_H
#include "hdr/fenv_macros.h"
+#include "hdr/types/fenv_t.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/macros/attributes.h" // For LIBC_INLINE
-#include <fenv.h>
#include <stdint.h>
namespace LIBC_NAMESPACE {
diff --git a/src/__support/FPUtil/riscv/FEnvImpl.h b/src/__support/FPUtil/riscv/FEnvImpl.h
index a5224330f339..e7aee3ba4b91 100644
--- a/src/__support/FPUtil/riscv/FEnvImpl.h
+++ b/src/__support/FPUtil/riscv/FEnvImpl.h
@@ -10,11 +10,11 @@
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV_FENVIMPL_H
#include "hdr/fenv_macros.h"
+#include "hdr/types/fenv_t.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/macros/attributes.h" // For LIBC_INLINE_ASM
#include "src/__support/macros/config.h" // For LIBC_INLINE
-#include <fenv.h>
#include <stdint.h>
namespace LIBC_NAMESPACE {
diff --git a/src/__support/FPUtil/x86_64/FEnvImpl.h b/src/__support/FPUtil/x86_64/FEnvImpl.h
index b73b70e90779..0595658d7df3 100644
--- a/src/__support/FPUtil/x86_64/FEnvImpl.h
+++ b/src/__support/FPUtil/x86_64/FEnvImpl.h
@@ -16,9 +16,9 @@
#error "Invalid include"
#endif
-#include <fenv.h>
#include <stdint.h>
+#include "hdr/types/fenv_t.h"
#include "src/__support/macros/sanitizer.h"
namespace LIBC_NAMESPACE {
diff --git a/src/__support/macros/sanitizer.h b/src/__support/macros/sanitizer.h
index bd9b62b7121a..baf44f7996ca 100644
--- a/src/__support/macros/sanitizer.h
+++ b/src/__support/macros/sanitizer.h
@@ -47,14 +47,13 @@
// Functions to unpoison memory
//-----------------------------------------------------------------------------
-#if defined(LIBC_HAVE_MEMORY_SANITIZER) && __has_builtin(__builtin_constant_p)
+#if defined(LIBC_HAVE_MEMORY_SANITIZER)
// Only perform MSAN unpoison in non-constexpr context.
#include <sanitizer/msan_interface.h>
#define MSAN_UNPOISON(addr, size) \
do { \
- if (!__builtin_constant_p(*addr)) { \
+ if (!__builtin_is_constant_evaluated()) \
__msan_unpoison(addr, size); \
- } \
} while (0)
#else
#define MSAN_UNPOISON(ptr, size)
diff --git a/src/fenv/fegetenv.h b/src/fenv/fegetenv.h
index 658316482984..8d3302964740 100644
--- a/src/fenv/fegetenv.h
+++ b/src/fenv/fegetenv.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_FENV_FEGETENV_H
#define LLVM_LIBC_SRC_FENV_FEGETENV_H
-#include <fenv.h>
+#include "hdr/types/fenv_t.h"
namespace LIBC_NAMESPACE {
diff --git a/src/fenv/fegetexceptflag.cpp b/src/fenv/fegetexceptflag.cpp
index c6160da7afbd..72f31bf7abd5 100644
--- a/src/fenv/fegetexceptflag.cpp
+++ b/src/fenv/fegetexceptflag.cpp
@@ -7,11 +7,10 @@
//===----------------------------------------------------------------------===//
#include "src/fenv/fegetexceptflag.h"
+#include "hdr/types/fexcept_t.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-#include <fenv.h>
-
namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fegetexceptflag, (fexcept_t * flagp, int excepts)) {
diff --git a/src/fenv/fegetexceptflag.h b/src/fenv/fegetexceptflag.h
index ad72161e536f..fcb9598658d4 100644
--- a/src/fenv/fegetexceptflag.h
+++ b/src/fenv/fegetexceptflag.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_FENV_FEGETEXCEPTFLAG_H
#define LLVM_LIBC_SRC_FENV_FEGETEXCEPTFLAG_H
-#include <fenv.h>
+#include "hdr/types/fexcept_t.h"
namespace LIBC_NAMESPACE {
diff --git a/src/fenv/feholdexcept.cpp b/src/fenv/feholdexcept.cpp
index f264c5ae251d..e5ca257e2be5 100644
--- a/src/fenv/feholdexcept.cpp
+++ b/src/fenv/feholdexcept.cpp
@@ -7,9 +7,9 @@
//===----------------------------------------------------------------------===//
#include "src/fenv/feholdexcept.h"
+#include "hdr/types/fenv_t.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-#include <fenv.h>
namespace LIBC_NAMESPACE {
diff --git a/src/fenv/feholdexcept.h b/src/fenv/feholdexcept.h
index bbefc4ecbd41..e53619e12fea 100644
--- a/src/fenv/feholdexcept.h
+++ b/src/fenv/feholdexcept.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_FENV_FEHOLDEXCEPT_H
#define LLVM_LIBC_SRC_FENV_FEHOLDEXCEPT_H
-#include <fenv.h>
+#include "hdr/types/fenv_t.h"
namespace LIBC_NAMESPACE {
diff --git a/src/fenv/fesetenv.h b/src/fenv/fesetenv.h
index 8b56bebc2e36..8636711cb1fe 100644
--- a/src/fenv/fesetenv.h
+++ b/src/fenv/fesetenv.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_FENV_FESETENV_H
#define LLVM_LIBC_SRC_FENV_FESETENV_H
-#include <fenv.h>
+#include "hdr/types/fenv_t.h"
namespace LIBC_NAMESPACE {
diff --git a/src/fenv/fesetexceptflag.cpp b/src/fenv/fesetexceptflag.cpp
index 3ff8e270dc0a..628f33dcb9c4 100644
--- a/src/fenv/fesetexceptflag.cpp
+++ b/src/fenv/fesetexceptflag.cpp
@@ -7,9 +7,9 @@
//===----------------------------------------------------------------------===//
#include "src/fenv/fesetexceptflag.h"
+#include "hdr/types/fexcept_t.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-#include <fenv.h>
namespace LIBC_NAMESPACE {
diff --git a/src/fenv/fesetexceptflag.h b/src/fenv/fesetexceptflag.h
index 15e62eda1b84..a018358dc9df 100644
--- a/src/fenv/fesetexceptflag.h
+++ b/src/fenv/fesetexceptflag.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_FENV_FESETEXCEPTFLAG_H
#define LLVM_LIBC_SRC_FENV_FESETEXCEPTFLAG_H
-#include <fenv.h>
+#include "hdr/types/fexcept_t.h"
namespace LIBC_NAMESPACE {
diff --git a/src/fenv/fetestexceptflag.cpp b/src/fenv/fetestexceptflag.cpp
new file mode 100644
index 000000000000..63453350a199
--- /dev/null
+++ b/src/fenv/fetestexceptflag.cpp
@@ -0,0 +1,23 @@
+//===-- Implementation of fetestexceptflag function -----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/fenv/fetestexceptflag.h"
+#include "hdr/types/fexcept_t.h"
+#include "src/__support/FPUtil/FEnvImpl.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(int, fetestexceptflag,
+ (const fexcept_t *flagp, int excepts)) {
+ static_assert(sizeof(int) >= sizeof(fexcept_t),
+ "fexcept_t value cannot fit in an int value.");
+ return *flagp | fputil::test_except(excepts);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/src/fenv/fetestexceptflag.h b/src/fenv/fetestexceptflag.h
new file mode 100644
index 000000000000..1c8b0b843f54
--- /dev/null
+++ b/src/fenv/fetestexceptflag.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for fetestexceptflag --------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_FENV_FETESTEXCEPTFLAG_H
+#define LLVM_LIBC_SRC_FENV_FETESTEXCEPTFLAG_H
+
+#include "hdr/types/fexcept_t.h"
+
+namespace LIBC_NAMESPACE {
+
+int fetestexceptflag(const fexcept_t *, int excepts);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_FENV_FETESTEXCEPTFLAG_H
diff --git a/src/fenv/feupdateenv.cpp b/src/fenv/feupdateenv.cpp
index 7e81b9476da9..066486353815 100644
--- a/src/fenv/feupdateenv.cpp
+++ b/src/fenv/feupdateenv.cpp
@@ -10,7 +10,7 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-#include <fenv.h>
+#include "hdr/types/fenv_t.h"
namespace LIBC_NAMESPACE {
diff --git a/src/fenv/feupdateenv.h b/src/fenv/feupdateenv.h
index 294c041ddeae..3c9c88b36e72 100644
--- a/src/fenv/feupdateenv.h
+++ b/src/fenv/feupdateenv.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_FENV_FEUPDATEENV_H
#define LLVM_LIBC_SRC_FENV_FEUPDATEENV_H
-#include <fenv.h>
+#include "hdr/types/fenv_t.h"
namespace LIBC_NAMESPACE {
diff --git a/src/pthread/pthread_condattr_destroy.cpp b/src/pthread/pthread_condattr_destroy.cpp
new file mode 100644
index 000000000000..41994c6941ff
--- /dev/null
+++ b/src/pthread/pthread_condattr_destroy.cpp
@@ -0,0 +1,24 @@
+//===-- Implementation of the pthread_condattr_destroy --------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "pthread_condattr_destroy.h"
+
+#include "src/__support/common.h"
+
+#include <pthread.h>
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(int, pthread_condattr_destroy,
+ (pthread_condattr_t * attr [[gnu::unused]])) {
+ // Initializing a pthread_condattr_t acquires no resources, so this is a
+ // no-op.
+ return 0;
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/src/pthread/pthread_condattr_destroy.h b/src/pthread/pthread_condattr_destroy.h
new file mode 100644
index 000000000000..2910fa9f9616
--- /dev/null
+++ b/src/pthread/pthread_condattr_destroy.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for pthread_condattr_destroy ------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_DESTROY_H
+#define LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_DESTROY_H
+
+#include <pthread.h>
+
+namespace LIBC_NAMESPACE {
+
+int pthread_condattr_destroy(pthread_condattr_t *attr);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_DESTROY_H
diff --git a/src/pthread/pthread_condattr_getclock.cpp b/src/pthread/pthread_condattr_getclock.cpp
new file mode 100644
index 000000000000..a3a3963f4f42
--- /dev/null
+++ b/src/pthread/pthread_condattr_getclock.cpp
@@ -0,0 +1,25 @@
+//===-- Implementation of the pthread_condattr_getclock -------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "pthread_condattr_getclock.h"
+
+#include "src/__support/common.h"
+
+#include <pthread.h> // pthread_condattr_t
+#include <sys/types.h> // clockid_t
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(int, pthread_condattr_getclock,
+ (const pthread_condattr_t *__restrict attr,
+ clockid_t *__restrict clock_id)) {
+ *clock_id = attr->clock;
+ return 0;
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/src/pthread/pthread_condattr_getclock.h b/src/pthread/pthread_condattr_getclock.h
new file mode 100644
index 000000000000..d5878c4f45b5
--- /dev/null
+++ b/src/pthread/pthread_condattr_getclock.h
@@ -0,0 +1,22 @@
+//===-- Implementation header for pthread_condattr_getclock -----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_GETCLOCK_H
+#define LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_GETCLOCK_H
+
+#include <pthread.h> // pthread_condattr_t
+#include <sys/types.h> // clockid_t
+
+namespace LIBC_NAMESPACE {
+
+int pthread_condattr_getclock(const pthread_condattr_t *__restrict attr,
+ clockid_t *__restrict clock_id);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_GETCLOCK_H
diff --git a/src/pthread/pthread_condattr_getpshared.cpp b/src/pthread/pthread_condattr_getpshared.cpp
new file mode 100644
index 000000000000..0c5fdc115c25
--- /dev/null
+++ b/src/pthread/pthread_condattr_getpshared.cpp
@@ -0,0 +1,24 @@
+//===-- Implementation of the pthread_condattr_getpshared -----------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "pthread_condattr_getpshared.h"
+
+#include "src/__support/common.h"
+
+#include <pthread.h>
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(int, pthread_condattr_getpshared,
+ (const pthread_condattr_t *__restrict attr,
+ int *__restrict pshared)) {
+ *pshared = attr->pshared;
+ return 0;
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/src/pthread/pthread_condattr_getpshared.h b/src/pthread/pthread_condattr_getpshared.h
new file mode 100644
index 000000000000..3d7a0c1d357c
--- /dev/null
+++ b/src/pthread/pthread_condattr_getpshared.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for pthread_condattr_getpshared ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_PSHARED_H
+#define LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_PSHARED_H
+
+#include <pthread.h>
+
+namespace LIBC_NAMESPACE {
+
+int pthread_condattr_getpshared(const pthread_condattr_t *__restrict attr,
+ int *__restrict pshared);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_PSHARED_H
diff --git a/src/pthread/pthread_condattr_init.cpp b/src/pthread/pthread_condattr_init.cpp
new file mode 100644
index 000000000000..54633b2e3a5e
--- /dev/null
+++ b/src/pthread/pthread_condattr_init.cpp
@@ -0,0 +1,24 @@
+//===-- Implementation of the pthread_condattr_init -----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "pthread_condattr_init.h"
+
+#include "src/__support/common.h"
+
+#include <pthread.h> // pthread_condattr_t, PTHREAD_PROCESS_PRIVATE
+#include <time.h> // CLOCK_REALTIME
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(int, pthread_condattr_init, (pthread_condattr_t * attr)) {
+ attr->clock = CLOCK_REALTIME;
+ attr->pshared = PTHREAD_PROCESS_PRIVATE;
+ return 0;
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/src/pthread/pthread_condattr_init.h b/src/pthread/pthread_condattr_init.h
new file mode 100644
index 000000000000..9f3c06bb6f4a
--- /dev/null
+++ b/src/pthread/pthread_condattr_init.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for pthread_condattr_init ---------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_INIT_H
+#define LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_INIT_H
+
+#include <pthread.h>
+
+namespace LIBC_NAMESPACE {
+
+int pthread_condattr_init(pthread_condattr_t *attr);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_INIT_H
diff --git a/src/pthread/pthread_condattr_setclock.cpp b/src/pthread/pthread_condattr_setclock.cpp
new file mode 100644
index 000000000000..6eca8b30ef7f
--- /dev/null
+++ b/src/pthread/pthread_condattr_setclock.cpp
@@ -0,0 +1,30 @@
+//===-- Implementation of the pthread_condattr_setclock -------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "pthread_condattr_setclock.h"
+
+#include "src/__support/common.h"
+
+#include <errno.h> // EINVAL
+#include <pthread.h> // pthread_condattr_t
+#include <sys/types.h> // clockid_t
+#include <time.h> // CLOCK_MONOTONIC, CLOCK_REALTIME
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(int, pthread_condattr_setclock,
+ (pthread_condattr_t * attr, clockid_t clock)) {
+
+ if (clock != CLOCK_MONOTONIC && clock != CLOCK_REALTIME)
+ return EINVAL;
+
+ attr->clock = clock;
+ return 0;
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/src/pthread/pthread_condattr_setclock.h b/src/pthread/pthread_condattr_setclock.h
new file mode 100644
index 000000000000..328766fe7883
--- /dev/null
+++ b/src/pthread/pthread_condattr_setclock.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for pthread_condattr_setclock -----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_SETCLOCK_H
+#define LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_SETCLOCK_H
+
+#include <pthread.h>
+#include <sys/types.h> // clockid_t
+
+namespace LIBC_NAMESPACE {
+
+int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_SETCLOCK_H
diff --git a/src/pthread/pthread_condattr_setpshared.cpp b/src/pthread/pthread_condattr_setpshared.cpp
new file mode 100644
index 000000000000..7f1560acad84
--- /dev/null
+++ b/src/pthread/pthread_condattr_setpshared.cpp
@@ -0,0 +1,28 @@
+//===-- Implementation of the pthread_condattr_setpshared -----------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "pthread_condattr_setpshared.h"
+
+#include "src/__support/common.h"
+
+#include <errno.h> // EINVAL
+#include <pthread.h> // pthread_condattr_t, PTHREAD_PROCESS_SHARED, PTHREAD_PROCESS_PRIVATE
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(int, pthread_condattr_setpshared,
+ (pthread_condattr_t * attr, int pshared)) {
+
+ if (pshared != PTHREAD_PROCESS_SHARED && pshared != PTHREAD_PROCESS_PRIVATE)
+ return EINVAL;
+
+ attr->pshared = pshared;
+ return 0;
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/src/pthread/pthread_condattr_setpshared.h b/src/pthread/pthread_condattr_setpshared.h
new file mode 100644
index 000000000000..8083bdec78cc
--- /dev/null
+++ b/src/pthread/pthread_condattr_setpshared.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for pthread_condattr_setpshared ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_SETPSHARED_H
+#define LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_SETPSHARED_H
+
+#include <pthread.h>
+
+namespace LIBC_NAMESPACE {
+
+int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_CONDATTR_SETPSHARED_H
diff --git a/src/unistd/linux/pipe.cpp b/src/unistd/linux/pipe.cpp
index b4e8b9b7d9c8..8cfb8d1d5c2c 100644
--- a/src/unistd/linux/pipe.cpp
+++ b/src/unistd/linux/pipe.cpp
@@ -10,6 +10,7 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/macros/sanitizer.h" // for MSAN_UNPOISON
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
@@ -23,6 +24,7 @@ LLVM_LIBC_FUNCTION(int, pipe, (int pipefd[2])) {
int ret = LIBC_NAMESPACE::syscall_impl<int>(
SYS_pipe2, reinterpret_cast<long>(pipefd), 0);
#endif
+ MSAN_UNPOISON(pipefd, sizeof(int) * 2);
if (ret < 0) {
libc_errno = -ret;
return -1;
diff --git a/test/UnitTest/FPExceptMatcher.cpp b/test/UnitTest/FPExceptMatcher.cpp
index 1601b7e53f2b..53ea72ad9ddd 100644
--- a/test/UnitTest/FPExceptMatcher.cpp
+++ b/test/UnitTest/FPExceptMatcher.cpp
@@ -8,7 +8,8 @@
#include "FPExceptMatcher.h"
-#include <fenv.h>
+#include "hdr/types/fenv_t.h"
+#include "src/__support/FPUtil/FEnvImpl.h"
#include <memory>
#include <setjmp.h>
#include <signal.h>
@@ -36,12 +37,12 @@ FPExceptMatcher::FPExceptMatcher(FunctionCaller *func) {
caughtExcept = false;
fenv_t oldEnv;
- fegetenv(&oldEnv);
+ fputil::get_env(&oldEnv);
if (sigsetjmp(jumpBuffer, 1) == 0)
funcUP->call();
// We restore the previous floating point environment after
// the call to the function which can potentially raise SIGFPE.
- fesetenv(&oldEnv);
+ fputil::set_env(&oldEnv);
signal(SIGFPE, oldSIGFPEHandler);
exceptionRaised = caughtExcept;
}
diff --git a/test/src/fenv/exception_flags_test.cpp b/test/src/fenv/exception_flags_test.cpp
index 434adc06b1a3..9d2be6426a6d 100644
--- a/test/src/fenv/exception_flags_test.cpp
+++ b/test/src/fenv/exception_flags_test.cpp
@@ -1,4 +1,4 @@
-//===-- Unittests for fegetexceptflag and fesetexceptflag -----------------===//
+//===-- Unittests for fe{get|set|test}exceptflag --------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,15 +6,15 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/types/fexcept_t.h"
#include "src/fenv/fegetexceptflag.h"
#include "src/fenv/fesetexceptflag.h"
+#include "src/fenv/fetestexceptflag.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "test/UnitTest/Test.h"
-#include <fenv.h>
-
-TEST(LlvmLibcFenvTest, GetExceptFlagAndSetExceptFlag) {
+TEST(LlvmLibcFenvTest, GetSetTestExceptFlag) {
// We will disable all exceptions to prevent invocation of the exception
// handler.
LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
@@ -40,19 +40,36 @@ TEST(LlvmLibcFenvTest, GetExceptFlagAndSetExceptFlag) {
ASSERT_EQ(LIBC_NAMESPACE::fesetexceptflag(&eflags, FE_ALL_EXCEPT), 0);
ASSERT_NE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
+ // Exception flags are exactly the flags corresponding to the previously
+ // raised exception.
+ ASSERT_EQ(LIBC_NAMESPACE::fetestexceptflag(&eflags, FE_ALL_EXCEPT),
+ LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT));
+
// Cleanup. We clear all excepts as raising excepts like FE_OVERFLOW
// can also raise FE_INEXACT.
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
}
- // Next, we will raise one exception and save the flags.
+ // Next, we will raise one exception, save the flag and clear all exceptions.
LIBC_NAMESPACE::fputil::raise_except(FE_INVALID);
- fexcept_t eflags;
- LIBC_NAMESPACE::fegetexceptflag(&eflags, FE_ALL_EXCEPT);
- // Clear all exceptions and raise two other exceptions.
+ fexcept_t invalid_flag;
+ LIBC_NAMESPACE::fegetexceptflag(&invalid_flag, FE_ALL_EXCEPT);
+ ASSERT_EQ(LIBC_NAMESPACE::fetestexceptflag(&invalid_flag, FE_ALL_EXCEPT),
+ FE_INVALID);
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+
+ // Raise two other exceptions and verify that they are set.
LIBC_NAMESPACE::fputil::raise_except(FE_OVERFLOW | FE_INEXACT);
+ fexcept_t overflow_and_inexact_flag;
+ LIBC_NAMESPACE::fegetexceptflag(&overflow_and_inexact_flag, FE_ALL_EXCEPT);
+ ASSERT_EQ(LIBC_NAMESPACE::fetestexceptflag(&overflow_and_inexact_flag,
+ FE_ALL_EXCEPT),
+ FE_OVERFLOW | FE_INEXACT);
+ ASSERT_EQ(LIBC_NAMESPACE::fetestexceptflag(&overflow_and_inexact_flag,
+ FE_OVERFLOW | FE_INEXACT),
+ FE_OVERFLOW | FE_INEXACT);
+
// When we set the flags and test, we should only see FE_INVALID.
- LIBC_NAMESPACE::fesetexceptflag(&eflags, FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fesetexceptflag(&invalid_flag, FE_ALL_EXCEPT);
EXPECT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT), FE_INVALID);
}
diff --git a/test/src/fenv/feholdexcept_test.cpp b/test/src/fenv/feholdexcept_test.cpp
index 735c7705ff49..0689d89ab233 100644
--- a/test/src/fenv/feholdexcept_test.cpp
+++ b/test/src/fenv/feholdexcept_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/types/fenv_t.h"
#include "src/fenv/feholdexcept.h"
#include "src/__support/FPUtil/FEnvImpl.h"
@@ -13,8 +14,6 @@
#include "test/UnitTest/FPExceptMatcher.h"
#include "test/UnitTest/Test.h"
-#include <fenv.h>
-
TEST(LlvmLibcFEnvTest, RaiseAndCrash) {
#if defined(LIBC_TARGET_ARCH_IS_ANY_ARM) || \
defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
diff --git a/test/src/fenv/feupdateenv_test.cpp b/test/src/fenv/feupdateenv_test.cpp
index 96f253f76077..251b8566aac3 100644
--- a/test/src/fenv/feupdateenv_test.cpp
+++ b/test/src/fenv/feupdateenv_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/types/fenv_t.h"
#include "src/fenv/feupdateenv.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "test/UnitTest/Test.h"
-#include <fenv.h>
#include <signal.h>
TEST(LlvmLibcFEnvTest, UpdateEnvTest) {
diff --git a/test/src/fenv/getenv_and_setenv_test.cpp b/test/src/fenv/getenv_and_setenv_test.cpp
index 8184a5c3bb99..f767e8ab9b2f 100644
--- a/test/src/fenv/getenv_and_setenv_test.cpp
+++ b/test/src/fenv/getenv_and_setenv_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/types/fenv_t.h"
#include "src/fenv/fegetenv.h"
#include "src/fenv/fegetround.h"
#include "src/fenv/fesetenv.h"
@@ -14,8 +15,6 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "test/UnitTest/Test.h"
-#include <fenv.h>
-
TEST(LlvmLibcFenvTest, GetEnvAndSetEnv) {
// We will disable all exceptions to prevent invocation of the exception
// handler.
diff --git a/test/src/pthread/pthread_condattr_test.cpp b/test/src/pthread/pthread_condattr_test.cpp
new file mode 100644
index 000000000000..5fcdbd99cb0e
--- /dev/null
+++ b/test/src/pthread/pthread_condattr_test.cpp
@@ -0,0 +1,82 @@
+//===-- Unittests for pthread_condattr_t ----------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "include/llvm-libc-macros/generic-error-number-macros.h" // EINVAL
+#include "include/llvm-libc-macros/time-macros.h" // CLOCK_REALTIME, CLOCK_MONOTONIC
+#include "src/pthread/pthread_condattr_destroy.h"
+#include "src/pthread/pthread_condattr_getclock.h"
+#include "src/pthread/pthread_condattr_getpshared.h"
+#include "src/pthread/pthread_condattr_init.h"
+#include "src/pthread/pthread_condattr_setclock.h"
+#include "src/pthread/pthread_condattr_setpshared.h"
+#include "test/UnitTest/Test.h"
+
+// TODO: https://github.com/llvm/llvm-project/issues/88997
+#include <pthread.h> // PTHREAD_PROCESS_PRIVATE, PTHREAD_PROCESS_SHARED
+
+TEST(LlvmLibcPThreadCondAttrTest, InitAndDestroy) {
+ pthread_condattr_t cond;
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_init(&cond), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_destroy(&cond), 0);
+}
+
+TEST(LlvmLibcPThreadCondAttrTest, GetDefaultValues) {
+ pthread_condattr_t cond;
+
+ // Invalid clock id.
+ clockid_t clock = 7;
+ // Invalid value.
+ int pshared = 42;
+
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_init(&cond), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_getclock(&cond, &clock), 0);
+ ASSERT_EQ(clock, CLOCK_REALTIME);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_getpshared(&cond, &pshared), 0);
+ ASSERT_EQ(pshared, PTHREAD_PROCESS_PRIVATE);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_destroy(&cond), 0);
+}
+
+TEST(LlvmLibcPThreadCondAttrTest, SetGoodValues) {
+ pthread_condattr_t cond;
+
+ // Invalid clock id.
+ clockid_t clock = 7;
+ // Invalid value.
+ int pshared = 42;
+
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_init(&cond), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_setclock(&cond, CLOCK_MONOTONIC),
+ 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_getclock(&cond, &clock), 0);
+ ASSERT_EQ(clock, CLOCK_MONOTONIC);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_setpshared(&cond,
+ PTHREAD_PROCESS_SHARED),
+ 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_getpshared(&cond, &pshared), 0);
+ ASSERT_EQ(pshared, PTHREAD_PROCESS_SHARED);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_destroy(&cond), 0);
+}
+
+TEST(LlvmLibcPThreadCondAttrTest, SetBadValues) {
+ pthread_condattr_t cond;
+
+ // Invalid clock id.
+ clockid_t clock = 7;
+ // Invalid value.
+ int pshared = 42;
+
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_init(&cond), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_setclock(&cond, clock), EINVAL);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_getclock(&cond, &clock), 0);
+ ASSERT_EQ(clock, CLOCK_REALTIME);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_setpshared(&cond, pshared),
+ EINVAL);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_getpshared(&cond, &pshared), 0);
+ ASSERT_EQ(pshared, PTHREAD_PROCESS_PRIVATE);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_condattr_destroy(&cond), 0);
+}