diff options
author | dim <dim@FreeBSD.org> | 2016-03-03 23:15:46 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2016-03-03 23:15:46 +0000 |
commit | 9ac7ec88271f4a2dca21389be4d8f3c51f6b66f4 (patch) | |
tree | 933ca1d4eee78dcba4bd7cb9578fbf354cd90bbb /usr.bin | |
parent | d50a25246889bd164391143e1394f0c845d954ae (diff) | |
parent | aa85fc5f7d9ad16a9160db16293329e874f53bc4 (diff) | |
download | FreeBSD-src-9ac7ec88271f4a2dca21389be4d8f3c51f6b66f4.zip FreeBSD-src-9ac7ec88271f4a2dca21389be4d8f3c51f6b66f4.tar.gz |
Merge ^/head r296007 through r296368.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/kdump/Makefile | 6 | ||||
-rw-r--r-- | usr.bin/kdump/Makefile.depend | 4 | ||||
-rw-r--r-- | usr.bin/kdump/kdump.c | 38 | ||||
-rw-r--r-- | usr.bin/limits/limits.c | 7 | ||||
-rw-r--r-- | usr.bin/procstat/procstat_rlimit.c | 5 | ||||
-rw-r--r-- | usr.bin/talk/ctl_transact.c | 18 | ||||
-rw-r--r-- | usr.bin/talk/io.c | 18 |
7 files changed, 55 insertions, 41 deletions
diff --git a/usr.bin/kdump/Makefile b/usr.bin/kdump/Makefile index 40109f0..f80f668 100644 --- a/usr.bin/kdump/Makefile +++ b/usr.bin/kdump/Makefile @@ -11,8 +11,10 @@ CFLAGS+= -I${.CURDIR}/../ktrace -I${.CURDIR} -I${.CURDIR}/../.. -I. LIBADD= sysdecode .if ${MK_CASPER} != "no" -LIBADD+= capsicum -CFLAGS+=-DHAVE_LIBCAPSICUM +LIBADD+= casper +LIBADD+= cap_grp +LIBADD+= cap_pwd +CFLAGS+=-DHAVE_LIBCASPER .endif NO_WERROR?= YES diff --git a/usr.bin/kdump/Makefile.depend b/usr.bin/kdump/Makefile.depend index 4faacfd..71c8213 100644 --- a/usr.bin/kdump/Makefile.depend +++ b/usr.bin/kdump/Makefile.depend @@ -9,7 +9,9 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ - lib/libcapsicum \ + lib/libcasper/libcasper \ + lib/libcasper/services/cap_grp \ + lib/libcasper/services/cap_pwd \ lib/libcompiler_rt \ lib/libnv \ lib/libsysdecode \ diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index b4a1f69..e45a733 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -61,7 +61,7 @@ extern int errno; #include <sys/un.h> #include <sys/queue.h> #include <sys/wait.h> -#ifdef HAVE_LIBCAPSICUM +#ifdef HAVE_LIBCASPER #include <sys/nv.h> #endif #include <arpa/inet.h> @@ -70,12 +70,6 @@ extern int errno; #include <err.h> #include <grp.h> #include <inttypes.h> -#ifdef HAVE_LIBCAPSICUM -#include <libcapsicum.h> -#include <libcapsicum_grp.h> -#include <libcapsicum_pwd.h> -#include <libcapsicum_service.h> -#endif #include <locale.h> #include <netdb.h> #include <nl_types.h> @@ -91,6 +85,13 @@ extern int errno; #include "ktrace.h" #include "kdump_subr.h" +#ifdef HAVE_LIBCASPER +#include <libcasper.h> + +#include <casper/cap_grp.h> +#include <casper/cap_pwd.h> +#endif + u_int abidump(struct ktr_header *); int fetchprocinfo(struct ktr_header *, u_int *); int fread_tail(void *, int, int); @@ -151,7 +152,7 @@ struct proc_info static TAILQ_HEAD(trace_procs, proc_info) trace_procs; -#ifdef HAVE_LIBCAPSICUM +#ifdef HAVE_LIBCASPER static cap_channel_t *cappwd, *capgrp; #endif @@ -180,7 +181,7 @@ localtime_init(void) (void)localtime(<ime); } -#ifdef HAVE_LIBCAPSICUM +#ifdef HAVE_LIBCASPER static int cappwdgrp_setup(cap_channel_t **cappwdp, cap_channel_t **capgrpp) { @@ -189,8 +190,8 @@ cappwdgrp_setup(cap_channel_t **cappwdp, cap_channel_t **capgrpp) capcas = cap_init(); if (capcas == NULL) { - warn("unable to contact casperd"); - return (-1); + err(1, "unable to create casper process"); + exit(1); } cappwdloc = cap_service_open(capcas, "system.pwd"); capgrploc = cap_service_open(capcas, "system.grp"); @@ -222,7 +223,7 @@ cappwdgrp_setup(cap_channel_t **cappwdp, cap_channel_t **capgrpp) *capgrpp = capgrploc; return (0); } -#endif /* HAVE_LIBCAPSICUM */ +#endif /* HAVE_LIBCASPER */ int main(int argc, char *argv[]) @@ -302,7 +303,7 @@ main(int argc, char *argv[]) strerror_init(); localtime_init(); -#ifdef HAVE_LIBCAPSICUM +#ifdef HAVE_LIBCASPER if (resolv != 0) { if (cappwdgrp_setup(&cappwd, &capgrp) < 0) { cappwd = NULL; @@ -520,6 +521,9 @@ abidump(struct ktr_header *kth) case SV_ABI_FREEBSD: abi = "F"; break; + case SV_ABI_CLOUDABI: + abi = "C"; + break; default: abi = "U"; break; @@ -674,6 +678,10 @@ syscallabi(u_int sv_flags) #endif return (SYSDECODE_ABI_LINUX); #endif +#if defined(__aarch64__) || defined(__amd64__) + case SV_ABI_CLOUDABI: + return (SYSDECODE_ABI_CLOUDABI64); +#endif default: return (SYSDECODE_ABI_UNKNOWN); } @@ -1641,7 +1649,7 @@ ktrstat(struct stat *statp) if (resolv == 0) { pwd = NULL; } else { -#ifdef HAVE_LIBCAPSICUM +#ifdef HAVE_LIBCASPER if (cappwd != NULL) pwd = cap_getpwuid(cappwd, statp->st_uid); else @@ -1655,7 +1663,7 @@ ktrstat(struct stat *statp) if (resolv == 0) { grp = NULL; } else { -#ifdef HAVE_LIBCAPSICUM +#ifdef HAVE_LIBCASPER if (capgrp != NULL) grp = cap_getgrgid(capgrp, statp->st_gid); else diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c index 28b09ca..093a367 100644 --- a/usr.bin/limits/limits.c +++ b/usr.bin/limits/limits.c @@ -92,6 +92,7 @@ static struct { { " pseudo-terminals%-4s %8s", "\n", 1 }, { " swapuse%-4s %8s", " kB\n", 1024 }, { " kqueues%-4s %8s", "\n", 1 }, + { " umtxp%-4s %8s", "\n", 1 }, } }, { "sh", "unlimited", "", " -H", " -S", "", @@ -110,6 +111,7 @@ static struct { { "ulimit%s -p %s", ";\n", 1 }, { "ulimit%s -w %s", ";\n", 1024 }, { "ulimit%s -k %s", ";\n", 1 }, + { "ulimit%s -o %s", ";\n", 1 }, } }, { "csh", "unlimited", "", " -h", "", NULL, @@ -128,6 +130,7 @@ static struct { { "limit%s pseudoterminals %s", ";\n", 1 }, { "limit%s swapsize %s", ";\n", 1024 }, { "limit%s kqueues %s", ";\n", 1 }, + { "limit%s umtxp %s", ";\n", 1 }, } }, { "bash|bash2", "unlimited", "", " -H", " -S", "", @@ -163,6 +166,7 @@ static struct { { "limit%s pseudoterminals %s", ";\n", 1 }, { "limit%s swapsize %s", ";\n", 1024 }, { "limit%s kqueues %s", ";\n", 1 }, + { "limit%s umtxp %s", ";\n", 1 }, } }, { "ksh|pdksh", "unlimited", "", " -H", " -S", "", @@ -239,6 +243,7 @@ static struct { { "pseudoterminals",login_getcapnum }, { "swapuse", login_getcapsize }, { "kqueues", login_getcapnum }, + { "umtxp", login_getcapnum }, }; /* @@ -289,7 +294,7 @@ main(int argc, char *argv[]) pid = -1; optarg = NULL; while ((ch = getopt(argc, argv, - ":EeC:U:BSHP:ab:c:d:f:l:m:n:s:t:u:v:p:w:k:")) != -1) { + ":EeC:U:BSHP:ab:c:d:f:l:m:n:s:t:u:v:p:w:k:o:")) != -1) { switch(ch) { case 'a': doall = 1; diff --git a/usr.bin/procstat/procstat_rlimit.c b/usr.bin/procstat/procstat_rlimit.c index 5e7d12e..5088c59 100644 --- a/usr.bin/procstat/procstat_rlimit.c +++ b/usr.bin/procstat/procstat_rlimit.c @@ -47,7 +47,7 @@ static struct { const char *name; const char *suffix; -} rlimit_param[14] = { +} rlimit_param[15] = { {"cputime", "sec"}, {"filesize", "B "}, {"datasize", "B "}, @@ -62,9 +62,10 @@ static struct { {"pseudo-terminals", " "}, {"swapuse", "B "}, {"kqueues", " "}, + {"umtxp", " "}, }; -#if RLIM_NLIMITS > 14 +#if RLIM_NLIMITS > 15 #error "Resource limits have grown. Add new entries to rlimit_param[]." #endif diff --git a/usr.bin/talk/ctl_transact.c b/usr.bin/talk/ctl_transact.c index 81fead6..687de1e 100644 --- a/usr.bin/talk/ctl_transact.c +++ b/usr.bin/talk/ctl_transact.c @@ -38,6 +38,7 @@ static const char sccsid[] = "@(#)ctl_transact.c 8.1 (Berkeley) 6/6/93"; #include <arpa/inet.h> #include <errno.h> +#include <poll.h> #include "talk.h" #include "talk_ctl.h" @@ -52,23 +53,20 @@ static const char sccsid[] = "@(#)ctl_transact.c 8.1 (Berkeley) 6/6/93"; void ctl_transact(struct in_addr target, CTL_MSG lmsg, int type, CTL_RESPONSE *rp) { - fd_set read_mask, ctl_mask; + struct pollfd pfd[1]; int nready = 0, cc; - struct timeval wait; lmsg.type = type; daemon_addr.sin_addr = target; daemon_addr.sin_port = daemon_port; - FD_ZERO(&ctl_mask); - FD_SET(ctl_sockt, &ctl_mask); + pfd[0].fd = ctl_sockt; + pfd[0].events = POLLIN; /* * Keep sending the message until a response of * the proper type is obtained. */ do { - wait.tv_sec = CTL_WAIT; - wait.tv_usec = 0; /* resend message until a response is obtained */ do { cc = sendto(ctl_sockt, (char *)&lmsg, sizeof (lmsg), 0, @@ -79,8 +77,7 @@ ctl_transact(struct in_addr target, CTL_MSG lmsg, int type, CTL_RESPONSE *rp) continue; p_error("Error on write to talk daemon"); } - read_mask = ctl_mask; - nready = select(32, &read_mask, 0, 0, &wait); + nready = poll(pfd, 1, CTL_WAIT * 1000); if (nready < 0) { if (errno == EINTR) continue; @@ -99,10 +96,7 @@ ctl_transact(struct in_addr target, CTL_MSG lmsg, int type, CTL_RESPONSE *rp) continue; p_error("Error on read from talk daemon"); } - read_mask = ctl_mask; - /* an immediate poll */ - timerclear(&wait); - nready = select(32, &read_mask, 0, 0, &wait); + nready = poll(pfd, 1, 0); } while (nready > 0 && (rp->vers != TALK_VERSION || rp->type != type)); } while (rp->vers != TALK_VERSION || rp->type != type); diff --git a/usr.bin/talk/io.c b/usr.bin/talk/io.c index 7e9db73..eb5df61 100644 --- a/usr.bin/talk/io.c +++ b/usr.bin/talk/io.c @@ -46,6 +46,7 @@ static const char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; #include <errno.h> #include <signal.h> #include <netdb.h> +#include <poll.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -67,8 +68,8 @@ void talk(void) { struct hostent *hp, *hp2; + struct pollfd fds[2]; int nb; - fd_set read_set; wchar_t buf[BUFSIZ]; char **addr, *his_machine_name; FILE *sockfp; @@ -107,10 +108,11 @@ talk(void) * Wait on both the other process (sockt) and standard input. */ for (;;) { - FD_ZERO(&read_set); - FD_SET(sockt, &read_set); - FD_SET(fileno(stdin), &read_set); - nb = select(32, &read_set, 0, 0, NULL); + fds[0].fd = fileno(stdin); + fds[0].events = POLLIN; + fds[1].fd = sockt; + fds[1].events = POLLIN; + nb = poll(fds, 2, INFTIM); if (gotwinch) { resize_display(); gotwinch = 0; @@ -119,10 +121,10 @@ talk(void) if (errno == EINTR) continue; /* Panic, we don't know what happened. */ - p_error("Unexpected error from select"); + p_error("Unexpected error from poll"); quit(); } - if (FD_ISSET(sockt, &read_set)) { + if (fds[1].revents & POLLIN) { wint_t w; /* There is data on sockt. */ @@ -133,7 +135,7 @@ talk(void) } display(&his_win, &w); } - if (FD_ISSET(fileno(stdin), &read_set)) { + if (fds[0].revents & POLLIN) { wint_t w; if ((w = getwchar()) != WEOF) { |