summaryrefslogtreecommitdiffstats
path: root/freebsd/lib/libcapsicum/capsicum_helpers.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-07-09 11:14:53 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-07-09 14:45:47 +0200
commit5283630d2c9d40deb0183696d278e02644fe4326 (patch)
treed5695aea058ed05d4d9a4b84b5cb9986aaefd23f /freebsd/lib/libcapsicum/capsicum_helpers.h
parentEPOCH(9): Add epoch_drain_callbacks() (diff)
downloadrtems-libbsd-5283630d2c9d40deb0183696d278e02644fe4326.tar.bz2
Update to FreeBSD stable/12 2019-07-09
Git mirror commit 3427c3416aa3c0f25124070959cca78024b94d85.
Diffstat (limited to 'freebsd/lib/libcapsicum/capsicum_helpers.h')
-rw-r--r--freebsd/lib/libcapsicum/capsicum_helpers.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/freebsd/lib/libcapsicum/capsicum_helpers.h b/freebsd/lib/libcapsicum/capsicum_helpers.h
index 60c894f3..d1c46e74 100644
--- a/freebsd/lib/libcapsicum/capsicum_helpers.h
+++ b/freebsd/lib/libcapsicum/capsicum_helpers.h
@@ -136,6 +136,35 @@ caph_enter(void)
return (0);
}
+static __inline int
+caph_rights_limit(int fd, const cap_rights_t *rights)
+{
+
+ if (cap_rights_limit(fd, rights) < 0 && errno != ENOSYS)
+ return (-1);
+
+ return (0);
+}
+
+static __inline int
+caph_ioctls_limit(int fd, const unsigned long *cmds, size_t ncmds)
+{
+
+ if (cap_ioctls_limit(fd, cmds, ncmds) < 0 && errno != ENOSYS)
+ return (-1);
+
+ return (0);
+}
+
+static __inline int
+caph_fcntls_limit(int fd, uint32_t fcntlrights)
+{
+
+ if (cap_fcntls_limit(fd, fcntlrights) < 0 && errno != ENOSYS)
+ return (-1);
+
+ return (0);
+}
static __inline int
caph_enter_casper(void)