aboutsummaryrefslogtreecommitdiff
path: root/lib/libsys/_umtx_op_err.c
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2024-01-17 20:26:52 +0000
committerBrooks Davis <brooks@FreeBSD.org>2024-02-05 20:34:56 +0000
commitef9871c6205c158b16ee23702d2b8c043debc51a (patch)
tree475baf3f7056c4fbc9f848123a0429ebdb95ce17 /lib/libsys/_umtx_op_err.c
parente9d961055aa2502f4915611e8fb2e9f9f9c86719 (diff)
Diffstat (limited to 'lib/libsys/_umtx_op_err.c')
-rw-r--r--lib/libsys/_umtx_op_err.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/libsys/_umtx_op_err.c b/lib/libsys/_umtx_op_err.c
new file mode 100644
index 000000000000..8281b8af7110
--- /dev/null
+++ b/lib/libsys/_umtx_op_err.c
@@ -0,0 +1,39 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2005 David Xu <davidxu@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.
+ */
+
+#include <sys/types.h>
+#include <sys/errno.h>
+#include <sys/umtx.h>
+
+int
+_umtx_op_err(void *obj, int op, u_long val, void *uaddr, void *uaddr2)
+{
+ if (_umtx_op(obj, op, val, uaddr, uaddr2) == -1)
+ return (errno);
+ return (0);
+}