diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-11-06 15:42:44 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-11-15 10:56:14 +0100 |
commit | e0b4edbdcc3558d3f38af8398f995c2e9f019f07 (patch) | |
tree | ea91a5fcfb9b6a66a8c0b74cf68ff8d450ce17e0 /freebsd/lib | |
parent | Disable or make static kern_* functions (diff) | |
download | rtems-libbsd-e0b4edbdcc3558d3f38af8398f995c2e9f019f07.tar.bz2 |
Update to FreeBSD head 2018-11-15
Git mirror commit a18b0830c4be01b39489a891b63d6023ada6358a.
Update #3472.
Diffstat (limited to 'freebsd/lib')
-rw-r--r-- | freebsd/lib/libc/net/nsdispatch.c | 11 | ||||
-rw-r--r-- | freebsd/lib/libcapsicum/capsicum_helpers.h | 29 |
2 files changed, 40 insertions, 0 deletions
diff --git a/freebsd/lib/libc/net/nsdispatch.c b/freebsd/lib/libc/net/nsdispatch.c index 1c7612f1..880a4101 100644 --- a/freebsd/lib/libc/net/nsdispatch.c +++ b/freebsd/lib/libc/net/nsdispatch.c @@ -351,6 +351,7 @@ static int nss_configure(void) { static time_t confmod; + static int already_initialized = 0; struct stat statbuf; int result, isthreaded; const char *path; @@ -368,6 +369,16 @@ nss_configure(void) if (path == NULL) #endif path = _PATH_NS_CONF; +#ifndef NS_REREAD_CONF + /* + * Define NS_REREAD_CONF to have nsswitch notice changes + * to nsswitch.conf(5) during runtime. This involves calling + * stat(2) every time, which can result in performance hit. + */ + if (already_initialized) + return (0); + already_initialized = 1; +#endif /* NS_REREAD_CONF */ if (stat(path, &statbuf) != 0) return (0); if (statbuf.st_mtime <= confmod) 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) |