1 /* Public domain. */ 2 3 #ifndef _LINUX_CAPABILITY_H 4 #define _LINUX_CAPABILITY_H 5 6 #include <sys/param.h> 7 #include <sys/systm.h> 8 #include <sys/ucred.h> 9 #include <machine/cpu.h> 10 11 #define CAP_SYS_ADMIN 0x1 12 #define CAP_SYS_NICE 0x2 13 14 static inline bool capable(int cap)15capable(int cap) 16 { 17 switch (cap) { 18 case CAP_SYS_ADMIN: 19 case CAP_SYS_NICE: 20 return suser(curproc) == 0; 21 default: 22 panic("unhandled capability"); 23 } 24 } 25 26 static inline bool perfmon_capable(void)27perfmon_capable(void) 28 { 29 return false; 30 } 31 32 #endif 33