diff options
author | gjb <gjb@FreeBSD.org> | 2016-04-04 23:55:32 +0000 |
---|---|---|
committer | gjb <gjb@FreeBSD.org> | 2016-04-04 23:55:32 +0000 |
commit | 1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f (patch) | |
tree | a027fe5a27446f32854d6a07b34b5f2a992bf283 /usr.sbin | |
parent | 3669a0dced7e344be71d234ffc3a71530ef0ae08 (diff) | |
parent | 589cedfe0cde2b49d5f47fc240de37c8bf307abd (diff) | |
download | FreeBSD-src-1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f.zip FreeBSD-src-1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f.tar.gz |
MFH
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/Makefile | 2 | ||||
-rw-r--r-- | usr.sbin/autofs/log.c | 15 | ||||
-rw-r--r-- | usr.sbin/bhyve/pci_emul.c | 1 | ||||
-rw-r--r-- | usr.sbin/bluetooth/bthidd/kbd.c | 30 | ||||
-rwxr-xr-x | usr.sbin/bsdinstall/scripts/zfsboot | 10 | ||||
-rw-r--r-- | usr.sbin/ctld/log.c | 15 | ||||
-rw-r--r-- | usr.sbin/devinfo/devinfo.c | 4 | ||||
-rw-r--r-- | usr.sbin/iscsid/iscsid.c | 6 | ||||
-rw-r--r-- | usr.sbin/iscsid/log.c | 15 | ||||
-rw-r--r-- | usr.sbin/kbdcontrol/kbdcontrol.1 | 9 | ||||
-rw-r--r-- | usr.sbin/kbdcontrol/kbdcontrol.c | 87 | ||||
-rw-r--r-- | usr.sbin/mtest/mtest.c | 2 | ||||
-rw-r--r-- | usr.sbin/ndiscvt/ndisgen.sh | 5 | ||||
-rw-r--r-- | usr.sbin/pciconf/cap.c | 72 | ||||
-rw-r--r-- | usr.sbin/pw/cpdir.c | 1 | ||||
-rw-r--r-- | usr.sbin/pw/pw.8 | 20 | ||||
-rw-r--r-- | usr.sbin/pw/pw_user.c | 2 | ||||
-rw-r--r-- | usr.sbin/pw/pw_utils.c | 3 | ||||
-rw-r--r-- | usr.sbin/pw/pw_vpw.c | 1 | ||||
-rw-r--r-- | usr.sbin/sesutil/eltsub.c | 4 | ||||
-rw-r--r-- | usr.sbin/sesutil/sesutil.c | 1 | ||||
-rw-r--r-- | usr.sbin/uathload/Makefile | 22 | ||||
-rw-r--r-- | usr.sbin/uathload/uathload.c | 28 |
23 files changed, 211 insertions, 144 deletions
diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 86b5247..16feb68 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -194,9 +194,7 @@ SUBDIR.${MK_TIMED}+= timed SUBDIR.${MK_TOOLCHAIN}+= config SUBDIR.${MK_TOOLCHAIN}+= crunch SUBDIR.${MK_UNBOUND}+= unbound -.if !(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 50200) SUBDIR.${MK_USB}+= uathload -.endif SUBDIR.${MK_USB}+= uhsoctl SUBDIR.${MK_USB}+= usbconfig SUBDIR.${MK_USB}+= usbdump diff --git a/usr.sbin/autofs/log.c b/usr.sbin/autofs/log.c index d5682cc..b3935dc 100644 --- a/usr.sbin/autofs/log.c +++ b/usr.sbin/autofs/log.c @@ -88,6 +88,7 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) { static char msgbuf[MSGBUF_LEN]; static char msgbuf_strvised[MSGBUF_LEN * 4 + 1]; + char *errstr; int ret; ret = vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap); @@ -121,21 +122,23 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) } } else { + errstr = strerror(log_errno); + if (peer_name != NULL) { fprintf(stderr, "%s: %s (%s): %s: %s\n", getprogname(), - peer_addr, peer_name, msgbuf_strvised, strerror(errno)); + peer_addr, peer_name, msgbuf_strvised, errstr); syslog(priority, "%s (%s): %s: %s", - peer_addr, peer_name, msgbuf_strvised, strerror(errno)); + peer_addr, peer_name, msgbuf_strvised, errstr); } else if (peer_addr != NULL) { fprintf(stderr, "%s: %s: %s: %s\n", getprogname(), - peer_addr, msgbuf_strvised, strerror(errno)); + peer_addr, msgbuf_strvised, errstr); syslog(priority, "%s: %s: %s", - peer_addr, msgbuf_strvised, strerror(errno)); + peer_addr, msgbuf_strvised, errstr); } else { fprintf(stderr, "%s: %s: %s\n", getprogname(), - msgbuf_strvised, strerror(errno)); + msgbuf_strvised, errstr); syslog(priority, "%s: %s", - msgbuf_strvised, strerror(errno)); + msgbuf_strvised, errstr); } } } diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index c6763c9..1e45bad 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -2054,6 +2054,7 @@ pci_emul_dior(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx, return (0); } + value = 0; if (size == 1) { value = sc->ioregs[offset]; } else if (size == 2) { diff --git a/usr.sbin/bluetooth/bthidd/kbd.c b/usr.sbin/bluetooth/bthidd/kbd.c index cd9f70b..a92a63a 100644 --- a/usr.sbin/bluetooth/bthidd/kbd.c +++ b/usr.sbin/bluetooth/bthidd/kbd.c @@ -514,7 +514,7 @@ int32_t kbd_status_changed(bthid_session_p s, uint8_t *data, int32_t len) { vkbd_status_t st; - uint8_t leds, report_id; + uint8_t found, report_id; hid_device_p hid_device; hid_data_t d; hid_item_t h; @@ -523,15 +523,21 @@ kbd_status_changed(bthid_session_p s, uint8_t *data, int32_t len) assert(len == sizeof(vkbd_status_t)); memcpy(&st, data, sizeof(st)); - leds = 0; + found = 0; report_id = NO_REPORT_ID; hid_device = get_hid_device(&s->bdaddr); assert(hid_device != NULL); + data[0] = 0xa2; /* DATA output (HID output report) */ + data[1] = 0x00; + data[2] = 0x00; + for (d = hid_start_parse(hid_device->desc, 1 << hid_output, -1); hid_get_item(d, &h) > 0; ) { if (HID_PAGE(h.usage) == HUP_LEDS) { + found++; + if (report_id == NO_REPORT_ID) report_id = h.report_ID; else if (h.report_ID != report_id) @@ -544,17 +550,17 @@ kbd_status_changed(bthid_session_p s, uint8_t *data, int32_t len) switch(HID_USAGE(h.usage)) { case 0x01: /* Num Lock LED */ if (st.leds & LED_NUM) - hid_set_data(&leds, &h, 1); + hid_set_data(&data[1], &h, 1); break; case 0x02: /* Caps Lock LED */ if (st.leds & LED_CAP) - hid_set_data(&leds, &h, 1); + hid_set_data(&data[1], &h, 1); break; case 0x03: /* Scroll Lock LED */ if (st.leds & LED_SCR) - hid_set_data(&leds, &h, 1); + hid_set_data(&data[1], &h, 1); break; /* XXX add other LEDs ? */ @@ -563,18 +569,8 @@ kbd_status_changed(bthid_session_p s, uint8_t *data, int32_t len) } hid_end_parse(d); - data[0] = 0xa2; /* DATA output (HID output report) */ - - if (report_id != NO_REPORT_ID) { - data[1] = report_id; - data[2] = leds; - len = 3; - } else { - data[1] = leds; - len = 2; - } - - write(s->intr, data, len); + if (found) + write(s->intr, data, (report_id != NO_REPORT_ID) ? 3 : 2); return (0); } diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot index ed93c37..4dedbf0 100755 --- a/usr.sbin/bsdinstall/scripts/zfsboot +++ b/usr.sbin/bsdinstall/scripts/zfsboot @@ -302,7 +302,7 @@ msg_swap_mirror_help="Mirror swap partitions for redundancy, breaks crash dumps" msg_swap_size="Swap Size" msg_swap_size_help="Customize how much swap space is allocated to each selected disk" msg_swap_toosmall="The selected swap size (%s) is to small. Please enter a value greater than 100MB or enter 0 for no swap" -msg_these_disks_are_too_small="These disks are too small given the amount of requested\nswap (%s) and/or geli(8) (%s) partitions, which would\ntake 50%% or more of each of the following selected disk\ndevices (not recommended):\n\n %s\n\nRecommend changing partition size(s) and/or selecting a\ndifferent set of devices." +msg_these_disks_are_too_small="These disks are smaller than the amount of requested\nswap (%s) and/or geli(8) (%s) partitions, which would\ntake 100%% or more of each of the following selected disks:\n\n %s\n\nRecommend changing partition size(s) and/or selecting a\ndifferent set of disks." msg_unable_to_get_disk_capacity="Unable to get disk capacity of \`%s'" msg_unsupported_partition_scheme="%s is an unsupported partition scheme" msg_user_cancelled="User Cancelled." @@ -1483,11 +1483,12 @@ while :; do # NB: dialog_menu_layout supports running non-interactively dialog_menu_layout || continue - # Make sure each disk will be at least 50% ZFS + # Make sure each disk will have room for ZFS if f_expand_number "$ZFSBOOT_SWAP_SIZE" swapsize && - f_expand_number "$ZFSBOOT_BOOT_POOL_SIZE" bootsize + f_expand_number "$ZFSBOOT_BOOT_POOL_SIZE" bootsize && + f_expand_number "1g" zpoolmin then - minsize=$swapsize teeny_disks= + minsize=$(( $swapsize + $zpoolmin )) teeny_disks= [ "$ZFSBOOT_BOOT_POOL" ] && minsize=$(( $minsize + $bootsize )) for disk in $ZFSBOOT_DISKS; do @@ -1495,7 +1496,6 @@ while :; do $disk $DEVICE_TYPE_DISK device $device get capacity disksize || continue [ ${disksize:-0} -ge 0 ] || disksize=0 - disksize=$(( $disksize - $minsize )) [ $disksize -lt $minsize ] && teeny_disks="$teeny_disks $disk" done diff --git a/usr.sbin/ctld/log.c b/usr.sbin/ctld/log.c index ac838f3..ed66c31 100644 --- a/usr.sbin/ctld/log.c +++ b/usr.sbin/ctld/log.c @@ -88,6 +88,7 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) { static char msgbuf[MSGBUF_LEN]; static char msgbuf_strvised[MSGBUF_LEN * 4 + 1]; + char *errstr; int ret; ret = vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap); @@ -121,21 +122,23 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) } } else { + errstr = strerror(log_errno); + if (peer_name != NULL) { fprintf(stderr, "%s: %s (%s): %s: %s\n", getprogname(), - peer_addr, peer_name, msgbuf_strvised, strerror(errno)); + peer_addr, peer_name, msgbuf_strvised, errstr); syslog(priority, "%s (%s): %s: %s", - peer_addr, peer_name, msgbuf_strvised, strerror(errno)); + peer_addr, peer_name, msgbuf_strvised, errstr); } else if (peer_addr != NULL) { fprintf(stderr, "%s: %s: %s: %s\n", getprogname(), - peer_addr, msgbuf_strvised, strerror(errno)); + peer_addr, msgbuf_strvised, errstr); syslog(priority, "%s: %s: %s", - peer_addr, msgbuf_strvised, strerror(errno)); + peer_addr, msgbuf_strvised, errstr); } else { fprintf(stderr, "%s: %s: %s\n", getprogname(), - msgbuf_strvised, strerror(errno)); + msgbuf_strvised, errstr); syslog(priority, "%s: %s", - msgbuf_strvised, strerror(errno)); + msgbuf_strvised, errstr); } } } diff --git a/usr.sbin/devinfo/devinfo.c b/usr.sbin/devinfo/devinfo.c index 40f2b0b..734d563 100644 --- a/usr.sbin/devinfo/devinfo.c +++ b/usr.sbin/devinfo/devinfo.c @@ -66,9 +66,9 @@ print_resource(struct devinfo_res *res) rman = devinfo_handle_to_rman(res->dr_rman); hexmode = (rman->dm_size > 1000) || (rman->dm_size == 0); - printf(hexmode ? "0x%lx" : "%lu", res->dr_start); + printf(hexmode ? "0x%jx" : "%ju", res->dr_start); if (res->dr_size > 1) - printf(hexmode ? "-0x%lx" : "-%lu", + printf(hexmode ? "-0x%jx" : "-%ju", res->dr_start + res->dr_size - 1); } diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index 72828ef..5be7a44 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -290,7 +290,9 @@ void fail(const struct connection *conn, const char *reason) { struct iscsi_daemon_fail idf; - int error; + int error, saved_errno; + + saved_errno = errno; memset(&idf, 0, sizeof(idf)); idf.idf_session_id = conn->conn_session_id; @@ -299,6 +301,8 @@ fail(const struct connection *conn, const char *reason) error = ioctl(conn->conn_iscsi_fd, ISCSIDFAIL, &idf); if (error != 0) log_err(1, "ISCSIDFAIL"); + + errno = saved_errno; } /* diff --git a/usr.sbin/iscsid/log.c b/usr.sbin/iscsid/log.c index ea7755f..920c081 100644 --- a/usr.sbin/iscsid/log.c +++ b/usr.sbin/iscsid/log.c @@ -88,6 +88,7 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) { static char msgbuf[MSGBUF_LEN]; static char msgbuf_strvised[MSGBUF_LEN * 4 + 1]; + char *errstr; int ret; ret = vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap); @@ -121,21 +122,23 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) } } else { + errstr = strerror(log_errno); + if (peer_name != NULL) { fprintf(stderr, "%s: %s (%s): %s: %s\n", getprogname(), - peer_addr, peer_name, msgbuf_strvised, strerror(errno)); + peer_addr, peer_name, msgbuf_strvised, errstr); syslog(priority, "%s (%s): %s: %s", - peer_addr, peer_name, msgbuf_strvised, strerror(errno)); + peer_addr, peer_name, msgbuf_strvised, errstr); } else if (peer_addr != NULL) { fprintf(stderr, "%s: %s: %s: %s\n", getprogname(), - peer_addr, msgbuf_strvised, strerror(errno)); + peer_addr, msgbuf_strvised, errstr); syslog(priority, "%s: %s: %s", - peer_addr, msgbuf_strvised, strerror(errno)); + peer_addr, msgbuf_strvised, errstr); } else { fprintf(stderr, "%s: %s: %s\n", getprogname(), - msgbuf_strvised, strerror(errno)); + msgbuf_strvised, errstr); syslog(priority, "%s: %s", - msgbuf_strvised, strerror(errno)); + msgbuf_strvised, errstr); } } } diff --git a/usr.sbin/kbdcontrol/kbdcontrol.1 b/usr.sbin/kbdcontrol/kbdcontrol.1 index ea76b53..17e9d11 100644 --- a/usr.sbin/kbdcontrol/kbdcontrol.1 +++ b/usr.sbin/kbdcontrol/kbdcontrol.1 @@ -13,7 +13,7 @@ .\" @(#)kbdcontrol.1 .\" $FreeBSD$ .\" -.Dd January 29, 2008 +.Dd March 16, 2016 .Dt KBDCONTROL 1 .Os .Sh NAME @@ -36,6 +36,7 @@ .Op Fl f Ar # Ar string .Op Fl k Ar keyboard_device .Op Fl L Ar keymap_file +.Op Fl P Ar path .Sh DESCRIPTION The .Nm @@ -171,6 +172,12 @@ and write the compiled from it to stdout. This option is primarily intended for programmers and is probably of little use under normal circumstances. +.It Fl P Ar path +Search for the keymap file in +.Ar path . +The +.Fl P +option may be specified multiple times. .El .Sh ENVIRONMENT The environment variable diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c index 0f927ef..f381bd7 100644 --- a/usr.sbin/kbdcontrol/kbdcontrol.c +++ b/usr.sbin/kbdcontrol/kbdcontrol.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include <fcntl.h> #include <sys/kbio.h> #include <sys/consio.h> +#include <sys/queue.h> #include <sys/sysctl.h> #include "path.h" #include "lex.h" @@ -112,11 +113,13 @@ static const int repeats[] = { 34, 38, 42, 46, 50, 55, 59, 63, static const int ndelays = (sizeof(delays) / sizeof(int)); static const int nrepeats = (sizeof(repeats) / sizeof(int)); static int hex = 0; +static int paths_configured = 0; static int token; int number; char letter; +static void add_keymap_path(const char *path); static void dump_accent_definition(char *name, accentmap_t *accentmap); static void dump_entry(int value); static void dump_key_definition(char *name, keymap_t *keymap); @@ -142,6 +145,12 @@ static void set_keyrates(char *opt); static void show_kbd_info(void); static void usage(void) __dead2; +struct pathent { + STAILQ_ENTRY(pathent) next; + char *path; +}; +static STAILQ_HEAD(, pathent) pathlist = STAILQ_HEAD_INITIALIZER(pathlist); + /* Detect presence of vt(4). */ static int is_vt4(void) @@ -279,11 +288,11 @@ get_entry(void) } static int -get_definition_line(FILE *fd, keymap_t *keymap, accentmap_t *accentmap) +get_definition_line(FILE *file, keymap_t *keymap, accentmap_t *accentmap) { int c; - yyin = fd; + yyin = file; if (token < 0) token = yylex(); @@ -791,32 +800,57 @@ dump_accent_definition(char *name, accentmap_t *accentmap) } static void +add_keymap_path(const char *path) +{ + struct pathent* pe; + size_t len; + + len = strlen(path); + if ((pe = malloc(sizeof(*pe))) == NULL || + (pe->path = malloc(len + 2)) == NULL) + err(1, "malloc"); + memcpy(pe->path, path, len); + if (len > 0 && path[len - 1] != '/') + pe->path[len++] = '/'; + pe->path[len] = '\0'; + STAILQ_INSERT_TAIL(&pathlist, pe, next); +} + +static void load_keymap(char *opt, int dumponly) { keymap_t keymap; accentmap_t accentmap; - FILE *fd; - int i, j; + struct pathent *pe; + FILE *file; + int j; char *name, *cp; char blank[] = "", keymap_path[] = KEYMAP_PATH; char vt_keymap_path[] = VT_KEYMAP_PATH, dotkbd[] = ".kbd"; - char *prefix[] = {blank, blank, keymap_path, NULL}; char *postfix[] = {blank, dotkbd, NULL}; - if (is_vt4()) - prefix[2] = vt_keymap_path; - cp = getenv("KEYMAP_PATH"); - if (cp != NULL) - asprintf(&(prefix[0]), "%s/", cp); - - fd = NULL; - for (i=0; prefix[i] && fd == NULL; i++) { - for (j=0; postfix[j] && fd == NULL; j++) { - name = mkfullname(prefix[i], opt, postfix[j]); - fd = fopen(name, "r"); + if (!paths_configured) { + cp = getenv("KEYMAP_PATH"); + if (cp != NULL) + add_keymap_path(cp); + add_keymap_path(""); + if (is_vt4()) + add_keymap_path(vt_keymap_path); + else + add_keymap_path(keymap_path); + paths_configured = 1; + } + + file = NULL; + STAILQ_FOREACH(pe, &pathlist, next) { + for (j=0; postfix[j] && file == NULL; j++) { + name = mkfullname(pe->path, opt, postfix[j]); + file = fopen(name, "r"); + if (file != NULL) + break; } } - if (fd == NULL) { + if (file == NULL) { warn("keymap file \"%s\" not found", opt); return; } @@ -824,7 +858,7 @@ load_keymap(char *opt, int dumponly) memset(&accentmap, 0, sizeof(accentmap)); token = -1; while (1) { - if (get_definition_line(fd, &keymap, &accentmap) < 0) + if (get_definition_line(file, &keymap, &accentmap) < 0) break; } if (dumponly) { @@ -841,13 +875,13 @@ load_keymap(char *opt, int dumponly) } if ((keymap.n_keys > 0) && (ioctl(0, PIO_KEYMAP, &keymap) < 0)) { warn("setting keymap"); - fclose(fd); + fclose(file); return; } if ((accentmap.n_accs > 0) && (ioctl(0, PIO_DEADKEYMAP, &accentmap) < 0)) { warn("setting accentmap"); - fclose(fd); + fclose(file); return; } } @@ -1170,7 +1204,7 @@ usage(void) fprintf(stderr, "%s\n%s\n%s\n", "usage: kbdcontrol [-dFKix] [-A name] [-a name] [-b duration.pitch | [quiet.]belltype]", " [-r delay.repeat | speed] [-l mapfile] [-f # string]", -" [-k device] [-L mapfile]"); +" [-k device] [-L mapfile] [-P path]"); exit(1); } @@ -1178,9 +1212,16 @@ usage(void) int main(int argc, char **argv) { + const char *optstring = "A:a:b:df:iKk:Fl:L:P:r:x"; int opt; - while((opt = getopt(argc, argv, "A:a:b:df:iKk:Fl:L:r:x")) != -1) + /* Collect any -P arguments, regardless of where they appear. */ + while ((opt = getopt(argc, argv, optstring)) != -1) + if (opt == 'P') + add_keymap_path(optarg); + + optind = optreset = 1; + while ((opt = getopt(argc, argv, optstring)) != -1) switch(opt) { case 'A': case 'a': @@ -1198,6 +1239,8 @@ main(int argc, char **argv) case 'L': load_keymap(optarg, 1); break; + case 'P': + break; case 'f': set_functionkey(optarg, nextarg(argc, argv, &optind, 'f')); diff --git a/usr.sbin/mtest/mtest.c b/usr.sbin/mtest/mtest.c index a28fab7..af522e2 100644 --- a/usr.sbin/mtest/mtest.c +++ b/usr.sbin/mtest/mtest.c @@ -396,6 +396,7 @@ process_cmd(char *cmd, int s, int s6, FILE *fp __unused) while (isblank(*++line)) ; /* Skip whitespace. */ + n = 0; switch (*cmd) { case '?': usage(); @@ -611,7 +612,6 @@ process_cmd(char *cmd, int s, int s6, FILE *fp __unused) } /* First determine our current filter mode. */ - n = 0; if (getsourcefilter(af2sock(af, s, s6), ifindex, &su.sa, su.sa.sa_len, &fmode, &n, NULL) != 0) { warn("getsourcefilter"); diff --git a/usr.sbin/ndiscvt/ndisgen.sh b/usr.sbin/ndiscvt/ndisgen.sh index 97e8364..1674ea1 100644 --- a/usr.sbin/ndiscvt/ndisgen.sh +++ b/usr.sbin/ndiscvt/ndisgen.sh @@ -432,11 +432,6 @@ fi echo -n " Building kernel module... " echo "" > bus_if.h echo "" > device_if.h -if ! ${MAKE} -f ${MAKEFILE} depend > /dev/null; then - echo "build failed. Exiting." - echo "" - exit -fi if ! ${MAKE} -f ${MAKEFILE} all > /dev/null; then echo "build failed. Exiting." echo "" diff --git a/usr.sbin/pciconf/cap.c b/usr.sbin/pciconf/cap.c index 980e2c7..cd5ae26 100644 --- a/usr.sbin/pciconf/cap.c +++ b/usr.sbin/pciconf/cap.c @@ -410,14 +410,38 @@ aspm_string(uint8_t aspm) } } +static int +slot_power(uint32_t cap) +{ + int mwatts; + + mwatts = (cap & PCIEM_SLOT_CAP_SPLV) >> 7; + switch (cap & PCIEM_SLOT_CAP_SPLS) { + case 0x0: + mwatts *= 1000; + break; + case 0x1: + mwatts *= 100; + break; + case 0x2: + mwatts *= 10; + break; + default: + break; + } + return (mwatts); +} + static void cap_express(int fd, struct pci_conf *p, uint8_t ptr) { - uint32_t cap, cap2; + uint32_t cap; uint16_t ctl, flags, sta; + unsigned int version; flags = read_config(fd, &p->pc_sel, ptr + PCIER_FLAGS, 2); - printf("PCI-Express %d ", flags & PCIEM_FLAGS_VERSION); + version = flags & PCIEM_FLAGS_VERSION; + printf("PCI-Express %u ", version); switch (flags & PCIEM_FLAGS_TYPE) { case PCIEM_TYPE_ENDPOINT: printf("endpoint"); @@ -450,12 +474,9 @@ cap_express(int fd, struct pci_conf *p, uint8_t ptr) printf("type %d", (flags & PCIEM_FLAGS_TYPE) >> 4); break; } - if (flags & PCIEM_FLAGS_SLOT) - printf(" slot"); if (flags & PCIEM_FLAGS_IRQ) - printf(" IRQ %d", (flags & PCIEM_FLAGS_IRQ) >> 9); + printf(" MSI %d", (flags & PCIEM_FLAGS_IRQ) >> 9); cap = read_config(fd, &p->pc_sel, ptr + PCIER_DEVICE_CAP, 4); - cap2 = read_config(fd, &p->pc_sel, ptr + PCIER_DEVICE_CAP2, 4); ctl = read_config(fd, &p->pc_sel, ptr + PCIER_DEVICE_CTL, 2); printf(" max data %d(%d)", MAX_PAYLOAD((ctl & PCIEM_CTL_MAX_PAYLOAD) >> 5), @@ -466,12 +487,22 @@ cap_express(int fd, struct pci_conf *p, uint8_t ptr) printf(" RO"); if (ctl & PCIEM_CTL_NOSNOOP_ENABLE) printf(" NS"); + if (version >= 2) { + cap = read_config(fd, &p->pc_sel, ptr + PCIER_DEVICE_CAP2, 4); + if ((cap & PCIEM_CAP2_ARI) != 0) { + ctl = read_config(fd, &p->pc_sel, + ptr + PCIER_DEVICE_CTL2, 4); + printf(" ARI %s", + (ctl & PCIEM_CTL2_ARI) ? "enabled" : "disabled"); + } + } cap = read_config(fd, &p->pc_sel, ptr + PCIER_LINK_CAP, 4); sta = read_config(fd, &p->pc_sel, ptr + PCIER_LINK_STA, 2); + if (cap == 0 && sta == 0) + return; + printf("\n "); printf(" link x%d(x%d)", (sta & PCIEM_LINK_STA_WIDTH) >> 4, (cap & PCIEM_LINK_CAP_MAX_WIDTH) >> 4); - if ((cap & (PCIEM_LINK_CAP_MAX_WIDTH | PCIEM_LINK_CAP_ASPM)) != 0) - printf("\n "); if ((cap & PCIEM_LINK_CAP_MAX_WIDTH) != 0) { printf(" speed %s(%s)", (sta & PCIEM_LINK_STA_WIDTH) == 0 ? "0.0" : link_speed_string(sta & PCIEM_LINK_STA_SPEED), @@ -482,11 +513,26 @@ cap_express(int fd, struct pci_conf *p, uint8_t ptr) printf(" ASPM %s(%s)", aspm_string(ctl & PCIEM_LINK_CTL_ASPMC), aspm_string((cap & PCIEM_LINK_CAP_ASPM) >> 10)); } - if ((cap2 & PCIEM_CAP2_ARI) != 0) { - ctl = read_config(fd, &p->pc_sel, ptr + PCIER_DEVICE_CTL2, 4); - printf(" ARI %s", - (ctl & PCIEM_CTL2_ARI) ? "enabled" : "disabled"); - } + if (!(flags & PCIEM_FLAGS_SLOT)) + return; + cap = read_config(fd, &p->pc_sel, ptr + PCIER_SLOT_CAP, 4); + sta = read_config(fd, &p->pc_sel, ptr + PCIER_SLOT_STA, 2); + ctl = read_config(fd, &p->pc_sel, ptr + PCIER_SLOT_CTL, 2); + printf("\n "); + printf(" slot %d", (cap & PCIEM_SLOT_CAP_PSN) >> 19); + printf(" power limit %d mW", slot_power(cap)); + if (cap & PCIEM_SLOT_CAP_HPC) + printf(" HotPlug(%s)", sta & PCIEM_SLOT_STA_PDS ? "present" : + "empty"); + if (cap & PCIEM_SLOT_CAP_HPS) + printf(" surprise"); + if (cap & PCIEM_SLOT_CAP_APB) + printf(" Attn Button"); + if (cap & PCIEM_SLOT_CAP_PCP) + printf(" PC(%s)", ctl & PCIEM_SLOT_CTL_PCC ? "on" : "off"); + if (cap & PCIEM_SLOT_CAP_MRLSP) + printf(" MRL(%s)", sta & PCIEM_SLOT_STA_MRLSS ? "open" : + "closed"); } static void diff --git a/usr.sbin/pw/cpdir.c b/usr.sbin/pw/cpdir.c index 334f789..679758b 100644 --- a/usr.sbin/pw/cpdir.c +++ b/usr.sbin/pw/cpdir.c @@ -37,7 +37,6 @@ static const char rcsid[] = #include <unistd.h> #include "pw.h" -#include "pwupd.h" void copymkdir(int rootfd, char const * dir, int skelfd, mode_t mode, uid_t uid, diff --git a/usr.sbin/pw/pw.8 b/usr.sbin/pw/pw.8 index 3a9c0b0..84ceda3 100644 --- a/usr.sbin/pw/pw.8 +++ b/usr.sbin/pw/pw.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 14, 2015 +.Dd March 27, 2016 .Dt PW 8 .Os .Sh NAME @@ -420,18 +420,16 @@ Set the account's primary group to the given group. .Ar group may be defined by either its name or group number. .It Fl G Ar grouplist -Set additional group memberships for an account. +Set secondary group memberships for an account. .Ar grouplist -is a comma, space or tab-separated list of group names or group numbers. -The user's name is added to the group lists in -.Pa /etc/group , -and -removed from any groups not specified in -.Ar grouplist . -Note: a user should not be added to their primary group with +is a comma, space, or tab-separated list of group names or group numbers. +The user is added to the groups specified in +.Ar grouplist , +and removed from all groups not specified. +The current login session is not affected by group membership changes, +which only take effect when the user reconnects. +Note: do not add a user to their primary group with .Ar grouplist . -Also, group membership changes do not take effect for current user login -sessions, requiring the user to reconnect to be affected by the changes. .It Fl L Ar class This option sets the login class for the user being created. See diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index 2f87b56..5ad1409 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -31,8 +31,6 @@ static const char rcsid[] = #endif /* not lint */ #include <sys/param.h> -#include <sys/resource.h> -#include <sys/time.h> #include <sys/types.h> #include <ctype.h> diff --git a/usr.sbin/pw/pw_utils.c b/usr.sbin/pw/pw_utils.c index 1a4f812..e483977 100644 --- a/usr.sbin/pw/pw_utils.c +++ b/usr.sbin/pw/pw_utils.c @@ -27,13 +27,10 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/types.h> #include <sys/wait.h> #include <err.h> -#include <inttypes.h> #include <sysexits.h> -#include <limits.h> #include <stdlib.h> #include <string.h> #include <unistd.h> diff --git a/usr.sbin/pw/pw_vpw.c b/usr.sbin/pw/pw_vpw.c index 2d1c75b..08c8bd5 100644 --- a/usr.sbin/pw/pw_vpw.c +++ b/usr.sbin/pw/pw_vpw.c @@ -37,7 +37,6 @@ static const char rcsid[] = #include <stdio.h> #include <string.h> #include <stdlib.h> -#include <sys/param.h> #include <err.h> #include "pwupd.h" diff --git a/usr.sbin/sesutil/eltsub.c b/usr.sbin/sesutil/eltsub.c index 287530d..f7c4b9d 100644 --- a/usr.sbin/sesutil/eltsub.c +++ b/usr.sbin/sesutil/eltsub.c @@ -37,13 +37,9 @@ #include <sys/sbuf.h> #include <err.h> -#include <unistd.h> #include <stddef.h> -#include <stdint.h> #include <stdlib.h> #include <stdio.h> -#include <sys/ioctl.h> -#include <cam/scsi/scsi_all.h> #include <cam/scsi/scsi_enc.h> #include "eltsub.h" diff --git a/usr.sbin/sesutil/sesutil.c b/usr.sbin/sesutil/sesutil.c index 0f04c07..0bf82f4 100644 --- a/usr.sbin/sesutil/sesutil.c +++ b/usr.sbin/sesutil/sesutil.c @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <unistd.h> -#include <cam/scsi/scsi_all.h> #include <cam/scsi/scsi_enc.h> #include "eltsub.h" diff --git a/usr.sbin/uathload/Makefile b/usr.sbin/uathload/Makefile index 949f800..f8b26a4 100644 --- a/usr.sbin/uathload/Makefile +++ b/usr.sbin/uathload/Makefile @@ -3,28 +3,14 @@ PROG= uathload MAN= uathload.8 -SRCS= uathload.c ar5523.bin +SRCS= uathload.c +FILES= ar5523.bin +FILESDIR= ${SHAREDIR}/firmware +FILESMODE= 444 CLEANFILES= ar5523.bin -# It's hard to tag ar5523.o with the proper gnu note saying that it has a -# non-executable stack, so ld doesn't properly mark his executable as -# not having an executable stack. Mark it explicitly, but only for those -# platforms that support his feature (otherwise signals don't work). -# Note: Newer versions of ld than is in the tree ignore -z. -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" -LDFLAGS+= -Wl,-z,noexecstack -.endif - -# The conversion from .bin to .o doesn't always produce a pedantically correct -# .o's. And it doesn't matter, so turn off the mismatch warnings since it is -# pure data. On mips64 here's no easy way to produce a proper .o. -LDFLAGS+= -Wl,--no-warn-mismatch - ar5523.bin: ${.CURDIR}/../../sys/contrib/dev/uath/ar5523.bin.uu uudecode -p ${.CURDIR}/../../sys/contrib/dev/uath/ar5523.bin.uu > ${.TARGET} -ar5523.o: ar5523.bin - ${LD} -b binary -d -warn-common -r -d -o ${.TARGET} ar5523.bin - .include <bsd.prog.mk> diff --git a/usr.sbin/uathload/uathload.c b/usr.sbin/uathload/uathload.c index 64ae661..50e9eb6 100644 --- a/usr.sbin/uathload/uathload.c +++ b/usr.sbin/uathload/uathload.c @@ -140,23 +140,19 @@ main(int argc, char *argv[]) if (argc > 1) usage(); - if (argc == 1) { + if (argc == 1) fwname = argv[0]; - fw = open(fwname, O_RDONLY, 0); - if (fw < 0) - err(-1, "open(%s)", fwname); - if (fstat(fw, &sb) < 0) - err(-1, "fstat(%s)", fwname); - txdata = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fw, 0); - if (txdata == MAP_FAILED) - err(-1, "mmap(%s)", fwname); - len = sb.st_size; - } else { - fwname = "ar5523.bin (builtin)"; - fw = -1; - txdata = &_binary_ar5523_bin_start; - len = &_binary_ar5523_bin_end - &_binary_ar5523_bin_start; - } + else + fwname = _PATH_FIRMWARE "/ar5523.bin"; + fw = open(fwname, O_RDONLY, 0); + if (fw < 0) + err(-1, "open(%s)", fwname); + if (fstat(fw, &sb) < 0) + err(-1, "fstat(%s)", fwname); + txdata = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fw, 0); + if (txdata == MAP_FAILED) + err(-1, "mmap(%s)", fwname); + len = sb.st_size; /* XXX verify device is an AR5005 part */ if (getdevname(devname, msgdev, datadev)) err(-1, "getdevname error"); |