LibC+LibPthread: Stub out pthread_rwlock_* functions

This commit is contained in:
AnotherTest 2021-02-13 12:06:05 +03:30 committed by Andreas Kling
parent 9e2c37a8b2
commit 26a8a84ded
3 changed files with 76 additions and 1 deletions

View file

@ -99,7 +99,7 @@ typedef struct __pthread_cond_t {
} pthread_cond_t;
typedef void* pthread_rwlock_t;
typedef void* pthread_rwlockatrr_t;
typedef void* pthread_rwlockattr_t;
typedef void* pthread_spinlock_t;
typedef struct __pthread_condattr_t {
int clockid; // clockid_t

View file

@ -28,6 +28,8 @@
#include <AK/Atomic.h>
#include <AK/Debug.h>
#include <AK/StdLibExtras.h>
#include <Kernel/API/Syscall.h>
#include <LibSystem/syscall.h>
#include <limits.h>
#include <pthread.h>
#include <serenity.h>
@ -683,4 +685,59 @@ int pthread_equal(pthread_t t1, pthread_t t2)
return t1 == t2;
}
int pthread_rwlock_destroy(pthread_rwlock_t* rl)
{
if (!rl)
return 0;
ASSERT_NOT_REACHED();
}
int pthread_rwlock_init(pthread_rwlock_t* __restrict, const pthread_rwlockattr_t* __restrict)
{
ASSERT_NOT_REACHED();
}
int pthread_rwlock_rdlock(pthread_rwlock_t*)
{
ASSERT_NOT_REACHED();
}
int pthread_rwlock_timedrdlock(pthread_rwlock_t* __restrict, const struct timespec* __restrict)
{
ASSERT_NOT_REACHED();
}
int pthread_rwlock_timedwrlock(pthread_rwlock_t* __restrict, const struct timespec* __restrict)
{
ASSERT_NOT_REACHED();
}
int pthread_rwlock_tryrdlock(pthread_rwlock_t*)
{
ASSERT_NOT_REACHED();
}
int pthread_rwlock_trywrlock(pthread_rwlock_t*)
{
ASSERT_NOT_REACHED();
}
int pthread_rwlock_unlock(pthread_rwlock_t*)
{
ASSERT_NOT_REACHED();
}
int pthread_rwlock_wrlock(pthread_rwlock_t*)
{
ASSERT_NOT_REACHED();
}
int pthread_rwlockattr_destroy(pthread_rwlockattr_t*)
{
ASSERT_NOT_REACHED();
}
int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t* __restrict, int* __restrict)
{
ASSERT_NOT_REACHED();
}
int pthread_rwlockattr_init(pthread_rwlockattr_t*)
{
ASSERT_NOT_REACHED();
}
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t*, int)
{
ASSERT_NOT_REACHED();
}
} // extern "C"

View file

@ -87,6 +87,10 @@ int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param
0, 0, CLOCK_MONOTONIC_COARSE \
}
// FIXME: Actually implement this!
#define PTHREAD_RWLOCK_INITIALIZER \
NULL
#define PTHREAD_KEYS_MAX 64
#define PTHREAD_DESTRUCTOR_ITERATIONS 4
@ -127,4 +131,18 @@ int pthread_getname_np(pthread_t, char*, size_t);
int pthread_equal(pthread_t t1, pthread_t t2);
int pthread_rwlock_destroy(pthread_rwlock_t*);
int pthread_rwlock_init(pthread_rwlock_t* __restrict, const pthread_rwlockattr_t* __restrict);
int pthread_rwlock_rdlock(pthread_rwlock_t*);
int pthread_rwlock_timedrdlock(pthread_rwlock_t* __restrict, const struct timespec* __restrict);
int pthread_rwlock_timedwrlock(pthread_rwlock_t* __restrict, const struct timespec* __restrict);
int pthread_rwlock_tryrdlock(pthread_rwlock_t*);
int pthread_rwlock_trywrlock(pthread_rwlock_t*);
int pthread_rwlock_unlock(pthread_rwlock_t*);
int pthread_rwlock_wrlock(pthread_rwlock_t*);
int pthread_rwlockattr_destroy(pthread_rwlockattr_t*);
int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t* __restrict, int* __restrict);
int pthread_rwlockattr_init(pthread_rwlockattr_t*);
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t*, int);
__END_DECLS