| Main index | Section 3 | Options |
#include <sys/capsicum.h>
The rights argument can be inspected using cap_rights_init(3) family of functions.
The complete list of the capability rights can be found in the rights(4) manual page.
cap_rights_t setrights, getrights; int fd;memset(&setrights, 0, sizeof(setrights)); memset(&getrights, 0, sizeof(getrights));
fd = open("/tmp/foo", O_RDONLY); if (fd < 0) err(1, "open() failed");
cap_rights_init(&setrights, CAP_FSTAT, CAP_READ); if (cap_rights_limit(fd, &setrights) < 0 && errno != ENOSYS) err(1, "cap_rights_limit() failed");
if (cap_rights_get(fd, &getrights) < 0 && errno != ENOSYS) err(1, "cap_rights_get() failed");
assert(memcmp(&setrights, &getrights, sizeof(setrights)) == 0);
| [EBADF] | |
| The fd argument is not a valid active descriptor. | |
| [EFAULT] | |
| The rights argument points at an invalid address. | |
| CAP_RIGHTS_GET (3) | May 5, 2020 |
| Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | Ken Thompson has an automobile which he helped design. Unlike most automobiles, it has neither speedometer, nor gas gauge, nor any of the other numerous idiot lights which plague the modern driver. Rather, if the driver makes a mistake, a giant “?” lights up in the center of the dashboard. “The experienced driver,” says Thompson, “will usually know what's wrong.” | ” |