2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2002, Jeffrey Roberson <jeff@freebsd.org>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice unmodified, this list of conditions, and the following
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _SYS_UMTXVAR_H_
33 #define _SYS_UMTXVAR_H_
38 * The umtx_key structure is used by both the Linux futex code and the
39 * umtx implementation to map userland addresses to unique keys.
52 TYPE_PI_ROBUST_UMUTEX,
53 TYPE_PP_ROBUST_UMUTEX,
56 /* Key to represent a unique userland synchronous object */
63 struct vm_object *object;
77 #define THREAD_SHARE 0
78 #define PROCESS_SHARE 1
81 struct umtx_abs_timeout {
83 bool is_abs_real; /* TIMER_ABSTIME && CLOCK_REALTIME* */
91 umtx_key_match(const struct umtx_key *k1, const struct umtx_key *k2)
94 return (k1->type == k2->type &&
95 k1->info.both.a == k2->info.both.a &&
96 k1->info.both.b == k2->info.both.b);
99 void umtx_abs_timeout_init(struct umtx_abs_timeout *, int, int,
100 const struct timespec *);
101 int umtx_copyin_timeout(const void *, struct timespec *);
102 void umtx_exec(struct proc *p);
103 int umtx_key_get(const void *, int, int, struct umtx_key *);
104 void umtx_key_release(struct umtx_key *);
105 struct umtx_q *umtxq_alloc(void);
106 void umtxq_free(struct umtx_q *);
107 int kern_umtx_wake(struct thread *, void *, int, int);
108 void umtx_pi_adjust(struct thread *, u_char);
109 void umtx_thread_init(struct thread *);
110 void umtx_thread_fini(struct thread *);
111 void umtx_thread_alloc(struct thread *);
112 void umtx_thread_exit(struct thread *);
115 #endif /* !_SYS_UMTXVAR_H_ */