diff options
Diffstat (limited to 'usr/src/cmd')
125 files changed, 641 insertions, 1169 deletions
diff --git a/usr/src/cmd/dladm/dladm.c b/usr/src/cmd/dladm/dladm.c index 92f3bfb665..a69b3da081 100644 --- a/usr/src/cmd/dladm/dladm.c +++ b/usr/src/cmd/dladm/dladm.c @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2017 Joyent, Inc. * Copyright 2016 Nexenta Systems, Inc. + * Copyright 2020 Peter Tribble. */ #include <stdio.h> @@ -1148,7 +1149,7 @@ typedef struct usage_fields_buf_s { char usage_rbytes[10]; char usage_opackets[9]; char usage_obytes[10]; - char usage_bandwidth[14]; + char usage_bandwidth[15]; } usage_fields_buf_t; static const ofmt_field_t usage_fields[] = { @@ -1164,7 +1165,7 @@ static const ofmt_field_t usage_fields[] = { offsetof(usage_fields_buf_t, usage_opackets), print_default_cb}, { "OBYTES", 11, offsetof(usage_fields_buf_t, usage_obytes), print_default_cb}, -{ "BANDWIDTH", 15, +{ "BANDWIDTH", 16, offsetof(usage_fields_buf_t, usage_bandwidth), print_default_cb}, { NULL, 0, 0, NULL}} ; @@ -1180,7 +1181,7 @@ typedef struct usage_l_fields_buf_s { char usage_l_etime[13]; char usage_l_rbytes[8]; char usage_l_obytes[8]; - char usage_l_bandwidth[14]; + char usage_l_bandwidth[15]; } usage_l_fields_buf_t; static const ofmt_field_t usage_l_fields[] = { @@ -1195,7 +1196,7 @@ static const ofmt_field_t usage_l_fields[] = { offsetof(usage_l_fields_buf_t, usage_l_rbytes), print_default_cb}, { "OBYTES", 9, offsetof(usage_l_fields_buf_t, usage_l_obytes), print_default_cb}, -{ "BANDWIDTH", 15, +{ "BANDWIDTH", 16, offsetof(usage_l_fields_buf_t, usage_l_bandwidth), print_default_cb}, { NULL, 0, 0, NULL}} ; diff --git a/usr/src/cmd/dlstat/dlstat.c b/usr/src/cmd/dlstat/dlstat.c index 8c1749475b..d11e623206 100644 --- a/usr/src/cmd/dlstat/dlstat.c +++ b/usr/src/cmd/dlstat/dlstat.c @@ -27,6 +27,10 @@ * Copyright 2017 Joyent, Inc. */ +/* + * Copyright 2020 Peter Tribble. + */ + #include <stdio.h> #include <ctype.h> #include <locale.h> @@ -417,7 +421,7 @@ typedef struct history_fields_buf_s { char h_rbytes[10]; char h_opackets[9]; char h_obytes[10]; - char h_bandwidth[14]; + char h_bandwidth[15]; } history_fields_buf_t; static ofmt_field_t history_fields[] = { @@ -433,7 +437,7 @@ static ofmt_field_t history_fields[] = { offsetof(history_fields_buf_t, h_opackets), print_default_cb}, { "OBYTES", 11, offsetof(history_fields_buf_t, h_obytes), print_default_cb}, -{ "BANDWIDTH", 15, +{ "BANDWIDTH", 16, offsetof(history_fields_buf_t, h_bandwidth), print_default_cb}, { NULL, 0, 0, NULL}}; @@ -446,7 +450,7 @@ typedef struct history_l_fields_buf_s { char hl_etime[13]; char hl_rbytes[8]; char hl_obytes[8]; - char hl_bandwidth[14]; + char hl_bandwidth[15]; } history_l_fields_buf_t; static ofmt_field_t history_l_fields[] = { @@ -461,7 +465,7 @@ static ofmt_field_t history_l_fields[] = { offsetof(history_l_fields_buf_t, hl_rbytes), print_default_cb}, { "OBYTES", 9, offsetof(history_l_fields_buf_t, hl_obytes), print_default_cb}, -{ "BANDWIDTH", 15, +{ "BANDWIDTH", 16, offsetof(history_l_fields_buf_t, hl_bandwidth), print_default_cb}, { NULL, 0, 0, NULL}} ; @@ -569,7 +573,7 @@ show_history_time(dladm_usage_t *history, void *arg) { show_history_state_t *state = arg; char buf[DLADM_STRSIZE]; - history_l_fields_buf_t ubuf; + history_l_fields_buf_t ubuf; time_t time; double bw; dladm_status_t status; @@ -754,7 +758,7 @@ do_show_history(int argc, char *argv[], const char *use) die("show-link -h requires a file"); if (optind == (argc-1)) { - uint32_t flags; + uint32_t flags; resource = argv[optind]; if (!state.hs_showall && @@ -1500,7 +1504,7 @@ static int show_queried_stats(dladm_handle_t dh, datalink_id_t linkid, void *arg) { show_state_t *state = arg; - int i; + int i; dladm_stat_chain_t *diff_stat; char linkname[DLPI_LINKNAME_MAX]; char zonename[DLADM_PROP_VAL_MAX + 1]; @@ -1654,7 +1658,7 @@ do_show(int argc, char *argv[], const char *use) ofmt_handle_t ofmt; ofmt_status_t oferr; uint_t ofmtflags = OFMT_RIGHTJUST; - ofmt_field_t *oftemplate; + ofmt_field_t *oftemplate; bzero(&state, sizeof (state)); opterr = 0; @@ -1855,7 +1859,7 @@ do_show_phys(int argc, char *argv[], const char *use) ofmt_handle_t ofmt; ofmt_status_t oferr; uint_t ofmtflags = OFMT_RIGHTJUST; - ofmt_field_t *oftemplate; + ofmt_field_t *oftemplate; bzero(&state, sizeof (state)); opterr = 0; @@ -2037,7 +2041,7 @@ do_show_link(int argc, char *argv[], const char *use) ofmt_handle_t ofmt; ofmt_status_t oferr; uint_t ofmtflags = OFMT_RIGHTJUST; - ofmt_field_t *oftemplate; + ofmt_field_t *oftemplate; bzero(&state, sizeof (state)); opterr = 0; @@ -2242,7 +2246,7 @@ do_show_aggr(int argc, char *argv[], const char *use) ofmt_handle_t ofmt; ofmt_status_t oferr; uint_t ofmtflags = OFMT_RIGHTJUST; - ofmt_field_t *oftemplate; + ofmt_field_t *oftemplate; bzero(&state, sizeof (state)); opterr = 0; diff --git a/usr/src/cmd/ed/ed.c b/usr/src/cmd/ed/ed.c index e8593cadbf..a2fae9c409 100644 --- a/usr/src/cmd/ed/ed.c +++ b/usr/src/cmd/ed/ed.c @@ -24,7 +24,7 @@ */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ /* * Editor @@ -41,7 +41,7 @@ #include <errno.h> #include <paths.h> -static const char *msgtab[] = +static const char *msgtab[] = { "write or open on pipe failed", /* 0 */ "warning: expecting `w'", /* 1 */ @@ -161,7 +161,6 @@ static const char *msgtab[] = extern char *optarg; /* Value of argument */ extern int optind; /* Indicator of argument */ -extern int __xpg4; /* defined in xpg4.c; 0 if not xpg4-compiled program */ struct Fspec { char Ftabs[22]; @@ -253,15 +252,15 @@ static int fflg, shflg; static char prompt[16] = "*"; static int rflg; static int readflg; -static int eflg; -static int qflg = 0; -static int ncflg; -static int listn; -static int listf; -static int pflag; -static int flag28 = 0; /* Prevents write after a partial read */ -static int save28 = 0; /* Flag whether buffer empty at start of read */ -static long savtime; +static int eflg; +static int qflg = 0; +static int ncflg; +static int listn; +static int listf; +static int pflag; +static int flag28 = 0; /* Prevents write after a partial read */ +static int save28 = 0; /* Flag whether buffer empty at start of read */ +static long savtime; static char *name = "SHELL"; static char *rshell = "/usr/lib/rsh"; static char *val; @@ -466,7 +465,7 @@ main(int argc, char **argv) ; globp = "e"; fflg++; - } else /* editing with no file so set savtime to 0 */ + } else /* editing with no file so set savtime to 0 */ savtime = 0; eflg++; if ((tfname = tempnam("", "ea")) == NULL) { @@ -3061,8 +3060,8 @@ static char stdtabs[] = { 'f', 0, 1, 7, 11, 15, 19, 23, 0, /* FORTRAN */ 'p', 0, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 0, /* PL/I */ -'s', 0, 1, 10, 55, 0, /* SNOBOL */ -'u', 0, 1, 12, 20, 44, 0, /* UNIVAC ASM */ +'s', 0, 1, 10, 55, 0, /* SNOBOL */ +'u', 0, 1, 12, 20, 44, 0, /* UNIVAC ASM */ 0 }; diff --git a/usr/src/cmd/find/find.c b/usr/src/cmd/find/find.c index 5b5811ea6a..8860e9b711 100644 --- a/usr/src/cmd/find/find.c +++ b/usr/src/cmd/find/find.c @@ -22,6 +22,7 @@ * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 Andrew Stormont. All rights reserved. + * Copyright 2020 Joyent, Inc. */ @@ -1027,9 +1028,12 @@ execute(const char *name, const struct stat *statb, int type, struct FTW *state) * /usr/bin/find will not pattern match a leading * '.' in a filename, unless '.' is explicitly * specified. + * + * The legacy behavior makes no sense for PATH. */ #ifndef XPG4 - fnmflags |= FNM_PERIOD; + if (np->action == NAME || np->action == INAME) + fnmflags |= FNM_PERIOD; #endif val = !fnmatch(np->first.cp, diff --git a/usr/src/cmd/flowstat/flowstat.c b/usr/src/cmd/flowstat/flowstat.c index e772470f9d..a0e2b85f32 100644 --- a/usr/src/cmd/flowstat/flowstat.c +++ b/usr/src/cmd/flowstat/flowstat.c @@ -31,6 +31,10 @@ * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. */ +/* + * Copyright 2020 Peter Tribble. + */ + #include <stdio.h> #include <locale.h> #include <stdarg.h> @@ -139,7 +143,7 @@ typedef struct history_fields_buf_s { char history_rbytes[10]; char history_opackets[9]; char history_obytes[10]; - char history_bandwidth[14]; + char history_bandwidth[15]; } history_fields_buf_t; static ofmt_field_t history_fields[] = { @@ -156,7 +160,7 @@ static ofmt_field_t history_fields[] = { offsetof(history_fields_buf_t, history_opackets), print_default_cb}, { "OBYTES", 11, offsetof(history_fields_buf_t, history_obytes), print_default_cb}, -{ "BANDWIDTH", 15, +{ "BANDWIDTH", 16, offsetof(history_fields_buf_t, history_bandwidth), print_default_cb}, NULL_OFMT} ; @@ -167,7 +171,7 @@ typedef struct history_l_fields_buf_s { char history_l_etime[13]; char history_l_rbytes[8]; char history_l_obytes[8]; - char history_l_bandwidth[14]; + char history_l_bandwidth[15]; } history_l_fields_buf_t; static ofmt_field_t history_l_fields[] = { @@ -182,7 +186,7 @@ static ofmt_field_t history_l_fields[] = { offsetof(history_l_fields_buf_t, history_l_rbytes), print_default_cb}, { "OBYTES", 9, offsetof(history_l_fields_buf_t, history_l_obytes), print_default_cb}, -{ "BANDWIDTH", 15, +{ "BANDWIDTH", 16, offsetof(history_l_fields_buf_t, history_l_bandwidth), print_default_cb}, NULL_OFMT} @@ -544,7 +548,7 @@ dump_all_flow_stats(dladm_flow_attr_t *attrp, void *arg, datalink_id_t linkid, int main(int argc, char *argv[]) { - dladm_status_t status; + dladm_status_t status; int option; boolean_t r_arg = B_FALSE; boolean_t t_arg = B_FALSE; @@ -790,7 +794,7 @@ show_history_time(dladm_usage_t *history, void *arg) { show_history_state_t *state = (show_history_state_t *)arg; char buf[DLADM_STRSIZE]; - history_l_fields_buf_t ubuf; + history_l_fields_buf_t ubuf; time_t time; double bw; dladm_flow_attr_t attr; diff --git a/usr/src/cmd/fm/dicts/Makefile b/usr/src/cmd/fm/dicts/Makefile index 22bebd3ae8..93e0303f83 100644 --- a/usr/src/cmd/fm/dicts/Makefile +++ b/usr/src/cmd/fm/dicts/Makefile @@ -38,7 +38,8 @@ common_DCNAMES = \ SCA1000 \ SENSOR \ STORAGE \ - TEST + TEST \ + NIC i386_DCNAMES = \ AMD \ diff --git a/usr/src/cmd/fm/dicts/NIC.dict b/usr/src/cmd/fm/dicts/NIC.dict new file mode 100644 index 0000000000..670dc53d46 --- /dev/null +++ b/usr/src/cmd/fm/dicts/NIC.dict @@ -0,0 +1,21 @@ +# +# Copyright 2020 the University of Queensland +# Use is subject to license terms. +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +FMDICT: name=NIC version=1 maxkey=4 + +fault.io.nic.transceiver.notsupp=0 +fault.io.nic.transceiver.whitelist=1 +fault.io.nic.transceiver.overtemp=2 +fault.io.nic.transceiver.hwfail=3 +fault.io.nic.transceiver.unknown=4 diff --git a/usr/src/cmd/fm/dicts/NIC.po b/usr/src/cmd/fm/dicts/NIC.po new file mode 100644 index 0000000000..46f1c859b9 --- /dev/null +++ b/usr/src/cmd/fm/dicts/NIC.po @@ -0,0 +1,98 @@ +# +# Copyright 2020 the University of Queensland +# Use is subject to license terms. +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# code: NIC-8000-0Q +# keys: fault.io.nic.transceiver.notsupp +# +msgid "NIC-8000-0Q.type" +msgstr "Fault" +msgid "NIC-8000-0Q.severity" +msgstr "Critical" +msgid "NIC-8000-0Q.description" +msgstr "NIC transceiver module %<fault-list[0].resource.hc-specific.txr_index> (SFP/SFP+/QSFP+ etc.) in %<fault-list[0].resource.hc-specific.link-name> is of a type that is not supported. This may be due to an incompatible link type or speed. In some NICs, this may also be caused by enforcement of a vendor or part whitelist.\n\n NIC data link: %<fault-list[0].resource.hc-specific.link-name> (%<fault-list[0].resource.hc-specific.primary-mac-address>)\n Module vendor: %<fault-list[0].resource.hc-specific.vendor>\n Module part: %<fault-list[0].resource.part>\n Module serial: %<fault-list[0].resource.serial>\n\n Refer to %s for more information." +msgid "NIC-8000-0Q.response" +msgstr "The transceiver module has been disabled, and the network data link associated with it (%<fault-list[0].resource.hc-specific.link-name>) has been marked as down.\n" +msgid "NIC-8000-0Q.impact" +msgstr "No network traffic will pass through the data link or network interfaces associated with this transceiver slot.\n" +msgid "NIC-8000-0Q.action" +msgstr "Replace the transceiver module with one of a supported type.\n" + +# +# code: NIC-8000-1C +# keys: fault.io.nic.transceiver.whitelist +# +msgid "NIC-8000-1C.type" +msgstr "Fault" +msgid "NIC-8000-1C.severity" +msgstr "Critical" +msgid "NIC-8000-1C.description" +msgstr "NIC transceiver module %<fault-list[0].resource.hc-specific.txr_index> (SFP/SFP+/QSFP+ etc.) in %<fault-list[0].resource.hc-specific.link-name> is of a type that is not allowed to be used with this NIC (due to a hardware-enforced vendor or part whitelist).\n\n NIC data link: %<fault-list[0].resource.hc-specific.link-name> (%<fault-list[0].resource.hc-specific.primary-mac-address>)\n Module vendor: %<fault-list[0].resource.hc-specific.vendor>\n Module part: %<fault-list[0].resource.part>\n Module serial: %<fault-list[0].resource.serial>\n\n Refer to %s for more information." +msgid "NIC-8000-1C.response" +msgstr "The transceiver module has been disabled, and the network data link associated with it (%<fault-list[0].resource.hc-specific.link-name>) has been marked as down.\n" +msgid "NIC-8000-1C.impact" +msgstr "No network traffic will pass through the data link or network\ninterfaces associated with this transceiver slot.\n" +msgid "NIC-8000-1C.action" +msgstr "Replace the transceiver module with one of a supported type.\n" + +# +# code: NIC-8000-2R +# keys: fault.io.nic.transceiver.overtemp +# +msgid "NIC-8000-2R.type" +msgstr "Fault" +msgid "NIC-8000-2R.severity" +msgstr "Critical" +msgid "NIC-8000-2R.description" +msgstr "NIC transceiver module %<fault-list[0].resource.hc-specific.txr_index> (SFP/SFP+/QSFP+ etc.) in %<fault-list[0].resource.hc-specific.link-name> has overheated.\n\n NIC data link: %<fault-list[0].resource.hc-specific.link-name> (%<fault-list[0].resource.hc-specific.primary-mac-address>)\n Module vendor: %<fault-list[0].resource.hc-specific.vendor>\n Module part: %<fault-list[0].resource.part>\n Module serial: %<fault-list[0].resource.serial>\n\n Refer to %s for more information." +msgid "NIC-8000-2R.response" +msgstr "The transceiver module has been disabled, and the network data link associated with it (%<fault-list[0].resource.hc-specific.link-name>) has been marked as down.\n" +msgid "NIC-8000-2R.impact" +msgstr "No network traffic will pass through the data link or network interfaces associated with this transceiver slot.\n" +msgid "NIC-8000-2R.action" +msgstr "Remove the transceiver module and check for adequate ventilation\nand cooling. Re-inserting the module after it has cooled will restore service.\n" + +# +# code: NIC-8000-34 +# keys: fault.io.nic.transceiver.hwfail +# +msgid "NIC-8000-34.type" +msgstr "Fault" +msgid "NIC-8000-34.severity" +msgstr "Critical" +msgid "NIC-8000-34.description" +msgstr "NIC transceiver module %<fault-list[0].resource.hc-specific.txr_index> (SFP/SFP+/QSFP+ etc.) in %<fault-list[0].resource.hc-specific.link-name> has experienced a hardware failure.\n\n NIC data link: %<fault-list[0].resource.hc-specific.link-name> (%<fault-list[0].resource.hc-specific.primary-mac-address>)\n Module vendor: %<fault-list[0].resource.hc-specific.vendor>\n Module part: %<fault-list[0].resource.part>\n Module serial: %<fault-list[0].resource.serial>\n\n Refer to %s for more information." +msgid "NIC-8000-34.response" +msgstr "The transceiver module has been disabled, and the network data link associated with it (%<fault-list[0].resource.hc-specific.link-name>) has been marked as down.\n" +msgid "NIC-8000-34.impact" +msgstr "No network traffic will pass through the data link or network\ninterfaces associated with this transceiver slot.\n" +msgid "NIC-8000-34.action" +msgstr "Remove and check the transceiver module, and consider replacing it.\n" + +# +# code: NIC-8000-4X +# keys: fault.io.nic.transceiver.unknown +# +msgid "NIC-8000-4X.type" +msgstr "Fault" +msgid "NIC-8000-4X.severity" +msgstr "Critical" +msgid "NIC-8000-4X.description" +msgstr "The slot for NIC transceiver module %<fault-list[0].resource.hc-specific.txr_index> (SFP/SFP+/QSFP+ etc.) in %<fault-list[0].resource.hc-specific.link-name> is occupied, but hardware did not find a valid transceiver in it.\n Refer to %s for more information." +msgid "NIC-8000-4X.response" +msgstr "The transceiver module slot has been disabled, and the network data link associated with it (%<fault-list[0].resource.hc-specific.link-name>) has been marked as down.\n" +msgid "NIC-8000-4X.impact" +msgstr "No network traffic will pass through the data link or network\ninterfaces associated with this transceiver slot.\n" +msgid "NIC-8000-4X.action" +msgstr "Remove and check the transceiver module. It may be faulty,\ninserted incorrectly, or not of the correct type for the slot.\nIf problems persist, consider replacing the module.\n" diff --git a/usr/src/cmd/fm/eversholt/files/common/nic.esc b/usr/src/cmd/fm/eversholt/files/common/nic.esc new file mode 100644 index 0000000000..6dfaf5fa5b --- /dev/null +++ b/usr/src/cmd/fm/eversholt/files/common/nic.esc @@ -0,0 +1,127 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ +/* + * Copyright 2020, the University of Queensland + */ + +#pragma dictionary "NIC" + +/* + * Rules for the generic NIC (non-driver-specific) fault events. + */ + +/* + * Transceiver events are emitted by drivers under ereport.io.nic.txr-err. + * + * These are emitted with detector = the PCI/PCIex function of the NIC. + * They must always have a string property "error", set to one of the + * generic transceiver fault type names (notsupp, whitelist, overtemp etc). + * + * As well as "error", they must have both the "port_index" and "txr_index" + * properties set in the event payload (both integer types). + * + * It is expected that drivers will call ddi_fm_service_impact() immediately + * after noticing a transceiver error, with an argument of DDI_SERVICE_LOST or + * DDI_SERVICE_DEGRADED (depending on the specific error -- at time of writing + * all the supported events expect DDI_SERVICE_LOST). + */ + +asru pcifn; +fru pcifn/port/transceiver; + +asru pciexfn; +fru pciexfn/port/transceiver; + +#define EV_DECL_TXR_FAULT(TYPE) \ + event fault.io.nic.transceiver.TYPE@pcifn/port/transceiver \ + FRU=pcifn/port/transceiver, ASRU=pcifn; \ + event fault.io.nic.transceiver.TYPE@pciexfn/port/transceiver \ + FRU=pciexfn/port/transceiver, ASRU=pciexfn; + +EV_DECL_TXR_FAULT(notsupp) +EV_DECL_TXR_FAULT(whitelist) +EV_DECL_TXR_FAULT(overtemp) +EV_DECL_TXR_FAULT(hwfail) +EV_DECL_TXR_FAULT(unknown) + +event ereport.io.nic.txr-err@pcifn; +event ereport.io.service.lost@pcifn; + +event ereport.io.nic.txr-err@pciexfn; +event ereport.io.service.lost@pciexfn; + +#define EV_PROP_TXR_FAULT(TYPE) \ + prop fault.io.nic.transceiver.TYPE@pcifn/port[pn]/transceiver[tn] (2) -> \ + ereport.io.nic.txr-err@pcifn { \ + payloadprop("txr_index") == tn && \ + payloadprop("port_index") == pn && \ + payloadprop("error") == "TYPE" && \ + setpayloadprop("txr_index", tn) && \ + setpayloadprop("link-name", confprop(pcifn/port[pn], "link-name")) && \ + setpayloadprop("primary-mac-address", confprop(pcifn/port[pn], "primary-mac-address")) && \ + (!confprop_defined(pcifn/port[pn]/transceiver[tn], "vendor") || \ + setpayloadprop("vendor", confprop(pcifn/port[pn]/transceiver[tn], "vendor"))) \ + }, \ + ereport.io.service.lost@pcifn { within(1s) }; \ + prop fault.io.nic.transceiver.TYPE@pciexfn/port[pn]/transceiver[tn] (2) -> \ + ereport.io.nic.txr-err@pciexfn { \ + payloadprop("txr_index") == tn && \ + payloadprop("port_index") == pn && \ + payloadprop("error") == "TYPE" && \ + setpayloadprop("txr_index", tn) && \ + setpayloadprop("link-name", confprop(pciexfn/port[pn], "link-name")) && \ + setpayloadprop("primary-mac-address", confprop(pciexfn/port[pn], "primary-mac-address")) && \ + (!confprop_defined(pciexfn/port[pn]/transceiver[tn], "vendor") || \ + setpayloadprop("vendor", confprop(pciexfn/port[pn]/transceiver[tn], "vendor"))) \ + }, \ + ereport.io.service.lost@pciexfn { within(1s) }; + +EV_PROP_TXR_FAULT(notsupp) +EV_PROP_TXR_FAULT(whitelist) +EV_PROP_TXR_FAULT(overtemp) +EV_PROP_TXR_FAULT(hwfail) +EV_PROP_TXR_FAULT(unknown) + +/* + * Allow drivers (e.g. i40e) which can't tell the difference between the events + * notsupp/unknown/whitelist to generate a single ereport covering all 3. + * + * If transceiver information is available in topo, we will turn it into + * a "notsupp" fault. If it isn't, we'll turn it into an "unknown" fault + * instead. The text in "notsupp" explicitly notes that certain drivers might + * have difficulty telling the difference between it and "whitelist". + * + * If you want this for a pcifn driver rather than pciexfn, you'll have to + * make another copy. + */ +prop fault.io.nic.transceiver.notsupp@pciexfn/port[pn]/transceiver[tn] (2) -> + ereport.io.nic.txr-err@pciexfn { + payloadprop("txr_index") == tn && + payloadprop("port_index") == pn && + payloadprop("error") == "notsupp/unknown" && + confprop_defined(pciexfn/port[pn]/transceiver[tn], "vendor") && + setpayloadprop("txr_index", tn) && + setpayloadprop("link-name", confprop(pciexfn/port[pn], "link-name")) && + setpayloadprop("primary-mac-address", confprop(pciexfn/port[pn], "primary-mac-address")) && + setpayloadprop("vendor", confprop(pciexfn/port[pn]/transceiver[tn], "vendor")) + }, + ereport.io.service.lost@pciexfn { within(1s) }; +prop fault.io.nic.transceiver.unknown@pciexfn/port[pn]/transceiver[tn] (2) -> + ereport.io.nic.txr-err@pciexfn { + payloadprop("txr_index") == tn && + payloadprop("port_index") == pn && + payloadprop("error") == "notsupp/unknown" && + !confprop_defined(pciexfn/port[pn]/transceiver[tn], "vendor") && + setpayloadprop("txr_index", tn) && + setpayloadprop("link-name", confprop(pciexfn/port[pn], "link-name")) && + setpayloadprop("primary-mac-address", confprop(pciexfn/port[pn], "primary-mac-address")) + }, + ereport.io.service.lost@pciexfn { within(1s) }; diff --git a/usr/src/cmd/fm/eversholt/files/i386/Makefile b/usr/src/cmd/fm/eversholt/files/i386/Makefile index bb6cda3b38..67caa4468e 100644 --- a/usr/src/cmd/fm/eversholt/files/i386/Makefile +++ b/usr/src/cmd/fm/eversholt/files/i386/Makefile @@ -33,7 +33,8 @@ EFT_COMMON_FILES= \ sca500.eft \ sca1000.eft \ sensor.eft \ - storage.eft + storage.eft \ + nic.eft include ../../../Makefile.subdirs diff --git a/usr/src/cmd/fm/eversholt/files/sparc/Makefile b/usr/src/cmd/fm/eversholt/files/sparc/Makefile index 4e5655cbf7..0482b12b33 100644 --- a/usr/src/cmd/fm/eversholt/files/sparc/Makefile +++ b/usr/src/cmd/fm/eversholt/files/sparc/Makefile @@ -34,7 +34,8 @@ EFT_COMMON_FILES= \ sca500.eft \ sca1000.eft \ sensor.eft \ - storage.eft + storage.eft \ + nic.eft include ../../../Makefile.subdirs diff --git a/usr/src/cmd/fm/fmd/common/fmd.c b/usr/src/cmd/fm/fmd/common/fmd.c index 8177c81049..7369a68047 100644 --- a/usr/src/cmd/fm/fmd/common/fmd.c +++ b/usr/src/cmd/fm/fmd/common/fmd.c @@ -169,8 +169,8 @@ fmd_trmode_set(fmd_conf_param_t *pp, const char *value) else return (fmd_set_errno(EFMD_CONF_INVAL)); - fmd.d_thr_trace = (void (*)())func; - pp->cp_value.cpv_ptr = (void *)func; + fmd.d_thr_trace = func; + pp->cp_value.cpv_ptr = func; return (0); } diff --git a/usr/src/cmd/fm/fmd/common/fmd.h b/usr/src/cmd/fm/fmd/common/fmd.h index 272fa3c305..fa2d4710b7 100644 --- a/usr/src/cmd/fm/fmd/common/fmd.h +++ b/usr/src/cmd/fm/fmd/common/fmd.h @@ -36,6 +36,7 @@ extern "C" { #include <fmd_list.h> #include <fmd_time.h> #include <fmd_api.h> +#include <fmd_trace.h> struct fmd_conf; /* see <fmd_conf.h> */ struct fmd_dispq; /* see <fmd_dispq.h> */ @@ -89,7 +90,7 @@ typedef struct fmd { pthread_mutex_t d_thr_lock; /* lock for d_thr_list */ fmd_list_t d_thr_list; /* list of all fmd_thread_t's */ - void (*d_thr_trace)(); /* thread trace buffer function */ + fmd_tracebuf_f *d_thr_trace; /* thread trace buffer function */ int d_thr_sig; /* cached copy of client.thrsig */ pthread_mutex_t d_mod_lock; /* lock for d_mod_list */ diff --git a/usr/src/cmd/fm/fmd/common/fmd_api.c b/usr/src/cmd/fm/fmd/common/fmd_api.c index 008a55c90f..594e41896d 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_api.c +++ b/usr/src/cmd/fm/fmd/common/fmd_api.c @@ -1872,7 +1872,7 @@ fmd_doorthr_create(door_info_t *dip, void *(*crf)(void *), void *crarg, return (0); } - if ((new_tp = fmd_doorthread_create(mp, (fmd_thread_f *)crf, + if ((new_tp = fmd_doorthread_create(mp, (fmd_thread_f *)(uintptr_t)crf, crarg)) != NULL) { tid = new_tp->thr_tid; mp->mod_stats->ms_doorthrtotal.fmds_value.ui32++; diff --git a/usr/src/cmd/fm/fmd/common/fmd_case.c b/usr/src/cmd/fm/fmd/common/fmd_case.c index dff15220a7..9ffa939cd1 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_case.c +++ b/usr/src/cmd/fm/fmd/common/fmd_case.c @@ -1572,9 +1572,9 @@ fmd_case_rele_locked(fmd_case_t *cp) } int -fmd_case_insert_principal(fmd_case_t *cp, fmd_event_t *ep) +fmd_case_insert_principal(void *cp, fmd_event_t *ep) { - fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; + fmd_case_impl_t *cip = cp; fmd_case_item_t *cit; fmd_event_t *oep; uint_t state; @@ -1611,9 +1611,9 @@ fmd_case_insert_principal(fmd_case_t *cp, fmd_event_t *ep) } int -fmd_case_insert_event(fmd_case_t *cp, fmd_event_t *ep) +fmd_case_insert_event(void *cp, fmd_event_t *ep) { - fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; + fmd_case_impl_t *cip = cp; fmd_case_item_t *cit; uint_t state; int new; diff --git a/usr/src/cmd/fm/fmd/common/fmd_case.h b/usr/src/cmd/fm/fmd/common/fmd_case.h index 733826e91c..92b6a91de5 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_case.h +++ b/usr/src/cmd/fm/fmd/common/fmd_case.h @@ -130,8 +130,8 @@ extern void fmd_case_rele(fmd_case_t *); extern void fmd_case_rele_locked(fmd_case_t *); extern void fmd_case_update(fmd_case_t *); -extern int fmd_case_insert_principal(fmd_case_t *, fmd_event_t *); -extern int fmd_case_insert_event(fmd_case_t *, fmd_event_t *); +extern int fmd_case_insert_principal(void *, fmd_event_t *); +extern int fmd_case_insert_event(void *, fmd_event_t *); extern void fmd_case_insert_suspect(fmd_case_t *, nvlist_t *); extern void fmd_case_recreate_suspect(fmd_case_t *, nvlist_t *); diff --git a/usr/src/cmd/fm/fmd/common/fmd_ckpt.c b/usr/src/cmd/fm/fmd/common/fmd_ckpt.c index 4bae10f7b4..c923cbbb22 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_ckpt.c +++ b/usr/src/cmd/fm/fmd/common/fmd_ckpt.c @@ -894,7 +894,7 @@ fmd_ckpt_strptr(fmd_ckpt_t *ckp, fcf_stridx_t sid, const char *defstr) static void fmd_ckpt_restore_events(fmd_ckpt_t *ckp, fcf_secidx_t sid, - void (*func)(void *, fmd_event_t *), void *arg) + int (*func)(void *, fmd_event_t *), void *arg) { const fcf_event_t *fcfe; const fcf_sec_t *sp; @@ -942,7 +942,7 @@ fmd_ckpt_restore_events(fmd_ckpt_t *ckp, fcf_secidx_t sid, ep = fmd_event_recreate(FMD_EVT_PROTOCOL, &ftv, NULL, NULL, lp, fcfe->fcfe_offset, 0); fmd_event_hold(ep); - func(arg, ep); + (void) func(arg, ep); fmd_event_rele(ep); fcfe = (fcf_event_t *)((uintptr_t)fcfe + sp->fcfs_entsize); @@ -1050,10 +1050,10 @@ fmd_ckpt_restore_case(fmd_ckpt_t *ckp, fmd_module_t *mp, const fcf_sec_t *sp) } fmd_ckpt_restore_events(ckp, fcfc->fcfc_principal, - (void (*)(void *, fmd_event_t *))fmd_case_insert_principal, cp); + fmd_case_insert_principal, cp); fmd_ckpt_restore_events(ckp, fcfc->fcfc_events, - (void (*)(void *, fmd_event_t *))fmd_case_insert_event, cp); + fmd_case_insert_event, cp); /* * Once solved, treat suspects from resource cache as master copy. @@ -1105,7 +1105,7 @@ fmd_ckpt_restore_serd(fmd_ckpt_t *ckp, fmd_module_t *mp, const fcf_sec_t *sp) fmd_module_lock(mp); fmd_ckpt_restore_events(ckp, fcfd->fcfd_events, - (void (*)(void *, fmd_event_t *))fmd_serd_eng_record, + fmd_serd_eng_record, fmd_serd_eng_lookup(&mp->mod_serds, s)); fmd_module_unlock(mp); diff --git a/usr/src/cmd/fm/fmd/common/fmd_mdb.c b/usr/src/cmd/fm/fmd/common/fmd_mdb.c index 8ad141ab27..c24d0cee39 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_mdb.c +++ b/usr/src/cmd/fm/fmd/common/fmd_mdb.c @@ -208,8 +208,11 @@ trwalk_fini(mdb_walk_state_t *wsp) /*ARGSUSED*/ static int -trprint_msg(uintptr_t addr, const fmd_tracerec_t *trp, uintptr_t tid) +trprint_msg(uintptr_t addr, const void *arg, void *arg1) { + const fmd_tracerec_t *trp = arg; + uintptr_t tid = (uintptr_t)arg1; + if (tid == 0) mdb_printf("%3lu ", trp->tr_stack[trp->tr_depth]); else if (trp->tr_stack[trp->tr_depth] != tid) @@ -223,8 +226,10 @@ trprint_msg(uintptr_t addr, const fmd_tracerec_t *trp, uintptr_t tid) /*ARGSUSED*/ static int -trprint_cpp(uintptr_t addr, const fmd_tracerec_t *trp, uintptr_t tid) +trprint_cpp(uintptr_t addr, const void *arg, void *arg1) { + const fmd_tracerec_t *trp = arg; + uintptr_t tid = (uintptr_t)arg1; char file[64]; if (tid == 0) @@ -254,17 +259,19 @@ trprint_stack(const fmd_tracerec_t *trp) } static int -trprint_msg_stack(uintptr_t addr, const fmd_tracerec_t *trp, uintptr_t tid) +trprint_msg_stack(uintptr_t addr, const void *arg, void *arg1) { - int status = trprint_msg(addr, trp, tid); + const fmd_tracerec_t *trp = arg; + int status = trprint_msg(addr, trp, arg1); trprint_stack(trp); return (status); } static int -trprint_cpp_stack(uintptr_t addr, const fmd_tracerec_t *trp, uintptr_t tid) +trprint_cpp_stack(uintptr_t addr, const void *arg, void *arg1) { - int status = trprint_cpp(addr, trp, tid); + const fmd_tracerec_t *trp = arg; + int status = trprint_cpp(addr, trp, arg1); trprint_stack(trp); return (status); } @@ -272,7 +279,7 @@ trprint_cpp_stack(uintptr_t addr, const fmd_tracerec_t *trp, uintptr_t tid) static int fmd_trace(uintptr_t tid, uint_t flags, int argc, const mdb_arg_t *argv) { - int (*func)(uintptr_t, const fmd_tracerec_t *, uintptr_t); + int (*func)(uintptr_t, const void *, void *); uint_t opt_c = FALSE, opt_s = FALSE; if (mdb_getopts(argc, argv, @@ -293,7 +300,7 @@ fmd_trace(uintptr_t tid, uint_t flags, int argc, const mdb_arg_t *argv) func = opt_s ? trprint_msg_stack : trprint_msg; } - if (mdb_walk("fmd_trace", (mdb_walk_cb_t)func, (void *)tid) == -1) { + if (mdb_walk("fmd_trace", func, (void *)tid) == -1) { mdb_warn("failed to walk fmd_trace"); return (DCMD_ERR); } diff --git a/usr/src/cmd/fm/fmd/common/fmd_module.c b/usr/src/cmd/fm/fmd/common/fmd_module.c index ad3b8f424d..5fe1c701ce 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_module.c +++ b/usr/src/cmd/fm/fmd/common/fmd_module.c @@ -641,8 +641,7 @@ fmd_module_gc(fmd_module_t *mp) fmd_module_lock(mp); if ((info = mp->mod_info) != NULL) { - fmd_serd_hash_apply(&mp->mod_serds, - (fmd_serd_eng_f *)fmd_serd_eng_gc, NULL); + fmd_serd_hash_apply(&mp->mod_serds, fmd_serd_eng_gc, NULL); } fmd_module_unlock(mp); @@ -657,8 +656,7 @@ void fmd_module_trygc(fmd_module_t *mp) { if (fmd_module_trylock(mp)) { - fmd_serd_hash_apply(&mp->mod_serds, - (fmd_serd_eng_f *)fmd_serd_eng_gc, NULL); + fmd_serd_hash_apply(&mp->mod_serds, fmd_serd_eng_gc, NULL); fmd_module_unlock(mp); } } @@ -715,7 +713,7 @@ fmd_module_clrdirty(fmd_module_t *mp) if (mp->mod_flags & FMD_MOD_MDIRTY) { fmd_serd_hash_apply(&mp->mod_serds, - (fmd_serd_eng_f *)fmd_serd_eng_clrdirty, NULL); + fmd_serd_eng_clrdirty, NULL); fmd_buf_hash_commit(&mp->mod_bufs); } @@ -740,8 +738,7 @@ fmd_module_commit(fmd_module_t *mp) } if (mp->mod_flags & FMD_MOD_MDIRTY) { - fmd_serd_hash_apply(&mp->mod_serds, - (fmd_serd_eng_f *)fmd_serd_eng_commit, NULL); + fmd_serd_hash_apply(&mp->mod_serds, fmd_serd_eng_commit, NULL); fmd_buf_hash_commit(&mp->mod_bufs); } diff --git a/usr/src/cmd/fm/fmd/common/fmd_scheme.c b/usr/src/cmd/fm/fmd/common/fmd_scheme.c index 4ddad713a6..367ecde455 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_scheme.c +++ b/usr/src/cmd/fm/fmd/common/fmd_scheme.c @@ -142,21 +142,38 @@ fmd_scheme_fmd_unusable(nvlist_t *nvl) return (rv); } -/*ARGSUSED*/ static nvlist_t * -fmd_scheme_notranslate(nvlist_t *fmri, nvlist_t *auth) +fmd_scheme_notranslate(nvlist_t *fmri, nvlist_t *auth __unused) { (void) nvlist_xdup(fmri, &fmri, &fmd.d_nva); return (fmri); } -static long -fmd_scheme_notsup(void) +static ssize_t +fmd_scheme_notsup_nvl2str(nvlist_t *fmri __unused, char *arg1 __unused, + size_t arg2 __unused) +{ + return (fmd_set_errno(EFMD_FMRI_NOTSUP)); +} + +static int +fmd_scheme_notsup(nvlist_t *fmri __unused) { return (fmd_set_errno(EFMD_FMRI_NOTSUP)); } static int +fmd_scheme_notsup2(nvlist_t *fmri1 __unused, nvlist_t *fmri2 __unused) +{ + return (fmd_set_errno(EFMD_FMRI_NOTSUP)); +} + +static void +fmd_scheme_vnop(void) +{ +} + +static int fmd_scheme_nop(void) { return (0); @@ -167,29 +184,29 @@ fmd_scheme_nop(void) * the module, then this operation is implemented using the default function. */ static const fmd_scheme_ops_t _fmd_scheme_default_ops = { - (int (*)())fmd_scheme_nop, /* sop_init */ - (void (*)())fmd_scheme_nop, /* sop_fini */ - (ssize_t (*)())fmd_scheme_notsup, /* sop_nvl2str */ - (int (*)())fmd_scheme_nop, /* sop_expand */ - (int (*)())fmd_scheme_notsup, /* sop_present */ - (int (*)())fmd_scheme_notsup, /* sop_replaced */ - (int (*)())fmd_scheme_notsup, /* sop_service_state */ - (int (*)())fmd_scheme_notsup, /* sop_unusable */ - (int (*)())fmd_scheme_notsup, /* sop_contains */ - fmd_scheme_notranslate /* sop_translate */ + .sop_init = fmd_scheme_nop, + .sop_fini = fmd_scheme_vnop, + .sop_nvl2str = fmd_scheme_notsup_nvl2str, + .sop_expand = fmd_scheme_notsup, + .sop_present = fmd_scheme_notsup, + .sop_replaced = fmd_scheme_notsup, + .sop_service_state = fmd_scheme_notsup, + .sop_unusable = fmd_scheme_notsup, + .sop_contains = fmd_scheme_notsup2, + .sop_translate = fmd_scheme_notranslate }; static const fmd_scheme_ops_t _fmd_scheme_builtin_ops = { - (int (*)())fmd_scheme_nop, /* sop_init */ - (void (*)())fmd_scheme_nop, /* sop_fini */ - fmd_scheme_fmd_nvl2str, /* sop_nvl2str */ - (int (*)())fmd_scheme_nop, /* sop_expand */ - fmd_scheme_fmd_present, /* sop_present */ - fmd_scheme_fmd_replaced, /* sop_replaced */ - fmd_scheme_fmd_service_state, /* sop_service_state */ - fmd_scheme_fmd_unusable, /* sop_unusable */ - (int (*)())fmd_scheme_notsup, /* sop_contains */ - fmd_scheme_notranslate /* sop_translate */ + .sop_init = fmd_scheme_nop, + .sop_fini = fmd_scheme_vnop, + .sop_nvl2str = fmd_scheme_fmd_nvl2str, + .sop_expand = fmd_scheme_notsup, + .sop_present = fmd_scheme_fmd_present, + .sop_replaced = fmd_scheme_fmd_replaced, + .sop_service_state = fmd_scheme_fmd_service_state, + .sop_unusable = fmd_scheme_fmd_unusable, + .sop_contains = fmd_scheme_notsup2, + .sop_translate = fmd_scheme_notranslate }; /* diff --git a/usr/src/cmd/fm/fmd/common/fmd_serd.c b/usr/src/cmd/fm/fmd/common/fmd_serd.c index 166b565666..0c817ef07d 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_serd.c +++ b/usr/src/cmd/fm/fmd/common/fmd_serd.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <fmd_alloc.h> #include <fmd_string.h> #include <fmd_subr.h> @@ -189,8 +187,9 @@ fmd_serd_eng_contains(fmd_serd_eng_t *sgp, fmd_event_t *ep) } int -fmd_serd_eng_record(fmd_serd_eng_t *sgp, fmd_event_t *ep) +fmd_serd_eng_record(void *ptr, fmd_event_t *ep) { + fmd_serd_eng_t *sgp = ptr; fmd_serd_elem_t *sep, *oep; /* @@ -253,7 +252,7 @@ fmd_serd_eng_reset(fmd_serd_eng_t *sgp) } void -fmd_serd_eng_gc(fmd_serd_eng_t *sgp) +fmd_serd_eng_gc(fmd_serd_eng_t *sgp, void *arg __unused) { fmd_serd_elem_t *sep, *nep; hrtime_t hrt; @@ -275,7 +274,7 @@ fmd_serd_eng_gc(fmd_serd_eng_t *sgp) } void -fmd_serd_eng_commit(fmd_serd_eng_t *sgp) +fmd_serd_eng_commit(fmd_serd_eng_t *sgp, void *arg __unused) { fmd_serd_elem_t *sep; @@ -290,7 +289,7 @@ fmd_serd_eng_commit(fmd_serd_eng_t *sgp) } void -fmd_serd_eng_clrdirty(fmd_serd_eng_t *sgp) +fmd_serd_eng_clrdirty(fmd_serd_eng_t *sgp, void *arg __unused) { sgp->sg_flags &= ~FMD_SERD_DIRTY; } diff --git a/usr/src/cmd/fm/fmd/common/fmd_serd.h b/usr/src/cmd/fm/fmd/common/fmd_serd.h index 3841f91999..48190a9058 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_serd.h +++ b/usr/src/cmd/fm/fmd/common/fmd_serd.h @@ -27,8 +27,6 @@ #ifndef _FMD_SERD_H #define _FMD_SERD_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -75,14 +73,14 @@ extern fmd_serd_eng_t *fmd_serd_eng_lookup(fmd_serd_hash_t *, const char *); extern void fmd_serd_eng_delete(fmd_serd_hash_t *, const char *); extern int fmd_serd_eng_contains(fmd_serd_eng_t *, fmd_event_t *); -extern int fmd_serd_eng_record(fmd_serd_eng_t *, fmd_event_t *); +extern int fmd_serd_eng_record(void *, fmd_event_t *); extern int fmd_serd_eng_fired(fmd_serd_eng_t *); extern int fmd_serd_eng_empty(fmd_serd_eng_t *); extern void fmd_serd_eng_reset(fmd_serd_eng_t *); -extern void fmd_serd_eng_gc(fmd_serd_eng_t *); -extern void fmd_serd_eng_commit(fmd_serd_eng_t *); -extern void fmd_serd_eng_clrdirty(fmd_serd_eng_t *); +extern void fmd_serd_eng_gc(fmd_serd_eng_t *, void *); +extern void fmd_serd_eng_commit(fmd_serd_eng_t *, void*); +extern void fmd_serd_eng_clrdirty(fmd_serd_eng_t *, void*); #ifdef __cplusplus } diff --git a/usr/src/cmd/fm/fmd/common/fmd_thread.c b/usr/src/cmd/fm/fmd/common/fmd_thread.c index cb0cb0745d..5de69238b5 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_thread.c +++ b/usr/src/cmd/fm/fmd/common/fmd_thread.c @@ -41,7 +41,7 @@ fmd_thread_xcreate(fmd_module_t *mp, pthread_t tid) tp->thr_func = NULL; tp->thr_arg = NULL; tp->thr_trdata = fmd_trace_create(); - tp->thr_trfunc = (fmd_tracebuf_f *)fmd.d_thr_trace; + tp->thr_trfunc = fmd.d_thr_trace; tp->thr_errdepth = 0; tp->thr_isdoor = 0; @@ -81,7 +81,7 @@ fmd_thread_create_cmn(fmd_module_t *mp, fmd_thread_f *func, void *arg, tp->thr_func = func; tp->thr_arg = arg; tp->thr_trdata = fmd_trace_create(); - tp->thr_trfunc = (fmd_tracebuf_f *)fmd.d_thr_trace; + tp->thr_trfunc = fmd.d_thr_trace; tp->thr_errdepth = 0; tp->thr_isdoor = isdoor; diff --git a/usr/src/cmd/fm/fmd/common/fmd_time.c b/usr/src/cmd/fm/fmd/common/fmd_time.c index ace772a476..a735ba03bf 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_time.c +++ b/usr/src/cmd/fm/fmd/common/fmd_time.c @@ -186,7 +186,7 @@ fmd_time_tod2hrt(hrtime_t hrt_base, const fmd_timeval_t *tod_base, * period between 'hrt' and 't0', therefore to check which one came first, we * test their subtraction against the highest bit of mask, if the bit is not * set, then 't0' is earlier. This is equivalent to - * ((hrt - t0) & mask) < ((mask + 1) / 2) + * ((hrt - t0) & mask) < ((mask + 1) / 2) */ hrtime_t fmd_time_ena2hrt(hrtime_t hrt, uint64_t ena) @@ -366,6 +366,11 @@ fmd_native_cancel(pthread_t tid) (void) pthread_kill(tid, SIGALRM); } +static void +fmd_time_vnop(void) +{ +} + static void * fmd_time_nop(void) { @@ -374,10 +379,10 @@ fmd_time_nop(void) const fmd_timeops_t fmd_timeops_native = { (void *(*)())fmd_time_nop, /* fto_init */ - (void (*)())fmd_time_nop, /* fto_fini */ + (void (*)())fmd_time_vnop, /* fto_fini */ gettimeofday, /* fto_gettimeofday */ gethrtime, /* fto_gethrtime */ - (void (*)())fmd_time_nop, /* fto_addhrtime */ + (void (*)())fmd_time_vnop, /* fto_addhrtime */ fmd_native_wait, /* fto_waithrtime */ fmd_native_cancel, /* fto_waitcancel */ }; diff --git a/usr/src/cmd/fm/fmdump/common/scheme.c b/usr/src/cmd/fm/fmdump/common/scheme.c index 425fbd302c..20cad01a50 100644 --- a/usr/src/cmd/fm/fmdump/common/scheme.c +++ b/usr/src/cmd/fm/fmdump/common/scheme.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/systeminfo.h> @@ -79,6 +77,11 @@ fmd_scheme_notsup(void) return (-1); } +static void +fmd_scheme_vnop(void) +{ +} + static int fmd_scheme_nop(void) { @@ -91,7 +94,7 @@ fmd_scheme_nop(void) */ static const fmd_scheme_ops_t _fmd_scheme_default_ops = { (int (*)())fmd_scheme_nop, /* sop_init */ - (void (*)())fmd_scheme_nop, /* sop_fini */ + (void (*)())fmd_scheme_vnop, /* sop_fini */ (ssize_t (*)())fmd_scheme_notsup, /* sop_nvl2str */ }; diff --git a/usr/src/cmd/fm/modules/common/eversholt/eval.c b/usr/src/cmd/fm/modules/common/eversholt/eval.c index a3c47f91dc..78ce797d28 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/eval.c +++ b/usr/src/cmd/fm/modules/common/eversholt/eval.c @@ -32,6 +32,7 @@ #include <stdlib.h> #include <ctype.h> #include <string.h> +#include <fm/libtopo.h> #include "alloc.h" #include "out.h" #include "stable.h" @@ -507,7 +508,7 @@ eval_func(struct node *funcnp, struct lut *ex, struct node *events[], valuep->v = 1; return (1); } else if (funcname == L_has_fault) { - nvlist_t *asru = NULL, *fru = NULL, *rsrc = NULL; + nvlist_t *rsrc = NULL; nodep = eval_getname(funcnp, ex, events, np->u.expr.left, globals, croot, arrowp, try, &duped); @@ -519,7 +520,8 @@ eval_func(struct node *funcnp, struct lut *ex, struct node *events[], } path = ipath2str(NULL, ipath(nodep)); - platform_units_translate(0, croot, &asru, &fru, &rsrc, path); + platform_unit_translate(0, croot, TOPO_PROP_RESOURCE, + &rsrc, path); outfl(O_ALTFP|O_VERB2|O_NONL, np->file, np->line, "has_fault("); ptree_name_iter(O_ALTFP|O_VERB2|O_NONL, nodep); out(O_ALTFP|O_VERB2|O_NONL, "(%s), \"%s\") ", path, diff --git a/usr/src/cmd/fm/modules/common/eversholt/fme.c b/usr/src/cmd/fm/modules/common/eversholt/fme.c index e153385551..0f7edab994 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/fme.c +++ b/usr/src/cmd/fm/modules/common/eversholt/fme.c @@ -38,6 +38,7 @@ #include <libnvpair.h> #include <sys/fm/protocol.h> #include <fm/fmd_api.h> +#include <fm/libtopo.h> #include "alloc.h" #include "out.h" #include "stats.h" @@ -340,7 +341,7 @@ newfme(const char *e0class, const struct ipath *e0ipp, fmd_hdl_t *hdl, ipathlastcomp(e0ipp); pathstr = ipath2str(NULL, e0ipp); cfgdata = config_snapshot(); - platform_units_translate(0, cfgdata->cooked, NULL, NULL, + platform_unit_translate(0, cfgdata->cooked, TOPO_PROP_RESOURCE, &detector, pathstr); FREE(pathstr); structconfig_free(cfgdata->cooked); @@ -392,7 +393,7 @@ newfme(const char *e0class, const struct ipath *e0ipp, fmd_hdl_t *hdl, nvlist_free(detector); pathstr = ipath2str(NULL, e0ipp); cfgdata = config_snapshot(); - platform_units_translate(0, cfgdata->cooked, NULL, NULL, + platform_unit_translate(0, cfgdata->cooked, TOPO_PROP_RESOURCE, &detector, pathstr); FREE(pathstr); platform_save_config(hdl, fmcase); @@ -2181,7 +2182,8 @@ void get_resources(struct event *sp, struct rsl *rsrcs, struct config *croot) { struct node *asrudef, *frudef; - nvlist_t *asru, *fru; + const struct ipath *asrupath, *frupath; + nvlist_t *asru = NULL, *fru = NULL; nvlist_t *rsrc = NULL; char *pathstr; @@ -2193,19 +2195,29 @@ get_resources(struct event *sp, struct rsl *rsrcs, struct config *croot) frudef = eventprop_lookup(sp, L_FRU); /* - * Create FMRIs based on those definitions + * Create ipaths based on those definitions */ - asru = node2fmri(asrudef); - fru = node2fmri(frudef); - pathstr = ipath2str(NULL, sp->ipp); + asrupath = ipath(asrudef); + frupath = ipath(frudef); /* * Allow for platform translations of the FMRIs */ - platform_units_translate(is_defect(sp->t), croot, &asru, &fru, &rsrc, - pathstr); + pathstr = ipath2str(NULL, sp->ipp); + platform_unit_translate(is_defect(sp->t), croot, TOPO_PROP_RESOURCE, + &rsrc, pathstr); + FREE(pathstr); + pathstr = ipath2str(NULL, asrupath); + platform_unit_translate(is_defect(sp->t), croot, TOPO_PROP_ASRU, + &asru, pathstr); FREE(pathstr); + + pathstr = ipath2str(NULL, frupath); + platform_unit_translate(is_defect(sp->t), croot, TOPO_PROP_FRU, + &fru, pathstr); + FREE(pathstr); + rsrcs->suspect = sp; rsrcs->asru = asru; rsrcs->fru = fru; @@ -3115,8 +3127,8 @@ fme_undiagnosable(struct fme *f) fmd_case_add_ereport(f->hdl, f->fmcase, ep->ffep); pathstr = ipath2str(NULL, ipath(platform_getpath(ep->nvp))); - platform_units_translate(0, f->config, NULL, NULL, &detector, - pathstr); + platform_unit_translate(0, f->config, TOPO_PROP_RESOURCE, + &detector, pathstr); FREE(pathstr); /* add defect */ diff --git a/usr/src/cmd/fm/modules/common/eversholt/platform.c b/usr/src/cmd/fm/modules/common/eversholt/platform.c index 1fe49bd9b4..a3972400e4 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/platform.c +++ b/usr/src/cmd/fm/modules/common/eversholt/platform.c @@ -767,7 +767,7 @@ platform_config_snapshot(void) } static const char * -cfgstrprop_lookup(struct config *croot, char *path, char *pname) +cfgstrprop_lookup(struct config *croot, char *path, const char *pname) { struct config *cresource; const char *fmristr; @@ -790,43 +790,45 @@ cfgstrprop_lookup(struct config *croot, char *path, char *pname) } /* - * Get resource FMRI from libtopo + * Get FMRI for a particular unit from libtopo. The unit is specified by the + * "path" argument (a stringified ipath). "prop" argument should be one + * of the constants TOPO_PROP_RESOURCE, TOPO_PROP_ASRU, TOPO_PROP_FRU, etc. */ /*ARGSUSED*/ void -platform_units_translate(int isdefect, struct config *croot, - nvlist_t **dfltasru, nvlist_t **dfltfru, nvlist_t **dfltrsrc, char *path) +platform_unit_translate(int isdefect, struct config *croot, const char *prop, + nvlist_t **fmrip, char *path) { const char *fmristr; char *serial; - nvlist_t *rsrc; + nvlist_t *fmri; int err; - fmristr = cfgstrprop_lookup(croot, path, TOPO_PROP_RESOURCE); + fmristr = cfgstrprop_lookup(croot, path, prop); if (fmristr == NULL) { - out(O_ALTFP, "Cannot rewrite resource for %s.", path); + out(O_ALTFP, "Cannot rewrite unit FMRI for %s.", path); return; } - if (topo_fmri_str2nvl(Eft_topo_hdl, fmristr, &rsrc, &err) < 0) { + if (topo_fmri_str2nvl(Eft_topo_hdl, fmristr, &fmri, &err) < 0) { out(O_ALTFP, "Can not convert config info: %s", topo_strerror(err)); - out(O_ALTFP, "Cannot rewrite resource for %s.", path); + out(O_ALTFP, "Cannot rewrite unit FMRI for %s.", path); return; } /* - * If we don't have a serial number in the resource then check if it + * If we don't have a serial number in the unit then check if it * is available as a separate property and if so then add it. */ - if (nvlist_lookup_string(rsrc, FM_FMRI_HC_SERIAL_ID, &serial) != 0) { + if (nvlist_lookup_string(fmri, FM_FMRI_HC_SERIAL_ID, &serial) != 0) { serial = (char *)cfgstrprop_lookup(croot, path, FM_FMRI_HC_SERIAL_ID); if (serial != NULL) - (void) nvlist_add_string(rsrc, FM_FMRI_HC_SERIAL_ID, + (void) nvlist_add_string(fmri, FM_FMRI_HC_SERIAL_ID, serial); } - *dfltrsrc = rsrc; + *fmrip = fmri; } /* diff --git a/usr/src/cmd/fm/modules/common/eversholt/platform.h b/usr/src/cmd/fm/modules/common/eversholt/platform.h index 30cab516ed..23e1f6f41e 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/platform.h +++ b/usr/src/cmd/fm/modules/common/eversholt/platform.h @@ -28,8 +28,6 @@ #ifndef _EFT_PLATFORM_H #define _EFT_PLATFORM_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <libnvpair.h> #ifdef __cplusplus @@ -38,6 +36,7 @@ extern "C" { #include <config.h> #include <fm/fmd_api.h> +#include <fm/libtopo.h> nvlist_t *Action_nvl; /* nvl for problem with action=... prop on it */ @@ -45,8 +44,8 @@ void platform_init(void); void platform_fini(void); void platform_run_poller(const char *poller); void platform_set_payloadnvp(nvlist_t *nvlp); -void platform_units_translate(int, struct config *, nvlist_t **, nvlist_t **, - nvlist_t **, char *); +void platform_unit_translate(int, struct config *, const char *, nvlist_t **, + char *); struct cfgdata *platform_config_snapshot(void); void platform_restore_config(fmd_hdl_t *hdl, fmd_case_t *fmcase); diff --git a/usr/src/cmd/hal/hald/solaris/devinfo_storage.c b/usr/src/cmd/hal/hald/solaris/devinfo_storage.c index bfe027ad25..d1fea0c577 100644 --- a/usr/src/cmd/hal/hald/solaris/devinfo_storage.c +++ b/usr/src/cmd/hal/hald/solaris/devinfo_storage.c @@ -1522,19 +1522,17 @@ devinfo_storage_mnttab_event (HalDevice *hal_volume) /* cleanup if was mounted by us */ if (hal_util_is_mounted_by_hald (mount_point)) { - char *cleanup_stdin; char *extra_env[2]; HAL_INFO (("Cleaning up '%s'", mount_point)); extra_env[0] = g_strdup_printf ("HALD_CLEANUP=%s", mount_point); extra_env[1] = NULL; - cleanup_stdin = "\n"; hald_runner_run_method (d, "hal-storage-cleanup-mountpoint", extra_env, - cleanup_stdin, TRUE, + "", TRUE, 0, devinfo_storage_cleanup_mountpoint_cb, g_strdup (mount_point), NULL); @@ -1577,7 +1575,6 @@ static void devinfo_volume_force_unmount (HalDevice *d, void *end_token) { const char *mount_point; - char *unmount_stdin; char *extra_env[2]; extra_env[0] = "HAL_METHOD_INVOKED_BY_UID=0"; extra_env[1] = NULL; @@ -1591,12 +1588,10 @@ devinfo_volume_force_unmount (HalDevice *d, void *end_token) HAL_INFO (("devinfo_volume_force_unmount for udi='%s'", hal_device_get_udi (d))); - unmount_stdin = "\n"; - hald_runner_run_method (d, "hal-storage-unmount", extra_env, - unmount_stdin, TRUE, + "", TRUE, 0, devinfo_volume_force_unmount_cb, end_token, NULL); diff --git a/usr/src/cmd/hal/tools/hal-storage-mount.c b/usr/src/cmd/hal/tools/hal-storage-mount.c index 5622123274..5e687bea9e 100644 --- a/usr/src/cmd/hal/tools/hal-storage-mount.c +++ b/usr/src/cmd/hal/tools/hal-storage-mount.c @@ -228,7 +228,7 @@ canonicalize_filename (gchar *filename) static char * resolve_symlink (const char *file) { - GError *error; + GError *error = NULL; char *dir; char *link; char *f; diff --git a/usr/src/cmd/iscsiadm/cmdparse.c b/usr/src/cmd/iscsiadm/cmdparse.c index 882ff3c673..b1a2f84692 100644 --- a/usr/src/cmd/iscsiadm/cmdparse.c +++ b/usr/src/cmd/iscsiadm/cmdparse.c @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright 2020 Joyent Inc. + */ + #include <stdlib.h> #include <stdio.h> #include <sys/types.h> @@ -70,7 +74,7 @@ static void subUsage(uint_t, subcommand_t *); static void subUsageObject(uint_t, subcommand_t *, object_t *); static int getObject(char *, object_t **); static int getObjectRules(uint_t, objectRules_t **); -static char *getLongOption(int); +static const char *getLongOption(int); static optionProp_t *getOptions(uint_t, uint_t); static char *getOptionArgDesc(int); extern void seeMan(void); @@ -208,7 +212,7 @@ getOptions(uint_t object, uint_t subcommand) * on success, long option name * on failure, NULL */ -static char * +static const char * getLongOption(int shortOption) { struct option *op; @@ -319,7 +323,7 @@ subUsageObject(uint_t usageType, subcommand_t *subcommand, object_t *objp) opCmd_t *opCmd = NULL; optionProp_t *options; char *optionArgDesc; - char *longOpt; + const char *longOpt; if (getObjectRules(objp->value, &objRules) != 0) { diff --git a/usr/src/cmd/isns/isnsadm/cmdparse.c b/usr/src/cmd/isns/isnsadm/cmdparse.c index ccad6df26c..7303b347ac 100644 --- a/usr/src/cmd/isns/isnsadm/cmdparse.c +++ b/usr/src/cmd/isns/isnsadm/cmdparse.c @@ -22,6 +22,9 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2020 Joyent Inc. + */ #include <stdlib.h> #include <stdio.h> @@ -69,7 +72,7 @@ static int getSubcommandProps(char *, subCommandProps_t **); static char *getExecBasename(char *); static void usage(uint_t); static void subUsage(uint_t, subCommandProps_t *); -static char *getLongOption(int); +static const char *getLongOption(int); static char *getOptionArgDesc(int); /* global data */ @@ -119,7 +122,7 @@ getSubcommandProps(char *subCommand, subCommandProps_t **subCommandProps) * on success, long option name * on failure, NULL */ -static char * +static const char * getLongOption(int shortOption) { struct option *op; @@ -169,7 +172,7 @@ subUsage(uint_t usageType, subCommandProps_t *subcommand) { int i; char *optionArgDesc; - char *longOpt; + const char *longOpt; if (usageType == GENERAL_USAGE) { (void) printf("%s:\t%s %s [", gettext("Usage"), commandName, diff --git a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c index ad6a388b49..cd50cdce17 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c @@ -3205,6 +3205,7 @@ const mdb_dcmd_t mdb_dcmd_builtins[] = { { "typeset", "[+/-t] var ...", "set variable attributes", cmd_typeset }, { "typedef", "[-c model | -d | -l | -r file | -w file ] [type] [name]", "create synthetic types", cmd_typedef, cmd_typedef_help }, + { "typelist", NULL, "list known types", cmd_typelist }, { "unset", "[name ...]", "unset variables", cmd_unset }, { "vars", "[-npt]", "print listing of variables", cmd_vars }, { "version", NULL, "print debugger version string", cmd_version }, diff --git a/usr/src/cmd/mdb/common/mdb/mdb_ctf.c b/usr/src/cmd/mdb/common/mdb/mdb_ctf.c index f2854bb6d6..9cc7c6f1a0 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_ctf.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_ctf.c @@ -2272,3 +2272,35 @@ mdb_ctf_synthetics_to_file(const char *file) return (err); } + +static int +cmd_typelist_type(mdb_ctf_id_t id, void *arg) +{ + char buf[1024]; + + if (mdb_ctf_type_name(id, buf, sizeof (buf)) != NULL) { + mdb_printf("%s\n", buf); + } + return (0); +} + +static int +cmd_typelist_module(void *data, const mdb_map_t *mp, const char *name) +{ + (void) mdb_ctf_type_iter(name, cmd_typelist_type, data); + return (0); +} + +int +cmd_typelist(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) +{ + if ((flags & DCMD_ADDRSPEC) != 0) { + return (DCMD_USAGE); + } + + (void) mdb_tgt_object_iter(mdb.m_target, cmd_typelist_module, NULL); + (void) mdb_ctf_type_iter(MDB_CTF_SYNTHETIC_ITER, cmd_typelist_type, + NULL); + + return (DCMD_OK); +} diff --git a/usr/src/cmd/mdb/common/mdb/mdb_ctf.h b/usr/src/cmd/mdb/common/mdb/mdb_ctf.h index 74bc8e95da..639e7b2bdc 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_ctf.h +++ b/usr/src/cmd/mdb/common/mdb/mdb_ctf.h @@ -35,6 +35,7 @@ #ifdef _MDB #include <sys/machelf.h> +#include <mdb/mdb_modapi.h> #endif /* @@ -159,6 +160,8 @@ extern int mdb_ctf_synthetics_init(void); /* Internal */ extern void mdb_ctf_synthetics_fini(void); /* Internal */ extern int mdb_ctf_synthetics_from_file(const char *); /* Internal */ extern int mdb_ctf_synthetics_to_file(const char *); /* Internal */ +extern int cmd_typelist(uintptr_t, uint_t, int, /* Internal */ + const mdb_arg_t *); #endif diff --git a/usr/src/cmd/mdb/common/mdb/mdb_fmt.c b/usr/src/cmd/mdb/common/mdb/mdb_fmt.c index c68f20b107..6a745b2ac4 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_fmt.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_fmt.c @@ -21,7 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. - * Copyright 2019 Joyent, Inc. + * Copyright 2020 Joyent, Inc. * Copyright (c) 2017 by Delphix. All rights reserved. */ @@ -739,7 +739,7 @@ mdb_fmt_print(mdb_tgt_t *t, mdb_tgt_as_t as, * Unless a format has explicitly opted out, we force autowrap * for the duration of mdb_fmt_print(). */ - mdb.m_flags |= MDB_FL_AUTOWRAP; + mdb_iob_set_autowrap(mdb.m_out); } switch (FMT_TYPE(fp->f_type)) { diff --git a/usr/src/cmd/mdb/common/mdb/mdb_io.c b/usr/src/cmd/mdb/common/mdb/mdb_io.c index f1ad8d051c..752c6f5c35 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_io.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_io.c @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2019, Joyent, Inc. All rights reserved. + * Copyright 2020 Joyent, Inc. * Copyright (c) 2016 by Delphix. All rights reserved. */ @@ -1777,6 +1777,27 @@ mdb_iob_snprintf(char *buf, size_t nbytes, const char *format, ...) return (nbytes); } +/* + * Return how many bytes we can copy into our buffer, limited by either cols or + * bufsiz depending on whether AUTOWRAP is on. Note that typically, + * mdb_iob_set_autowrap() will have already checked for an existing + * "->iob_nbytes > ->iob_cols" situation, but we double check here anyway. + */ +static size_t +iob_bufleft(mdb_iob_t *iob) +{ + if (IOB_AUTOWRAP(iob)) { + if (iob->iob_cols < iob->iob_nbytes) { + mdb_iob_nl(iob); + ASSERT(iob->iob_cols >= iob->iob_nbytes); + } + return (iob->iob_cols - iob->iob_nbytes); + } + + ASSERT(iob->iob_bufsiz >= iob->iob_nbytes); + return (iob->iob_bufsiz - iob->iob_nbytes); +} + void mdb_iob_nputs(mdb_iob_t *iob, const char *s, size_t nbytes) { @@ -1810,20 +1831,11 @@ mdb_iob_nputs(mdb_iob_t *iob, const char *s, size_t nbytes) } /* - * For a given string component, we determine how many bytes (n) we can - * copy into our buffer (limited by either cols or bufsiz depending - * on whether AUTOWRAP is on), copy a chunk into the buffer, and + * For a given string component, we copy a chunk into the buffer, and * flush the buffer if we reach the end of a line. */ while (nleft != 0) { - if (IOB_AUTOWRAP(iob)) { - ASSERT(iob->iob_cols >= iob->iob_nbytes); - n = iob->iob_cols - iob->iob_nbytes; - } else { - ASSERT(iob->iob_bufsiz >= iob->iob_nbytes); - n = iob->iob_bufsiz - iob->iob_nbytes; - } - + n = iob_bufleft(iob); m = MIN(nleft, n); /* copy at most n bytes in this pass */ bcopy(q, iob->iob_bufp, m); @@ -1884,14 +1896,7 @@ mdb_iob_fill(mdb_iob_t *iob, int c, size_t nfill) ASSERT(iob->iob_flags & MDB_IOB_WRONLY); while (nfill != 0) { - if (IOB_AUTOWRAP(iob)) { - ASSERT(iob->iob_cols >= iob->iob_nbytes); - n = iob->iob_cols - iob->iob_nbytes; - } else { - ASSERT(iob->iob_bufsiz >= iob->iob_nbytes); - n = iob->iob_bufsiz - iob->iob_nbytes; - } - + n = iob_bufleft(iob); m = MIN(nfill, n); /* fill at most n bytes in this pass */ for (i = 0; i < m; i++) @@ -2169,6 +2174,26 @@ mdb_iob_stack_size(mdb_iob_stack_t *stk) } /* + * This only enables autowrap for iobs that are already autowrap themselves such + * as mdb.m_out typically. + * + * Note that we might be the middle of the iob buffer at this point, and + * specifically, iob->iob_nbytes could be more than iob->iob_cols. As that's + * not a valid situation, we may need to do an autowrap *now*. + * + * In theory, we would need to do this across all MDB_IOB_AUTOWRAP iob's; + * instead, we have a failsafe in iob_bufleft(). + */ +void +mdb_iob_set_autowrap(mdb_iob_t *iob) +{ + mdb.m_flags |= MDB_FL_AUTOWRAP; + if (IOB_WRAPNOW(iob, 0)) + mdb_iob_nl(iob); + ASSERT(iob->iob_cols >= iob->iob_nbytes); +} + +/* * Stub functions for i/o backend implementors: these stubs either act as * pass-through no-ops or return ENOTSUP as appropriate. */ @@ -2267,14 +2292,14 @@ no_io_resume(mdb_io_t *io) /* * Iterate over the varargs. The first item indicates the mode: * MDB_TBL_PRNT - * pull out the next vararg as a const char * and pass it and the - * remaining varargs to iob_doprnt; if we want to print the column, - * direct the output to mdb.m_out otherwise direct it to mdb.m_null + * pull out the next vararg as a const char * and pass it and the + * remaining varargs to iob_doprnt; if we want to print the column, + * direct the output to mdb.m_out otherwise direct it to mdb.m_null * * MDB_TBL_FUNC - * pull out the next vararg as type mdb_table_print_f and the - * following one as a void * argument to the function; call the - * function with the given argument if we want to print the column + * pull out the next vararg as type mdb_table_print_f and the + * following one as a void * argument to the function; call the + * function with the given argument if we want to print the column * * The second item indicates the flag; if the flag is set in the flags * argument, then the column is printed. A flag value of 0 indicates diff --git a/usr/src/cmd/mdb/common/mdb/mdb_io.h b/usr/src/cmd/mdb/common/mdb/mdb_io.h index 2ef4677db4..0c41c5c740 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_io.h +++ b/usr/src/cmd/mdb/common/mdb/mdb_io.h @@ -21,13 +21,13 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2020 Joyent, Inc. */ #ifndef _MDB_IO_H #define _MDB_IO_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -149,6 +149,8 @@ extern size_t mdb_iob_lineno(mdb_iob_t *); extern size_t mdb_iob_gettabstop(mdb_iob_t *); extern size_t mdb_iob_getmargin(mdb_iob_t *); +extern void mdb_iob_set_autowrap(mdb_iob_t *); + extern void mdb_iob_stack_create(mdb_iob_stack_t *); extern void mdb_iob_stack_destroy(mdb_iob_stack_t *); extern void mdb_iob_stack_push(mdb_iob_stack_t *, mdb_iob_t *, size_t); diff --git a/usr/src/cmd/mdb/common/mdb/mdb_print.c b/usr/src/cmd/mdb/common/mdb/mdb_print.c index 2c0af13a25..bd23ef681f 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_print.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_print.c @@ -25,7 +25,7 @@ /* * Copyright (c) 2012, 2014 by Delphix. All rights reserved. - * Copyright 2018 Joyent, Inc. + * Copyright 2020 Joyent, Inc. * Copyright (c) 2014 Nexenta Systems, Inc. All rights reserved. */ @@ -931,6 +931,30 @@ print_bitfield(ulong_t off, printarg_t *pap, ctf_encoding_t *ep) } /* + * We want to print an escaped char as e.g. '\0'. We don't use mdb_fmt_print() + * as it won't get auto-wrap right here (although even now, we don't include any + * trailing comma). + */ +static int +print_char_val(mdb_tgt_addr_t addr, printarg_t *pap) +{ + char cval; + char *s; + + if (mdb_tgt_aread(pap->pa_tgt, pap->pa_as, &cval, 1, addr) != 1) + return (1); + + if (mdb.m_flags & MDB_FL_ADB) + s = strchr2adb(&cval, 1); + else + s = strchr2esc(&cval, 1); + + mdb_printf("'%s'", s); + strfree(s); + return (0); +} + +/* * Print out a character or integer value. We use some simple heuristics, * described below, to determine the appropriate radix to use for output. */ @@ -971,14 +995,8 @@ print_int_val(const char *type, ctf_encoding_t *ep, ulong_t off, if (size > 8 || (ep->cte_bits % NBBY) != 0 || (size & (size - 1)) != 0) return (print_bitfield(off, pap, ep)); - if (IS_CHAR(*ep)) { - mdb_printf("'"); - if (mdb_fmt_print(pap->pa_tgt, pap->pa_as, - addr, 1, 'C') == addr) - return (1); - mdb_printf("'"); - return (0); - } + if (IS_CHAR(*ep)) + return (print_char_val(addr, pap)); if (mdb_tgt_aread(pap->pa_tgt, pap->pa_as, &u.i8, size, addr) != size) { mdb_warn("failed to read %lu bytes at %llx", diff --git a/usr/src/cmd/mdb/common/mdb/mdb_set.c b/usr/src/cmd/mdb/common/mdb/mdb_set.c index cd8926fbcc..8d4a1d30f7 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_set.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_set.c @@ -24,7 +24,7 @@ */ /* - * Copyright 2017 Joyent, Inc. + * Copyright 2020 Joyent, Inc. */ /* @@ -275,7 +275,7 @@ print_properties(void) * we enable it for the duration of the command. */ oflags = mdb.m_flags; - mdb.m_flags |= MDB_FL_AUTOWRAP; + mdb_iob_set_autowrap(mdb.m_out); mdb_printf("follow_exec_mode="); switch (mdb.m_execmode) { diff --git a/usr/src/cmd/mdb/test/README b/usr/src/cmd/mdb/test/README deleted file mode 100644 index 28127e5916..0000000000 --- a/usr/src/cmd/mdb/test/README +++ /dev/null @@ -1,18 +0,0 @@ -MDB Test suite - -This provides a primordial version of a test suite for mdb. To run the tests, -run mtest. Tests exist in various subdirectories. The name of the test is -important. - -A test must start with either: - - o tst - Indicating that it should exit zero - o err - Indicating that it should exit non-zero - -A test must end with either: - - o mdb - Indicating that the file should be passed as standard input to mdb - o ksh - Indicating that it should be run with ksh - -A test may have an optional .out file which if present indicates that the test -should pass if and only if its standard ouput matches its standar error. diff --git a/usr/src/cmd/mdb/test/exit-e/err.cmdbadopt.ksh b/usr/src/cmd/mdb/test/exit-e/err.cmdbadopt.ksh deleted file mode 100644 index de50faeb01..0000000000 --- a/usr/src/cmd/mdb/test/exit-e/err.cmdbadopt.ksh +++ /dev/null @@ -1,2 +0,0 @@ -$MDB -e '::typegraph' -exit $? diff --git a/usr/src/cmd/mdb/test/exit-e/err.enocmd.ksh b/usr/src/cmd/mdb/test/exit-e/err.enocmd.ksh deleted file mode 100644 index 038f121b26..0000000000 --- a/usr/src/cmd/mdb/test/exit-e/err.enocmd.ksh +++ /dev/null @@ -1,2 +0,0 @@ -$MDB -e '::commandthatdoesnotexist' -exit $? diff --git a/usr/src/cmd/mdb/test/exit-e/err.nowrite.ksh b/usr/src/cmd/mdb/test/exit-e/err.nowrite.ksh deleted file mode 100644 index 8f0fda2253..0000000000 --- a/usr/src/cmd/mdb/test/exit-e/err.nowrite.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '0xbaddcafe/v 0x02' diff --git a/usr/src/cmd/mdb/test/exit-e/err.unmapped.ksh b/usr/src/cmd/mdb/test/exit-e/err.unmapped.ksh deleted file mode 100644 index 874283f186..0000000000 --- a/usr/src/cmd/mdb/test/exit-e/err.unmapped.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '0x0/v 0x02' /bin/ls diff --git a/usr/src/cmd/mdb/test/exit-e/tst.output.ksh b/usr/src/cmd/mdb/test/exit-e/tst.output.ksh deleted file mode 100644 index 13b5db072d..0000000000 --- a/usr/src/cmd/mdb/test/exit-e/tst.output.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '0t2 << 0t10=K' diff --git a/usr/src/cmd/mdb/test/exit-e/tst.output.ksh.out b/usr/src/cmd/mdb/test/exit-e/tst.output.ksh.out deleted file mode 100644 index 7a38ab6e65..0000000000 --- a/usr/src/cmd/mdb/test/exit-e/tst.output.ksh.out +++ /dev/null @@ -1 +0,0 @@ - 800 diff --git a/usr/src/cmd/mdb/test/exit-e/tst.simple.ksh b/usr/src/cmd/mdb/test/exit-e/tst.simple.ksh deleted file mode 100644 index 4c8a3c58ad..0000000000 --- a/usr/src/cmd/mdb/test/exit-e/tst.simple.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::dcmds' diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-E.mdb b/usr/src/cmd/mdb/test/format/tst.format-cap-E.mdb deleted file mode 100644 index 18e9053ce4..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-cap-E.mdb +++ /dev/null @@ -1,2 +0,0 @@ --1,10=E -1<<0t63,10=E diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-E.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-cap-E.mdb.out deleted file mode 100644 index 2268a48be9..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-cap-E.mdb.out +++ /dev/null @@ -1,12 +0,0 @@ - 18446744073709551615 18446744073709551615 18446744073709551615 - 18446744073709551615 18446744073709551615 18446744073709551615 - 18446744073709551615 18446744073709551615 18446744073709551615 - 18446744073709551615 18446744073709551615 18446744073709551615 - 18446744073709551615 18446744073709551615 18446744073709551615 - 18446744073709551615 - 9223372036854775808 9223372036854775808 9223372036854775808 - 9223372036854775808 9223372036854775808 9223372036854775808 - 9223372036854775808 9223372036854775808 9223372036854775808 - 9223372036854775808 9223372036854775808 9223372036854775808 - 9223372036854775808 9223372036854775808 9223372036854775808 - 9223372036854775808 diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-G.mdb b/usr/src/cmd/mdb/test/format/tst.format-cap-G.mdb deleted file mode 100644 index f10f78336b..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-cap-G.mdb +++ /dev/null @@ -1,4 +0,0 @@ --1,10=G -1<<0t63,10=G -1<<0t60,10=G -1<<0t57,10=G diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-G.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-cap-G.mdb.out deleted file mode 100644 index f1dfd5193b..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-cap-G.mdb.out +++ /dev/null @@ -1,32 +0,0 @@ - 1777777777777777777777 1777777777777777777777 - 1777777777777777777777 1777777777777777777777 - 1777777777777777777777 1777777777777777777777 - 1777777777777777777777 1777777777777777777777 - 1777777777777777777777 1777777777777777777777 - 1777777777777777777777 1777777777777777777777 - 1777777777777777777777 1777777777777777777777 - 1777777777777777777777 1777777777777777777777 - 1000000000000000000000 1000000000000000000000 - 1000000000000000000000 1000000000000000000000 - 1000000000000000000000 1000000000000000000000 - 1000000000000000000000 1000000000000000000000 - 1000000000000000000000 1000000000000000000000 - 1000000000000000000000 1000000000000000000000 - 1000000000000000000000 1000000000000000000000 - 1000000000000000000000 1000000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-J.mdb b/usr/src/cmd/mdb/test/format/tst.format-cap-J.mdb deleted file mode 100644 index ff9dabbce9..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-cap-J.mdb +++ /dev/null @@ -1,3 +0,0 @@ --1,10=J -1<<0t63,10=J -1<<0t59,10=J diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-J.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-cap-J.mdb.out deleted file mode 100644 index 644fee231e..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-cap-J.mdb.out +++ /dev/null @@ -1,16 +0,0 @@ - ffffffffffffffff ffffffffffffffff ffffffffffffffff - ffffffffffffffff ffffffffffffffff ffffffffffffffff - ffffffffffffffff ffffffffffffffff ffffffffffffffff - ffffffffffffffff ffffffffffffffff ffffffffffffffff - ffffffffffffffff ffffffffffffffff ffffffffffffffff - ffffffffffffffff - 8000000000000000 8000000000000000 8000000000000000 - 8000000000000000 8000000000000000 8000000000000000 - 8000000000000000 8000000000000000 8000000000000000 - 8000000000000000 8000000000000000 8000000000000000 - 8000000000000000 8000000000000000 8000000000000000 - 8000000000000000 - 800000000000000 800000000000000 800000000000000 800000000000000 - 800000000000000 800000000000000 800000000000000 800000000000000 - 800000000000000 800000000000000 800000000000000 800000000000000 - 800000000000000 800000000000000 800000000000000 800000000000000 diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-P.mdb b/usr/src/cmd/mdb/test/format/tst.format-cap-P.mdb deleted file mode 100644 index 88928fda29..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-cap-P.mdb +++ /dev/null @@ -1 +0,0 @@ -1<<0t63,10=P diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-P.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-cap-P.mdb.out deleted file mode 100644 index 65e05e7220..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-cap-P.mdb.out +++ /dev/null @@ -1,6 +0,0 @@ - 0x8000000000000000 0x8000000000000000 0x8000000000000000 - 0x8000000000000000 0x8000000000000000 0x8000000000000000 - 0x8000000000000000 0x8000000000000000 0x8000000000000000 - 0x8000000000000000 0x8000000000000000 0x8000000000000000 - 0x8000000000000000 0x8000000000000000 0x8000000000000000 - 0x8000000000000000 diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-R.mdb b/usr/src/cmd/mdb/test/format/tst.format-cap-R.mdb deleted file mode 100644 index 9f55408276..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-cap-R.mdb +++ /dev/null @@ -1,4 +0,0 @@ -1=RRRR -1<<0t62=RRR -1<<0t63=RRR --1=RRRR diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-R.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-cap-R.mdb.out deleted file mode 100644 index f05b0bac4d..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-cap-R.mdb.out +++ /dev/null @@ -1,14 +0,0 @@ - 1 - 1 - 1 - 1 - 100000000000000000000000000000000000000000000000000000000000000 - 100000000000000000000000000000000000000000000000000000000000000 - 100000000000000000000000000000000000000000000000000000000000000 - 1000000000000000000000000000000000000000000000000000000000000000 - 1000000000000000000000000000000000000000000000000000000000000000 - 1000000000000000000000000000000000000000000000000000000000000000 - 1111111111111111111111111111111111111111111111111111111111111111 - 1111111111111111111111111111111111111111111111111111111111111111 - 1111111111111111111111111111111111111111111111111111111111111111 - 1111111111111111111111111111111111111111111111111111111111111111 diff --git a/usr/src/cmd/mdb/test/format/tst.format-e.mdb b/usr/src/cmd/mdb/test/format/tst.format-e.mdb deleted file mode 100644 index 79d4b25af4..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-e.mdb +++ /dev/null @@ -1,2 +0,0 @@ --1,10=e -1<<0t63,10=e diff --git a/usr/src/cmd/mdb/test/format/tst.format-e.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-e.mdb.out deleted file mode 100644 index 909c53cbc0..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-e.mdb.out +++ /dev/null @@ -1,12 +0,0 @@ - -1 -1 -1 - -1 -1 -1 - -1 -1 -1 - -1 -1 -1 - -1 -1 -1 - -1 - -9223372036854775808 -9223372036854775808 -9223372036854775808 - -9223372036854775808 -9223372036854775808 -9223372036854775808 - -9223372036854775808 -9223372036854775808 -9223372036854775808 - -9223372036854775808 -9223372036854775808 -9223372036854775808 - -9223372036854775808 -9223372036854775808 -9223372036854775808 - -9223372036854775808 diff --git a/usr/src/cmd/mdb/test/format/tst.format-g.mdb b/usr/src/cmd/mdb/test/format/tst.format-g.mdb deleted file mode 100644 index b3397d21ed..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-g.mdb +++ /dev/null @@ -1,5 +0,0 @@ --1,10=g -1<<0t63,10=g -(1<<0t63)-1,10=g -1<<0t60,10=g -1<<0t57,10=g diff --git a/usr/src/cmd/mdb/test/format/tst.format-g.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-g.mdb.out deleted file mode 100644 index c46dff3594..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-g.mdb.out +++ /dev/null @@ -1,40 +0,0 @@ - -1 -1 - -1 -1 - -1 -1 - -1 -1 - -1 -1 - -1 -1 - -1 -1 - -1 -1 - -1000000000000000000000 -1000000000000000000000 - -1000000000000000000000 -1000000000000000000000 - -1000000000000000000000 -1000000000000000000000 - -1000000000000000000000 -1000000000000000000000 - -1000000000000000000000 -1000000000000000000000 - -1000000000000000000000 -1000000000000000000000 - -1000000000000000000000 -1000000000000000000000 - -1000000000000000000000 -1000000000000000000000 - 777777777777777777777 777777777777777777777 - 777777777777777777777 777777777777777777777 - 777777777777777777777 777777777777777777777 - 777777777777777777777 777777777777777777777 - 777777777777777777777 777777777777777777777 - 777777777777777777777 777777777777777777777 - 777777777777777777777 777777777777777777777 - 777777777777777777777 777777777777777777777 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 100000000000000000000 100000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 - 10000000000000000000 10000000000000000000 diff --git a/usr/src/cmd/mdb/test/format/tst.format-j.mdb b/usr/src/cmd/mdb/test/format/tst.format-j.mdb deleted file mode 100644 index 875a1e178f..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-j.mdb +++ /dev/null @@ -1,8 +0,0 @@ --1=JRjnn -0=JRjnn -1=JRjnn -feedface=JRjnn -badfeedcafe=JRjnn -deadba11e12a=JRjnn -badb100d=JRjnn -baddefec8ed=JRjnn diff --git a/usr/src/cmd/mdb/test/format/tst.format-j.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-j.mdb.out deleted file mode 100644 index 3f5fa0afaf..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-j.mdb.out +++ /dev/null @@ -1,238 +0,0 @@ - ffffffffffffffff - 1111111111111111111111111111111111111111111111111111111111111111 - 1111111111111111111111111111111111111111111111111111111111111111 - |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| - |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+-- bit 0 mask 0x0000000000000001 - ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+--- bit 1 mask 0x0000000000000002 - |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+---- bit 2 mask 0x0000000000000004 - ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+----- bit 3 mask 0x0000000000000008 - |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+------ bit 4 mask 0x0000000000000010 - ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+------- bit 5 mask 0x0000000000000020 - |||||||||||||||||||||||||||||||||||||||||||||||||||||||||+-------- bit 6 mask 0x0000000000000040 - ||||||||||||||||||||||||||||||||||||||||||||||||||||||||+--------- bit 7 mask 0x0000000000000080 - |||||||||||||||||||||||||||||||||||||||||||||||||||||||+---------- bit 8 mask 0x0000000000000100 - ||||||||||||||||||||||||||||||||||||||||||||||||||||||+----------- bit 9 mask 0x0000000000000200 - |||||||||||||||||||||||||||||||||||||||||||||||||||||+------------ bit 10 mask 0x0000000000000400 - ||||||||||||||||||||||||||||||||||||||||||||||||||||+------------- bit 11 mask 0x0000000000000800 - |||||||||||||||||||||||||||||||||||||||||||||||||||+-------------- bit 12 mask 0x0000000000001000 - ||||||||||||||||||||||||||||||||||||||||||||||||||+--------------- bit 13 mask 0x0000000000002000 - |||||||||||||||||||||||||||||||||||||||||||||||||+---------------- bit 14 mask 0x0000000000004000 - ||||||||||||||||||||||||||||||||||||||||||||||||+----------------- bit 15 mask 0x0000000000008000 - |||||||||||||||||||||||||||||||||||||||||||||||+------------------ bit 16 mask 0x0000000000010000 - ||||||||||||||||||||||||||||||||||||||||||||||+------------------- bit 17 mask 0x0000000000020000 - |||||||||||||||||||||||||||||||||||||||||||||+-------------------- bit 18 mask 0x0000000000040000 - ||||||||||||||||||||||||||||||||||||||||||||+--------------------- bit 19 mask 0x0000000000080000 - |||||||||||||||||||||||||||||||||||||||||||+---------------------- bit 20 mask 0x0000000000100000 - ||||||||||||||||||||||||||||||||||||||||||+----------------------- bit 21 mask 0x0000000000200000 - |||||||||||||||||||||||||||||||||||||||||+------------------------ bit 22 mask 0x0000000000400000 - ||||||||||||||||||||||||||||||||||||||||+------------------------- bit 23 mask 0x0000000000800000 - |||||||||||||||||||||||||||||||||||||||+-------------------------- bit 24 mask 0x0000000001000000 - ||||||||||||||||||||||||||||||||||||||+--------------------------- bit 25 mask 0x0000000002000000 - |||||||||||||||||||||||||||||||||||||+---------------------------- bit 26 mask 0x0000000004000000 - ||||||||||||||||||||||||||||||||||||+----------------------------- bit 27 mask 0x0000000008000000 - |||||||||||||||||||||||||||||||||||+------------------------------ bit 28 mask 0x0000000010000000 - ||||||||||||||||||||||||||||||||||+------------------------------- bit 29 mask 0x0000000020000000 - |||||||||||||||||||||||||||||||||+-------------------------------- bit 30 mask 0x0000000040000000 - ||||||||||||||||||||||||||||||||+--------------------------------- bit 31 mask 0x0000000080000000 - |||||||||||||||||||||||||||||||+---------------------------------- bit 32 mask 0x0000000100000000 - ||||||||||||||||||||||||||||||+----------------------------------- bit 33 mask 0x0000000200000000 - |||||||||||||||||||||||||||||+------------------------------------ bit 34 mask 0x0000000400000000 - ||||||||||||||||||||||||||||+------------------------------------- bit 35 mask 0x0000000800000000 - |||||||||||||||||||||||||||+-------------------------------------- bit 36 mask 0x0000001000000000 - ||||||||||||||||||||||||||+--------------------------------------- bit 37 mask 0x0000002000000000 - |||||||||||||||||||||||||+---------------------------------------- bit 38 mask 0x0000004000000000 - ||||||||||||||||||||||||+----------------------------------------- bit 39 mask 0x0000008000000000 - |||||||||||||||||||||||+------------------------------------------ bit 40 mask 0x0000010000000000 - ||||||||||||||||||||||+------------------------------------------- bit 41 mask 0x0000020000000000 - |||||||||||||||||||||+-------------------------------------------- bit 42 mask 0x0000040000000000 - ||||||||||||||||||||+--------------------------------------------- bit 43 mask 0x0000080000000000 - |||||||||||||||||||+---------------------------------------------- bit 44 mask 0x0000100000000000 - ||||||||||||||||||+----------------------------------------------- bit 45 mask 0x0000200000000000 - |||||||||||||||||+------------------------------------------------ bit 46 mask 0x0000400000000000 - ||||||||||||||||+------------------------------------------------- bit 47 mask 0x0000800000000000 - |||||||||||||||+-------------------------------------------------- bit 48 mask 0x0001000000000000 - ||||||||||||||+--------------------------------------------------- bit 49 mask 0x0002000000000000 - |||||||||||||+---------------------------------------------------- bit 50 mask 0x0004000000000000 - ||||||||||||+----------------------------------------------------- bit 51 mask 0x0008000000000000 - |||||||||||+------------------------------------------------------ bit 52 mask 0x0010000000000000 - ||||||||||+------------------------------------------------------- bit 53 mask 0x0020000000000000 - |||||||||+-------------------------------------------------------- bit 54 mask 0x0040000000000000 - ||||||||+--------------------------------------------------------- bit 55 mask 0x0080000000000000 - |||||||+---------------------------------------------------------- bit 56 mask 0x0100000000000000 - ||||||+----------------------------------------------------------- bit 57 mask 0x0200000000000000 - |||||+------------------------------------------------------------ bit 58 mask 0x0400000000000000 - ||||+------------------------------------------------------------- bit 59 mask 0x0800000000000000 - |||+-------------------------------------------------------------- bit 60 mask 0x1000000000000000 - ||+--------------------------------------------------------------- bit 61 mask 0x2000000000000000 - |+---------------------------------------------------------------- bit 62 mask 0x4000000000000000 - +----------------------------------------------------------------- bit 63 mask 0x8000000000000000 - - - 0 - 0 - 0 - - - 1 - 1 - 1 - | - +-- bit 0 mask 0x1 - - - feedface - 11111110111011011111101011001110 - 11111110111011011111101011001110 - ||||||| ||| || |||||| | || ||| - ||||||| ||| || |||||| | || ||+--- bit 1 mask 0x00000002 - ||||||| ||| || |||||| | || |+---- bit 2 mask 0x00000004 - ||||||| ||| || |||||| | || +----- bit 3 mask 0x00000008 - ||||||| ||| || |||||| | |+-------- bit 6 mask 0x00000040 - ||||||| ||| || |||||| | +--------- bit 7 mask 0x00000080 - ||||||| ||| || |||||| +----------- bit 9 mask 0x00000200 - ||||||| ||| || |||||+------------- bit 11 mask 0x00000800 - ||||||| ||| || ||||+-------------- bit 12 mask 0x00001000 - ||||||| ||| || |||+--------------- bit 13 mask 0x00002000 - ||||||| ||| || ||+---------------- bit 14 mask 0x00004000 - ||||||| ||| || |+----------------- bit 15 mask 0x00008000 - ||||||| ||| || +------------------ bit 16 mask 0x00010000 - ||||||| ||| |+-------------------- bit 18 mask 0x00040000 - ||||||| ||| +--------------------- bit 19 mask 0x00080000 - ||||||| ||+----------------------- bit 21 mask 0x00200000 - ||||||| |+------------------------ bit 22 mask 0x00400000 - ||||||| +------------------------- bit 23 mask 0x00800000 - ||||||+--------------------------- bit 25 mask 0x02000000 - |||||+---------------------------- bit 26 mask 0x04000000 - ||||+----------------------------- bit 27 mask 0x08000000 - |||+------------------------------ bit 28 mask 0x10000000 - ||+------------------------------- bit 29 mask 0x20000000 - |+-------------------------------- bit 30 mask 0x40000000 - +--------------------------------- bit 31 mask 0x80000000 - - - badfeedcafe - 10111010110111111110111011011100101011111110 - 10111010110111111110111011011100101011111110 - | ||| | || |||||||| ||| || ||| | | ||||||| - | ||| | || |||||||| ||| || ||| | | ||||||+--- bit 1 mask 0x00000000002 - | ||| | || |||||||| ||| || ||| | | |||||+---- bit 2 mask 0x00000000004 - | ||| | || |||||||| ||| || ||| | | ||||+----- bit 3 mask 0x00000000008 - | ||| | || |||||||| ||| || ||| | | |||+------ bit 4 mask 0x00000000010 - | ||| | || |||||||| ||| || ||| | | ||+------- bit 5 mask 0x00000000020 - | ||| | || |||||||| ||| || ||| | | |+-------- bit 6 mask 0x00000000040 - | ||| | || |||||||| ||| || ||| | | +--------- bit 7 mask 0x00000000080 - | ||| | || |||||||| ||| || ||| | +----------- bit 9 mask 0x00000000200 - | ||| | || |||||||| ||| || ||| +------------- bit 11 mask 0x00000000800 - | ||| | || |||||||| ||| || ||+---------------- bit 14 mask 0x00000004000 - | ||| | || |||||||| ||| || |+----------------- bit 15 mask 0x00000008000 - | ||| | || |||||||| ||| || +------------------ bit 16 mask 0x00000010000 - | ||| | || |||||||| ||| |+-------------------- bit 18 mask 0x00000040000 - | ||| | || |||||||| ||| +--------------------- bit 19 mask 0x00000080000 - | ||| | || |||||||| ||+----------------------- bit 21 mask 0x00000200000 - | ||| | || |||||||| |+------------------------ bit 22 mask 0x00000400000 - | ||| | || |||||||| +------------------------- bit 23 mask 0x00000800000 - | ||| | || |||||||+--------------------------- bit 25 mask 0x00002000000 - | ||| | || ||||||+---------------------------- bit 26 mask 0x00004000000 - | ||| | || |||||+----------------------------- bit 27 mask 0x00008000000 - | ||| | || ||||+------------------------------ bit 28 mask 0x00010000000 - | ||| | || |||+------------------------------- bit 29 mask 0x00020000000 - | ||| | || ||+-------------------------------- bit 30 mask 0x00040000000 - | ||| | || |+--------------------------------- bit 31 mask 0x00080000000 - | ||| | || +---------------------------------- bit 32 mask 0x00100000000 - | ||| | |+------------------------------------ bit 34 mask 0x00400000000 - | ||| | +------------------------------------- bit 35 mask 0x00800000000 - | ||| +--------------------------------------- bit 37 mask 0x02000000000 - | ||+----------------------------------------- bit 39 mask 0x08000000000 - | |+------------------------------------------ bit 40 mask 0x10000000000 - | +------------------------------------------- bit 41 mask 0x20000000000 - +--------------------------------------------- bit 43 mask 0x80000000000 - - - deadba11e12a - 110111101010110110111010000100011110000100101010 - 110111101010110110111010000100011110000100101010 - || |||| | | || || ||| | | |||| | | | | - || |||| | | || || ||| | | |||| | | | +--- bit 1 mask 0x000000000002 - || |||| | | || || ||| | | |||| | | +----- bit 3 mask 0x000000000008 - || |||| | | || || ||| | | |||| | +------- bit 5 mask 0x000000000020 - || |||| | | || || ||| | | |||| +---------- bit 8 mask 0x000000000100 - || |||| | | || || ||| | | |||+--------------- bit 13 mask 0x000000002000 - || |||| | | || || ||| | | ||+---------------- bit 14 mask 0x000000004000 - || |||| | | || || ||| | | |+----------------- bit 15 mask 0x000000008000 - || |||| | | || || ||| | | +------------------ bit 16 mask 0x000000010000 - || |||| | | || || ||| | +---------------------- bit 20 mask 0x000000100000 - || |||| | | || || ||| +--------------------------- bit 25 mask 0x000002000000 - || |||| | | || || ||+----------------------------- bit 27 mask 0x000008000000 - || |||| | | || || |+------------------------------ bit 28 mask 0x000010000000 - || |||| | | || || +------------------------------- bit 29 mask 0x000020000000 - || |||| | | || |+--------------------------------- bit 31 mask 0x000080000000 - || |||| | | || +---------------------------------- bit 32 mask 0x000100000000 - || |||| | | |+------------------------------------ bit 34 mask 0x000400000000 - || |||| | | +------------------------------------- bit 35 mask 0x000800000000 - || |||| | +--------------------------------------- bit 37 mask 0x002000000000 - || |||| +----------------------------------------- bit 39 mask 0x008000000000 - || |||+------------------------------------------- bit 41 mask 0x020000000000 - || ||+-------------------------------------------- bit 42 mask 0x040000000000 - || |+--------------------------------------------- bit 43 mask 0x080000000000 - || +---------------------------------------------- bit 44 mask 0x100000000000 - |+------------------------------------------------ bit 46 mask 0x400000000000 - +------------------------------------------------- bit 47 mask 0x800000000000 - - - badb100d - 10111010110110110001000000001101 - 10111010110110110001000000001101 - | ||| | || || || | || | - | ||| | || || || | || +-- bit 0 mask 0x00000001 - | ||| | || || || | |+---- bit 2 mask 0x00000004 - | ||| | || || || | +----- bit 3 mask 0x00000008 - | ||| | || || || +-------------- bit 12 mask 0x00001000 - | ||| | || || |+------------------ bit 16 mask 0x00010000 - | ||| | || || +------------------- bit 17 mask 0x00020000 - | ||| | || |+--------------------- bit 19 mask 0x00080000 - | ||| | || +---------------------- bit 20 mask 0x00100000 - | ||| | |+------------------------ bit 22 mask 0x00400000 - | ||| | +------------------------- bit 23 mask 0x00800000 - | ||| +--------------------------- bit 25 mask 0x02000000 - | ||+----------------------------- bit 27 mask 0x08000000 - | |+------------------------------ bit 28 mask 0x10000000 - | +------------------------------- bit 29 mask 0x20000000 - +--------------------------------- bit 31 mask 0x80000000 - - - baddefec8ed - 10111010110111011110111111101100100011101101 - 10111010110111011110111111101100100011101101 - | ||| | || ||| |||| ||||||| || | ||| || | - | ||| | || ||| |||| ||||||| || | ||| || +-- bit 0 mask 0x00000000001 - | ||| | || ||| |||| ||||||| || | ||| |+---- bit 2 mask 0x00000000004 - | ||| | || ||| |||| ||||||| || | ||| +----- bit 3 mask 0x00000000008 - | ||| | || ||| |||| ||||||| || | ||+------- bit 5 mask 0x00000000020 - | ||| | || ||| |||| ||||||| || | |+-------- bit 6 mask 0x00000000040 - | ||| | || ||| |||| ||||||| || | +--------- bit 7 mask 0x00000000080 - | ||| | || ||| |||| ||||||| || +------------- bit 11 mask 0x00000000800 - | ||| | || ||| |||| ||||||| |+---------------- bit 14 mask 0x00000004000 - | ||| | || ||| |||| ||||||| +----------------- bit 15 mask 0x00000008000 - | ||| | || ||| |||| ||||||+------------------- bit 17 mask 0x00000020000 - | ||| | || ||| |||| |||||+-------------------- bit 18 mask 0x00000040000 - | ||| | || ||| |||| ||||+--------------------- bit 19 mask 0x00000080000 - | ||| | || ||| |||| |||+---------------------- bit 20 mask 0x00000100000 - | ||| | || ||| |||| ||+----------------------- bit 21 mask 0x00000200000 - | ||| | || ||| |||| |+------------------------ bit 22 mask 0x00000400000 - | ||| | || ||| |||| +------------------------- bit 23 mask 0x00000800000 - | ||| | || ||| |||+--------------------------- bit 25 mask 0x00002000000 - | ||| | || ||| ||+---------------------------- bit 26 mask 0x00004000000 - | ||| | || ||| |+----------------------------- bit 27 mask 0x00008000000 - | ||| | || ||| +------------------------------ bit 28 mask 0x00010000000 - | ||| | || ||+-------------------------------- bit 30 mask 0x00040000000 - | ||| | || |+--------------------------------- bit 31 mask 0x00080000000 - | ||| | || +---------------------------------- bit 32 mask 0x00100000000 - | ||| | |+------------------------------------ bit 34 mask 0x00400000000 - | ||| | +------------------------------------- bit 35 mask 0x00800000000 - | ||| +--------------------------------------- bit 37 mask 0x02000000000 - | ||+----------------------------------------- bit 39 mask 0x08000000000 - | |+------------------------------------------ bit 40 mask 0x10000000000 - | +------------------------------------------- bit 41 mask 0x20000000000 - +--------------------------------------------- bit 43 mask 0x80000000000 - - diff --git a/usr/src/cmd/mdb/test/format/tst.format-p.mdb b/usr/src/cmd/mdb/test/format/tst.format-p.mdb deleted file mode 100644 index ee2b989d1b..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-p.mdb +++ /dev/null @@ -1 +0,0 @@ -1<<0t63,10=p diff --git a/usr/src/cmd/mdb/test/format/tst.format-p.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-p.mdb.out deleted file mode 100644 index 65e05e7220..0000000000 --- a/usr/src/cmd/mdb/test/format/tst.format-p.mdb.out +++ /dev/null @@ -1,6 +0,0 @@ - 0x8000000000000000 0x8000000000000000 0x8000000000000000 - 0x8000000000000000 0x8000000000000000 0x8000000000000000 - 0x8000000000000000 0x8000000000000000 0x8000000000000000 - 0x8000000000000000 0x8000000000000000 0x8000000000000000 - 0x8000000000000000 0x8000000000000000 0x8000000000000000 - 0x8000000000000000 diff --git a/usr/src/cmd/mdb/test/mtest.sh b/usr/src/cmd/mdb/test/mtest.sh deleted file mode 100755 index f21d0faa21..0000000000 --- a/usr/src/cmd/mdb/test/mtest.sh +++ /dev/null @@ -1,235 +0,0 @@ -#!/bin/bash -# -# This file and its contents are supplied under the terms of the -# Common Development and Distribution License ("CDDL"), version 1.0. -# You may only use this file in accordance with the terms of version -# 1.0 of the CDDL. -# -# A full copy of the text of the CDDL should have accompanied this -# source. A copy of the CDDL is also available via the Internet at -# http://www.illumos.org/license/CDDL. -# - -# -# Copyright 2012 (c), Joyent, Inc. -# - -# -# mdb test driver -# -unalias -a -shopt -s xpg_echo -#set -o xtrace - -mt_arg0=$(basename $0) -mt_ksh="/usr/bin/ksh" -mt_mdb="/usr/bin/mdb" -mt_outdir= -mt_keep= -mt_all= -mt_tests= -mt_tnum=0 -mt_tfail=0 -mt_tsuc=0 - -function usage -{ - local msg="$*" - [[ -z "$msg" ]] || echo "$msg" 2>&1 - cat <<USAGE >&2 -Usage: $mt_arg0 [ -o dir ] [ -k ] [ -m executable ] [ -a | test ... ] - - -o dir Sets 'dir' as the output directory - -a Runs all tests, ignores tests passed in - -k Keep output from all tests, not just failures - -m mdb binary to test -USAGE - exit 2 -} - -function fatal -{ - local msg="$*" - [[ -z "$msg" ]] && msg="failed" - echo "$mt_arg0: $msg" >&2 - exit 1 -} - -function setup_outdir -{ - mt_outdir="$mt_outdir/$mt_arg0.$$" - mkdir -p $mt_outdir || fatal "failed to make output dir $mt_outdir" -} - -function run_single -{ - local name=$1 - local expect base ext exe command odir res reason input - - [[ -z "$name" ]] && fail "missing test to run" - base=${name##*/} - ext=${base##*.} - expect=${base%%.*} - odir="$mt_outdir/current" - [[ -z "$ext" ]] && fatal "found test without ext: $name" - [[ -z "$expect" ]] && fatal "found test without prefix: $name" - - case "$ext" in - "ksh") - command="$mt_ksh $name" - ;; - "mdb") - command="$mt_mdb" - input="$name" - ;; - "out") - # - # This is the file format for checking output against. - # - return 0 - ;; - *) - echo "skipping test $name (unknown extensino)" - return 0 - ;; - esac - - echo "Executing test $name ... \c" - mkdir -p "$odir" >/dev/null || fatal "can't make output directory" - if [[ -z "$input" ]]; then - MDB=$mt_mdb $command > "$odir/stdout" 2>"$odir/stderr" - res=$? - else - MDB=$mt_mdb $command < $input > "$odir/stdout" 2>"$odir/stderr" - res=$? - fi - - if [[ -f "$name.out" ]] && ! diff "$name.out" "$odir/stdout" >/dev/null; then - cp $name.out $odir/$base.out - reason="stdout mismatch" - elif [[ "$expect" == "tst" && $res -ne 0 ]]; then - reason="test exited $res, not zero" - elif [[ "$expect" == "err" && $res -eq 0 ]]; then - reason="test exited $res, not non-zero" - fi - - if [[ -n "$reason" ]]; then - echo "$reason" - ((mt_tfail++)) - mv "$odir" "$mt_outdir/failure.$mt_tfail" || fatal \ - "failed to move test output directory" - cp "$name" "$mt_outdir/failure.$mt_tfail/test" || fatal \ - "failed to copy test into output directory" - else - echo "passed" - ((mt_tsuc++)) - mv "$odir" "$mt_outdir/success.$mt_tsuc" || fatal \ - "failed to move test directory" - fi - - ((mt_tnum++)) -} - -function run_all -{ - local tests t - - tests=$(find . -type f -name '[tst,err]*.*.[ksh,mdb]*') - for t in $tests; do - run_single $t - done -} - -function welcome -{ - cat <<WELCOME -Starting tests... -mtest target: $mt_mdb -output directory: $mt_outdir -WELCOME -} - -function cleanup -{ - [[ -n "$mt_keep" ]] && return - rm -rf "$mt_outdir"/success.* || fatal \ - "failed to remove successful test cases" - if [[ $mt_tfail -eq 0 ]]; then - rmdir "$mt_outdir" || fatal \ - "failed to remove test output directory" - fi -} - -function goodbye -{ - cat <<EOF - -------------- -Results -------------- - -Tests passed: $mt_tsuc -Tests failed: $mt_tfail -Tests ran: $mt_tnum - -EOF - if [[ $mt_tfail -eq 0 ]]; then - echo "Congrats, mdb isn't completely broken, the tests pass". - else - echo "Some tests failed, you have some work to do." - fi -} - -while getopts ":ahko:m:" c $@; do - case "$c" in - a) - mt_all="y" - ;; - k) - mt_keep="y" - ;; - m) - mt_mdb="$OPTARG" - ;; - o) - mt_outdir="$OPTARG" - ;; - h) - usage - ;; - :) - usage "option requires an argument -- $OPTARG" - ;; - *) - usage "invalid option -- $OPTARG" - ;; - esac -done - -shift $((OPTIND-1)) - -[[ -z "$mt_all" && $# == 0 ]] && usage "no tests to run" - -[[ -x "$mt_mdb" ]] || fatal "unable to execute mdb binary: $mt_mdb" - -[[ -z "$mt_outdir" ]] && mt_outdir=/var/tmp - -setup_outdir -welcome - -if [[ ! -z "$mt_all" ]]; then - run_all -else - for t in $@; do - [[ -f $t ]] || fatal "cannot find test $t" - run_single $t - done -fi - -goodbye -cleanup - -# -# Exit 1 if we have tests that return non-zero -# -[[ $mt_tfai -eq 0 ]] diff --git a/usr/src/cmd/mdb/test/options/tst.autowrap.mdb b/usr/src/cmd/mdb/test/options/tst.autowrap.mdb deleted file mode 100644 index 5904cbf4c7..0000000000 --- a/usr/src/cmd/mdb/test/options/tst.autowrap.mdb +++ /dev/null @@ -1,15 +0,0 @@ -::set +o autowrap -::typedef -c lp32 -0::printf "Pack my box with five dozen liquor jugs. How razorback-jumping frogs can level six piqued gymnasts! Amazingly few discotheques provide jukeboxes.%d" int . - -0::printf "%-79d%d" int . . -0::printf "%-80d%d" int . . -0::printf "%-81d%d" int . . - -::set -o autowrap -0::printf "Pack my box with five dozen liquor jugs. How razorback-jumping frogs can level six piqued gymnasts! Amazingly few discotheques provide jukeboxes.%d" int . - -0::printf "%-79d%d" int . . -0::printf "%-80d%d" int . . -0::printf "%-81d%d" int . . - diff --git a/usr/src/cmd/mdb/test/options/tst.autowrap.mdb.out b/usr/src/cmd/mdb/test/options/tst.autowrap.mdb.out deleted file mode 100644 index 81d3ef5293..0000000000 --- a/usr/src/cmd/mdb/test/options/tst.autowrap.mdb.out +++ /dev/null @@ -1,11 +0,0 @@ -Pack my box with five dozen liquor jugs. How razorback-jumping frogs can level six piqued gymnasts! Amazingly few discotheques provide jukeboxes.0 -0 0 -0 0 -0 0 -Pack my box with five dozen liquor jugs. How razorback-jumping frogs can level s -ix piqued gymnasts! Amazingly few discotheques provide jukeboxes.0 -0 0 -0 -0 -0 -0 diff --git a/usr/src/cmd/mdb/test/typedef/err.badid-leadnum.ksh b/usr/src/cmd/mdb/test/typedef/err.badid-leadnum.ksh deleted file mode 100644 index f297cf99f1..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badid-leadnum.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef lp32; ::typedef uint8_t 42foo' diff --git a/usr/src/cmd/mdb/test/typedef/err.badid-leadschar.ksh b/usr/src/cmd/mdb/test/typedef/err.badid-leadschar.ksh deleted file mode 100644 index 5c7582b89c..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badid-leadschar.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef lp32; ::typedef uint8_t %foo' diff --git a/usr/src/cmd/mdb/test/typedef/err.badmodel.ksh b/usr/src/cmd/mdb/test/typedef/err.badmodel.ksh deleted file mode 100644 index 28d6cf05a5..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badmodel.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c LLP64' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-extrabraces.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-extrabraces.ksh deleted file mode 100644 index 3543aab1df..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-extrabraces.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[7]; {} void {**white; }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-neglenarr.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-neglenarr.ksh deleted file mode 100644 index ec41576179..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-neglenarr.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[-3]; void **white; }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayclose.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayclose.ksh deleted file mode 100644 index b91094ae44..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayclose.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[7; void **white; }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-noarraylen.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-noarraylen.ksh deleted file mode 100644 index 4fe23fcee2..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-noarraylen.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[]; void **white; }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayopen.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayopen.ksh deleted file mode 100644 index 9fe7e77200..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayopen.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone7]; void **white; }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-nobraces.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-nobraces.ksh deleted file mode 100644 index d50d8e3fb9..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-nobraces.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct uintptr_t stone[7]; void **white;" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-noclosebrace.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-noclosebrace.ksh deleted file mode 100644 index 4b20fac8c5..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-noclosebrace.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[7]; void **white; " gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-nomembers.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-nomembers.ksh deleted file mode 100644 index 9fd82a01cc..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-nomembers.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct { }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-nomemname.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-nomemname.ksh deleted file mode 100644 index e1e4eacf13..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-nomemname.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct { void; }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-nomemsemi.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-nomemsemi.ksh deleted file mode 100644 index 9ab93a792f..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-nomemsemi.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[7]; void **white }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-noopenbrace.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-noopenbrace.ksh deleted file mode 100644 index 450b35ade2..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-noopenbrace.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct uintptr_t stone[7]; void **white; }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-noquotes.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-noquotes.ksh deleted file mode 100644 index 789caf63b0..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-noquotes.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef struct { uintptr_t stone[7]; void **white; } gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-repmemname.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-repmemname.ksh deleted file mode 100644 index c00aca88fb..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-repmemname.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[7]; void **stone; }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-vlaonly.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-vlaonly.ksh deleted file mode 100644 index a678d136b6..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-vlaonly.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[]; }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-zerolenarr.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-zerolenarr.ksh deleted file mode 100644 index 7999c97a5a..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badstruct-zerolenarr.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[0]; void **white; }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.badunion-hasvla.ksh b/usr/src/cmd/mdb/test/typedef/err.badunion-hasvla.ksh deleted file mode 100644 index 57a82a7752..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.badunion-hasvla.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "union { int foo; uintptr_t stone[]; }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.extraargs.ksh b/usr/src/cmd/mdb/test/typedef/err.extraargs.ksh deleted file mode 100644 index 510797265b..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.extraargs.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e "::typedef -c lp32; ::typedef uint8_t rm_t extra_t" diff --git a/usr/src/cmd/mdb/test/typedef/err.noargs.ksh b/usr/src/cmd/mdb/test/typedef/err.noargs.ksh deleted file mode 100644 index 77eeacc5f2..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.noargs.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef' diff --git a/usr/src/cmd/mdb/test/typedef/err.nokeyword.ksh b/usr/src/cmd/mdb/test/typedef/err.nokeyword.ksh deleted file mode 100644 index 9a5e1a1fcc..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.nokeyword.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c lp32; ::typedef "{ uintptr_t stone[7]; void **white; }" gift_t' diff --git a/usr/src/cmd/mdb/test/typedef/err.nomodel.ksh b/usr/src/cmd/mdb/test/typedef/err.nomodel.ksh deleted file mode 100644 index 4614ac23d6..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.nomodel.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef -c' diff --git a/usr/src/cmd/mdb/test/typedef/err.noname.ksh b/usr/src/cmd/mdb/test/typedef/err.noname.ksh deleted file mode 100644 index 04ebca1204..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.noname.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB -e '::typedef int' diff --git a/usr/src/cmd/mdb/test/typedef/err.typeexists.ksh b/usr/src/cmd/mdb/test/typedef/err.typeexists.ksh deleted file mode 100644 index a1158cd830..0000000000 --- a/usr/src/cmd/mdb/test/typedef/err.typeexists.ksh +++ /dev/null @@ -1 +0,0 @@ -$MDB /lib/libc.so -e '::typedef uint8_t uint16_t' diff --git a/usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb b/usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb deleted file mode 100644 index 27de9428c6..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb +++ /dev/null @@ -1,4 +0,0 @@ -::typedef -c lp32 -::typedef "struct { uintptr_t stone[7]; void **white; }" gift_t -::sizeof gift_t -::print -at gift_t diff --git a/usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb.out deleted file mode 100644 index 605e0facfc..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb.out +++ /dev/null @@ -1,5 +0,0 @@ -sizeof (gift_t) = 0x28 -0 gift_t { - 0 uintptr_t [7] stone - 20 void **white -} diff --git a/usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb b/usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb deleted file mode 100644 index 1aa17b5366..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb +++ /dev/null @@ -1,4 +0,0 @@ -::typedef -c lp64 -::typedef "union { int frodo; char sam; long gandalf; }" ringbearer_t; -::sizeof ringbearer_t -::print -at ringbearer_t diff --git a/usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb.out deleted file mode 100644 index 0a762dc1f8..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb.out +++ /dev/null @@ -1,6 +0,0 @@ -sizeof (ringbearer_t) = 8 -0 ringbearer_t { - 0 int frodo - 0 char sam - 0 long gandalf -} diff --git a/usr/src/cmd/mdb/test/typedef/tst.cleanupstruct.ksh b/usr/src/cmd/mdb/test/typedef/tst.cleanupstruct.ksh deleted file mode 100644 index fabc7dfb57..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.cleanupstruct.ksh +++ /dev/null @@ -1,22 +0,0 @@ -# -# One of the problems that we can encounter involves trying to typedef a struct -# that has an error in it. The problem here is that we actually create the type -# itself for the struct before we add members. So what we need is something that -# will fail validation. So here we go! -# - -TMPFILE="$(mktemp -p /tmp mtest.XXXXXX)" -if [[ -z "$TMPFILE" ]]; then - echo "Failed to get a temp file" 2>&1 - exit 1 -fi - -$MDB <<EOF -::typedef "struct foo { int r; }" foo_t -::typedef -l ! cat > $TMPFILE -EOF - -DATA=$(cat $TMPFILE) -rm -f $TMPFILE - -[[ -z $DATA ]] diff --git a/usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb b/usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb deleted file mode 100644 index 12c28075a8..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb +++ /dev/null @@ -1,27 +0,0 @@ -::typedef -c LP32 -::sizeof int8_t -::sizeof int16_t -::sizeof int32_t -::sizeof int64_t -::sizeof uint8_t -::sizeof uint16_t -::sizeof uint32_t -::sizeof uint64_t -::sizeof intptr_t -::sizeof uintptr_t -::sizeof uchar_t -::sizeof ushort_t -::sizeof uint_t -::sizeof ulong_t -::sizeof u_longlong_t -::sizeof ptrdiff_t -::sizeof signed -::sizeof unsigned -::sizeof void -::sizeof char -::sizeof short -::sizeof int -::sizeof long -::sizeof _Bool -::sizeof float -::sizeof double diff --git a/usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb.out deleted file mode 100644 index 792f42fbf2..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb.out +++ /dev/null @@ -1,26 +0,0 @@ -sizeof (int8_t) = 1 -sizeof (int16_t) = 2 -sizeof (int32_t) = 4 -sizeof (int64_t) = 8 -sizeof (uint8_t) = 1 -sizeof (uint16_t) = 2 -sizeof (uint32_t) = 4 -sizeof (uint64_t) = 8 -sizeof (intptr_t) = 4 -sizeof (uintptr_t) = 4 -sizeof (uchar_t) = 1 -sizeof (ushort_t) = 2 -sizeof (uint_t) = 4 -sizeof (ulong_t) = 4 -sizeof (u_longlong_t) = 8 -sizeof (ptrdiff_t) = 4 -sizeof (signed) = 4 -sizeof (unsigned) = 4 -sizeof (void) = 0 -sizeof (char) = 1 -sizeof (short) = 2 -sizeof (int) = 4 -sizeof (long) = 4 -sizeof (_Bool) = 1 -sizeof (float) = 4 -sizeof (double) = 8 diff --git a/usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb b/usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb deleted file mode 100644 index 5ae94cdea0..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb +++ /dev/null @@ -1,27 +0,0 @@ -::typedef -c LP64 -::sizeof int8_t -::sizeof int16_t -::sizeof int32_t -::sizeof int64_t -::sizeof uint8_t -::sizeof uint16_t -::sizeof uint32_t -::sizeof uint64_t -::sizeof intptr_t -::sizeof uintptr_t -::sizeof uchar_t -::sizeof ushort_t -::sizeof uint_t -::sizeof ulong_t -::sizeof u_longlong_t -::sizeof ptrdiff_t -::sizeof signed -::sizeof unsigned -::sizeof void -::sizeof char -::sizeof short -::sizeof int -::sizeof long -::sizeof _Bool -::sizeof float -::sizeof double diff --git a/usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb.out deleted file mode 100644 index 83b85b943a..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb.out +++ /dev/null @@ -1,26 +0,0 @@ -sizeof (int8_t) = 1 -sizeof (int16_t) = 2 -sizeof (int32_t) = 4 -sizeof (int64_t) = 8 -sizeof (uint8_t) = 1 -sizeof (uint16_t) = 2 -sizeof (uint32_t) = 4 -sizeof (uint64_t) = 8 -sizeof (intptr_t) = 8 -sizeof (uintptr_t) = 8 -sizeof (uchar_t) = 1 -sizeof (ushort_t) = 2 -sizeof (uint_t) = 4 -sizeof (ulong_t) = 8 -sizeof (u_longlong_t) = 8 -sizeof (ptrdiff_t) = 8 -sizeof (signed) = 4 -sizeof (unsigned) = 4 -sizeof (void) = 0 -sizeof (char) = 1 -sizeof (short) = 2 -sizeof (int) = 4 -sizeof (long) = 8 -sizeof (_Bool) = 1 -sizeof (float) = 4 -sizeof (double) = 8 diff --git a/usr/src/cmd/mdb/test/typedef/tst.dellist.mdb b/usr/src/cmd/mdb/test/typedef/tst.dellist.mdb deleted file mode 100644 index e9009d7b68..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.dellist.mdb +++ /dev/null @@ -1,3 +0,0 @@ -::typdef -c lp32 -::typedef -d -::typedef -l diff --git a/usr/src/cmd/mdb/test/typedef/tst.dellist.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.dellist.mdb.out deleted file mode 100644 index e69de29bb2..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.dellist.mdb.out +++ /dev/null diff --git a/usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb b/usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb deleted file mode 100644 index 6c7505ac1c..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb +++ /dev/null @@ -1 +0,0 @@ -::typedef -l diff --git a/usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb.out deleted file mode 100644 index e69de29bb2..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb.out +++ /dev/null diff --git a/usr/src/cmd/mdb/test/typedef/tst.libctype.ksh b/usr/src/cmd/mdb/test/typedef/tst.libctype.ksh deleted file mode 100644 index cf517cf937..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.libctype.ksh +++ /dev/null @@ -1,6 +0,0 @@ -$MDB /lib/libc.so <<EOF -::typedef uint8_t rm_t -::typedef -l -::print -at rm_t -::sizeof rm_t -EOF diff --git a/usr/src/cmd/mdb/test/typedef/tst.libctype.ksh.out b/usr/src/cmd/mdb/test/typedef/tst.libctype.ksh.out deleted file mode 100644 index d37ffafbfb..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.libctype.ksh.out +++ /dev/null @@ -1,4 +0,0 @@ -uint8_t -rm_t -0 rm_t -sizeof (rm_t) = 1 diff --git a/usr/src/cmd/mdb/test/typedef/tst.models.ksh b/usr/src/cmd/mdb/test/typedef/tst.models.ksh deleted file mode 100644 index 8537ec443c..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.models.ksh +++ /dev/null @@ -1,11 +0,0 @@ -lp64m="lp64 Lp64 LP64 lP64" -lp32m="lp32 Lp32 LP32 lP32" -ilp32m="ilp32 ilP32 iLp32 iLP32 Ilp32 IlP32 ILp32 ILP32" -for m in $lp64m $lp32m $ilp32m; do - $MDB -e "::typedef -c $m" - if [[ ! $? -eq 0 ]]; then - echo "failed to create model $m" 2>&1 - exit 1 - fi -done -exit 0 diff --git a/usr/src/cmd/mdb/test/typedef/tst.struct.mdb b/usr/src/cmd/mdb/test/typedef/tst.struct.mdb deleted file mode 100644 index 2e0206e7ec..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.struct.mdb +++ /dev/null @@ -1,6 +0,0 @@ -::typedef -c lp32 -::typedef "struct gift { uintptr_t stone[7]; void **white; }" gift_t -::sizeof gift_t -::print -at gift_t -::sizeof struct gift -::print -at struct gift diff --git a/usr/src/cmd/mdb/test/typedef/tst.struct.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.struct.mdb.out deleted file mode 100644 index 9a7d801742..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.struct.mdb.out +++ /dev/null @@ -1,10 +0,0 @@ -sizeof (gift_t) = 0x28 -0 gift_t { - 0 uintptr_t [7] stone - 20 void **white -} -sizeof (struct gift) = 0x28 -0 struct gift { - 0 uintptr_t [7] stone - 20 void **white -} diff --git a/usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb b/usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb deleted file mode 100644 index 85b3068e00..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb +++ /dev/null @@ -1,4 +0,0 @@ -::typedef -c lp32 -::typedef "struct list { struct list *prev; struct list *next; }" list_t -::sizeof list_t -::print -at list_t diff --git a/usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb.out deleted file mode 100644 index a6f4823ad1..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb.out +++ /dev/null @@ -1,5 +0,0 @@ -sizeof (list_t) = 0x10 -0 list_t { - 0 struct list *prev - 8 struct list *next -} diff --git a/usr/src/cmd/mdb/test/typedef/tst.structvla.mdb b/usr/src/cmd/mdb/test/typedef/tst.structvla.mdb deleted file mode 100644 index 27cd56c186..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.structvla.mdb +++ /dev/null @@ -1,4 +0,0 @@ -::typedef -c lp32 -::typedef "struct gift { uintptr_t stone[7]; void **white; char owner[]; }" gift_t -::sizeof gift_t -::print -at gift_t diff --git a/usr/src/cmd/mdb/test/typedef/tst.structvla.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.structvla.mdb.out deleted file mode 100644 index 0a0d3d4029..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.structvla.mdb.out +++ /dev/null @@ -1,6 +0,0 @@ -sizeof (gift_t) = 0x28 -0 gift_t { - 0 uintptr_t [7] stone - 20 void **white - 28 char [0] owner -} diff --git a/usr/src/cmd/mdb/test/typedef/tst.union.mdb b/usr/src/cmd/mdb/test/typedef/tst.union.mdb deleted file mode 100644 index 966446caee..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.union.mdb +++ /dev/null @@ -1,6 +0,0 @@ -::typedef -c lp64 -::typedef "union ringbearer { int frodo; char sam; long gandalf; }" ringbearer_t; -::sizeof ringbearer_t -::print -at ringbearer_t -::sizeof union ringbearer -::print -at union ringbearer diff --git a/usr/src/cmd/mdb/test/typedef/tst.union.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.union.mdb.out deleted file mode 100644 index 2afc2eabb9..0000000000 --- a/usr/src/cmd/mdb/test/typedef/tst.union.mdb.out +++ /dev/null @@ -1,12 +0,0 @@ -sizeof (ringbearer_t) = 8 -0 ringbearer_t { - 0 int frodo - 0 char sam - 0 long gandalf -} -sizeof (union ringbearer) = 8 -0 union ringbearer { - 0 int frodo - 0 char sam - 0 long gandalf -} diff --git a/usr/src/cmd/mpathadm/cmdparse.c b/usr/src/cmd/mpathadm/cmdparse.c index 9080e1cfdd..c4c2dd744a 100644 --- a/usr/src/cmd/mpathadm/cmdparse.c +++ b/usr/src/cmd/mpathadm/cmdparse.c @@ -22,6 +22,10 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2020 Joyent Inc. + */ + #include <stdlib.h> #include <stdio.h> @@ -70,7 +74,7 @@ static void subUsage(uint_t, subcommand_t *); static void subUsageObject(uint_t, subcommand_t *, object_t *); static int getObject(char *, object_t **); static int getObjectRules(uint_t, objectRules_t **); -static char *getLongOption(int); +static const char *getLongOption(int); static optionProp_t *getOptions(uint_t, uint_t); static char *getOptionArgDesc(int); @@ -207,7 +211,7 @@ getOptions(uint_t object, uint_t subcommand) * on success, long option name * on failure, NULL */ -static char * +static const char * getLongOption(int shortOption) { struct option *op; @@ -317,7 +321,7 @@ subUsageObject(uint_t usageType, subcommand_t *subcommand, object_t *objp) opCmd_t *opCmd = NULL; optionProp_t *options; char *optionArgDesc; - char *longOpt; + const char *longOpt; if (getObjectRules(objp->value, &objRules) != 0) { diff --git a/usr/src/cmd/ptools/pfiles/pfiles.c b/usr/src/cmd/ptools/pfiles/pfiles.c index c9540a466c..474650faa4 100644 --- a/usr/src/cmd/ptools/pfiles/pfiles.c +++ b/usr/src/cmd/ptools/pfiles/pfiles.c @@ -205,13 +205,19 @@ intr(int sig) /* ------ begin specific code ------ */ +static int +show_paths(uint_t type, const void *data, size_t len, void *arg __unused) +{ + if (type == PR_PATHNAME) + (void) printf(" %.*s\n", len, data); + return (0); +} static int show_file(void *data, const prfdinfo_t *info) { struct ps_prochandle *Pr = data; char unknown[12]; - const char *path; char *s; mode_t mode; @@ -259,8 +265,6 @@ show_file(void *data, const prfdinfo_t *info) (void) printf(" rdev:%u,%u\n", (unsigned)info->pr_rmajor, (unsigned)info->pr_rminor); - path = proc_fdinfo_misc(info, PR_PATHNAME, NULL); - if (!nflag) { dofcntl(Pr, info, (mode & (S_IFMT|S_ENFMT|S_IXGRP)) == (S_IFREG|S_ENFMT), @@ -285,8 +289,7 @@ show_file(void *data, const prfdinfo_t *info) } } - if (path != NULL) - (void) printf(" %s\n", path); + (void) proc_fdinfowalk(info, show_paths, NULL); if (info->pr_offset != -1) { (void) printf(" offset:%lld\n", diff --git a/usr/src/cmd/svc/milestone/fs-joyent b/usr/src/cmd/svc/milestone/fs-joyent index 9082f22e46..f8b4ffb53d 100755 --- a/usr/src/cmd/svc/milestone/fs-joyent +++ b/usr/src/cmd/svc/milestone/fs-joyent @@ -11,7 +11,7 @@ # # -# Copyright (c) 2018, Joyent, Inc. +# Copyright 2020 Joyent, Inc. # set -o xtrace @@ -70,6 +70,24 @@ function mount_zfs echo ${output} 1>&2 } +function unlock_pool +{ + local pool=$1 + + # If the key is already loaded, don't bother trying again + local keystatus="$(zfs get -Hpo value keystatus $pool)" + if [[ "$keystatus" == "available" ]]; then + return + fi + + kbmadm unlock $pool && return + + echo "Failed to unlock $pool; recovery may be required" | \ + tee -a /dev/console >&2 + + exit $SMF_EXIT_ERR_FATAL +} + /bin/bootparams | grep "^noimport=true" >/dev/null if [ $? -ne 0 ]; then # If the zpool doesn't exist, then there's nothing to mount. @@ -87,11 +105,17 @@ if [ $? -ne 0 ]; then for pool in $pools; do zpool import -f $pool - # Due to early, failed attempts to support the filesystem_limits - # feature we now need to ensure the dependent feature is enabled. - zpool set feature@extensible_dataset=enabled $pool + + is_encr="$(zfs get -Hpo value encryption $pool)" + + [[ "$is_encr" != "off" ]] && unlock_pool $pool + + # Due to early, failed attempts to support the filesystem_limits + # feature we now need to ensure the dependent feature is enabled. + zpool set feature@extensible_dataset=enabled $pool if [[ -f /$pool/.system_pool ]]; then SYS_ZPOOL=$pool + [[ "$is_encr" != "off" ]] && kbmadm set-syspool $pool fi done diff --git a/usr/src/cmd/svc/milestone/joyent-fs.xml b/usr/src/cmd/svc/milestone/joyent-fs.xml index 3d004e8d33..f21eae27d8 100644 --- a/usr/src/cmd/svc/milestone/joyent-fs.xml +++ b/usr/src/cmd/svc/milestone/joyent-fs.xml @@ -44,6 +44,14 @@ <service_fmri value='svc:/system/filesystem/usr' /> </dependency> + <dependency + name='kbmd' + grouping='optional_all' + restart_on='none' + type='service'> + <service_fmri value='svc:/system/kbmd:default' /> + </dependency> + <!-- Start method timeout is infinite to handle potentially unbounded fsck times. diff --git a/usr/src/cmd/zlogin/zlogin.c b/usr/src/cmd/zlogin/zlogin.c index f2da6a3d74..fb219918c5 100644 --- a/usr/src/cmd/zlogin/zlogin.c +++ b/usr/src/cmd/zlogin/zlogin.c @@ -24,7 +24,7 @@ * Copyright (c) 2014 Gary Mills * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright 2020 Joyent, Inc. - * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ /* @@ -127,8 +127,6 @@ static int pollerr = 0; static const char *pname; static char *username; -extern int __xpg4; /* 0 if not an xpg4/6-compiled program */ - /* * When forced_login is true, the user is not prompted * for an authentication password in the target zone. @@ -835,16 +833,8 @@ process_output(int in_fd, int out_fd) cc = read(in_fd, ibuf, ZLOGIN_BUFSIZ); if (cc == -1 && (errno != EINTR || dead)) return (-1); - if (cc == 0) { - /* - * A return value of 0 when calling read() on a terminal - * indicates end-of-file pre-XPG4 and no data available - * for XPG4 and above. - */ - if (__xpg4 == 0) - return (-1); - return (0); - } + if (cc == 0) + return (-1); /* EOF */ if (cc == -1) /* The read was interrupted. */ return (0); diff --git a/usr/src/cmd/zpool/zpool_main.c b/usr/src/cmd/zpool/zpool_main.c index 7242a156c7..31ce0c7e11 100644 --- a/usr/src/cmd/zpool/zpool_main.c +++ b/usr/src/cmd/zpool/zpool_main.c @@ -350,7 +350,7 @@ get_usage(zpool_help_t idx) case HELP_IOSTAT: return (gettext("\tiostat " "[[-lq]|[-rw]] [-T d | u] [-ghHLpPvy]\n" - "\t [pool] ..." + "\t [[pool] ...]|[pool vdev ...]|[vdev ...]]" " [[-n] interval [count]]\n")); case HELP_LABELCLEAR: return (gettext("\tlabelclear [-f] <vdev>\n")); @@ -4987,6 +4987,7 @@ zpool_do_iostat(int argc, char **argv) cb.cb_vdev_names_count)) && !cb.cb_scripted) { print_iostat_separator(&cb); + printf("\n"); } } |