1161304Snetchild/* $NetBSD: linux_futex.h,v 1.2 2005/12/11 12:20:19 christos Exp $ */ 2161304Snetchild 3161304Snetchild/*- 4161304Snetchild * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved. 5161304Snetchild * 6161304Snetchild * Redistribution and use in source and binary forms, with or without 7161304Snetchild * modification, are permitted provided that the following conditions 8161304Snetchild * are met: 9161304Snetchild * 1. Redistributions of source code must retain the above copyright 10161304Snetchild * notice, this list of conditions and the following disclaimer. 11161304Snetchild * 2. Redistributions in binary form must reproduce the above copyright 12161304Snetchild * notice, this list of conditions and the following disclaimer in the 13161304Snetchild * documentation and/or other materials provided with the distribution. 14161304Snetchild * 3. All advertising materials mentioning features or use of this software 15161304Snetchild * must display the following acknowledgement: 16161304Snetchild * This product includes software developed by Emmanuel Dreyfus 17166969Snetchild * 4. The name of the author may not be used to endorse or promote 18166969Snetchild * products derived from this software without specific prior written 19161304Snetchild * permission. 20161304Snetchild * 21166969Snetchild * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS'' 22166969Snetchild * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 23161304Snetchild * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24166969Snetchild * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS 25161304Snetchild * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26161304Snetchild * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27161304Snetchild * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28161304Snetchild * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29161304Snetchild * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30161304Snetchild * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31161304Snetchild * POSSIBILITY OF SUCH DAMAGE. 32161304Snetchild * 33161304Snetchild * $FreeBSD: releng/10.2/sys/compat/linux/linux_futex.h 218118 2011-01-31 06:06:23Z dchagin $ 34161304Snetchild */ 35161304Snetchild 36161304Snetchild#ifndef _LINUX_FUTEX_H 37161304Snetchild#define _LINUX_FUTEX_H 38161304Snetchild 39191741Sdchaginextern LIST_HEAD(futex_list, futex) futex_list; 40191741Sdchaginextern struct mtx futex_mtx; 41191741Sdchagin 42215338Snetchild#define LINUX_FUTEX_WAIT 0 43215338Snetchild#define LINUX_FUTEX_WAKE 1 44215338Snetchild#define LINUX_FUTEX_FD 2 /* unused */ 45215338Snetchild#define LINUX_FUTEX_REQUEUE 3 46215338Snetchild#define LINUX_FUTEX_CMP_REQUEUE 4 47215338Snetchild#define LINUX_FUTEX_WAKE_OP 5 48215338Snetchild#define LINUX_FUTEX_LOCK_PI 6 49215338Snetchild#define LINUX_FUTEX_UNLOCK_PI 7 50215338Snetchild#define LINUX_FUTEX_TRYLOCK_PI 8 51215338Snetchild#define LINUX_FUTEX_WAIT_BITSET 9 52218117Sdchagin#define LINUX_FUTEX_WAKE_BITSET 10 53215338Snetchild#define LINUX_FUTEX_WAIT_REQUEUE_PI 11 54218118Sdchagin#define LINUX_FUTEX_CMP_REQUEUE_PI 12 55161304Snetchild 56177460Srdivacky#define LINUX_FUTEX_PRIVATE_FLAG 128 57215338Snetchild#define LINUX_FUTEX_CLOCK_REALTIME 256 58177460Srdivacky 59166969Snetchild#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */ 60166969Snetchild#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */ 61166969Snetchild#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */ 62166969Snetchild#define FUTEX_OP_ANDN 3 /* *(int *)UADDR2 &= ~OPARG; */ 63166969Snetchild#define FUTEX_OP_XOR 4 /* *(int *)UADDR2 ^= OPARG; */ 64161304Snetchild 65166969Snetchild#define FUTEX_OP_OPARG_SHIFT 8 /* Use (1 << OPARG) instead of OPARG. */ 66161304Snetchild 67166969Snetchild#define FUTEX_OP_CMP_EQ 0 /* if (oldval == CMPARG) wake */ 68166969Snetchild#define FUTEX_OP_CMP_NE 1 /* if (oldval != CMPARG) wake */ 69166969Snetchild#define FUTEX_OP_CMP_LT 2 /* if (oldval < CMPARG) wake */ 70166969Snetchild#define FUTEX_OP_CMP_LE 3 /* if (oldval <= CMPARG) wake */ 71166969Snetchild#define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */ 72166969Snetchild#define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */ 73161304Snetchild 74178976Srdivacky#define FUTEX_WAITERS 0x80000000 75178976Srdivacky#define FUTEX_OWNER_DIED 0x40000000 76178976Srdivacky#define FUTEX_TID_MASK 0x3fffffff 77218117Sdchagin#define FUTEX_BITSET_MATCH_ANY 0xffffffff 78178976Srdivacky 79178976Srdivackyvoid release_futexes(struct proc *); 80178976Srdivacky 81166969Snetchild#endif /* !_LINUX_FUTEX_H */ 82