Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/umtx.h
Show All 28 Lines | |||||
* | * | ||||
*/ | */ | ||||
#ifndef _SYS_UMTX_H_ | #ifndef _SYS_UMTX_H_ | ||||
#define _SYS_UMTX_H_ | #define _SYS_UMTX_H_ | ||||
#include <sys/_umtx.h> | #include <sys/_umtx.h> | ||||
#define UMTX_UNOWNED 0x0 | |||||
#define UMTX_CONTESTED LONG_MIN | |||||
/* Common lock flags */ | /* Common lock flags */ | ||||
#define USYNC_PROCESS_SHARED 0x0001 /* Process shared sync objs */ | #define USYNC_PROCESS_SHARED 0x0001 /* Process shared sync objs */ | ||||
/* umutex flags */ | /* umutex flags */ | ||||
#define UMUTEX_PRIO_INHERIT 0x0004 /* Priority inherited mutex */ | #define UMUTEX_PRIO_INHERIT 0x0004 /* Priority inherited mutex */ | ||||
#define UMUTEX_PRIO_PROTECT 0x0008 /* Priority protect mutex */ | #define UMUTEX_PRIO_PROTECT 0x0008 /* Priority protect mutex */ | ||||
#define UMUTEX_ROBUST 0x0010 /* Robust mutex */ | #define UMUTEX_ROBUST 0x0010 /* Robust mutex */ | ||||
#define UMUTEX_NONCONSISTENT 0x0020 /* Robust locked but not consistent */ | #define UMUTEX_NONCONSISTENT 0x0020 /* Robust locked but not consistent */ | ||||
Show All 23 Lines | |||||
#define SEM_NAMED 0x0002 | #define SEM_NAMED 0x0002 | ||||
/* _usem2 count field */ | /* _usem2 count field */ | ||||
#define USEM_HAS_WAITERS 0x80000000U | #define USEM_HAS_WAITERS 0x80000000U | ||||
#define USEM_MAX_COUNT 0x7fffffffU | #define USEM_MAX_COUNT 0x7fffffffU | ||||
#define USEM_COUNT(c) ((c) & USEM_MAX_COUNT) | #define USEM_COUNT(c) ((c) & USEM_MAX_COUNT) | ||||
/* op code for _umtx_op */ | /* op code for _umtx_op */ | ||||
#define UMTX_OP_RESERVED0 0 | #define UMTX_OP_LOCK 0 /* COMPAT10 */ | ||||
#define UMTX_OP_RESERVED1 1 | #define UMTX_OP_UNLOCK 1 /* COMPAT10 */ | ||||
brooks: Does it make sense to put these under `#ifdef _KERNEL` to prevent new code form using them… | |||||
Done Inline ActionsWe do not do that for UMTX_OP_SEM_WAIT/WAKE. I considered keeping RESERVED symbols in the header, and redefine them to LOCK/UNLOCK in kern_umtx.c, as well as defining struct umtx in kern_umtx.c too. But then I decided that this obfuscation is not worth it: the facilitiy is under COMPAT_FREEBSD10 anyway, so anybody trying to use it (why? also it is not documented in umtx_op(2)) needs to make an argument to himself. kib: We do not do that for UMTX_OP_SEM_WAIT/WAKE.
I considered keeping RESERVED symbols in the… | |||||
#define UMTX_OP_WAIT 2 | #define UMTX_OP_WAIT 2 | ||||
#define UMTX_OP_WAKE 3 | #define UMTX_OP_WAKE 3 | ||||
#define UMTX_OP_MUTEX_TRYLOCK 4 | #define UMTX_OP_MUTEX_TRYLOCK 4 | ||||
#define UMTX_OP_MUTEX_LOCK 5 | #define UMTX_OP_MUTEX_LOCK 5 | ||||
#define UMTX_OP_MUTEX_UNLOCK 6 | #define UMTX_OP_MUTEX_UNLOCK 6 | ||||
#define UMTX_OP_SET_CEILING 7 | #define UMTX_OP_SET_CEILING 7 | ||||
#define UMTX_OP_CV_WAIT 8 | #define UMTX_OP_CV_WAIT 8 | ||||
#define UMTX_OP_CV_SIGNAL 9 | #define UMTX_OP_CV_SIGNAL 9 | ||||
▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines |
Does it make sense to put these under #ifdef _KERNEL to prevent new code form using them without some effort?