diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-08-22 14:59:50 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-09-21 10:29:41 +0200 |
commit | 3489e3b6396ee9944a6a2e19e675ca54c36993b4 (patch) | |
tree | cd55cfac1c96ff4b888a9606fd6a0d8eb65bb446 /freebsd/lib | |
parent | ck: Define CK_MD_PPC32_LWSYNC if available (diff) | |
download | rtems-libbsd-3489e3b6396ee9944a6a2e19e675ca54c36993b4.tar.bz2 |
Update to FreeBSD head 2018-09-17
Git mirror commit 6c2192b1ef8c50788c751f878552526800b1e319.
Update #3472.
Diffstat (limited to 'freebsd/lib')
-rw-r--r-- | freebsd/lib/libc/gen/err.c | 4 | ||||
-rw-r--r-- | freebsd/lib/libc/gen/getdomainname.c | 4 | ||||
-rw-r--r-- | freebsd/lib/libc/gen/gethostname.c | 4 | ||||
-rw-r--r-- | freebsd/lib/libc/gen/sethostname.c | 4 | ||||
-rw-r--r-- | freebsd/lib/libc/include/libc_private.h | 2 | ||||
-rw-r--r-- | freebsd/lib/libc/include/namespace.h | 1 | ||||
-rw-r--r-- | freebsd/lib/libc/include/un-namespace.h | 1 | ||||
-rw-r--r-- | freebsd/lib/libc/inet/inet_addr.c | 7 | ||||
-rw-r--r-- | freebsd/lib/libc/resolv/res_init.c | 2 | ||||
-rw-r--r-- | freebsd/lib/libcapsicum/capsicum_helpers.h | 149 | ||||
-rw-r--r-- | freebsd/lib/libcasper/libcasper/libcasper.h | 6 | ||||
-rw-r--r-- | freebsd/lib/libkvm/kvm.h | 4 | ||||
-rw-r--r-- | freebsd/lib/libutil/libutil.h | 1 |
13 files changed, 167 insertions, 22 deletions
diff --git a/freebsd/lib/libc/gen/err.c b/freebsd/lib/libc/gen/err.c index 9ad0da79..1ab23a1e 100644 --- a/freebsd/lib/libc/gen/err.c +++ b/freebsd/lib/libc/gen/err.c @@ -31,10 +31,8 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> +__SCCSID("@(#)err.c 8.1 (Berkeley) 6/4/93"); __FBSDID("$FreeBSD$"); #include "namespace.h" diff --git a/freebsd/lib/libc/gen/getdomainname.c b/freebsd/lib/libc/gen/getdomainname.c index 32dfdf01..14ede72a 100644 --- a/freebsd/lib/libc/gen/getdomainname.c +++ b/freebsd/lib/libc/gen/getdomainname.c @@ -31,10 +31,8 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)gethostname.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> +__SCCSID("@(#)gethostname.c 8.1 (Berkeley) 6/4/93"); __FBSDID("$FreeBSD$"); #include <sys/param.h> diff --git a/freebsd/lib/libc/gen/gethostname.c b/freebsd/lib/libc/gen/gethostname.c index 0c832be1..974b771f 100644 --- a/freebsd/lib/libc/gen/gethostname.c +++ b/freebsd/lib/libc/gen/gethostname.c @@ -31,10 +31,8 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)gethostname.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> +__SCCSID("@(#)gethostname.c 8.1 (Berkeley) 6/4/93"); __FBSDID("$FreeBSD$"); #include <sys/param.h> diff --git a/freebsd/lib/libc/gen/sethostname.c b/freebsd/lib/libc/gen/sethostname.c index c7185019..5ab629d8 100644 --- a/freebsd/lib/libc/gen/sethostname.c +++ b/freebsd/lib/libc/gen/sethostname.c @@ -31,10 +31,8 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)sethostname.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> +__SCCSID("@(#)sethostname.c 8.1 (Berkeley) 6/4/93"); __FBSDID("$FreeBSD$"); #include <sys/param.h> diff --git a/freebsd/lib/libc/include/libc_private.h b/freebsd/lib/libc/include/libc_private.h index f5a2a570..8e78f556 100644 --- a/freebsd/lib/libc/include/libc_private.h +++ b/freebsd/lib/libc/include/libc_private.h @@ -409,8 +409,6 @@ int __sys_futimens(int fd, const struct timespec *times) __hidden; int __sys_utimensat(int fd, const char *path, const struct timespec *times, int flag) __hidden; -__size_t __arc4_sysctl(unsigned char *, __size_t); - /* execve() with PATH processing to implement posix_spawnp() */ int _execvpe(const char *, char * const *, char * const *); diff --git a/freebsd/lib/libc/include/namespace.h b/freebsd/lib/libc/include/namespace.h index 252265c8..08a8c673 100644 --- a/freebsd/lib/libc/include/namespace.h +++ b/freebsd/lib/libc/include/namespace.h @@ -126,6 +126,7 @@ #define pthread_detach _pthread_detach #define pthread_equal _pthread_equal #define pthread_exit _pthread_exit +#define pthread_get_name_np _pthread_get_name_np #define pthread_getaffinity_np _pthread_getaffinity_np #define pthread_getconcurrency _pthread_getconcurrency #define pthread_getcpuclockid _pthread_getcpuclockid diff --git a/freebsd/lib/libc/include/un-namespace.h b/freebsd/lib/libc/include/un-namespace.h index 5089a707..33c7b00a 100644 --- a/freebsd/lib/libc/include/un-namespace.h +++ b/freebsd/lib/libc/include/un-namespace.h @@ -116,6 +116,7 @@ #undef pthread_detach #undef pthread_equal #undef pthread_exit +#undef pthread_get_name_np #undef pthread_getaffinity_np #undef pthread_getconcurrency #undef pthread_getcpuclockid diff --git a/freebsd/lib/libc/inet/inet_addr.c b/freebsd/lib/libc/inet/inet_addr.c index 5d8f5f1a..0ec3ee63 100644 --- a/freebsd/lib/libc/inet/inet_addr.c +++ b/freebsd/lib/libc/inet/inet_addr.c @@ -186,19 +186,20 @@ inet_aton(const char *cp, struct in_addr *addr) { case 2: /*%< a.b -- 8.24 bits */ if (val > 0xffffffU) return (0); - val |= parts[0] << 24; + val |= (uint32_t)parts[0] << 24; break; case 3: /*%< a.b.c -- 8.8.16 bits */ if (val > 0xffffU) return (0); - val |= (parts[0] << 24) | (parts[1] << 16); + val |= ((uint32_t)parts[0] << 24) | (parts[1] << 16); break; case 4: /*%< a.b.c.d -- 8.8.8.8 bits */ if (val > 0xffU) return (0); - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); + val |= ((uint32_t)parts[0] << 24) | (parts[1] << 16) | + (parts[2] << 8); break; } if (addr != NULL) diff --git a/freebsd/lib/libc/resolv/res_init.c b/freebsd/lib/libc/resolv/res_init.c index 815313c0..2cbaa939 100644 --- a/freebsd/lib/libc/resolv/res_init.c +++ b/freebsd/lib/libc/resolv/res_init.c @@ -681,6 +681,8 @@ res_setoptions(res_state statp, const char *options, const char *source) statp->options |= RES_INSECURE2; } else if (!strncmp(cp, "rotate", sizeof("rotate") - 1)) { statp->options |= RES_ROTATE; + } else if (!strncmp(cp, "usevc", sizeof("usevc") - 1)) { + statp->options |= RES_USEVC; } else if (!strncmp(cp, "no-check-names", sizeof("no-check-names") - 1)) { statp->options |= RES_NOCHECKNAME; diff --git a/freebsd/lib/libcapsicum/capsicum_helpers.h b/freebsd/lib/libcapsicum/capsicum_helpers.h new file mode 100644 index 00000000..60c894f3 --- /dev/null +++ b/freebsd/lib/libcapsicum/capsicum_helpers.h @@ -0,0 +1,149 @@ +/*- + * Copyright (c) 2016 Mariusz Zaborski <oshogbo@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _CAPSICUM_HELPERS_H_ +#define _CAPSICUM_HELPERS_H_ + +#include <sys/param.h> +#include <sys/capsicum.h> +#include <sys/ioctl.h> + +#include <errno.h> +#include <nl_types.h> +#include <termios.h> +#include <time.h> +#include <unistd.h> + +#include <libcasper.h> + +#define CAPH_IGNORE_EBADF 0x0001 +#define CAPH_READ 0x0002 +#define CAPH_WRITE 0x0004 +#define CAPH_LOOKUP 0x0008 + +__BEGIN_DECLS + +static __inline int +caph_limit_stream(int fd, int flags) +{ + cap_rights_t rights; + unsigned long cmds[] = { TIOCGETA, TIOCGWINSZ, FIODTYPE }; + + cap_rights_init(&rights, CAP_EVENT, CAP_FCNTL, CAP_FSTAT, + CAP_IOCTL, CAP_SEEK); + + if ((flags & CAPH_READ) != 0) + cap_rights_set(&rights, CAP_READ); + if ((flags & CAPH_WRITE) != 0) + cap_rights_set(&rights, CAP_WRITE); + if ((flags & CAPH_LOOKUP) != 0) + cap_rights_set(&rights, CAP_LOOKUP); + + if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS) { + if (errno == EBADF && (flags & CAPH_IGNORE_EBADF) != 0) + return (0); + return (-1); + } + + if (cap_ioctls_limit(fd, cmds, nitems(cmds)) < 0 && errno != ENOSYS) + return (-1); + + if (cap_fcntls_limit(fd, CAP_FCNTL_GETFL) < 0 && errno != ENOSYS) + return (-1); + + return (0); +} + +static __inline int +caph_limit_stdin(void) +{ + + return (caph_limit_stream(STDIN_FILENO, CAPH_READ)); +} + +static __inline int +caph_limit_stderr(void) +{ + + return (caph_limit_stream(STDERR_FILENO, CAPH_WRITE)); +} + +static __inline int +caph_limit_stdout(void) +{ + + return (caph_limit_stream(STDOUT_FILENO, CAPH_WRITE)); +} + +static __inline int +caph_limit_stdio(void) +{ + const int iebadf = CAPH_IGNORE_EBADF; + + if (caph_limit_stream(STDIN_FILENO, CAPH_READ | iebadf) == -1 || + caph_limit_stream(STDOUT_FILENO, CAPH_WRITE | iebadf) == -1 || + caph_limit_stream(STDERR_FILENO, CAPH_WRITE | iebadf) == -1) + return (-1); + return (0); +} + +static __inline void +caph_cache_tzdata(void) +{ + + tzset(); +} + +static __inline void +caph_cache_catpages(void) +{ + + (void)catopen("libc", NL_CAT_LOCALE); +} + +static __inline int +caph_enter(void) +{ + + if (cap_enter() < 0 && errno != ENOSYS) + return (-1); + + return (0); +} + + +static __inline int +caph_enter_casper(void) +{ + + return (CASPER_SUPPORT == 0 ? 0 : caph_enter()); +} + +__END_DECLS + +#endif /* _CAPSICUM_HELPERS_H_ */ diff --git a/freebsd/lib/libcasper/libcasper/libcasper.h b/freebsd/lib/libcasper/libcasper/libcasper.h index 81d65f56..c8ed184d 100644 --- a/freebsd/lib/libcasper/libcasper/libcasper.h +++ b/freebsd/lib/libcasper/libcasper/libcasper.h @@ -71,6 +71,8 @@ typedef struct cap_channel cap_channel_t; #endif /* ! WITH_CASPER */ #endif /* ! _CAP_CHANNEL_T_DECLARED */ +__BEGIN_DECLS + #ifdef WITH_CASPER int cap_channel_flags(const cap_channel_t *chan); #else @@ -105,7 +107,7 @@ cap_init(void) { cap_channel_t *chan; - chan = malloc(sizeof(*chan)); + chan = (cap_channel_t *)malloc(sizeof(*chan)); if (chan != NULL) { chan->cch_fd = -1; } @@ -279,4 +281,6 @@ cap_xfer_nvlist(const cap_channel_t *chan, nvlist_t *nvl) } #endif +__END_DECLS + #endif /* !_LIBCASPER_H_ */ diff --git a/freebsd/lib/libkvm/kvm.h b/freebsd/lib/libkvm/kvm.h index c5d46f9f..823e40a7 100644 --- a/freebsd/lib/libkvm/kvm.h +++ b/freebsd/lib/libkvm/kvm.h @@ -61,10 +61,6 @@ typedef __ssize_t ssize_t; #define _SSIZE_T_DECLARED #endif -#ifndef __rtems__ -typedef uint64_t kvaddr_t; /* An address in a target image. */ -#endif /* __rtems__ */ - struct kvm_nlist { const char *n_name; unsigned char n_type; diff --git a/freebsd/lib/libutil/libutil.h b/freebsd/lib/libutil/libutil.h index c79eaac5..2ac5e975 100644 --- a/freebsd/lib/libutil/libutil.h +++ b/freebsd/lib/libutil/libutil.h @@ -155,6 +155,7 @@ int pw_edit(int _notsetuid); int pw_equal(const struct passwd *_pw1, const struct passwd *_pw2); void pw_fini(void); int pw_init(const char *_dir, const char *_master); +void pw_initpwd(struct passwd *_pw); char *pw_make(const struct passwd *_pw); char *pw_make_v7(const struct passwd *_pw); int pw_mkdb(const char *_user); |