diff options
author | pjd <pjd@FreeBSD.org> | 2013-11-15 19:55:35 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2013-11-15 19:55:35 +0000 |
commit | 6175f0915f143e6a7f6b234029a6317ac6f1516f (patch) | |
tree | 9679ecc5e195f976c67d86f2f4fd3f9424b98ee2 /sys/sys/capability.h | |
parent | f5a8595bc4fccca3eb882d06ba41dd4960c012b9 (diff) | |
download | FreeBSD-src-6175f0915f143e6a7f6b234029a6317ac6f1516f.zip FreeBSD-src-6175f0915f143e6a7f6b234029a6317ac6f1516f.tar.gz |
Replace CAP_POLL_EVENT and CAP_POST_EVENT capability rights (which I had
a very hard time to fully understand) with much more intuitive rights:
CAP_EVENT - when set on descriptor, the descriptor can be monitored
with syscalls like select(2), poll(2), kevent(2).
CAP_KQUEUE_EVENT - When set on a kqueue descriptor, the kevent(2)
syscall can be called on this kqueue to with the eventlist
argument set to non-NULL value; in other words the given
kqueue descriptor can be used to monitor other descriptors.
CAP_KQUEUE_CHANGE - When set on a kqueue descriptor, the kevent(2)
syscall can be called on this kqueue to with the changelist
argument set to non-NULL value; in other words it allows to
modify events monitored with the given kqueue descriptor.
Add alias CAP_KQUEUE, which allows for both CAP_KQUEUE_EVENT and
CAP_KQUEUE_CHANGE.
Add backward compatibility define CAP_POLL_EVENT which is equal to CAP_EVENT.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Diffstat (limited to 'sys/sys/capability.h')
-rw-r--r-- | sys/sys/capability.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/sys/capability.h b/sys/sys/capability.h index ace35f2..aad4a15 100644 --- a/sys/sys/capability.h +++ b/sys/sys/capability.h @@ -226,9 +226,10 @@ #define CAP_SEM_POST CAPRIGHT(1, 0x0000000000000008ULL) #define CAP_SEM_WAIT CAPRIGHT(1, 0x0000000000000010ULL) -/* kqueue events. */ -#define CAP_POLL_EVENT CAPRIGHT(1, 0x0000000000000020ULL) -#define CAP_POST_EVENT CAPRIGHT(1, 0x0000000000000040ULL) +/* Allows select(2) and poll(2) on descriptor. */ +#define CAP_EVENT CAPRIGHT(1, 0x0000000000000020ULL) +/* Allows for kevent(2) on kqueue descriptor with eventlist != NULL. */ +#define CAP_KQUEUE_EVENT CAPRIGHT(1, 0x0000000000000040ULL) /* Strange and powerful rights that should not be given lightly. */ /* Allows for ioctl(2). */ @@ -263,14 +264,22 @@ /* Allows for acl_set_fd(3) and acl_set_fd_np(3). */ #define CAP_ACL_SET CAPRIGHT(1, 0x0000000000080000ULL) +/* Allows for kevent(2) on kqueue descriptor with changelist != NULL. */ +#define CAP_KQUEUE_CHANGE CAPRIGHT(1, 0x0000000000100000ULL) + +#define CAP_KQUEUE (CAP_KQUEUE_EVENT | CAP_KQUEUE_CHANGE) + /* All used bits for index 1. */ -#define CAP_ALL1 CAPRIGHT(1, 0x00000000000FFFFFULL) +#define CAP_ALL1 CAPRIGHT(1, 0x00000000001FFFFFULL) /* Available bits for index 1. */ -#define CAP_UNUSED1_21 CAPRIGHT(1, 0x0000000000100000ULL) +#define CAP_UNUSED1_22 CAPRIGHT(1, 0x0000000000200000ULL) /* ... */ #define CAP_UNUSED1_57 CAPRIGHT(1, 0x0100000000000000ULL) +/* Backward compatibility. */ +#define CAP_POLL_EVENT CAP_EVENT + #define CAP_ALL(rights) do { \ (rights)->cr_rights[0] = \ ((uint64_t)CAP_RIGHTS_VERSION << 62) | CAP_ALL0; \ |