1*74b02905Sthorpej /* $NetBSD: futex_private.h,v 1.2 2020/05/16 16:16:59 thorpej Exp $ */
2276ef223Sthorpej
3276ef223Sthorpej /*-
4276ef223Sthorpej * Copyright (c) 2019 The NetBSD Foundation, Inc.
5276ef223Sthorpej * All rights reserved.
6276ef223Sthorpej *
7276ef223Sthorpej * This code is derived from software contributed to The NetBSD Foundation
8276ef223Sthorpej * by Jason R. Thorpe.
9276ef223Sthorpej *
10276ef223Sthorpej * Redistribution and use in source and binary forms, with or without
11276ef223Sthorpej * modification, are permitted provided that the following conditions
12276ef223Sthorpej * are met:
13276ef223Sthorpej * 1. Redistributions of source code must retain the above copyright
14276ef223Sthorpej * notice, this list of conditions and the following disclaimer.
15276ef223Sthorpej * 2. Redistributions in binary form must reproduce the above copyright
16276ef223Sthorpej * notice, this list of conditions and the following disclaimer in the
17276ef223Sthorpej * documentation and/or other materials provided with the distribution.
18276ef223Sthorpej *
19276ef223Sthorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20276ef223Sthorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21276ef223Sthorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22276ef223Sthorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23276ef223Sthorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24276ef223Sthorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25276ef223Sthorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26276ef223Sthorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27276ef223Sthorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28276ef223Sthorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29276ef223Sthorpej * POSSIBILITY OF SUCH DAMAGE.
30276ef223Sthorpej */
31276ef223Sthorpej
32276ef223Sthorpej #ifndef __LIBC_FUTEX_PRIVATE
33276ef223Sthorpej #define __LIBC_FUTEX_PRIVATE
34276ef223Sthorpej
35276ef223Sthorpej #include <sys/cdefs.h>
36276ef223Sthorpej #include <sys/syscall.h>
37276ef223Sthorpej #include <sys/futex.h>
38276ef223Sthorpej #include <unistd.h>
39276ef223Sthorpej
40*74b02905Sthorpej /* XXX Avoid pulling in namespace.h. */
41*74b02905Sthorpej extern int _syscall(int, ...);
42*74b02905Sthorpej
43276ef223Sthorpej static inline int __unused
__futex(volatile int * uaddr,int op,int val,const struct timespec * timeout,volatile int * uaddr2,int val2,int val3)44276ef223Sthorpej __futex(volatile int *uaddr, int op, int val, const struct timespec *timeout,
45276ef223Sthorpej volatile int *uaddr2, int val2, int val3)
46276ef223Sthorpej {
47*74b02905Sthorpej return _syscall(SYS___futex, uaddr, op, val, timeout, uaddr2,
48276ef223Sthorpej val2, val3);
49276ef223Sthorpej }
50276ef223Sthorpej
51276ef223Sthorpej static inline int __unused
__futex_set_robust_list(void * head,size_t len)52276ef223Sthorpej __futex_set_robust_list(void *head, size_t len)
53276ef223Sthorpej {
54*74b02905Sthorpej return _syscall(SYS___futex_set_robust_list, head, len);
55276ef223Sthorpej }
56276ef223Sthorpej
57276ef223Sthorpej static inline int __unused
__futex_get_robust_list(lwpid_t lwpid,void ** headp,size_t * lenp)58276ef223Sthorpej __futex_get_robust_list(lwpid_t lwpid, void **headp, size_t *lenp)
59276ef223Sthorpej {
60*74b02905Sthorpej return _syscall(SYS___futex_get_robust_list, lwpid, headp, lenp);
61276ef223Sthorpej }
62276ef223Sthorpej
63276ef223Sthorpej #endif /* __LIBC_FUTEX_PRIVATE */
64