summaryrefslogtreecommitdiff
path: root/usr/src/lib/libc
diff options
context:
space:
mode:
authorAndy Fiddaman <omnios@citrus-it.co.uk>2022-02-18 00:32:27 +0000
committerAndy Fiddaman <omnios@citrus-it.co.uk>2022-03-16 00:02:44 +0000
commit7bb0eb348e1119aed76a61d633a9106b6b9912f1 (patch)
treeacaa58321439ba3f834df192a741eacc65f1bc71 /usr/src/lib/libc
parent499bc737cd392291f0c92dcebcb576970689f5d8 (diff)
downloadillumos-gate-7bb0eb348e1119aed76a61d633a9106b6b9912f1.tar.gz
14521 bhyve should use error checking mutexes and check results
14522 Provide PTHREAD_{ERRORCHECK,RECURSIVE}_MUTEX_INITIALIZER_NP Portions contributed by: Robert Mustacchi <rm@fingolfin.org> Reviewed by: Robert Mustacchi <rm@fingolfin.org> Reviewed by: Jason King <jason.brian.king@gmail.com> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/lib/libc')
-rw-r--r--usr/src/lib/libc/port/mapfile-vers2
-rw-r--r--usr/src/lib/libc/port/threads/synch.c18
2 files changed, 12 insertions, 8 deletions
diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers
index 8b9a2f170b..4bf82c55ff 100644
--- a/usr/src/lib/libc/port/mapfile-vers
+++ b/usr/src/lib/libc/port/mapfile-vers
@@ -3756,6 +3756,8 @@ $endif
_psignal;
pthread_attr_getdaemonstate_np;
pthread_attr_setdaemonstate_np;
+ pthread_mutex_enter_np;
+ pthread_mutex_exit_np;
_pthread_setcleanupinit;
__putwchar_xpg5;
__putwc_xpg5;
diff --git a/usr/src/lib/libc/port/threads/synch.c b/usr/src/lib/libc/port/threads/synch.c
index 3ec76f7c21..b2c5980f9a 100644
--- a/usr/src/lib/libc/port/threads/synch.c
+++ b/usr/src/lib/libc/port/threads/synch.c
@@ -1781,7 +1781,7 @@ stall(void)
*/
int
mutex_lock_queue(ulwp_t *self, tdb_mutex_stats_t *msp, mutex_t *mp,
- timespec_t *tsp)
+ timespec_t *tsp)
{
uberdata_t *udp = curthread->ul_uberdata;
queue_head_t *qp;
@@ -2316,6 +2316,7 @@ mutex_lock(mutex_t *mp)
return (mutex_lock_impl(mp, NULL));
}
+#pragma weak pthread_mutex_enter_np = mutex_enter
void
mutex_enter(mutex_t *mp)
{
@@ -2341,7 +2342,7 @@ mutex_enter(mutex_t *mp)
int
pthread_mutex_timedlock(pthread_mutex_t *_RESTRICT_KYWD mp,
- const struct timespec *_RESTRICT_KYWD abstime)
+ const struct timespec *_RESTRICT_KYWD abstime)
{
timespec_t tslocal;
int error;
@@ -2356,7 +2357,7 @@ pthread_mutex_timedlock(pthread_mutex_t *_RESTRICT_KYWD mp,
int
pthread_mutex_reltimedlock_np(pthread_mutex_t *_RESTRICT_KYWD mp,
- const struct timespec *_RESTRICT_KYWD reltime)
+ const struct timespec *_RESTRICT_KYWD reltime)
{
timespec_t tslocal;
int error;
@@ -2598,6 +2599,7 @@ slow_unlock:
return (mutex_unlock_internal(mp, 0));
}
+#pragma weak pthread_mutex_exit_np = mutex_exit
void
mutex_exit(mutex_t *mp)
{
@@ -3574,7 +3576,7 @@ cond_wait(cond_t *cvp, mutex_t *mp)
*/
int
pthread_cond_wait(pthread_cond_t *_RESTRICT_KYWD cvp,
- pthread_mutex_t *_RESTRICT_KYWD mp)
+ pthread_mutex_t *_RESTRICT_KYWD mp)
{
int error;
@@ -3633,8 +3635,8 @@ cond_timedwait(cond_t *cvp, mutex_t *mp, const timespec_t *abstime)
*/
int
pthread_cond_timedwait(pthread_cond_t *_RESTRICT_KYWD cvp,
- pthread_mutex_t *_RESTRICT_KYWD mp,
- const struct timespec *_RESTRICT_KYWD abstime)
+ pthread_mutex_t *_RESTRICT_KYWD mp,
+ const struct timespec *_RESTRICT_KYWD abstime)
{
int error;
@@ -3677,8 +3679,8 @@ cond_reltimedwait(cond_t *cvp, mutex_t *mp, const timespec_t *reltime)
int
pthread_cond_reltimedwait_np(pthread_cond_t *_RESTRICT_KYWD cvp,
- pthread_mutex_t *_RESTRICT_KYWD mp,
- const struct timespec *_RESTRICT_KYWD reltime)
+ pthread_mutex_t *_RESTRICT_KYWD mp,
+ const struct timespec *_RESTRICT_KYWD reltime)
{
int error;