Index: sys/kern/kern_umtx.c =================================================================== --- sys/kern/kern_umtx.c +++ sys/kern/kern_umtx.c @@ -212,13 +212,6 @@ #define BUSY_SPINS 200 -struct abs_timeout { - int clockid; - bool is_abs_real; /* TIMER_ABSTIME && CLOCK_REALTIME* */ - struct timespec cur; - struct timespec end; -}; - struct umtx_copyops { int (*copyin_timeout)(const void *uaddr, struct timespec *tsp); int (*copyin_umtx_time)(const void *uaddr, size_t size, @@ -266,7 +259,7 @@ "umtx chain stats"); #endif -static void abs_timeout_update(struct abs_timeout *timo); +static void abs_timeout_update(struct umtx_abs_timeout *timo); static void umtx_shm_init(void); static void umtxq_sysinit(void *); @@ -277,7 +270,8 @@ static void umtxq_unbusy(struct umtx_key *key); static void umtxq_insert_queue(struct umtx_q *uq, int q); static void umtxq_remove_queue(struct umtx_q *uq, int q); -static int umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *); +static int umtxq_sleep(struct umtx_q *uq, const char *wmesg, + struct umtx_abs_timeout *); static int umtxq_count(struct umtx_key *key); static struct umtx_pi *umtx_pi_alloc(int); static void umtx_pi_free(struct umtx_pi *pi); @@ -740,9 +734,9 @@ return tvtohz(&tv); } -static void -abs_timeout_init(struct abs_timeout *timo, int clockid, int absolute, - const struct timespec *timeout) +void +umtx_abs_timeout_init(struct umtx_abs_timeout *timo, int clockid, + int absolute, const struct timespec *timeout) { timo->clockid = clockid; @@ -766,22 +760,22 @@ } static void -abs_timeout_init2(struct abs_timeout *timo, const struct _umtx_time *umtxtime) +abs_timeout_init2(struct umtx_abs_timeout *timo, const struct _umtx_time *umtxtime) { - abs_timeout_init(timo, umtxtime->_clockid, + umtx_abs_timeout_init(timo, umtxtime->_clockid, (umtxtime->_flags & UMTX_ABSTIME) != 0, &umtxtime->_timeout); } static inline void -abs_timeout_update(struct abs_timeout *timo) +abs_timeout_update(struct umtx_abs_timeout *timo) { kern_clock_gettime(curthread, timo->clockid, &timo->cur); } static int -abs_timeout_gethz(struct abs_timeout *timo) +abs_timeout_gethz(struct umtx_abs_timeout *timo) { struct timespec tts; @@ -809,7 +803,8 @@ * thread was removed from umtx queue. */ static inline int -umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *abstime) +umtxq_sleep(struct umtx_q *uq, const char *wmesg, + struct umtx_abs_timeout *abstime) { struct umtxq_chain *uc; int error, timo; @@ -915,7 +910,7 @@ do_wait(struct thread *td, void *addr, u_long id, struct _umtx_time *timeout, int compat32, int is_private) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; u_long tmp; uint32_t tmp32; @@ -988,7 +983,7 @@ do_lock_normal(struct thread *td, struct umutex *m, uint32_t flags, struct _umtx_time *timeout, int mode) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t owner, old, id; int error, rv; @@ -1656,7 +1651,7 @@ */ static int umtxq_sleep_pi(struct umtx_q *uq, struct umtx_pi *pi, uint32_t owner, - const char *wmesg, struct abs_timeout *timo, bool shared) + const char *wmesg, struct umtx_abs_timeout *timo, bool shared) { struct thread *td, *td1; struct umtx_q *uq1; @@ -1794,7 +1789,7 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32_t flags, struct _umtx_time *timeout, int try) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; struct umtx_pi *pi, *new_pi; uint32_t id, old_owner, owner, old; @@ -2130,7 +2125,7 @@ do_lock_pp(struct thread *td, struct umutex *m, uint32_t flags, struct _umtx_time *timeout, int try) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq, *uq2; struct umtx_pi *pi; uint32_t ceiling; @@ -2535,7 +2530,7 @@ do_cv_wait(struct thread *td, struct ucond *cv, struct umutex *m, struct timespec *timeout, u_long wflags) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t flags, clockid, hasw; int error; @@ -2582,8 +2577,8 @@ error = do_unlock_umutex(td, m, false); if (timeout != NULL) - abs_timeout_init(&timo, clockid, (wflags & CVWAIT_ABSTIME) != 0, - timeout); + umtx_abs_timeout_init(&timo, clockid, + (wflags & CVWAIT_ABSTIME) != 0, timeout); umtxq_lock(&uq->uq_key); if (error == 0) { @@ -2683,7 +2678,7 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, struct _umtx_time *timeout) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t flags, wrflags; int32_t state, oldstate; @@ -2868,7 +2863,7 @@ static int do_rw_wrlock(struct thread *td, struct urwlock *rwlock, struct _umtx_time *timeout) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t flags; int32_t state, oldstate; @@ -3163,7 +3158,7 @@ static int do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time *timeout) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t flags, count, count1; int error, rv, rv1; @@ -3268,7 +3263,7 @@ static int do_sem2_wait(struct thread *td, struct _usem2 *sem, struct _umtx_time *timeout) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t count, flags; int error, rv; Index: sys/sys/umtxvar.h =================================================================== --- sys/sys/umtxvar.h +++ sys/sys/umtxvar.h @@ -80,6 +80,13 @@ #define PROCESS_SHARE 1 #define AUTO_SHARE 2 +struct umtx_abs_timeout { + int clockid; + bool is_abs_real; /* TIMER_ABSTIME && CLOCK_REALTIME* */ + struct timespec cur; + struct timespec end; +}; + struct thread; static inline int @@ -90,6 +97,8 @@ k1->info.both.b == k2->info.both.b); } +void umtx_abs_timeout_init(struct umtx_abs_timeout *, int, int, + const struct timespec *); int umtx_copyin_timeout(const void *, struct timespec *); void umtx_exec(struct proc *p); int umtx_key_get(const void *, int, int, struct umtx_key *);