| 1 | /*	$OpenBSD: futex.h,v 1.3 2025/05/07 00:39:09 dlg Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (c) 2016 Martin Pieuchot |
| 5 | * |
| 6 | * Permission to use, copy, modify, and distribute this software for any |
| 7 | * purpose with or without fee is hereby granted, provided that the above |
| 8 | * copyright notice and this permission notice appear in all copies. |
| 9 | * |
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | #ifndef	_SYS_FUTEX_H_ |
| 20 | #define	_SYS_FUTEX_H_ |
| 21 | |
| 22 | #ifndef _KERNEL |
| 23 | #include <sys/cdefs.h> |
| 24 | |
| 25 | __BEGIN_DECLS |
| 26 | int futex(volatile uint32_t *, int, int, const struct timespec *, |
| 27 | volatile uint32_t *); |
| 28 | __END_DECLS |
| 29 | #endif /* ! _KERNEL */ |
| 30 | |
| 31 | #define	FUTEX_OP_MASK		0x007f |
| 32 | |
| 33 | #define	FUTEX_WAIT		1 |
| 34 | #define	FUTEX_WAKE		2 |
| 35 | #define	FUTEX_REQUEUE		3 |
| 36 | |
| 37 | #define	FUTEX_FLAG_MASK		0xff80 |
| 38 | |
| 39 | #define	FUTEX_PRIVATE_FLAG	0x0080 |
| 40 | |
| 41 | #define	FUTEX_WAIT_PRIVATE	(FUTEX_WAIT | FUTEX_PRIVATE_FLAG) |
| 42 | #define	FUTEX_WAKE_PRIVATE	(FUTEX_WAKE | FUTEX_PRIVATE_FLAG) |
| 43 | #define	FUTEX_REQUEUE_PRIVATE	(FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG) |
| 44 | |
| 45 | #endif	/* _SYS_FUTEX_H_ */ |