diff options
author | Renato Botelho <renato@netgate.com> | 2016-01-13 17:56:30 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-01-13 17:56:30 -0200 |
commit | 3e0bf52f358eb969d165c4b1e54942ee94cf2c8d (patch) | |
tree | 440bb9907871a5bc578d65b32f0c4aa339096175 /usr.sbin | |
parent | 4b4ac714f11471e43f18410bcc86da8f9dc3b88c (diff) | |
parent | e357bdb742b2696dcb81404917b6247f9e840232 (diff) | |
download | FreeBSD-src-3e0bf52f358eb969d165c4b1e54942ee94cf2c8d.zip FreeBSD-src-3e0bf52f358eb969d165c4b1e54942ee94cf2c8d.tar.gz |
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bhyve/bhyverun.c | 7 | ||||
-rw-r--r-- | usr.sbin/bhyve/pci_emul.c | 3 | ||||
-rw-r--r-- | usr.sbin/boot0cfg/boot0cfg.8 | 5 | ||||
-rw-r--r-- | usr.sbin/camdd/camdd.c | 5 | ||||
-rw-r--r-- | usr.sbin/fstyp/Makefile | 34 | ||||
-rw-r--r-- | usr.sbin/fstyp/fstyp.8 | 46 | ||||
-rw-r--r-- | usr.sbin/fstyp/fstyp.c | 29 | ||||
-rw-r--r-- | usr.sbin/fstyp/fstyp.h | 4 | ||||
-rw-r--r-- | usr.sbin/fstyp/geli.c | 71 | ||||
-rw-r--r-- | usr.sbin/fstyp/zfs.c | 78 | ||||
-rw-r--r-- | usr.sbin/gssd/gssd.c | 2 | ||||
-rw-r--r-- | usr.sbin/iostat/iostat.c | 59 | ||||
-rw-r--r-- | usr.sbin/kbdcontrol/kbdmap.5 | 14 | ||||
-rw-r--r-- | usr.sbin/ntp/config.h | 30 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/ntp-keygen.8 | 4 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/ntp.conf.5 | 4 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/ntp.keys.5 | 4 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/ntpd.8 | 4 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/ntpdc.8 | 4 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/ntpq.8 | 4 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/sntp.8 | 4 | ||||
-rwxr-xr-x | usr.sbin/ntp/scripts/mkver | 2 | ||||
-rw-r--r-- | usr.sbin/pw/pw_user.c | 6 | ||||
-rwxr-xr-x | usr.sbin/service/service.sh | 2 | ||||
-rw-r--r-- | usr.sbin/syslogd/syslogd.8 | 15 | ||||
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 12 |
26 files changed, 381 insertions, 71 deletions
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 5b277af..d281dc5 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -307,14 +307,13 @@ static int vmexit_inout(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu) { int error; - int bytes, port, in, out, string; + int bytes, port, in, out; int vcpu; vcpu = *pvcpu; port = vme->u.inout.port; bytes = vme->u.inout.bytes; - string = vme->u.inout.string; in = vme->u.inout.in; out = !in; @@ -596,7 +595,7 @@ static vmexit_handler_t handler[VM_EXITCODE_MAX] = { static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip) { - int error, rc, prevcpu; + int error, rc; enum vm_exitcode exitcode; cpuset_t active_cpus; @@ -617,8 +616,6 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip) if (error != 0) break; - prevcpu = vcpu; - exitcode = vmexit[vcpu].exitcode; if (exitcode >= VM_EXITCODE_MAX || handler[exitcode] == NULL) { fprintf(stderr, "vm_loop: unexpected exitcode 0x%x\n", diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index af427ef..c6763c9 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -863,10 +863,9 @@ msixcap_cfgwrite(struct pci_devinst *pi, int capoff, int offset, int bytes, uint32_t val) { uint16_t msgctrl, rwmask; - int off, table_bar; + int off; off = offset - capoff; - table_bar = pi->pi_msix.table_bar; /* Message Control Register */ if (off == 2 && bytes == 2) { rwmask = PCIM_MSIXCTRL_MSIX_ENABLE | PCIM_MSIXCTRL_FUNCTION_MASK; diff --git a/usr.sbin/boot0cfg/boot0cfg.8 b/usr.sbin/boot0cfg/boot0cfg.8 index 27f94e0..7d0b9b1 100644 --- a/usr.sbin/boot0cfg/boot0cfg.8 +++ b/usr.sbin/boot0cfg/boot0cfg.8 @@ -180,14 +180,13 @@ To enable just slices 1 and 3 in the menu: .Dl "boot0cfg -m 0x5 ada0" .Pp To go back to non-interactive booting, use -.Xr fdisk 8 +.Xr gpart 8 to install the default MBR: .Pp -.Dl "fdisk -B ada0" +.Dl "gpart bootcode -b /boot/mbr ada0" .Sh SEE ALSO .Xr geom 4 , .Xr boot 8 , -.Xr fdisk 8 , .Xr gpart 8 .Sh AUTHORS .An Robert Nordier Aq rnordier@FreeBSD.org . diff --git a/usr.sbin/camdd/camdd.c b/usr.sbin/camdd/camdd.c index 573214e..9284eb5 100644 --- a/usr.sbin/camdd/camdd.c +++ b/usr.sbin/camdd/camdd.c @@ -1276,7 +1276,6 @@ camdd_probe_pass(struct cam_device *cam_dev, struct camdd_io_opts *io_opts, struct camdd_dev_pass *pass_dev; struct kevent ke; int scsi_dev_type; - int retval; dev = NULL; @@ -1336,7 +1335,6 @@ camdd_probe_pass(struct cam_device *cam_dev, struct camdd_io_opts *io_opts, if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { cam_error_print(cam_dev, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); - retval = 1; goto bailout; } @@ -1371,11 +1369,8 @@ camdd_probe_pass(struct cam_device *cam_dev, struct camdd_io_opts *io_opts, if (cam_send_ccb(cam_dev, ccb) < 0) { warn("error sending READ CAPACITY (16) command"); - cam_error_print(cam_dev, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); - - retval = 1; goto bailout; } diff --git a/usr.sbin/fstyp/Makefile b/usr.sbin/fstyp/Makefile index b80398b..f17c005 100644 --- a/usr.sbin/fstyp/Makefile +++ b/usr.sbin/fstyp/Makefile @@ -3,13 +3,43 @@ .include <bsd.own.mk> PROG= fstyp -SRCS= fstyp.c ext2fs.c cd9660.c msdosfs.c ntfs.c ufs.c +SRCS= cd9660.c ext2fs.c fstyp.c geli.c msdosfs.c ntfs.c ufs.c + +.if ${MK_ZFS} != "no" +SRCS += zfs.c +.endif + MAN= fstyp.8 -WARNS= 6 +WARNS?= 2 .if ${MK_TESTS} != "no" SUBDIR+= tests .endif +CFLAGS+=-I${.CURDIR}/../../sys + +.if ${MK_ZFS} != "no" +IGNORE_PRAGMA= YES + +CFLAGS+= -DNEED_SOLARIS_BOOLEAN -DHAVE_ZFS +CFLAGS+= -I${.CURDIR}/../../sys/cddl/compat/opensolaris +CFLAGS+= -I${.CURDIR}/../../cddl/compat/opensolaris/include +CFLAGS+= -I${.CURDIR}/../../cddl/compat/opensolaris/lib/libumem +CFLAGS+= -I${.CURDIR}/../../cddl/contrib/opensolaris/lib/libnvpair +CFLAGS+= -I${.CURDIR}/../../cddl/contrib/opensolaris/lib/libzpool/common +CFLAGS+= -I${.CURDIR}/../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs +CFLAGS+= -I${.CURDIR}/../../sys/cddl/contrib/opensolaris/uts/common +CFLAGS+= -I${.CURDIR}/../../sys/cddl/contrib/opensolaris/uts/common/sys +CFLAGS+= -I${.CURDIR}/../../cddl/contrib/opensolaris/head +.endif + +DPADD= ${LIBGEOM} ${LIBMD} +LDADD= -lgeom -lmd + +.if ${MK_ZFS} != "no" +DPADD += ${LIBNVPAIR} ${LIBZFS} +LDADD += -lnvpair -lzfs +.endif + .include <bsd.prog.mk> diff --git a/usr.sbin/fstyp/fstyp.8 b/usr.sbin/fstyp/fstyp.8 index e72b01a..835feff 100644 --- a/usr.sbin/fstyp/fstyp.8 +++ b/usr.sbin/fstyp/fstyp.8 @@ -37,20 +37,42 @@ .Nm .Op Fl l .Op Fl s +.Op Fl u .Ar special .Sh DESCRIPTION The .Nm utility is used to determine the filesystem type on a given device. It can recognize ISO-9660, Ext2, FAT, NTFS, and UFS filesystems. +When the +.Fl u +flag is specified, +.Nm +also recognizes certain additional metadata formats that cannot be +handled using +.Xr mount 8 , +such as ZFS pools and +.Xr geli 8 +providers. +.Pp The filesystem name is printed to the standard output -as, respectively, -.Li cd9660 , -.Li ext2fs , -.Li msdosfs , -.Li ntfs , -or -.Li ufs . +as, respectively: +.Bl -item -offset indent -compact +.It +cd9660 +.It +ext2fs +.It +geli +.It +msdosfs +.It +ntfs +.It +ufs +.It +zfs +.El .Pp Because .Nm @@ -73,6 +95,9 @@ By default, only works on regular files and disk-like device nodes. Trying to read other file types might have unexpected consequences or hang indefinitely. +.It Fl u +Include filesystems and devices that cannot be mounted directly by +.Xr mount 8 . .El .Sh EXIT STATUS The @@ -82,8 +107,11 @@ type is not recognized. .Sh SEE ALSO .Xr file 1 , .Xr capsicum 4 , +.Xr autofs 8 , +.Xr geli 8 , .Xr glabel 8 , -.Xr mount 8 +.Xr mount 8 , +.Xr zpool 8 .Sh HISTORY The .Nm @@ -95,3 +123,5 @@ The utility was developed by .An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org under sponsorship from the FreeBSD Foundation. +ZFS and GELI support was added by +.An Allan Jude Aq Mt allanjude@FreeBSD.org diff --git a/usr.sbin/fstyp/fstyp.c b/usr.sbin/fstyp/fstyp.c index b49eb1e..843832e 100644 --- a/usr.sbin/fstyp/fstyp.c +++ b/usr.sbin/fstyp/fstyp.c @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <stdbool.h> #include <stddef.h> -#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -55,13 +54,18 @@ typedef int (*fstyp_function)(FILE *, char *, size_t); static struct { const char *name; fstyp_function function; + bool unmountable; } fstypes[] = { - { "cd9660", &fstyp_cd9660 }, - { "ext2fs", &fstyp_ext2fs }, - { "msdosfs", &fstyp_msdosfs }, - { "ntfs", &fstyp_ntfs }, - { "ufs", &fstyp_ufs }, - { NULL, NULL } + { "cd9660", &fstyp_cd9660, false }, + { "ext2fs", &fstyp_ext2fs, false }, + { "geli", &fstyp_geli, true }, + { "msdosfs", &fstyp_msdosfs, false }, + { "ntfs", &fstyp_ntfs, false }, + { "ufs", &fstyp_ufs, false }, +#ifdef HAVE_ZFS + { "zfs", &fstyp_zfs, true }, +#endif + { NULL, NULL, NULL } }; void * @@ -124,7 +128,7 @@ static void usage(void) { - fprintf(stderr, "usage: fstyp [-l][-s] special\n"); + fprintf(stderr, "usage: fstyp [-l] [-s] [-u] special\n"); exit(1); } @@ -153,13 +157,13 @@ int main(int argc, char **argv) { int ch, error, i, nbytes; - bool ignore_type = false, show_label = false; + bool ignore_type = false, show_label = false, show_unmountable = false; char label[LABEL_LEN + 1], strvised[LABEL_LEN * 4 + 1]; char *path; FILE *fp; fstyp_function fstyp_f; - while ((ch = getopt(argc, argv, "ls")) != -1) { + while ((ch = getopt(argc, argv, "lsu")) != -1) { switch (ch) { case 'l': show_label = true; @@ -167,6 +171,9 @@ main(int argc, char **argv) case 's': ignore_type = true; break; + case 'u': + show_unmountable = true; + break; default: usage(); } @@ -193,6 +200,8 @@ main(int argc, char **argv) memset(label, '\0', sizeof(label)); for (i = 0;; i++) { + if (show_unmountable == false && fstypes[i].unmountable == true) + continue; fstyp_f = fstypes[i].function; if (fstyp_f == NULL) break; diff --git a/usr.sbin/fstyp/fstyp.h b/usr.sbin/fstyp/fstyp.h index d4fd54f..8deba5e 100644 --- a/usr.sbin/fstyp/fstyp.h +++ b/usr.sbin/fstyp/fstyp.h @@ -40,8 +40,12 @@ void rtrim(char *label, size_t size); int fstyp_cd9660(FILE *fp, char *label, size_t size); int fstyp_ext2fs(FILE *fp, char *label, size_t size); +int fstyp_geli(FILE *fp, char *label, size_t size); int fstyp_msdosfs(FILE *fp, char *label, size_t size); int fstyp_ntfs(FILE *fp, char *label, size_t size); int fstyp_ufs(FILE *fp, char *label, size_t size); +#ifdef HAVE_ZFS +int fstyp_zfs(FILE *fp, char *label, size_t size); +#endif #endif /* !FSTYP_H */ diff --git a/usr.sbin/fstyp/geli.c b/usr.sbin/fstyp/geli.c new file mode 100644 index 0000000..59e8653 --- /dev/null +++ b/usr.sbin/fstyp/geli.c @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2015 Allan Jude <allanjude@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 AUTHORS 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 AUTHORS 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. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/disk.h> +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <geom/eli/g_eli.h> + +#include "fstyp.h" + +int +fstyp_geli(FILE *fp, char *label __unused, size_t labelsize __unused) +{ + int error; + off_t mediasize; + u_int sectorsize; + struct g_eli_metadata md; + u_char *buf; + + error = ioctl(fileno(fp), DIOCGMEDIASIZE, &mediasize); + if (error != 0) + return (1); + error = ioctl(fileno(fp), DIOCGSECTORSIZE, §orsize); + if (error != 0) + return (1); + buf = (u_char *)read_buf(fp, mediasize - sectorsize, sectorsize); + if (buf == NULL) + goto gelierr; + error = eli_metadata_decode(buf, &md); + if (error) + goto gelierr; + + if (strcmp(md.md_magic, G_ELI_MAGIC) == 0) { + free(buf); + return (0); + } + +gelierr: + free(buf); + + return (1); +} diff --git a/usr.sbin/fstyp/zfs.c b/usr.sbin/fstyp/zfs.c new file mode 100644 index 0000000..c37a5db --- /dev/null +++ b/usr.sbin/fstyp/zfs.c @@ -0,0 +1,78 @@ +/*- + * Copyright (c) 2015 Allan Jude <allanjude@FreeBSD.org> + * Copyright (c) 2015 Xin LI <delphij@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 AUTHORS 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 AUTHORS 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. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/types.h> +#include <cddl/compat/opensolaris/sys/types.h> +#include <sys/time.h> +#include <cddl/compat/opensolaris/sys/time.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <libnvpair.h> +#include <sys/vdev_impl.h> + +#include "fstyp.h" + +int +fstyp_zfs(FILE *fp, char *label, size_t labelsize) +{ + vdev_label_t *vdev_label = NULL; + vdev_phys_t *vdev_phys; + char *zpool_name = NULL; + nvlist_t *config = NULL; + int err = 0; + + /* + * Read in the first ZFS vdev label ("L0"), located at the beginning + * of the vdev and extract the pool name from it. + * + * TODO: the checksum of label should be validated. + */ + vdev_label = (vdev_label_t *)read_buf(fp, 0, sizeof(*vdev_label)); + if (vdev_label == NULL) + return (1); + + vdev_phys = &(vdev_label->vl_vdev_phys); + + if ((nvlist_unpack(vdev_phys->vp_nvlist, sizeof(vdev_phys->vp_nvlist), + &config, 0)) == 0 && + (nvlist_lookup_string(config, "name", &zpool_name) == 0)) { + strlcpy(label, zpool_name, labelsize); + } else + err = 1; + + nvlist_free(config); + free(vdev_label); + + return (err); +} diff --git a/usr.sbin/gssd/gssd.c b/usr.sbin/gssd/gssd.c index 11a633b..6ee165c 100644 --- a/usr.sbin/gssd/gssd.c +++ b/usr.sbin/gssd/gssd.c @@ -253,6 +253,7 @@ main(int argc, char **argv) gssd_syscall(_PATH_GSSDSOCK); svc_run(); + gssd_syscall(""); return (0); } @@ -1284,6 +1285,7 @@ void gssd_terminate(int sig __unused) if (hostbased_initiator_cred != 0) unlink(GSSD_CREDENTIAL_CACHE_FILE); #endif + gssd_syscall(""); exit(0); } diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c index 92b98e4..4db7991 100644 --- a/usr.sbin/iostat/iostat.c +++ b/usr.sbin/iostat/iostat.c @@ -110,6 +110,7 @@ #include <limits.h> #include <math.h> #include <nlist.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -135,6 +136,8 @@ struct device_selection *dev_select; int maxshowdevs; volatile sig_atomic_t headercount; volatile sig_atomic_t wresized; /* Tty resized, when non-zero. */ +volatile sig_atomic_t alarm_rang; +volatile sig_atomic_t return_requested; unsigned short wrows; /* Current number of tty rows. */ int dflag = 0, Iflag = 0, Cflag = 0, Tflag = 0, oflag = 0, Kflag = 0; int xflag = 0, zflag = 0; @@ -143,6 +146,8 @@ int xflag = 0, zflag = 0; static void usage(void); static void needhdr(int signo); static void needresize(int signo); +static void needreturn(int signo); +static void alarm_clock(int signo); static void doresize(void); static void phdr(void); static void devstats(int perf_select, long double etime, int havelast); @@ -172,6 +177,7 @@ main(int argc, char **argv) int count = 0, waittime = 0; char *memf = NULL, *nlistf = NULL; struct devstat_match *matches; + struct itimerval alarmspec; int num_matches = 0; char errbuf[_POSIX2_LINE_MAX]; kvm_t *kd = NULL; @@ -442,10 +448,28 @@ main(int argc, char **argv) wrows = IOSTAT_DEFAULT_ROWS; } + /* + * Register a SIGINT handler so that we can print out final statistics + * when we get that signal + */ + (void)signal(SIGINT, needreturn); + + /* + * Register a SIGALRM handler to implement sleeps if the user uses the + * -c or -w options + */ + (void)signal(SIGALRM, alarm_clock); + alarmspec.it_interval.tv_sec = waittime / 1000; + alarmspec.it_interval.tv_usec = 1000 * (waittime % 1000); + alarmspec.it_value.tv_sec = waittime / 1000; + alarmspec.it_value.tv_usec = 1000 * (waittime % 1000); + setitimer(ITIMER_REAL, &alarmspec, NULL); + for (headercount = 1;;) { struct devinfo *tmp_dinfo; long tmp; long double etime; + sigset_t sigmask, oldsigmask; if (Tflag > 0) { if ((readvar(kd, "kern.tty_nin", X_TK_NIN, &cur.tk_nin, @@ -599,10 +623,23 @@ main(int argc, char **argv) } fflush(stdout); - if (count >= 0 && --count <= 0) + if ((count >= 0 && --count <= 0) || return_requested) break; - usleep(waittime * 1000); + /* + * Use sigsuspend to safely sleep until either signal is + * received + */ + alarm_rang = 0; + sigemptyset(&sigmask); + sigaddset(&sigmask, SIGINT); + sigaddset(&sigmask, SIGALRM); + sigprocmask(SIG_BLOCK, &sigmask, &oldsigmask); + while (! (alarm_rang || return_requested) ) { + sigsuspend(&oldsigmask); + } + sigprocmask(SIG_UNBLOCK, &sigmask, NULL); + havelast = 1; } @@ -633,6 +670,24 @@ needresize(int signo) } /* + * Record the alarm so the main loop can break its sleep + */ +void +alarm_clock(int signo) +{ + alarm_rang = 1; +} + +/* + * Request that the main loop exit soon + */ +void +needreturn(int signo) +{ + return_requested = 1; +} + +/* * Update the global `wrows' count of terminal rows. */ void diff --git a/usr.sbin/kbdcontrol/kbdmap.5 b/usr.sbin/kbdcontrol/kbdmap.5 index c7f437a..2f25c29 100644 --- a/usr.sbin/kbdcontrol/kbdmap.5 +++ b/usr.sbin/kbdcontrol/kbdmap.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 29, 2008 +.Dd January 9, 2016 .Dt KBDMAP 5 .Os .Sh NAME @@ -111,9 +111,9 @@ ack, bel, bs, ht, -nl, +lf, vt, -np, +ff, cr, so, si, @@ -132,10 +132,16 @@ esc, fs, gs, rs, -ns, us, sp, del. +.It Ar control-alias +One of the historical aliases for certain +.Tn ASCII +control characters: +nl, +np, +ns. .It Ar accentname By giving one of the accent names, the next key pressed will produce diff --git a/usr.sbin/ntp/config.h b/usr.sbin/ntp/config.h index ef4717f..73f83a3 100644 --- a/usr.sbin/ntp/config.h +++ b/usr.sbin/ntp/config.h @@ -335,6 +335,9 @@ /* Define to 1 if you have the <arpa/nameser.h> header file. */ #define HAVE_ARPA_NAMESER_H 1 +/* Define to 1 if you have the `atomic_thread_fence' function. */ +/* #undef HAVE_ATOMIC_THREAD_FENCE */ + /* Do we have audio support? */ #define HAVE_AUDIO /**/ @@ -388,6 +391,9 @@ /* Define to 1 if you have the <errno.h> header file. */ #define HAVE_ERRNO_H 1 +/* Define to 1 if you have the `EVP_MD_do_all_sorted' function. */ +#define HAVE_EVP_MD_DO_ALL_SORTED 1 + /* Define to 1 if you have the `fchmod' function. */ #define HAVE_FCHMOD 1 @@ -823,6 +829,9 @@ /* Define to 1 if you have the <stdarg.h> header file. */ #define HAVE_STDARG_H 1 +/* Define to 1 if you have the <stdatomic.h> header file. */ +#define HAVE_STDATOMIC_H 1 + /* Define to 1 if you have the <stdbool.h> header file. */ #define HAVE_STDBOOL_H 1 @@ -1135,7 +1144,7 @@ /* #undef HAVE_UNIXWARE_SIGWAIT */ /* Define to 1 if the system has the type `unsigned long long int'. */ -/* #undef HAVE_UNSIGNED_LONG_LONG_INT */ +#define HAVE_UNSIGNED_LONG_LONG_INT 1 /* Define to 1 if you have the `updwtmp' function. */ /* #undef HAVE_UPDWTMP */ @@ -1317,6 +1326,9 @@ /* define to 1 if library is thread safe */ #define LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE 1 +/* leap smear mechanism */ +/* #undef LEAP_SMEAR */ + /* Define to any value to include libseccomp sandboxing. */ /* #undef LIBSECCOMP */ @@ -1333,6 +1345,10 @@ /* Should we recommend a minimum value for tickadj? */ /* #undef MIN_REC_TICKADJ */ +/* Define to 1 if the compiler does not support C99's structure + initialization. */ +/* #undef MISSING_C99_STRUCT_INIT */ + /* Do we need HPUX adjtime() library support? */ /* #undef NEED_HPUX_ADJTIME */ @@ -1421,7 +1437,7 @@ #define PACKAGE_NAME "ntp" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "ntp 4.2.8p4" +#define PACKAGE_STRING "ntp 4.2.8p5" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "ntp" @@ -1430,13 +1446,13 @@ #define PACKAGE_URL "http://www.ntp.org./" /* Define to the version of this package. */ -#define PACKAGE_VERSION "4.2.8p4" +#define PACKAGE_VERSION "4.2.8p5" /* data dir */ #define PERLLIBDIR "/usr/local/share/ntp/lib" /* define to a working POSIX compliant shell */ -#define POSIX_SHELL "/bin/bash" +#define POSIX_SHELL "/bin/sh" /* PARSE kernel PLL PPS support */ /* #undef PPS_SYNC */ @@ -1611,7 +1627,7 @@ typedef unsigned int uintptr_t; /* #undef USE_UDP_SIGPOLL */ /* Version number of package */ -#define VERSION "4.2.8p4" +#define VERSION "4.2.8p5" /* vsnprintf expands "%m" to strerror(errno) */ /* #undef VSNPRINTF_PERCENT_M */ @@ -1788,5 +1804,5 @@ typedef union mpinfou { /* * FreeBSD specific: Explicitly specify date/time for reproducible build. */ -#define MKREPRO_DATE "Oct 22 2015" -#define MKREPRO_TIME "17:58:31" +#define MKREPRO_DATE "Jan 8 2016" +#define MKREPRO_TIME "12:37:48" diff --git a/usr.sbin/ntp/doc/ntp-keygen.8 b/usr.sbin/ntp/doc/ntp-keygen.8 index 197adbf..a0c0954 100644 --- a/usr.sbin/ntp/doc/ntp-keygen.8 +++ b/usr.sbin/ntp/doc/ntp-keygen.8 @@ -1,11 +1,11 @@ -.Dd October 21 2015 +.Dd January 7 2016 .Dt NTP_KEYGEN 8 User Commands .Os .\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc) .\" .\" $FreeBSD$ .\" -.\" It has been AutoGen-ed October 21, 2015 at 12:40:10 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed January 7, 2016 at 11:32:43 PM by AutoGen 5.18.5 .\" From the definitions ntp-keygen-opts.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/usr.sbin/ntp/doc/ntp.conf.5 b/usr.sbin/ntp/doc/ntp.conf.5 index c7af12d..3f075a1 100644 --- a/usr.sbin/ntp/doc/ntp.conf.5 +++ b/usr.sbin/ntp/doc/ntp.conf.5 @@ -1,11 +1,11 @@ -.Dd October 21 2015 +.Dd January 7 2016 .Dt NTP_CONF 5 File Formats .Os .\" EDIT THIS FILE WITH CAUTION (ntp.mdoc) .\" .\" $FreeBSD$ .\" -.\" It has been AutoGen-ed October 21, 2015 at 12:38:24 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed January 7, 2016 at 11:30:57 PM by AutoGen 5.18.5 .\" From the definitions ntp.conf.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/usr.sbin/ntp/doc/ntp.keys.5 b/usr.sbin/ntp/doc/ntp.keys.5 index b1bcb3c..04dfbcd 100644 --- a/usr.sbin/ntp/doc/ntp.keys.5 +++ b/usr.sbin/ntp/doc/ntp.keys.5 @@ -1,11 +1,11 @@ -.Dd October 21 2015 +.Dd January 7 2016 .Dt NTP_KEYS 5 File Formats .Os SunOS 5.10 .\" EDIT THIS FILE WITH CAUTION (ntp.mdoc) .\" .\" $FreeBSD$ .\" -.\" It has been AutoGen-ed October 21, 2015 at 12:38:28 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed January 7, 2016 at 11:31:00 PM by AutoGen 5.18.5 .\" From the definitions ntp.keys.def .\" and the template file agmdoc-file.tpl .Sh NAME diff --git a/usr.sbin/ntp/doc/ntpd.8 b/usr.sbin/ntp/doc/ntpd.8 index 243f96d..70ab88e 100644 --- a/usr.sbin/ntp/doc/ntpd.8 +++ b/usr.sbin/ntp/doc/ntpd.8 @@ -1,11 +1,11 @@ -.Dd October 21 2015 +.Dd January 7 2016 .Dt NTPD 8 User Commands .Os .\" EDIT THIS FILE WITH CAUTION (ntpd-opts.mdoc) .\" .\" $FreeBSD$ .\" -.\" It has been AutoGen-ed October 21, 2015 at 12:38:30 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed January 7, 2016 at 11:31:02 PM by AutoGen 5.18.5 .\" From the definitions ntpd-opts.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/usr.sbin/ntp/doc/ntpdc.8 b/usr.sbin/ntp/doc/ntpdc.8 index 74129c4..3561f2a 100644 --- a/usr.sbin/ntp/doc/ntpdc.8 +++ b/usr.sbin/ntp/doc/ntpdc.8 @@ -1,11 +1,11 @@ -.Dd October 21 2015 +.Dd January 7 2016 .Dt NTPDC 8 User Commands .Os .\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc) .\" .\" $FreeBSD$ .\" -.\" It has been AutoGen-ed October 21, 2015 at 12:38:57 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed January 7, 2016 at 11:31:29 PM by AutoGen 5.18.5 .\" From the definitions ntpdc-opts.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/usr.sbin/ntp/doc/ntpq.8 b/usr.sbin/ntp/doc/ntpq.8 index bcd1fba..e71a84b 100644 --- a/usr.sbin/ntp/doc/ntpq.8 +++ b/usr.sbin/ntp/doc/ntpq.8 @@ -1,11 +1,11 @@ -.Dd October 21 2015 +.Dd January 7 2016 .Dt NTPQ 8 User Commands .Os .\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc) .\" .\" $FreeBSD$ .\" -.\" It has been AutoGen-ed October 21, 2015 at 12:39:29 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed January 7, 2016 at 11:32:02 PM by AutoGen 5.18.5 .\" From the definitions ntpq-opts.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/usr.sbin/ntp/doc/sntp.8 b/usr.sbin/ntp/doc/sntp.8 index 9bcc78d..0d2dd64 100644 --- a/usr.sbin/ntp/doc/sntp.8 +++ b/usr.sbin/ntp/doc/sntp.8 @@ -1,11 +1,11 @@ -.Dd October 21 2015 +.Dd January 7 2016 .Dt SNTP 8 User Commands .Os .\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc) .\" .\" $FreeBSD$ .\" -.\" It has been AutoGen-ed October 21, 2015 at 12:30:59 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed January 7, 2016 at 11:23:27 PM by AutoGen 5.18.5 .\" From the definitions sntp-opts.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/usr.sbin/ntp/scripts/mkver b/usr.sbin/ntp/scripts/mkver index 2bc36b5..6a99756 100755 --- a/usr.sbin/ntp/scripts/mkver +++ b/usr.sbin/ntp/scripts/mkver @@ -6,7 +6,7 @@ PROG=${1-UNKNOWN} ConfStr="$PROG" -ConfStr="$ConfStr 4.2.8p4" +ConfStr="$ConfStr 4.2.8p5" case "$CSET" in '') ;; diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index 5b422fe..30a2749 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -107,8 +107,10 @@ mkdir_home_parents(int dfd, const char *dir) errx(EX_UNAVAILABLE, "out of memory"); tmp = strrchr(dirs, '/'); - if (tmp == NULL) + if (tmp == NULL) { + free(dirs); return; + } tmp[0] = '\0'; /* @@ -809,7 +811,7 @@ pw_user_show(int argc, char **argv, char *arg1) case 'a': all = true; break; - case 7: + case '7': v7 = true; break; } diff --git a/usr.sbin/service/service.sh b/usr.sbin/service/service.sh index bd5a95c..6ba2a8e 100755 --- a/usr.sbin/service/service.sh +++ b/usr.sbin/service/service.sh @@ -71,6 +71,7 @@ if [ -n "$RESTART" ]; then if grep -q ^rcvar $file; then eval `grep ^name= $file` eval `grep ^rcvar $file` + load_rc_config_var ${name} ${rcvar} checkyesno $rcvar 2>/dev/null && run_rc_script ${file} stop fi done @@ -100,6 +101,7 @@ if [ -n "$ENABLED" ]; then if grep -q ^rcvar $file; then eval `grep ^name= $file` eval `grep ^rcvar $file` + load_rc_config_var ${name} ${rcvar} checkyesno $rcvar 2>/dev/null && echo $file fi done diff --git a/usr.sbin/syslogd/syslogd.8 b/usr.sbin/syslogd/syslogd.8 index 5b175a6..b2e8818 100644 --- a/usr.sbin/syslogd/syslogd.8 +++ b/usr.sbin/syslogd/syslogd.8 @@ -28,7 +28,7 @@ .\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd May 13, 2008 +.Dd March 3, 2015 .Dt SYSLOGD 8 .Os .Sh NAME @@ -36,7 +36,7 @@ .Nd log systems messages .Sh SYNOPSIS .Nm -.Op Fl 468ACcdkNnosTuv +.Op Fl 468ACcdFkNnosTuv .Op Fl a Ar allowed_peer .Op Fl b Ar bind_address .Op Fl f Ar config_file @@ -213,6 +213,17 @@ This is probably only of use to developers working on Specify the pathname of an alternate configuration file; the default is .Pa /etc/syslog.conf . +.It Fl F +Run +.Nm +in the foreground, rather than going into daemon mode. This is useful if +some other process uses +.Xr fork 2 +and +.Xr exec 3 +to run +.Nm , +and wants to monitor when and how it exits. .It Fl k Disable the translation of messages received with facility diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index ec1bd3c..4afec2d 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -282,6 +282,7 @@ static struct filed *Files; /* Log files that we write to */ static struct filed consfile; /* Console */ static int Debug; /* debug flag */ +static int Foreground = 0; /* Run in foreground, instead of daemonizing */ static int resolve = 1; /* resolve hostname */ static char LocalHostName[MAXHOSTNAMELEN]; /* our hostname */ static const char *LocalDomain; /* our local domain name */ @@ -385,7 +386,7 @@ main(int argc, char *argv[]) dprintf("madvise() failed: %s\n", strerror(errno)); bindhostname = NULL; - while ((ch = getopt(argc, argv, "468Aa:b:cCdf:kl:m:nNop:P:sS:Tuv")) + while ((ch = getopt(argc, argv, "468Aa:b:cCdf:Fkl:m:nNop:P:sS:Tuv")) != -1) switch (ch) { case '4': @@ -421,6 +422,9 @@ main(int argc, char *argv[]) case 'f': /* configuration file */ ConfFile = optarg; break; + case 'F': /* run in foreground instead of daemon */ + Foreground++; + break; case 'k': /* keep remote kern fac */ KeepKernFac = 1; break; @@ -512,14 +516,14 @@ main(int argc, char *argv[]) warn("cannot open pid file"); } - if (!Debug) { + if ((!Foreground) && (!Debug)) { ppid = waitdaemon(0, 0, 30); if (ppid < 0) { warn("could not become daemon"); pidfile_remove(pfh); exit(1); } - } else { + } else if (Debug) { setlinebuf(stdout); } @@ -739,7 +743,7 @@ usage(void) { fprintf(stderr, "%s\n%s\n%s\n%s\n", - "usage: syslogd [-468ACcdknosTuv] [-a allowed_peer]", + "usage: syslogd [-468ACcdFknosTuv] [-a allowed_peer]", " [-b bind_address] [-f config_file]", " [-l [mode:]path] [-m mark_interval]", " [-P pid_file] [-p log_socket]"); |