-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Revert "[libc][POSIX][pthreads] implemented missing pthread_rwlockattr functions" #91966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…r functi…" This reverts commit d2676a7.
@llvm/pr-subscribers-libc Author: Schrodinger ZHU Yifan (SchrodingerZhu) ChangesReverts llvm/llvm-project#90249 Fullbuild is broken: https://lab.llvm.org/buildbot/#/builders/163/builds/56501 Full diff: https://github.com/llvm/llvm-project/pull/91966.diff 11 Files Affected:
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 155deddaaade3..5e3ddd34fb4dc 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -673,10 +673,8 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.pthread.pthread_mutexattr_settype
libc.src.pthread.pthread_once
libc.src.pthread.pthread_rwlockattr_destroy
- libc.src.pthread.pthread_rwlockattr_getkind_np
libc.src.pthread.pthread_rwlockattr_getpshared
libc.src.pthread.pthread_rwlockattr_init
- libc.src.pthread.pthread_rwlockattr_setkind_np
libc.src.pthread.pthread_rwlockattr_setpshared
libc.src.pthread.pthread_setspecific
diff --git a/libc/include/pthread.h.def b/libc/include/pthread.h.def
index d41273b5590ea..a94d770657e10 100644
--- a/libc/include/pthread.h.def
+++ b/libc/include/pthread.h.def
@@ -38,11 +38,6 @@ enum {
#define PTHREAD_PROCESS_PRIVATE 0
#define PTHREAD_PROCESS_SHARED 1
-#define PTHREAD_RWLOCK_PREFER_READER_NP 0
-#define PTHREAD_RWLOCK_PREFER_WRITER_NP 1
-#define PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP 2
-
-
%%public_api()
#endif // LLVM_LIBC_PTHREAD_H
diff --git a/libc/spec/posix.td b/libc/spec/posix.td
index e16353b8142de..e7a0cf883c607 100644
--- a/libc/spec/posix.td
+++ b/libc/spec/posix.td
@@ -1234,11 +1234,6 @@ def POSIX : StandardSpec<"POSIX"> {
RetValSpec<IntType>,
[ArgSpec<PThreadRWLockAttrTPtr>]
>,
- FunctionSpec<
- "pthread_rwlockattr_getkind_np",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockAttrTPtr>, ArgSpec<IntPtr>]
- >,
FunctionSpec<
"pthread_rwlockattr_getpshared",
RetValSpec<IntType>,
@@ -1249,11 +1244,6 @@ def POSIX : StandardSpec<"POSIX"> {
RetValSpec<IntType>,
[ArgSpec<PThreadRWLockAttrTPtr>]
>,
- FunctionSpec<
- "pthread_rwlockattr_setkind_np",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockAttrTPtr>, ArgSpec<IntType>]
- >,
FunctionSpec<
"pthread_rwlockattr_setpshared",
RetValSpec<IntType>,
diff --git a/libc/src/pthread/CMakeLists.txt b/libc/src/pthread/CMakeLists.txt
index e5bebb63c6401..c57475c9114fa 100644
--- a/libc/src/pthread/CMakeLists.txt
+++ b/libc/src/pthread/CMakeLists.txt
@@ -470,16 +470,6 @@ add_entrypoint_object(
libc.include.pthread
)
-add_entrypoint_object(
- pthread_rwlockattr_getkind_np
- SRCS
- pthread_rwlockattr_getkind_np.cpp
- HDRS
- pthread_rwlockattr_getkind_np.h
- DEPENDS
- libc.include.pthread
-)
-
add_entrypoint_object(
pthread_rwlockattr_getpshared
SRCS
@@ -500,17 +490,6 @@ add_entrypoint_object(
libc.include.pthread
)
-add_entrypoint_object(
- pthread_rwlockattr_setkind_np
- SRCS
- pthread_rwlockattr_setkind_np.cpp
- HDRS
- pthread_rwlockattr_setkind_np.h
- DEPENDS
- libc.include.pthread
- libc.include.errno
-)
-
add_entrypoint_object(
pthread_rwlockattr_setpshared
SRCS
diff --git a/libc/src/pthread/pthread_rwlockattr_getkind_np.cpp b/libc/src/pthread/pthread_rwlockattr_getkind_np.cpp
deleted file mode 100644
index 0c821797b42ca..0000000000000
--- a/libc/src/pthread/pthread_rwlockattr_getkind_np.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-//===-- Implementation of the pthread_rwlockattr_getkind_np ---------------===//
-//
-// 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_rwlockattr_getkind_np.h"
-
-#include "src/__support/common.h"
-
-#include <pthread.h> // pthread_rwlockattr_t
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(int, pthread_rwlockattr_getkind_np,
- (const pthread_rwlockattr_t *__restrict attr,
- int *__restrict pref)) {
- *pref = attr->pref;
- return 0;
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_rwlockattr_getkind_np.h b/libc/src/pthread/pthread_rwlockattr_getkind_np.h
deleted file mode 100644
index 51f633cd559d4..0000000000000
--- a/libc/src/pthread/pthread_rwlockattr_getkind_np.h
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation header for pthread_rwlockattr_getkind_np -*- 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_RWLOCKATTR_GETKIND_NP_H
-#define LLVM_LIBC_SRC_PTHREAD_PTHREAD_RWLOCKATTR_GETKIND_NP_H
-
-#include <pthread.h>
-
-namespace LIBC_NAMESPACE {
-
-int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *__restrict attr,
- int *__restrict pref);
-
-} // namespace LIBC_NAMESPACE
-
-#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_RWLOCKATTR_GETKIND_NP_H
diff --git a/libc/src/pthread/pthread_rwlockattr_init.cpp b/libc/src/pthread/pthread_rwlockattr_init.cpp
index bbc89555c6c1c..7971f1714db48 100644
--- a/libc/src/pthread/pthread_rwlockattr_init.cpp
+++ b/libc/src/pthread/pthread_rwlockattr_init.cpp
@@ -17,7 +17,6 @@ namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_rwlockattr_init,
(pthread_rwlockattr_t * attr)) {
attr->pshared = PTHREAD_PROCESS_PRIVATE;
- attr->pref = PTHREAD_RWLOCK_PREFER_READER_NP;
return 0;
}
diff --git a/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp b/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp
deleted file mode 100644
index 47fbf2a851e50..0000000000000
--- a/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//===-- Implementation of the pthread_rwlockattr_setkind_np ---------------===//
-//
-// 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_rwlockattr_setkind_np.h"
-
-#include "src/__support/common.h"
-
-#include <errno.h>
-#include <pthread.h> // pthread_rwlockattr_t
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(int, pthread_rwlockattr_setkind_np,
- (pthread_rwlockattr_t * attr, int pref)) {
-
- if (pref != PTHREAD_RWLOCK_PREFER_READER_NP &&
- pref != PTHREAD_RWLOCK_PREFER_WRITER_NP &&
- pref != PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)
- return EINVAL;
-
- attr->pref = pref;
- return 0;
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_rwlockattr_setkind_np.h b/libc/src/pthread/pthread_rwlockattr_setkind_np.h
deleted file mode 100644
index 00ef8e1bbe009..0000000000000
--- a/libc/src/pthread/pthread_rwlockattr_setkind_np.h
+++ /dev/null
@@ -1,20 +0,0 @@
-//===-- Implementation header for pthread_rwlockattr_setkind_np -*- 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_RWLOCKATTR_SETKIND_NP_H
-#define LLVM_LIBC_SRC_PTHREAD_PTHREAD_RWLOCKATTR_SETKIND_NP_H
-
-#include <pthread.h>
-
-namespace LIBC_NAMESPACE {
-
-int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *attr, int pref);
-
-} // namespace LIBC_NAMESPACE
-
-#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_RWLOCKATTR_SETKIND_NP_H
diff --git a/libc/test/src/pthread/CMakeLists.txt b/libc/test/src/pthread/CMakeLists.txt
index 0eeec445d5f49..ea75e65f57c9e 100644
--- a/libc/test/src/pthread/CMakeLists.txt
+++ b/libc/test/src/pthread/CMakeLists.txt
@@ -68,9 +68,7 @@ add_libc_unittest(
libc.include.errno
libc.include.pthread
libc.src.pthread.pthread_rwlockattr_destroy
- libc.src.pthread.pthread_rwlockattr_getkind_np
libc.src.pthread.pthread_rwlockattr_getpshared
libc.src.pthread.pthread_rwlockattr_init
- libc.src.pthread.pthread_rwlockattr_setkind_np
libc.src.pthread.pthread_rwlockattr_setpshared
)
diff --git a/libc/test/src/pthread/pthread_rwlockattr_test.cpp b/libc/test/src/pthread/pthread_rwlockattr_test.cpp
index 3791f568e2228..6e5ae70df7343 100644
--- a/libc/test/src/pthread/pthread_rwlockattr_test.cpp
+++ b/libc/test/src/pthread/pthread_rwlockattr_test.cpp
@@ -8,10 +8,8 @@
#include "include/llvm-libc-macros/generic-error-number-macros.h" // EINVAL
#include "src/pthread/pthread_rwlockattr_destroy.h"
-#include "src/pthread/pthread_rwlockattr_getkind_np.h"
#include "src/pthread/pthread_rwlockattr_getpshared.h"
#include "src/pthread/pthread_rwlockattr_init.h"
-#include "src/pthread/pthread_rwlockattr_setkind_np.h"
#include "src/pthread/pthread_rwlockattr_setpshared.h"
#include "test/UnitTest/Test.h"
@@ -27,61 +25,40 @@ TEST(LlvmLibcPThreadRWLockAttrTest, InitAndDestroy) {
TEST(LlvmLibcPThreadRWLockAttrTest, GetDefaultValues) {
pthread_rwlockattr_t attr;
- // Invalid values.
+ // Invalid value.
int pshared = 42;
- int pref = 1337;
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_init(&attr), 0);
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_getpshared(&attr, &pshared), 0);
- ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_getkind_np(&attr, &pref), 0);
-
ASSERT_EQ(pshared, PTHREAD_PROCESS_PRIVATE);
- ASSERT_EQ(pref, PTHREAD_RWLOCK_PREFER_READER_NP);
-
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_destroy(&attr), 0);
}
TEST(LlvmLibcPThreadRWLockAttrTest, SetGoodValues) {
pthread_rwlockattr_t attr;
- // Invalid values.
+ // Invalid value.
int pshared = 42;
- int pref = 1337;
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_init(&attr), 0);
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_setpshared(
&attr, PTHREAD_PROCESS_SHARED),
0);
- ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_setkind_np(
- &attr, PTHREAD_RWLOCK_PREFER_WRITER_NP),
- 0);
-
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_getpshared(&attr, &pshared), 0);
- ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_getkind_np(&attr, &pref), 0);
-
ASSERT_EQ(pshared, PTHREAD_PROCESS_SHARED);
- ASSERT_EQ(pref, PTHREAD_RWLOCK_PREFER_WRITER_NP);
-
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_destroy(&attr), 0);
}
TEST(LlvmLibcPThreadRWLockAttrTest, SetBadValues) {
pthread_rwlockattr_t attr;
- // Invalid values.
+ // Invalid value.
int pshared = 42;
- int pref = 1337;
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_init(&attr), 0);
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_setpshared(&attr, pshared),
EINVAL);
- ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_setkind_np(&attr, pref), EINVAL);
-
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_getpshared(&attr, &pshared), 0);
- ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_getkind_np(&attr, &pref), 0);
-
ASSERT_EQ(pshared, PTHREAD_PROCESS_PRIVATE);
- ASSERT_EQ(pref, PTHREAD_RWLOCK_PREFER_READER_NP);
-
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlockattr_destroy(&attr), 0);
}
|
HendrikHuebner
added a commit
to HendrikHuebner/llvm-project
that referenced
this pull request
May 28, 2024
…wlockattr functions" (llvm#91966)" This reverts commit 27595c4.
HendrikHuebner
added a commit
to HendrikHuebner/llvm-project
that referenced
this pull request
May 28, 2024
…wlockattr functions" (llvm#91966)" This reverts commit 27595c4.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #90249
Fullbuild is broken: https://lab.llvm.org/buildbot/#/builders/163/builds/56501