aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2021-07-29 09:41:29 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2021-07-29 09:41:29 +0000
commitaf29f3995882fac6e1c0360c2276c7a98056957f (patch)
tree5de6f5af06c0062e63023b7a3633ddce3a644b91 /sys/sys
parent7cf06e075d1c28ad444e6b6beaf783210123c9d7 (diff)
downloadsrc-af29f3995882fac6e1c0360c2276c7a98056957f.tar.gz
src-af29f3995882fac6e1c0360c2276c7a98056957f.zip
umtx: Split umtx.h on two counterparts.
To prevent umtx.h polluting by future changes split it on two headers: umtx.h - ABI header for userspace; umtxvar.h - the kernel staff. While here fix umtx_key_match style. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31248 MFC after: 2 weeks
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/umtx.h73
-rw-r--r--sys/sys/umtxvar.h106
2 files changed, 106 insertions, 73 deletions
diff --git a/sys/sys/umtx.h b/sys/sys/umtx.h
index 60e9dccdad91..82a8e0e4b0f0 100644
--- a/sys/sys/umtx.h
+++ b/sys/sys/umtx.h
@@ -132,83 +132,10 @@ struct umtx_robust_lists_params {
uintptr_t robust_inact_offset;
};
-#ifndef _KERNEL
-
__BEGIN_DECLS
int _umtx_op(void *obj, int op, u_long val, void *uaddr, void *uaddr2);
__END_DECLS
-#else
-
-/*
- * The umtx_key structure is used by both the Linux futex code and the
- * umtx implementation to map userland addresses to unique keys.
- */
-
-enum {
- TYPE_SIMPLE_WAIT,
- TYPE_CV,
- TYPE_SEM,
- TYPE_SIMPLE_LOCK,
- TYPE_NORMAL_UMUTEX,
- TYPE_PI_UMUTEX,
- TYPE_PP_UMUTEX,
- TYPE_RWLOCK,
- TYPE_FUTEX,
- TYPE_SHM,
- TYPE_PI_ROBUST_UMUTEX,
- TYPE_PP_ROBUST_UMUTEX,
-};
-
-/* Key to represent a unique userland synchronous object */
-struct umtx_key {
- int hash;
- int type;
- int shared;
- union {
- struct {
- struct vm_object *object;
- uintptr_t offset;
- } shared;
- struct {
- struct vmspace *vs;
- uintptr_t addr;
- } private;
- struct {
- void *a;
- uintptr_t b;
- } both;
- } info;
-};
-
-#define THREAD_SHARE 0
-#define PROCESS_SHARE 1
-#define AUTO_SHARE 2
-
-struct thread;
-
-static inline int
-umtx_key_match(const struct umtx_key *k1, const struct umtx_key *k2)
-{
- return (k1->type == k2->type &&
- k1->info.both.a == k2->info.both.a &&
- k1->info.both.b == k2->info.both.b);
-}
-
-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 *);
-void umtx_key_release(struct umtx_key *);
-struct umtx_q *umtxq_alloc(void);
-void umtxq_free(struct umtx_q *);
-int kern_umtx_wake(struct thread *, void *, int, int);
-void umtx_pi_adjust(struct thread *, u_char);
-void umtx_thread_init(struct thread *);
-void umtx_thread_fini(struct thread *);
-void umtx_thread_alloc(struct thread *);
-void umtx_thread_exit(struct thread *);
-
-#endif /* !_KERNEL */
#endif /* !_SYS_UMTX_H_ */
diff --git a/sys/sys/umtxvar.h b/sys/sys/umtxvar.h
new file mode 100644
index 000000000000..b898c263201e
--- /dev/null
+++ b/sys/sys/umtxvar.h
@@ -0,0 +1,106 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2002, Jeffrey Roberson <jeff@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice unmodified, this list of conditions, and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ */
+
+#ifndef _SYS_UMTXVAR_H_
+#define _SYS_UMTXVAR_H_
+
+#ifdef _KERNEL
+
+/*
+ * The umtx_key structure is used by both the Linux futex code and the
+ * umtx implementation to map userland addresses to unique keys.
+ */
+enum {
+ TYPE_SIMPLE_WAIT,
+ TYPE_CV,
+ TYPE_SEM,
+ TYPE_SIMPLE_LOCK,
+ TYPE_NORMAL_UMUTEX,
+ TYPE_PI_UMUTEX,
+ TYPE_PP_UMUTEX,
+ TYPE_RWLOCK,
+ TYPE_FUTEX,
+ TYPE_SHM,
+ TYPE_PI_ROBUST_UMUTEX,
+ TYPE_PP_ROBUST_UMUTEX,
+};
+
+/* Key to represent a unique userland synchronous object */
+struct umtx_key {
+ int hash;
+ int type;
+ int shared;
+ union {
+ struct {
+ struct vm_object *object;
+ uintptr_t offset;
+ } shared;
+ struct {
+ struct vmspace *vs;
+ uintptr_t addr;
+ } private;
+ struct {
+ void *a;
+ uintptr_t b;
+ } both;
+ } info;
+};
+
+#define THREAD_SHARE 0
+#define PROCESS_SHARE 1
+#define AUTO_SHARE 2
+
+struct thread;
+
+static inline int
+umtx_key_match(const struct umtx_key *k1, const struct umtx_key *k2)
+{
+
+ return (k1->type == k2->type &&
+ k1->info.both.a == k2->info.both.a &&
+ k1->info.both.b == k2->info.both.b);
+}
+
+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 *);
+void umtx_key_release(struct umtx_key *);
+struct umtx_q *umtxq_alloc(void);
+void umtxq_free(struct umtx_q *);
+int kern_umtx_wake(struct thread *, void *, int, int);
+void umtx_pi_adjust(struct thread *, u_char);
+void umtx_thread_init(struct thread *);
+void umtx_thread_fini(struct thread *);
+void umtx_thread_alloc(struct thread *);
+void umtx_thread_exit(struct thread *);
+
+#endif /* _KERNEL */
+#endif /* !_SYS_UMTXVAR_H_ */