diff options
Diffstat (limited to 'usr/src')
106 files changed, 1373 insertions, 1260 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index ecd10c4cd9..6f851b7eef 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -34,4 +34,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2020.12.07.1 +BOOT_VERSION = $(LOADER_VERSION)-2020.12.11.1 diff --git a/usr/src/boot/lib/libstand/zfs/nvlist.c b/usr/src/boot/lib/libstand/zfs/nvlist.c index f786bfd9db..96b0e63736 100644 --- a/usr/src/boot/lib/libstand/zfs/nvlist.c +++ b/usr/src/boot/lib/libstand/zfs/nvlist.c @@ -55,7 +55,7 @@ static bool nvlist_size_native(xdr_t *, size_t *); static bool xdr_int(xdr_t *, int *); static bool xdr_u_int(xdr_t *, unsigned *); -typedef int (*xdrproc_t)(xdr_t *, void *); +typedef bool (*xdrproc_t)(xdr_t *, void *); /* Basic primitives for XDR translation operations, getint and putint. */ static int diff --git a/usr/src/boot/sys/boot/i386/libi386/vbe.c b/usr/src/boot/sys/boot/i386/libi386/vbe.c index c4d059bf1f..c660367bdf 100644 --- a/usr/src/boot/sys/boot/i386/libi386/vbe.c +++ b/usr/src/boot/sys/boot/i386/libi386/vbe.c @@ -51,6 +51,10 @@ multiboot_color_t *cmap; /* The default VGA color palette format is 6 bits per primary color. */ int palette_format = 6; +#define VESA_MODE_BASE 0x100 +#define VESA_MODE_MAX 0x1ff +#define VESA_MODE_COUNT (VESA_MODE_MAX - VESA_MODE_BASE + 1) + /* Actually assuming mode 3. */ void bios_set_text_mode(int mode) @@ -458,7 +462,7 @@ vbe_find_mode_xydm(int x, int y, int depth, int m) struct modeinfoblock mi; uint32_t farptr; uint16_t mode; - int safety = 0, i; + int safety, i; memset(vbe, 0, sizeof (vbe)); memcpy(vbe->VbeSignature, "VBE2", 4); @@ -466,8 +470,7 @@ vbe_find_mode_xydm(int x, int y, int depth, int m) return (0); if (memcmp(vbe->VbeSignature, "VESA", 4) != 0) return (0); - farptr = vbe->VideoModePtr; - if (farptr == 0) + if (vbe->VideoModePtr == 0) return (0); if (m != -1) @@ -478,10 +481,12 @@ vbe_find_mode_xydm(int x, int y, int depth, int m) i = depth; while (i > 0) { + farptr = vbe->VideoModePtr; + safety = 0; while ((mode = *(uint16_t *)vbe_farptr(farptr)) != 0xffff) { safety++; farptr += 2; - if (safety == 100) + if (safety == VESA_MODE_COUNT) return (0); if (biosvbe_get_mode_info(mode, &mi) != VBE_SUCCESS) { continue; @@ -489,7 +494,6 @@ vbe_find_mode_xydm(int x, int y, int depth, int m) /* we only care about linear modes here */ if (vbe_mode_is_supported(&mi) == 0) continue; - safety = 0; if (m != -1) { if (m == mode) @@ -675,7 +679,7 @@ vbe_modelist(int depth) while ((mode = *(uint16_t *)vbe_farptr(farptr)) != 0xffff) { safety++; farptr += 2; - if (safety == 100) { + if (safety == VESA_MODE_COUNT) { printf("[?] "); break; } @@ -921,7 +925,7 @@ command_vesa(int argc, char *argv[]) return (CMD_ERROR); } - if (modenum >= 0x100) { + if (modenum >= VESA_MODE_BASE) { if (vbestate.vbe_mode != modenum) { reset_font_flags(); bios_text_font(false); diff --git a/usr/src/cmd/ctfconvert/ctfconvert.c b/usr/src/cmd/ctfconvert/ctfconvert.c index bae355be22..121f1ed875 100644 --- a/usr/src/cmd/ctfconvert/ctfconvert.c +++ b/usr/src/cmd/ctfconvert/ctfconvert.c @@ -11,6 +11,7 @@ /* * Copyright 2019 Joyent, Inc. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ /* @@ -37,9 +38,6 @@ #define CTFCONVERT_FATAL 1 #define CTFCONVERT_USAGE 2 -#define CTFCONVERT_DEFAULT_BATCHSIZE 256 -#define CTFCONVERT_DEFAULT_NTHREADS 4 - static char *ctfconvert_progname; static void @@ -55,6 +53,20 @@ ctfconvert_fatal(const char *fmt, ...) exit(CTFCONVERT_FATAL); } +static void +ctfconvert_warning(void *arg, const char *fmt, ...) +{ + va_list ap; + char *buf; + + va_start(ap, fmt); + if (vasprintf(&buf, fmt, ap) != -1) { + (void) fprintf(stderr, "%s: WARNING: %s", ctfconvert_progname, + buf); + free(buf); + } + va_end(ap); +} static void ctfconvert_usage(const char *fmt, ...) @@ -68,21 +80,24 @@ ctfconvert_usage(const char *fmt, ...) va_end(ap); } - (void) fprintf(stderr, "Usage: %s [-ikm] [-j nthrs] [-l label | " + (void) fprintf(stderr, "Usage: %s [-fikms] [-j nthrs] [-l label | " "-L labelenv] [-b batchsize]\n" - " [-o outfile] input\n" + " [-o outfile] [-M ignorefile] input\n" "\n" "\t-b batch process this many dies at a time (default %d)\n" + "\t-f always attempt to convert files\n" "\t-i ignore files not built partially from C sources\n" "\t-j use nthrs threads to perform the merge (default %d)\n" "\t-k keep around original input file on failure\n" "\t-l set output container's label to specified value\n" "\t-L set output container's label to value from environment\n" "\t-m allow input to have missing debug info\n" - "\t-o copy input to outfile and add CTF\n", + "\t-M allow files listed in ignorefile to have missing debug\n" + "\t-o copy input to outfile and add CTF\n" + "\t-s allow truncation of data that cannot be fully converted\n", ctfconvert_progname, - CTFCONVERT_DEFAULT_BATCHSIZE, - CTFCONVERT_DEFAULT_NTHREADS); + CTF_CONVERT_DEFAULT_BATCHSIZE, + CTF_CONVERT_DEFAULT_NTHREADS); } /* @@ -192,13 +207,13 @@ ctfconvert_fixup_genunix(ctf_file_t *fp) CTF_K_STRUCT); if (mcpu == CTF_ERR) { ctfconvert_fatal("failed to add 'struct machcpu' " - "forward: %s", ctf_errmsg(ctf_errno(fp))); + "forward: %s\n", ctf_errmsg(ctf_errno(fp))); } } else { int kind; if ((kind = ctf_type_kind(fp, mcpu)) == CTF_ERR) { ctfconvert_fatal("failed to get the type kind for " - "the struct machcpu: %s", + "the struct machcpu: %s\n", ctf_errmsg(ctf_errno(fp))); } @@ -230,21 +245,23 @@ main(int argc, char *argv[]) { int c, ifd, err; boolean_t keep = B_FALSE; - uint_t flags = 0; - uint_t bsize = CTFCONVERT_DEFAULT_BATCHSIZE; - uint_t nthreads = CTFCONVERT_DEFAULT_NTHREADS; + ctf_convert_flag_t flags = 0; + uint_t bsize = CTF_CONVERT_DEFAULT_BATCHSIZE; + uint_t nthreads = CTF_CONVERT_DEFAULT_NTHREADS; const char *outfile = NULL; const char *label = NULL; const char *infile = NULL; + const char *ignorefile = NULL; char *tmpfile; ctf_file_t *ofp; - char buf[4096]; + char buf[4096] = ""; boolean_t optx = B_FALSE; boolean_t ignore_non_c = B_FALSE; + ctf_convert_t *cch; ctfconvert_progname = basename(argv[0]); - while ((c = getopt(argc, argv, ":b:ij:kl:L:mo:X")) != -1) { + while ((c = getopt(argc, argv, ":b:fij:kl:L:mM:o:sX")) != -1) { switch (c) { case 'b': { long argno; @@ -258,6 +275,9 @@ main(int argc, char *argv[]) bsize = (uint_t)argno; break; } + case 'f': + flags |= CTF_FORCE_CONVERSION; + break; case 'i': ignore_non_c = B_TRUE; break; @@ -285,9 +305,15 @@ main(int argc, char *argv[]) case 'm': flags |= CTF_ALLOW_MISSING_DEBUG; break; + case 'M': + ignorefile = optarg; + break; case 'o': outfile = optarg; break; + case 's': + flags |= CTF_ALLOW_TRUNCATION; + break; case 'X': optx = B_TRUE; break; @@ -327,8 +353,66 @@ main(int argc, char *argv[]) if (outfile != NULL && strcmp(infile, outfile) != 0) keep = B_TRUE; - ofp = ctf_fdconvert(ifd, label, bsize, nthreads, flags, &err, buf, - sizeof (buf)); + cch = ctf_convert_init(&err); + if (cch == NULL) { + ctfconvert_fatal( + "failed to create libctf conversion handle: %s\n", + strerror(err)); + } + if ((err = ctf_convert_set_nthreads(cch, nthreads)) != 0) + ctfconvert_fatal("Could not set number of threads: %s\n", + strerror(err)); + if ((err = ctf_convert_set_batchsize(cch, bsize)) != 0) + ctfconvert_fatal("Could not set batch size: %s\n", + strerror(err)); + if ((err = ctf_convert_set_flags(cch, flags)) != 0) + ctfconvert_fatal("Could not set conversion flags: %s\n", + strerror(err)); + if (label != NULL && (err = ctf_convert_set_label(cch, label)) != 0) + ctfconvert_fatal("Could not set label: %s\n", + strerror(err)); + if ((err = ctf_convert_set_warncb(cch, ctfconvert_warning, NULL)) != 0) + ctfconvert_fatal("Could not set warning callback: %s\n", + strerror(err)); + + if (ignorefile != NULL) { + char *buf = NULL; + ssize_t cnt; + size_t len = 0; + FILE *fp; + + if ((fp = fopen(ignorefile, "r")) == NULL) { + ctfconvert_fatal("Could not open ignorefile '%s': %s\n", + ignorefile, strerror(errno)); + } + + while ((cnt = getline(&buf, &len, fp)) != -1) { + char *p = buf; + + if (cnt == 0 || *p == '#') + continue; + + (void) strsep(&p, "\n"); + if ((err = ctf_convert_add_ignore(cch, buf)) != 0) { + ctfconvert_fatal( + "Failed to add '%s' to ignore list: %s\n", + buf, strerror(err)); + } + } + free(buf); + if (cnt == -1 && ferror(fp) != 0) { + ctfconvert_fatal( + "Error reading from ignorefile '%s': %s\n", + ignorefile, strerror(errno)); + } + + (void) fclose(fp); + } + + ofp = ctf_fdconvert(cch, ifd, &err, buf, sizeof (buf)); + + ctf_convert_fini(cch); + if (ofp == NULL) { /* * Normally, ctfconvert requires that its input file has at @@ -351,9 +435,19 @@ main(int argc, char *argv[]) if (keep == B_FALSE) (void) unlink(infile); - if (err == ECTF_CONVBKERR || err == ECTF_CONVNODEBUG) { - ctfconvert_fatal("%s\n", buf); - } else { + switch (err) { + case ECTF_CONVBKERR: + ctfconvert_fatal("CTF conversion failed: %s", buf); + break; + case ECTF_CONVNODEBUG: + ctfconvert_fatal("CTF conversion failed due to " + "missing debug data; use -m to override\n"); + break; + default: + if (*buf != '\0') { + (void) fprintf(stderr, "%s: %s", + ctfconvert_progname, buf); + } ctfconvert_fatal("CTF conversion failed: %s\n", ctf_errmsg(err)); } @@ -378,7 +472,7 @@ main(int argc, char *argv[]) if (keep == B_FALSE) (void) unlink(infile); ctfconvert_fatal("failed to write CTF section to output file: " - "%s", ctf_errmsg(ctf_errno(ofp))); + "%s\n", ctf_errmsg(ctf_errno(ofp))); } ctf_close(ofp); diff --git a/usr/src/cmd/eeprom/i386/benv.c b/usr/src/cmd/eeprom/i386/benv.c index 697bcd9a19..2119bdc3af 100644 --- a/usr/src/cmd/eeprom/i386/benv.c +++ b/usr/src/cmd/eeprom/i386/benv.c @@ -748,7 +748,7 @@ add_pair(const char *name, const char *nvlist, const char *key, int32_t lv; int16_t v; - v = strtol(value, &end, 0); + lv = strtol(value, &end, 0); if (errno != 0 || *end != '\0') goto done; if (lv < INT16_MIN || lv > INT16_MAX) diff --git a/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_Lxcacheerr.c b/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_Lxcacheerr.c index 9aa7efa831..6dd58d5a2c 100644 --- a/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_Lxcacheerr.c +++ b/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_Lxcacheerr.c @@ -377,10 +377,10 @@ get_retired_ways(uint64_t *tag_data) static cmd_evdisp_t extract_data_from_ereport_payload(fmd_hdl_t *hdl, nvlist_t *nvl, - cmd_cpu_t *cpu, - cmd_ptrsubtype_t pstype, - uint64_t *afarp, uint64_t *tag_data, - const char *fltnm) + cmd_cpu_t *cpu, + cmd_ptrsubtype_t pstype, + uint64_t *afarp, uint64_t *tag_data, + const char *fltnm) { ch_ec_data_t *ec_data; char *payload_namep; @@ -472,19 +472,15 @@ matching_ecc(uint64_t *tag_data) static void gen_data_for_ecc(uint64_t *tag_data, uint64_t *data_for_ecc_gen, - cmd_ptrsubtype_t pstype) + cmd_ptrsubtype_t pstype) { uint64_t ptag[PN_CACHE_NWAYS]; uint8_t state[PN_CACHE_NWAYS]; int i; - uint16_t tag_ecc[PN_CACHE_NWAYS]; uint8_t bit_position; for (i = 0; i < PN_CACHE_NWAYS; i++) { state[i] = tag_data[i] & CH_ECSTATE_MASK; - tag_ecc[i] = - ((tag_data[i] & PN_TAG_ECC_MASK) - >> PN_LX_TAG_ECC_START_BIT); switch (pstype) { case CMD_PTR_CPU_L2TAG: ptag[i] = (tag_data[i] >> PN_L2_PTAG_SHIFT) & @@ -603,7 +599,7 @@ find_bit_stickiness(uint64_t *tag_data, int8_t way, int16_t bit) static cmd_Lxcache_t * cmd_create_and_destroy_Lxcache(fmd_hdl_t *hdl, cmd_cpu_t *cpu, - cmd_Lxcache_t *Lxcache) + cmd_Lxcache_t *Lxcache) { const char *fltnm; cmd_Lxcache_t *new_Lxcache; @@ -954,9 +950,9 @@ cmd_Lxcache_anonymous_tag_error_timeout(fmd_hdl_t *hdl, id_t id) cmd_evdisp_t cmd_us4plus_tag_err(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, - cmd_cpu_t *cpu, cmd_ptrsubtype_t pstype, - const char *serdn, const char *serdt, - const char *fltnm, cmd_errcl_t clcode) + cmd_cpu_t *cpu, cmd_ptrsubtype_t pstype, + const char *serdn, const char *serdt, + const char *fltnm, cmd_errcl_t clcode) { uint64_t tag_afar; int32_t index; @@ -1576,7 +1572,7 @@ pn_there_is_a_matching_synd(fmd_hdl_t *hdl, cmd_xr_t *xr) } /* add to cheetahregs.h */ -#define CH_ECSTATE_NA 5 +#define CH_ECSTATE_NA 5 static int32_t pn_extract_index(int32_t type, uint64_t afar) @@ -1611,7 +1607,7 @@ pn_extract_index(int32_t type, uint64_t afar) * If the way is anonomyous, it will attempt to choose a way for the * given index to fault. If the maximum for the index has not been * reached, it will attempt to unretire a different way previously retired - * under suspicion for the index prior to faulting + * under suspicion for the index prior to faulting * the selected way. * The routine will also fault the CPU if the maximum number of * retired ways for the CPU has been exceeded based on the category. diff --git a/usr/src/cmd/fm/modules/sun4v/etm/etm.c b/usr/src/cmd/fm/modules/sun4v/etm/etm.c index ff50c2a888..af8768f6d3 100644 --- a/usr/src/cmd/fm/modules/sun4v/etm/etm.c +++ b/usr/src/cmd/fm/modules/sun4v/etm/etm.c @@ -3183,8 +3183,8 @@ etm_async_event_handler(void *arg) "error: can't find iosvc " "for async evnt %d\n", async_e.event_type); - (void) pthread_mutex_unlock( - &iosvc_list_lock); + (void) pthread_mutex_unlock( + &iosvc_list_lock); break; } @@ -3197,7 +3197,7 @@ etm_async_event_handler(void *arg) * the ldom name and the msg Q * remains in iosvc_list */ - if (iosvc->ldom_name != '\0') + if (*iosvc->ldom_name != '\0') fmd_hdl_debug(fmd_hdl, "info: iosvc w/ ldom_name " "%s \n", iosvc->ldom_name); diff --git a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Component.java b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Component.java index ff762d83ed..bbe1d04076 100644 --- a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Component.java +++ b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Component.java @@ -23,8 +23,6 @@ * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * - *ident "%Z%%M% %I% %E% SMI" - * */ package com.sun.solaris.service.pools; @@ -147,7 +145,7 @@ public class Component extends Element * Return the pointer to this component as an element. * * @return The pointer to the native component which this object wraps. - * @throws PoolsExecption If there is an error converting the native + * @throws PoolsException If there is an error converting the native * component pointer to a native elem pointer. */ protected long getElem() throws PoolsException diff --git a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Configuration.java b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Configuration.java index 1597af088b..a5b54e7630 100644 --- a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Configuration.java +++ b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Configuration.java @@ -23,8 +23,6 @@ * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * - *ident "%Z%%M% %I% %E% SMI" - * */ package com.sun.solaris.service.pools; @@ -173,7 +171,7 @@ public class Configuration extends Element /** * Remove the configuration. * - * @throws PoolsExecption If the removal fails. + * @throws PoolsException If the removal fails. */ public void remove() throws PoolsException { @@ -187,7 +185,7 @@ public class Configuration extends Element * made since the last commit or (if there are no commits) since the * configuration was opened. * - * @throws PoolsExecption If the rollback fails. + * @throws PoolsException If the rollback fails. */ public void rollback() throws PoolsException { @@ -201,7 +199,7 @@ public class Configuration extends Element * was last committed (or opened if there have been no prior commits) * permanent. * - * @throws PoolsExecption If the commit fails. + * @throws PoolsException If the commit fails. */ public void commit(int active) throws PoolsException { @@ -216,7 +214,7 @@ public class Configuration extends Element * * @param location The location of the export. * @param format The format of the export. - * @throws PoolsExecption If the export fails. + * @throws PoolsException If the export fails. */ public void export(String location, int format) throws PoolsException { @@ -230,7 +228,7 @@ public class Configuration extends Element * configuration satisfies the supplied validation level. * * @param level The desired level of validation. - * @throws PoolsExecption If the validation fails. + * @throws PoolsException If the validation fails. */ public void validate(int level) throws PoolsException { @@ -243,7 +241,7 @@ public class Configuration extends Element * Update the configuration, ensuring that the current state of the * configuration reflects that of the kernel. * - * @throws PoolsExecption If the update fails. + * @throws PoolsException If the update fails. * @return a bitmap of the changed types. */ public int update() throws PoolsException @@ -255,7 +253,7 @@ public class Configuration extends Element * Create a pool with the supplied name. * * @param name The name of the PoolInternal. - * @throws PoolsExecption If the pool creation fails. + * @throws PoolsException If the pool creation fails. * @return a pool with the supplied name. */ public Pool createPool(String name) throws PoolsException @@ -286,7 +284,7 @@ public class Configuration extends Element * Get the pool with the supplied name. * * @param name The name of the pool to be found. - * @throws PoolsExecption If the pool cannot be located. + * @throws PoolsException If the pool cannot be located. * @return a pool with the supplied name. */ public Pool getPool(String name) throws PoolsException @@ -304,13 +302,13 @@ public class Configuration extends Element elements.put(p.getKey(), p); return (p); } - } + } /** * Get the proxy for the pool with the supplied name. * * @param name The name of the pool to be found. - * @throws PoolsExecption If the pool cannot be located. + * @throws PoolsException If the pool cannot be located. * @return the proxy for the pool with the supplied name. */ long checkPool(String name) throws PoolsException @@ -322,14 +320,14 @@ public class Configuration extends Element throw new PoolsException(); } return (aPool); - } + } /** * Get a list of pools which match the supplied selection criteria * in values. * * @param values A list of values to be used to qualify the search. - * @throws PoolsExecption If there is an error executing the query. + * @throws PoolsException If there is an error executing the query. * @return a list of pools which match the supplied criteria */ public List getPools(List values) throws PoolsException @@ -350,13 +348,13 @@ public class Configuration extends Element ((Long)pools.get(i)).longValue())); return (aList); } - + /** * Create a resource with the supplied type and name. * * @param type The type of the resource. * @param name The name of the resource. - * @throws PoolsExecption If the resource creation fails. + * @throws PoolsException If the resource creation fails. * @return a resource of the supplied type and name. */ public Resource createResource(String type, String name) @@ -391,7 +389,7 @@ public class Configuration extends Element * * @param type The type of the resource to be found. * @param name The name of the resource to be found. - * @throws PoolsExecption If the resource cannot be located. + * @throws PoolsException If the resource cannot be located. * @return a resource with the supplied name. */ public Resource getResource(String type, String name) @@ -410,7 +408,7 @@ public class Configuration extends Element elements.put(r.getKey(), r); return (r); } - } + } /** * Get the proxy for the resource with the supplied type and @@ -418,7 +416,7 @@ public class Configuration extends Element * * @param type The type of the resource to be found. * @param name The name of the resource to be found. - * @throws PoolsExecption If the resource cannot be located. + * @throws PoolsException If the resource cannot be located. * @return the proxy for the resource with the supplied name. */ long checkResource(String type, String name) throws PoolsException @@ -430,14 +428,14 @@ public class Configuration extends Element throw new PoolsException(); } return (res); - } + } /** * Get a list of resources which match the supplied selection criteria * in values. * * @param values A list of values to be used to qualify the search. - * @throws PoolsExecption If there is an error executing the query. + * @throws PoolsException If there is an error executing the query. * @return a list of resources which match the supplied criteria */ public List getResources(List values) throws PoolsException @@ -464,7 +462,7 @@ public class Configuration extends Element * * @param type The type of the component to be found. * @param sys_id The sys_id of the component to be found. - * @throws PoolsExecption If the component cannot be located. + * @throws PoolsException If the component cannot be located. * @return a component with the supplied name. */ public Component getComponent(String type, long sys_id) @@ -482,14 +480,14 @@ public class Configuration extends Element if (comps.size() != 1) throw new PoolsException(); return ((Component) comps.get(0)); - } + } /** * Get the component proxy with the supplied type and sys_id. * * @param type The type of the component to be found. * @param sys_id The sys_id of the component to be found. - * @throws PoolsExecption If the component cannot be located. + * @throws PoolsException If the component cannot be located. * @return a component with the supplied name. */ long checkComponent(String type, long sys_id) @@ -507,20 +505,20 @@ public class Configuration extends Element if (comps.size() != 1) throw new PoolsException(); return (((Long)comps.get(0)).longValue()); - } + } /** * Get a list of components which match the supplied selection criteria * in values. * * @param values A list of values to be used to qualify the search. - * @throws PoolsExecption If there is an error executing the query. + * @throws PoolsException If there is an error executing the query. * @return a list of components which match the supplied criteria */ public List getComponents(List values) throws PoolsException { List components; - + if ((components = PoolInternal.pool_query_components(getConf(), values)) == null) { if (PoolInternal.pool_error() == @@ -556,7 +554,7 @@ public class Configuration extends Element throw new PoolsException(); long sys_id = idValue.getLong(); idValue.close(); - + if (elements.containsKey(type + "." + sys_id)) aList.add((Component)elements.get(type + "." + sys_id)); @@ -573,7 +571,7 @@ public class Configuration extends Element * selection criteria in values. * * @param values A list of values to be used to qualify the search. - * @throws PoolsExecption If there is an error executing the query. + * @throws PoolsException If there is an error executing the query. * @return a list of component proxies which match the * supplied criteria */ @@ -649,13 +647,13 @@ public class Configuration extends Element { return name.hashCode(); } - + /** * Return the pointer to this configuration as an element. * * @return The pointer to the native configuration which this object * wraps. - * @throws PoolsExecption If there is an error converting the native + * @throws PoolsException If there is an error converting the native * configuration pointer to a native elem pointer. */ protected long getElem() throws PoolsException @@ -668,7 +666,7 @@ public class Configuration extends Element } /** - * Return the anme of the configuration. + * Return the name of the configuration. */ String getName() { diff --git a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Element.java b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Element.java index 46f2a4b5f8..2cd07ad25e 100644 --- a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Element.java +++ b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Element.java @@ -84,7 +84,7 @@ public abstract class Element implements Property, PropertyWalk * Get the property with the supplied name. * * @param name The name of the property to be retrieved. - * @throws PoolsExecption If there is an error accessing the property. + * @throws PoolsException If there is an error accessing the property. * @return a value containing the property details. */ private Value getProperty(String name) throws PoolsException @@ -113,7 +113,7 @@ public abstract class Element implements Property, PropertyWalk * * @param name The name of the property to be retrieved. * @param proxy The proxy item used to retrieve the property. - * @throws PoolsExecption If there is an error accessing the property. + * @throws PoolsException If there is an error accessing the property. * @return a value containing the property details. */ protected Value getProperty(String name, long proxy) @@ -143,7 +143,7 @@ public abstract class Element implements Property, PropertyWalk * * @param name The name of the property to be updated. * @param value The value of the property to be updated. - * @throws PoolsExecption If there is an error accessing the property. + * @throws PoolsException If there is an error accessing the property. */ public void putProperty(String name, Value value) throws PoolsException { @@ -156,7 +156,7 @@ public abstract class Element implements Property, PropertyWalk * Remove the element property with the supplied name. * * @param name The name of the property to be removed. - * @throws PoolsExecption If there is an error removing the property. + * @throws PoolsException If there is an error removing the property. */ public void rmProperty(String name) throws PoolsException { @@ -259,7 +259,7 @@ public abstract class Element implements Property, PropertyWalk * @param elem The element to whom the property belongs. * @param val The value representing the current element. * @param user User supplied data, provided when the walk is invoked. - * @throws PoolsExecption If there is an error walking the property. + * @throws PoolsException If there is an error walking the property. * @return 0 to continue the walk, anything else to terminate it. */ public int walk(Element elem, Value val, Object user) @@ -275,7 +275,7 @@ public abstract class Element implements Property, PropertyWalk * Return the pointer to this subtype as an element. * * @return The pointer to the native subtype which this object wraps. - * @throws PoolsExecption If there is an error converting the native + * @throws PoolsException If there is an error converting the native * subtype pointer to a native elem pointer. */ protected abstract long getElem() throws PoolsException; @@ -286,7 +286,7 @@ public abstract class Element implements Property, PropertyWalk * @param handler The object which will receive the callbacks. * @param user Data supplied by the user for use in the callback. * @return 0 for a successful walk, else 1. - * @throws PoolsExecption If there is an error during the walk. + * @throws PoolsException If there is an error during the walk. */ public int walkProperties(PropertyWalk handler, Object user) throws PoolsException diff --git a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Pool.java b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Pool.java index 113bf463e7..12b6b6ffe8 100644 --- a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Pool.java +++ b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Pool.java @@ -23,8 +23,6 @@ * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * - *ident "%Z%%M% %I% %E% SMI" - * */ package com.sun.solaris.service.pools; @@ -108,7 +106,7 @@ public class Pool extends Element { * searched. * * @param values A list of values to be used to qualify the search. - * @throws PoolsExecption If there is an error executing the query. + * @throws PoolsException If there is an error executing the query. * @return a list of resources which match the supplied criteria */ public List getResources(List values) throws PoolsException @@ -195,7 +193,7 @@ public class Pool extends Element { * Return the pointer to this pool as an element. * * @return The pointer to the native pool which this object wraps. - * @throws PoolsExecption If there is an error converting the native + * @throws PoolsException If there is an error converting the native * pool pointer to a native elem pointer. */ protected long getElem() throws PoolsException diff --git a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Property.java b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Property.java index cf03d5835e..676c77c5fe 100644 --- a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Property.java +++ b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Property.java @@ -23,15 +23,13 @@ * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * - *ident "%Z%%M% %I% %E% SMI" - * */ package com.sun.solaris.service.pools; /** * The <code>Property</code> interface specifies the contract between - * a pools configuration element and it's properties. This interface + * a pools configuration element and its properties. This interface * must be implemented by all pools configuration elements to ensure that * properties can be manipulated. */ @@ -41,7 +39,7 @@ public interface Property { * Get a property with the supplied name. * * @param name The name of the property to be retrieved. - * @throws PoolsExecption If there is an error accessing the property. + * @throws PoolsException If there is an error accessing the property. */ public boolean getBoolProperty(String name) throws PoolsException; @@ -49,7 +47,7 @@ public interface Property { * Get a property with the supplied name. * * @param name The name of the property to be retrieved. - * @throws PoolsExecption If there is an error accessing the property. + * @throws PoolsException If there is an error accessing the property. */ public double getDoubleProperty(String name) throws PoolsException; @@ -57,7 +55,7 @@ public interface Property { * Get a property with the supplied name. * * @param name The name of the property to be retrieved. - * @throws PoolsExecption If there is an error accessing the property. + * @throws PoolsException If there is an error accessing the property. */ public long getLongProperty(String name) throws PoolsException; @@ -65,7 +63,7 @@ public interface Property { * Get a property with the supplied name. * * @param name The name of the property to be retrieved. - * @throws PoolsExecption If there is an error accessing the property. + * @throws PoolsException If there is an error accessing the property. */ public String getStringProperty(String name) throws PoolsException; @@ -74,7 +72,7 @@ public interface Property { * * @param name The name of the property to be updated. * @param value The value of the property to be updated. - * @throws PoolsExecption If there is an error accessing the property. + * @throws PoolsException If there is an error accessing the property. */ public void putProperty(String name, Value value) throws PoolsException; @@ -82,7 +80,7 @@ public interface Property { * Remove the property with the supplied name. * * @param name The name of the property to be removed. - * @throws PoolsExecption If there is an error removing the property. + * @throws PoolsException If there is an error removing the property. */ public void rmProperty(String name) throws PoolsException; } diff --git a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/PropertyWalk.java b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/PropertyWalk.java index 82f29845e0..de1827be43 100644 --- a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/PropertyWalk.java +++ b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/PropertyWalk.java @@ -23,8 +23,6 @@ * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * - *ident "%Z%%M% %I% %E% SMI" - * */ package com.sun.solaris.service.pools; @@ -40,12 +38,12 @@ import java.util.ArrayList; public interface PropertyWalk { /** - * Walk all properties of the invoking object, calling the + * Walk all properties of the invoking object, calling the * * @param elem The element to whom the property belongs. * @param val The value representing the current element. * @param user User supplied data, provided when the walk is invoked. - * @throws PoolsExecption If there is an error walking the property. + * @throws PoolsException If there is an error walking the property. * @return 0 to continue the walk, anything else to terminate it. */ public int walk(Element elem, Value val, Object user) diff --git a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Resource.java b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Resource.java index d09327e1bf..f907836998 100644 --- a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Resource.java +++ b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Resource.java @@ -22,8 +22,6 @@ /* * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. - * - *ident "%Z%%M% %I% %E% SMI" */ package com.sun.solaris.service.pools; @@ -69,7 +67,7 @@ public class Resource extends Element } /** - * Returns a pointer to the native resouce represented by this resource + * Returns a pointer to the native resource represented by this resource * object. * * @throws PoolsException If the pool cannot be located. @@ -96,7 +94,7 @@ public class Resource extends Element donor.getResource(), getResource(), qty) != PoolInternal.PO_SUCCESS) throw new PoolsException(); - } + } /** * Transfer the specified resource components from the donor to this @@ -114,7 +112,7 @@ public class Resource extends Element donor.getResource(), getResource(), components) != PoolInternal.PO_SUCCESS) throw new PoolsException(); - } + } /** * Get a list of components which match the supplied selection @@ -122,7 +120,7 @@ public class Resource extends Element * this resource are searched. * * @param values A list of values to be used to qualify the search. - * @throws PoolsExecption If there is an error executing the query. + * @throws PoolsException If there is an error executing the query. * @return a list of components which match the supplied criteria */ public List getComponents(List values) throws PoolsException @@ -211,7 +209,7 @@ public class Resource extends Element * Return the pointer to this resource as an element. * * @return The pointer to the native resource which this object wraps. - * @throws PoolsExecption If there is an error converting the native + * @throws PoolsException If there is an error converting the native * resource pointer to a native elem pointer. */ protected long getElem() throws PoolsException diff --git a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Value.java b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Value.java index f74ee135fd..5082b552fe 100644 --- a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Value.java +++ b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Value.java @@ -219,7 +219,7 @@ public class Value { * Set this value to take the supplied string value. * * @param value The value to which this value should be set. - * @throws PoolsExecption If the setting of the value fails. + * @throws PoolsException If the setting of the value fails. */ public void setValue(String value) throws PoolsException { diff --git a/usr/src/cmd/w/w.c b/usr/src/cmd/w/w.c index 65dda98621..7d56acf931 100644 --- a/usr/src/cmd/w/w.c +++ b/usr/src/cmd/w/w.c @@ -307,12 +307,13 @@ main(int argc, char *argv[]) if (hrs > 0 && mins > 0) { PRINTF((" %2d:%02d,", hrs, mins)); } else { - if (hrs > 0) + if (hrs > 0) { PRINTF((gettext( " %d hr(s),"), hrs)); - if (mins > 0) + } else { /* mins can be zero */ PRINTF((gettext( " %d min(s),"), mins)); + } } } } diff --git a/usr/src/cmd/zfs/zfs_iter.c b/usr/src/cmd/zfs/zfs_iter.c index e32748d290..4430913b0c 100644 --- a/usr/src/cmd/zfs/zfs_iter.c +++ b/usr/src/cmd/zfs/zfs_iter.c @@ -445,13 +445,13 @@ zfs_for_each(int argc, char **argv, int flags, zfs_type_t types, /* * If we're recursive, then we always allow filesystems as - * arguments. If we also are interested in snapshots, then we - * can take volumes as well. + * arguments. If we also are interested in snapshots or + * bookmarks, then we can take volumes as well. */ argtype = types; if (flags & ZFS_ITER_RECURSE) { argtype |= ZFS_TYPE_FILESYSTEM; - if (types & ZFS_TYPE_SNAPSHOT) + if (types & (ZFS_TYPE_SNAPSHOT | ZFS_TYPE_BOOKMARK)) argtype |= ZFS_TYPE_VOLUME; } diff --git a/usr/src/cmd/zfs/zfs_util.h b/usr/src/cmd/zfs/zfs_util.h index 3ddff9e22d..95ca4b76b8 100644 --- a/usr/src/cmd/zfs/zfs_util.h +++ b/usr/src/cmd/zfs/zfs_util.h @@ -31,9 +31,9 @@ extern "C" { #endif -void * safe_malloc(size_t size); -void nomem(void); -libzfs_handle_t *g_zfs; +extern void * safe_malloc(size_t size); +extern void nomem(void); +extern libzfs_handle_t *g_zfs; #ifdef __cplusplus } diff --git a/usr/src/cmd/zpool/zpool_main.c b/usr/src/cmd/zpool/zpool_main.c index cb13102874..4a904db641 100644 --- a/usr/src/cmd/zpool/zpool_main.c +++ b/usr/src/cmd/zpool/zpool_main.c @@ -70,6 +70,8 @@ #include "statcommon.h" +libzfs_handle_t *g_zfs; + static int zpool_do_create(int, char **); static int zpool_do_destroy(int, char **); diff --git a/usr/src/cmd/zpool/zpool_util.h b/usr/src/cmd/zpool/zpool_util.h index e4c93acf39..a4984e0528 100644 --- a/usr/src/cmd/zpool/zpool_util.h +++ b/usr/src/cmd/zpool/zpool_util.h @@ -35,44 +35,44 @@ extern "C" { /* * Basic utility functions */ -void *safe_malloc(size_t); -void zpool_no_memory(void); -uint_t num_logs(nvlist_t *nv); -uint64_t array64_max(uint64_t array[], unsigned int len); -int highbit64(uint64_t i); -int lowbit64(uint64_t i); -int isnumber(char *str); +extern void *safe_malloc(size_t); +extern void zpool_no_memory(void); +extern uint_t num_logs(nvlist_t *nv); +extern uint64_t array64_max(uint64_t array[], unsigned int len); +extern int highbit64(uint64_t i); +extern int lowbit64(uint64_t i); +extern int isnumber(char *str); /* * Virtual device functions */ -nvlist_t *make_root_vdev(zpool_handle_t *zhp, nvlist_t *props, int force, +extern nvlist_t *make_root_vdev(zpool_handle_t *zhp, nvlist_t *props, int force, int check_rep, boolean_t replacing, boolean_t dryrun, zpool_boot_label_t boot_type, uint64_t boot_size, int argc, char **argv); -nvlist_t *split_mirror_vdev(zpool_handle_t *zhp, char *newname, +extern nvlist_t *split_mirror_vdev(zpool_handle_t *zhp, char *newname, nvlist_t *props, splitflags_t flags, int argc, char **argv); /* * Pool list functions */ -int for_each_pool(int, char **, boolean_t unavail, zprop_list_t **, +extern int for_each_pool(int, char **, boolean_t unavail, zprop_list_t **, zpool_iter_f, void *); /* Vdev list functions */ typedef int (*pool_vdev_iter_f)(zpool_handle_t *, nvlist_t *, void *); -int for_each_vdev(zpool_handle_t *zhp, pool_vdev_iter_f func, void *data); +extern int for_each_vdev(zpool_handle_t *, pool_vdev_iter_f, void *); typedef struct zpool_list zpool_list_t; -zpool_list_t *pool_list_get(int, char **, zprop_list_t **, int *); -void pool_list_update(zpool_list_t *); -int pool_list_iter(zpool_list_t *, int unavail, zpool_iter_f, void *); -void pool_list_free(zpool_list_t *); -int pool_list_count(zpool_list_t *); -void pool_list_remove(zpool_list_t *, zpool_handle_t *); +extern zpool_list_t *pool_list_get(int, char **, zprop_list_t **, int *); +extern void pool_list_update(zpool_list_t *); +extern int pool_list_iter(zpool_list_t *, int unavail, zpool_iter_f, void *); +extern void pool_list_free(zpool_list_t *); +extern int pool_list_count(zpool_list_t *); +extern void pool_list_remove(zpool_list_t *, zpool_handle_t *); -libzfs_handle_t *g_zfs; +extern libzfs_handle_t *g_zfs; #ifdef __cplusplus } diff --git a/usr/src/common/ctf/ctf_impl.h b/usr/src/common/ctf/ctf_impl.h index b208cfb486..526e0f068c 100644 --- a/usr/src/common/ctf/ctf_impl.h +++ b/usr/src/common/ctf/ctf_impl.h @@ -312,6 +312,7 @@ extern void *ctf_alloc(size_t); extern void ctf_free(void *, size_t); extern char *ctf_strdup(const char *); +extern void ctf_strfree(char *); extern const char *ctf_strerror(int); extern void ctf_dprintf(const char *, ...); diff --git a/usr/src/common/ctf/ctf_util.c b/usr/src/common/ctf/ctf_util.c index 550195b5e1..f909bbc4af 100644 --- a/usr/src/common/ctf/ctf_util.c +++ b/usr/src/common/ctf/ctf_util.c @@ -149,6 +149,17 @@ ctf_strdup(const char *s1) } /* + * Free a string which was allocated via ctf_alloc() + */ +void +ctf_strfree(char *s) +{ + if (s == NULL) + return; + ctf_free(s, strlen(s) + 1); +} + +/* * Store the specified error code into errp if it is non-NULL, and then * return NULL for the benefit of the caller. */ diff --git a/usr/src/lib/fm/topo/modules/Makefile.plugin b/usr/src/lib/fm/topo/modules/Makefile.plugin index c42c02da80..c9203cd639 100644 --- a/usr/src/lib/fm/topo/modules/Makefile.plugin +++ b/usr/src/lib/fm/topo/modules/Makefile.plugin @@ -55,9 +55,6 @@ arch_ROOTCONF = $(ROOT)/usr/platform/$(ARCH)/lib/fm/topo/plugins/$(CONF) plat_ROOTCONF = $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/topo/plugins/$(CONF)) ROOTCONF = $($(CLASS)_ROOTCONF) -CERRWARN += $(CNOWARN_UNINIT) -CERRWARN += -_gcc=-Wno-parentheses - APIMAP = ../../../libtopo/common/topo_mod.map MAPFILES = # use APIMAP instead diff --git a/usr/src/lib/fm/topo/modules/common/disk/disk_common.c b/usr/src/lib/fm/topo/modules/common/disk/disk_common.c index 7c9027517d..0f4e03b813 100644 --- a/usr/src/lib/fm/topo/modules/common/disk/disk_common.c +++ b/usr/src/lib/fm/topo/modules/common/disk/disk_common.c @@ -1165,6 +1165,7 @@ disk_status(topo_mod_t *mod, tnode_t *nodep, topo_version_t vers, */ if (nvlist_lookup_string(in_nvl, "path", &fullpath) == 0) { devpath = NULL; + pathlen = 0; } else { /* * Get the /devices path and attempt to open the disk status diff --git a/usr/src/lib/fm/topo/modules/common/ipmi/ipmi_enum.c b/usr/src/lib/fm/topo/modules/common/ipmi/ipmi_enum.c index 8e867a447b..981596e4dc 100644 --- a/usr/src/lib/fm/topo/modules/common/ipmi/ipmi_enum.c +++ b/usr/src/lib/fm/topo/modules/common/ipmi/ipmi_enum.c @@ -454,6 +454,12 @@ ipmi_check_entity(ipmi_handle_t *ihp, ipmi_entity_t *ep, void *data) case IPMI_ET_FAN: labelname = "FAN"; break; + + default: + topo_mod_dprintf(mod, "unknown entity type, %u: cannot set " + "label name", edp->ed_entity); + nvlist_free(fmri); + return (1); } len = strlen(label); @@ -631,7 +637,7 @@ ipmi_enum_sp(topo_mod_t *mod, tnode_t *pnode) char ipv4_addr[INET_ADDRSTRLEN], subnet[INET_ADDRSTRLEN]; char gateway[INET_ADDRSTRLEN], macaddr[18]; char ipv6_addr[INET6_ADDRSTRLEN]; - char **ipv6_routes; + char **ipv6_routes = NULL; const char *sp_rev, *ipv4_cfgtype, *ipv6_cfgtype; nvlist_t *auth, *fmri; tnode_t *sp_node; diff --git a/usr/src/lib/fm/topo/modules/common/nic/topo_nic.c b/usr/src/lib/fm/topo/modules/common/nic/topo_nic.c index cd272a0c73..8478bd72db 100644 --- a/usr/src/lib/fm/topo/modules/common/nic/topo_nic.c +++ b/usr/src/lib/fm/topo/modules/common/nic/topo_nic.c @@ -251,6 +251,8 @@ nic_create_transceiver(topo_mod_t *mod, tnode_t *pnode, dladm_handle_t handle, case NIC_PORT_SFF: ret = port_create_sff(mod, pnode, tranid, &port); break; + default: + return (-1); } if ((ret = nic_port_datalink_props(mod, port, handle, linkid)) != 0) diff --git a/usr/src/lib/fm/topo/modules/common/pcibus/pcibus.c b/usr/src/lib/fm/topo/modules/common/pcibus/pcibus.c index b2b56e5eea..92c5b721e9 100644 --- a/usr/src/lib/fm/topo/modules/common/pcibus/pcibus.c +++ b/usr/src/lib/fm/topo/modules/common/pcibus/pcibus.c @@ -671,7 +671,7 @@ declare_dev_and_fn(topo_mod_t *mod, tnode_t *bus, tnode_t **dev, di_node_t din, tnode_t *fn; uint_t class, subclass; uint_t vid, did; - uint_t pdev_sz; + uint_t pdev_sz = 0; did_t *dp = NULL; if (*dev == NULL) { diff --git a/usr/src/lib/fm/topo/modules/common/pcibus/pcibus_labels.c b/usr/src/lib/fm/topo/modules/common/pcibus/pcibus_labels.c index 1a767312a1..254cae00c3 100644 --- a/usr/src/lib/fm/topo/modules/common/pcibus/pcibus_labels.c +++ b/usr/src/lib/fm/topo/modules/common/pcibus/pcibus_labels.c @@ -127,7 +127,7 @@ pci_label_slotname_lookup(topo_mod_t *mod, char *platform, topo_mod_dprintf(mod, "%s: calling test function=%p\n", __func__, rw.srw_test); - if (ret = rw.srw_test(mod, dp)) + if ((ret = rw.srw_test(mod, dp)) != 0) rlabel = rw.srw_new; topo_mod_dprintf(mod, "%s: test function return=%d\n", @@ -192,7 +192,7 @@ pci_label_missing_lookup(topo_mod_t *mod, char *platform, did_t *dp) topo_mod_dprintf(mod, "%s: calling test function=%p\n", __func__, m.dl_test); - if (ret = m.dl_test(mod, dp)) + if ((ret = m.dl_test(mod, dp)) != 0) rlabel = m.dl_label; topo_mod_dprintf(mod, "%s: test function return=%d\n", @@ -222,7 +222,7 @@ pci_slot_label_lookup(topo_mod_t *mod, tnode_t *node, did_t *dp, did_t *pdp) { tnode_t *anode, *apnode; did_t *adp, *apdp; - char *plat, *pp, *l, *ancestor_l = NULL, *new_l = NULL; + char *plat, *pp, *l = NULL, *ancestor_l = NULL, *new_l = NULL; int err, b, d, f, done = 0; size_t len; diff --git a/usr/src/lib/fm/topo/modules/common/shared/topo_sensor.c b/usr/src/lib/fm/topo/modules/common/shared/topo_sensor.c index a716c57a66..3cf969d697 100644 --- a/usr/src/lib/fm/topo/modules/common/shared/topo_sensor.c +++ b/usr/src/lib/fm/topo/modules/common/shared/topo_sensor.c @@ -260,7 +260,7 @@ topo_sensor_create_scalar_sensor(topo_mod_t *mod, tnode_t *pnode, reader_arg, &err) != 0) { topo_mod_dprintf(mod, "failed to set argument for sensor %s: " "%s", path, topo_strerror(err)); - err = topo_mod_seterrno(mod, err); + ret = topo_mod_seterrno(mod, err); goto out; } diff --git a/usr/src/lib/fm/topo/modules/i86pc/chip/chip_amd.c b/usr/src/lib/fm/topo/modules/i86pc/chip/chip_amd.c index d9a8eca7b8..0ac0523cf6 100644 --- a/usr/src/lib/fm/topo/modules/i86pc/chip/chip_amd.c +++ b/usr/src/lib/fm/topo/modules/i86pc/chip/chip_amd.c @@ -467,10 +467,10 @@ amd_dimm_create(topo_mod_t *mod, uint16_t chip_smbid, tnode_t *pnode, nvlist_t *fmri, **dimmarr = NULL; uint64_t num; uint_t ndimm; - id_t smbid; - const char *serial; - const char *part; - const char *rev; + id_t smbid = -1; + const char *serial = NULL; + const char *part = NULL; + const char *rev = NULL; if (nvlist_lookup_nvlist_array(mc, "dimmlist", &dimmarr, &ndimm) != 0) { whinge(mod, NULL, "amd_dimm_create: dimmlist lookup failed\n"); @@ -562,10 +562,10 @@ amd_dimm_create(topo_mod_t *mod, uint16_t chip_smbid, tnode_t *pnode, for (nvp = nvlist_next_nvpair(dimmarr[i], NULL); nvp != NULL; nvp = nvlist_next_nvpair(dimmarr[i], nvp)) { - if (nvpair_type(nvp) == DATA_TYPE_UINT64_ARRAY && - strcmp(nvpair_name(nvp), "csnums") == 0 || - nvpair_type(nvp) == DATA_TYPE_STRING_ARRAY && - strcmp(nvpair_name(nvp), "csnames") == 0) + if ((nvpair_type(nvp) == DATA_TYPE_UINT64_ARRAY && + strcmp(nvpair_name(nvp), "csnums") == 0) || + (nvpair_type(nvp) == DATA_TYPE_STRING_ARRAY && + strcmp(nvpair_name(nvp), "csnames") == 0)) continue; /* used in amd_rank_create() */ nerr += nvprop_add(mod, nvp, PGNAME(DIMM), dimmnode); diff --git a/usr/src/lib/fm/topo/modules/i86pc/chip/chip_intel.c b/usr/src/lib/fm/topo/modules/i86pc/chip/chip_intel.c index df6e2b6f95..4168a3516e 100644 --- a/usr/src/lib/fm/topo/modules/i86pc/chip/chip_intel.c +++ b/usr/src/lib/fm/topo/modules/i86pc/chip/chip_intel.c @@ -200,7 +200,7 @@ mc_add_dimms(topo_mod_t *mod, uint16_t chip_smbid, tnode_t *pnode, char *rev = NULL; char *label = NULL; char *name; - id_t smbid; + id_t smbid = -1; if (topo_node_range_create(mod, pnode, DIMM, 0, maxdimms ? maxdimms-1 : ndimms-1) < 0) { diff --git a/usr/src/lib/fm/topo/modules/sun4v/platform-mem/mem_mdesc.c b/usr/src/lib/fm/topo/modules/sun4v/platform-mem/mem_mdesc.c index 37faa04d1e..00ae460ccf 100644 --- a/usr/src/lib/fm/topo/modules/sun4v/platform-mem/mem_mdesc.c +++ b/usr/src/lib/fm/topo/modules/sun4v/platform-mem/mem_mdesc.c @@ -200,13 +200,14 @@ mem_get_dimm_by_sn(char *sn, md_mem_info_t *mem) mem_grp_t * find_grp(mde_cookie_t *listp, size_t n, mde_cookie_t *bclist, - mem_bank_map_t **banklist, size_t mem_bank_count, md_mem_info_t *mem) { - + mem_bank_map_t **banklist, size_t mem_bank_count, md_mem_info_t *mem) +{ mem_grp_t *mg; mem_bank_map_t *bp; size_t i, j; int err; + err = 0; for (mg = mem->mem_group; mg != NULL; mg = mg->mg_next) { if (mg->mg_size == n) { err = 0; @@ -220,9 +221,9 @@ find_grp(mde_cookie_t *listp, size_t n, mde_cookie_t *bclist, } if (bp == NULL) err++; } - } - else + } else { err++; + } if (err == 0) return (mg); } @@ -231,8 +232,8 @@ find_grp(mde_cookie_t *listp, size_t n, mde_cookie_t *bclist, mem_grp_t * create_grp(topo_mod_t *mod, mde_cookie_t *listp, size_t n, mde_cookie_t *bclist, - mem_bank_map_t **banklist, size_t mem_bank_count, md_mem_info_t *mem) { - + mem_bank_map_t **banklist, size_t mem_bank_count, md_mem_info_t *mem) +{ mem_grp_t *mg; size_t i, j; diff --git a/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_subr.c b/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_subr.c index b31eb28683..60ceb89b21 100644 --- a/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_subr.c +++ b/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_subr.c @@ -355,6 +355,7 @@ pi_get_chassisid(topo_mod_t *mod, md_t *mdp, mde_cookie_t mde_node) num_nodes, MD_STR_COMPONENT); idx = 0; + result = 0; while (id == NULL && idx < num_nodes) { hc_name = pi_get_topo_hc_name(mod, mdp, chassis_nodes[idx]); if (hc_name != NULL && strcmp(hc_name, MD_STR_CHASSIS) == 0) { @@ -976,7 +977,7 @@ int pi_set_auth(topo_mod_t *mod, md_t *mdp, mde_cookie_t mde_node, tnode_t *t_parent, tnode_t *t_node) { - int result; + int result; int err; nvlist_t *auth; char *val = NULL; diff --git a/usr/src/lib/libbe/common/be_activate.c b/usr/src/lib/libbe/common/be_activate.c index 6133f2ca59..4ec8f055e2 100644 --- a/usr/src/lib/libbe/common/be_activate.c +++ b/usr/src/lib/libbe/common/be_activate.c @@ -26,7 +26,7 @@ /* * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright 2016 Toomas Soome <tsoome@me.com> - * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ #include <assert.h> @@ -333,36 +333,39 @@ _be_activate(char *be_name, be_nextboot_state_t nextboot) } } - if ((zhp = zfs_open(g_zfs, root_ds, ZFS_TYPE_FILESYSTEM)) != NULL) { - /* - * We don't need to close the zfs handle at this - * point because The callback funtion - * be_promote_ds_callback() will close it for us. - */ - if (be_promote_ds_callback(zhp, NULL) != 0) { - be_print_err(gettext("be_activate: " - "failed to activate the " - "datasets for %s: %s\n"), - root_ds, + if (nextboot == BE_NEXTBOOT_IGNORE) { + if ((zhp = zfs_open(g_zfs, root_ds, ZFS_TYPE_FILESYSTEM)) != + NULL) { + /* + * We don't need to close the zfs handle at this + * point because The callback funtion + * be_promote_ds_callback() will close it for us. + */ + if (be_promote_ds_callback(zhp, NULL) != 0) { + be_print_err(gettext("be_activate: " + "failed to activate the " + "datasets for %s: %s\n"), + root_ds, + libzfs_error_description(g_zfs)); + ret = BE_ERR_PROMOTE; + goto done; + } + } else { + be_print_err(gettext("be_activate: failed to open " + "dataset (%s): %s\n"), root_ds, libzfs_error_description(g_zfs)); - ret = BE_ERR_PROMOTE; + ret = zfs_err_to_be_err(g_zfs); goto done; } - } else { - be_print_err(gettext("be_activate: failed to open " - "dataset (%s): %s\n"), root_ds, - libzfs_error_description(g_zfs)); - ret = zfs_err_to_be_err(g_zfs); - goto done; - } - if (getzoneid() == GLOBAL_ZONEID && - be_get_uuid(cb.obe_root_ds, &uu) == BE_SUCCESS && - (ret = be_promote_zone_ds(cb.obe_name, cb.obe_root_ds)) - != BE_SUCCESS) { - be_print_err(gettext("be_activate: failed to promote " - "the active zonepath datasets for zones in BE %s\n"), - cb.obe_name); + if (getzoneid() == GLOBAL_ZONEID && + be_get_uuid(cb.obe_root_ds, &uu) == BE_SUCCESS && + (ret = be_promote_zone_ds(cb.obe_name, cb.obe_root_ds)) + != BE_SUCCESS) { + be_print_err(gettext("be_activate: failed to promote " + "the active zonepath datasets for zones in BE " + "%s\n"), cb.obe_name); + } } if (getzoneid() != GLOBAL_ZONEID) { diff --git a/usr/src/lib/libctf/common/ctf_convert.c b/usr/src/lib/libctf/common/ctf_convert.c index 5b6c8a72b2..31b2ed429d 100644 --- a/usr/src/lib/libctf/common/ctf_convert.c +++ b/usr/src/lib/libctf/common/ctf_convert.c @@ -11,20 +11,22 @@ /* * Copyright 2019 Joyent, Inc. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ /* * Main conversion entry points. This has been designed such that there can be * any number of different conversion backends. Currently we only have one that - * understands DWARFv2 (and bits of DWARFv4). Each backend should be placed in + * understands DWARFv2 and DWARFv4. Each backend should be placed in * the ctf_converters list and each will be tried in turn. */ #include <libctf_impl.h> #include <assert.h> #include <gelf.h> +#include <sys/list.h> -ctf_convert_f ctf_converters[] = { +static ctf_convert_f ctf_converters[] = { ctf_dwarf_convert }; @@ -52,8 +54,10 @@ ctf_has_c_source(Elf *elf, char *errmsg, size_t errlen) break; } - if (scn == NULL) + if (scn == NULL) { + ctf_dprintf("Could not find symbol table section\n"); return (CHR_NO_C_SOURCE); + } if ((strscn = elf_getscn(elf, shdr.sh_link)) == NULL) { (void) snprintf(errmsg, errlen, "failed to get str section: %s", @@ -73,6 +77,8 @@ ctf_has_c_source(Elf *elf, char *errmsg, size_t errlen) return (CHR_ERROR); } + ctf_dprintf("Walking string table looking for .c files\n"); + for (i = 0; i < shdr.sh_size / shdr.sh_entsize; i++) { GElf_Sym sym; const char *file; @@ -85,13 +91,19 @@ ctf_has_c_source(Elf *elf, char *errmsg, size_t errlen) return (CHR_ERROR); } - if (GELF_ST_TYPE(sym.st_info) != STT_FILE) + file = (const char *)((uintptr_t)strdata->d_buf + sym.st_name); + + if (GELF_ST_TYPE(sym.st_info) != STT_FILE) { + ctf_dprintf("'%s'\n", file); continue; + } + + ctf_dprintf("'%s'; is a file\n", file); - file = (const char *)((uintptr_t)strdata->d_buf + sym.st_name); len = strlen(file); if (len >= 2 && strncmp(".c", &file[len - 2], 2) == 0) { ret = CHR_HAS_C_SOURCE; + ctf_dprintf("Found .c file - '%s'\n", file); break; } } @@ -100,11 +112,12 @@ ctf_has_c_source(Elf *elf, char *errmsg, size_t errlen) } ctf_file_t * -ctf_elfconvert(int fd, Elf *elf, const char *label, uint_t bsize, uint_t nthrs, - uint_t flags, int *errp, char *errbuf, size_t errlen) +ctf_elfconvert(ctf_convert_t *cch, int fd, Elf *elf, int *errp, char *errbuf, + size_t errlen) { int err, i; ctf_file_t *fp = NULL; + boolean_t no_c_src = B_FALSE; if (errp == NULL) errp = &err; @@ -114,11 +127,6 @@ ctf_elfconvert(int fd, Elf *elf, const char *label, uint_t bsize, uint_t nthrs, return (NULL); } - if (flags & ~CTF_ALLOW_MISSING_DEBUG) { - *errp = EINVAL; - return (NULL); - } - if (elf_kind(elf) != ELF_K_ELF) { *errp = ECTF_FMT; return (NULL); @@ -130,8 +138,12 @@ ctf_elfconvert(int fd, Elf *elf, const char *label, uint_t bsize, uint_t nthrs, return (NULL); case CHR_NO_C_SOURCE: - *errp = ECTF_CONVNOCSRC; - return (NULL); + if ((cch->cch_flags & CTF_FORCE_CONVERSION) == 0) { + *errp = ECTF_CONVNOCSRC; + return (NULL); + } + no_c_src = B_TRUE; + break; default: break; @@ -139,8 +151,7 @@ ctf_elfconvert(int fd, Elf *elf, const char *label, uint_t bsize, uint_t nthrs, for (i = 0; i < NCONVERTS; i++) { fp = NULL; - err = ctf_converters[i](fd, elf, bsize, nthrs, flags, - &fp, errbuf, errlen); + err = ctf_converters[i](cch, fd, elf, &fp, errbuf, errlen); if (err != ECTF_CONVNODEBUG) break; @@ -148,12 +159,21 @@ ctf_elfconvert(int fd, Elf *elf, const char *label, uint_t bsize, uint_t nthrs, if (err != 0) { assert(fp == NULL); - *errp = err; + /* + * If no C source was found but we attempted conversion anyway + * due to CTF_FORCE_CONVERSION, and none of the converters + * was able to process the object, return ECTF_CONVNOCSRC. + */ + if (no_c_src && err == ECTF_CONVNODEBUG) + *errp = ECTF_CONVNOCSRC; + else + *errp = err; return (NULL); } - if (label != NULL) { - if (ctf_add_label(fp, label, fp->ctf_typemax, 0) == CTF_ERR) { + if (cch->cch_label != NULL) { + if (ctf_add_label(fp, cch->cch_label, fp->ctf_typemax, 0) == + CTF_ERR) { *errp = ctf_errno(fp); ctf_close(fp); return (NULL); @@ -168,9 +188,131 @@ ctf_elfconvert(int fd, Elf *elf, const char *label, uint_t bsize, uint_t nthrs, return (fp); } +ctf_convert_t * +ctf_convert_init(int *errp) +{ + struct ctf_convert_handle *cch; + int err; + + if (errp == NULL) + errp = &err; + *errp = 0; + + cch = ctf_alloc(sizeof (struct ctf_convert_handle)); + if (cch == NULL) { + *errp = ENOMEM; + return (NULL); + } + + cch->cch_label = NULL; + cch->cch_flags = 0; + cch->cch_nthreads = CTF_CONVERT_DEFAULT_NTHREADS; + cch->cch_batchsize = CTF_CONVERT_DEFAULT_BATCHSIZE; + cch->cch_warncb = NULL; + cch->cch_warncb_arg = NULL; + list_create(&cch->cch_nodebug, sizeof (ctf_convert_filelist_t), + offsetof(ctf_convert_filelist_t, ccf_node)); + + return (cch); +} + +static void +ctf_convert_fini_filelist(ctf_convert_filelist_t *ccf) +{ + ctf_strfree(ccf->ccf_basename); + ctf_free(ccf, sizeof (ctf_convert_filelist_t)); +} + +void +ctf_convert_fini(ctf_convert_t *cch) +{ + ctf_convert_filelist_t *ccf; + + ctf_strfree(cch->cch_label); + while ((ccf = list_remove_head(&cch->cch_nodebug)) != NULL) + ctf_convert_fini_filelist(ccf); + list_destroy(&cch->cch_nodebug); + + ctf_free(cch, sizeof (struct ctf_convert_handle)); +} + +int +ctf_convert_set_nthreads(ctf_convert_t *cch, uint_t nthrs) +{ + if (nthrs == 0) + return (EINVAL); + cch->cch_nthreads = nthrs; + return (0); +} + +int +ctf_convert_set_batchsize(ctf_convert_t *cch, uint_t bsize) +{ + if (bsize == 0) + return (EINVAL); + cch->cch_batchsize = bsize; + return (0); +} + +int +ctf_convert_set_flags(ctf_convert_t *cch, uint_t flags) +{ + if ((flags & ~CTF_CONVERT_ALL_FLAGS) != 0) + return (EINVAL); + cch->cch_flags = flags; + return (0); +} + +int +ctf_convert_set_label(ctf_convert_t *cch, const char *label) +{ + char *dup; + + if (label == NULL) + return (EINVAL); + + dup = ctf_strdup(label); + if (dup == NULL) + return (ENOMEM); + + ctf_strfree(cch->cch_label); + cch->cch_label = dup; + return (0); +} + +int +ctf_convert_set_warncb(ctf_convert_t *cch, ctf_convert_warn_f cb, void *arg) +{ + cch->cch_warncb = cb; + cch->cch_warncb_arg = arg; + return (0); +} + +int +ctf_convert_add_ignore(ctf_convert_t *cch, const char *basename) +{ + ctf_convert_filelist_t *ccf; + + if (strchr(basename, '/') != NULL) + return (EINVAL); + + ccf = ctf_alloc(sizeof (ctf_convert_filelist_t)); + if (ccf == NULL) + return (ENOMEM); + + ccf->ccf_basename = ctf_strdup(basename); + if (ccf->ccf_basename == NULL) { + ctf_free(ccf, sizeof (ctf_convert_filelist_t)); + return (ENOMEM); + } + list_insert_tail(&cch->cch_nodebug, ccf); + + return (0); +} + ctf_file_t * -ctf_fdconvert(int fd, const char *label, uint_t bsize, uint_t nthrs, - uint_t flags, int *errp, char *errbuf, size_t errlen) +ctf_fdconvert(ctf_convert_t *cch, int fd, int *errp, + char *errbuf, size_t errlen) { int err; Elf *elf; @@ -185,8 +327,7 @@ ctf_fdconvert(int fd, const char *label, uint_t bsize, uint_t nthrs, return (NULL); } - fp = ctf_elfconvert(fd, elf, label, bsize, nthrs, flags, errp, errbuf, - errlen); + fp = ctf_elfconvert(cch, fd, elf, errp, errbuf, errlen); (void) elf_end(elf); return (fp); diff --git a/usr/src/lib/libctf/common/ctf_dwarf.c b/usr/src/lib/libctf/common/ctf_dwarf.c index 1618c8add4..b0b221f96e 100644 --- a/usr/src/lib/libctf/common/ctf_dwarf.c +++ b/usr/src/lib/libctf/common/ctf_dwarf.c @@ -202,6 +202,7 @@ #include <libctf_impl.h> #include <sys/avl.h> #include <sys/debug.h> +#include <sys/list.h> #include <gelf.h> #include <libdwarf.h> #include <dwarf.h> @@ -274,6 +275,7 @@ typedef struct ctf_die { avl_tree_t cu_map; /* map die offsets to CTF types */ char *cu_errbuf; /* error message buffer */ size_t cu_errlen; /* error message buffer length */ + ctf_convert_t *cu_handle; /* ctf convert handle */ size_t cu_ptrsz; /* object's pointer size */ boolean_t cu_bigend; /* is it big endian */ boolean_t cu_doweaks; /* should we convert weak symbols? */ @@ -485,7 +487,7 @@ ctf_dwarf_ref(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Half name, Dwarf_Off *refp) } (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "failed to get unsigned attribute for type: %s\n", + "failed to get attribute descriptor offset: %s\n", dwarf_errmsg(derr)); return (ECTF_CONVBKERR); } @@ -535,7 +537,7 @@ ctf_dwarf_signed(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Half name, } (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "failed to get unsigned attribute for type: %s\n", + "failed to get signed attribute for type: %s\n", dwarf_errmsg(derr)); return (ECTF_CONVBKERR); } @@ -649,7 +651,8 @@ ctf_dwarf_member_location(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Unsigned *valp) DWARF_UNLOCK(cup); if (ret != DW_DLV_OK) { (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "failed to get dwarf attribute for for member location: %s", + "failed to get dwarf attribute for for member " + "location: %s\n", dwarf_errmsg(derr)); ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); return (ECTF_CONVBKERR); @@ -679,7 +682,7 @@ ctf_dwarf_member_location(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Unsigned *valp) if (sign < 0) { (void) snprintf(cup->cu_errbuf, cup->cu_errlen, "encountered negative member data " - "location: %d", sign); + "location: %lld\n", sign); } *valp = (Dwarf_Unsigned)sign; return (0); @@ -689,7 +692,7 @@ ctf_dwarf_member_location(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Unsigned *valp) if (dwarf_loclist(attr, &loc, &locnum, &derr) != DW_DLV_OK) { DWARF_UNLOCK(cup); (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "failed to obtain location list for member offset: %s", + "failed to obtain location list for member offset: %s\n", dwarf_errmsg(derr)); ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); return (ECTF_CONVBKERR); @@ -699,7 +702,7 @@ ctf_dwarf_member_location(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Unsigned *valp) if (locnum != 1 || loc->ld_s->lr_atom != DW_OP_plus_uconst) { (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "failed to parse location structure for member"); + "failed to parse location structure for member\n"); ctf_dwarf_dealloc(cup, loc->ld_s, DW_DLA_LOC_BLOCK); ctf_dwarf_dealloc(cup, loc, DW_DLA_LOCDESC); return (ECTF_CONVBKERR); @@ -853,7 +856,7 @@ ctf_dwarf_die_elfenc(Elf *elf, ctf_cu_t *cup, char *errbuf, size_t errlen) VERIFY(ctf_setmodel(cup->cu_ctfp, CTF_MODEL_LP64) == 0); } else { (void) snprintf(errbuf, errlen, - "unknown ELF class %d", ehdr.e_ident[EI_CLASS]); + "unknown ELF class %d\n", ehdr.e_ident[EI_CLASS]); return (ECTF_CONVBKERR); } @@ -863,7 +866,7 @@ ctf_dwarf_die_elfenc(Elf *elf, ctf_cu_t *cup, char *errbuf, size_t errlen) cup->cu_bigend = B_TRUE; } else { (void) snprintf(errbuf, errlen, - "unknown ELF data encoding: %hhu", ehdr.e_ident[EI_DATA]); + "unknown ELF data encoding: %hhu\n", ehdr.e_ident[EI_DATA]); return (ECTF_CONVBKERR); } @@ -877,7 +880,7 @@ typedef struct ctf_dwarf_fpent { typedef struct ctf_dwarf_fpmap { uint_t cdf_mach; - ctf_dwarf_fpent_t cdf_ents[4]; + ctf_dwarf_fpent_t cdf_ents[5]; } ctf_dwarf_fpmap_t; static const ctf_dwarf_fpmap_t ctf_dwarf_fpmaps[] = { @@ -903,6 +906,17 @@ static const ctf_dwarf_fpmap_t ctf_dwarf_fpmaps[] = { { 4, { CTF_FP_SINGLE, CTF_FP_CPLX, CTF_FP_IMAGRY } }, { 8, { CTF_FP_DOUBLE, CTF_FP_DCPLX, CTF_FP_DIMAGRY } }, { 12, { CTF_FP_LDOUBLE, CTF_FP_LDCPLX, CTF_FP_LDIMAGRY } }, + /* + * ISO/IEC TS-18661-3:2015 defines several types with analogues + * to existing C types. However, in the i386 ABI there is no + * corresponding type for a _Float128. While, ideally we would + * add this as a discrete type, when C2x formally standardizes + * this and a number of additional extensions, we'll want to + * change that around. In the interim, we'll encode it as a + * weirdly sized long-double, even though not all the tools + * will expect an off-abi encoding. + */ + { 16, { CTF_FP_LDOUBLE, CTF_FP_LDCPLX, CTF_FP_LDIMAGRY } }, { 0, { 0 } } } }, { EM_X86_64, { @@ -983,7 +997,7 @@ ctf_dwarf_float_base(ctf_cu_t *cup, Dwarf_Signed type, ctf_encoding_t *enc) } (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "failed to find valid fp mapping for encoding %d, size %d bits\n", + "failed to find valid fp mapping for encoding %lld, size %d bits\n", type, enc->cte_bits); return (EINVAL); } @@ -1031,7 +1045,7 @@ ctf_dwarf_dwarf_base(ctf_cu_t *cup, Dwarf_Die die, int *kindp, break; default: (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "encountered unknown DWARF encoding: %d", type); + "encountered unknown DWARF encoding: %lld\n", type); return (ECTF_CONVBKERR); } @@ -1139,7 +1153,7 @@ ctf_dwarf_create_base(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, int isroot, bzero(&enc, sizeof (ctf_encoding_t)); enc.cte_bits = sz * 8; if ((ret = ctf_dwarf_parse_int(name, &kind, &enc, &nname)) == 0) { - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); name = nname; } else { if (ret != EINVAL) { @@ -1154,7 +1168,7 @@ ctf_dwarf_create_base(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, int isroot, &enc, &nname)) != 0) { goto out; } else if (nname != NULL) { - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); name = nname; } } @@ -1167,7 +1181,7 @@ ctf_dwarf_create_base(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, int isroot, ret = ctf_dwmap_add(cup, id, die, B_FALSE); } out: - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); return (ret); } @@ -1230,7 +1244,7 @@ ctf_dwarf_member_offset(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t mid, if ((tsz = ctf_type_size(cup->cu_ctfp, mid)) == CTF_ERR) { int e = ctf_errno(cup->cu_ctfp); (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "failed to get type size: %s", ctf_errmsg(e)); + "failed to get type size: %s\n", ctf_errmsg(e)); return (ECTF_CONVBKERR); } } else { @@ -1350,7 +1364,7 @@ ctf_dwarf_member_bitfield(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp) name, &e); if (cdb->cdb_id == CTF_ERR) { (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "failed to get add bitfield type %s: %s", name, + "failed to get add bitfield type %s: %s\n", name, ctf_errmsg(ctf_errno(cup->cu_ctfp))); ctf_free(name, namesz + 1); ctf_free(cdb, sizeof (ctf_dwbitf_t)); @@ -1427,7 +1441,7 @@ ctf_dwarf_fixup_sou(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t base, boolean_t add) } else if ((ret = ctf_dwarf_member_offset(cup, memb, mid, &memboff)) != 0) { if (mname != NULL) - ctf_free(mname, strlen(mname) + 1); + ctf_strfree(mname); return (ret); } @@ -1437,15 +1451,15 @@ ctf_dwarf_fixup_sou(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t base, boolean_t add) ret = ctf_add_member(cup->cu_ctfp, base, mname, mid, memboff); if (ret == CTF_ERR) { (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "failed to add member %s: %s", + "failed to add member %s: %s\n", mname, ctf_errmsg(ctf_errno(cup->cu_ctfp))); if (mname != NULL) - ctf_free(mname, strlen(mname) + 1); + ctf_strfree(mname); return (ECTF_CONVBKERR); } if (mname != NULL) - ctf_free(mname, strlen(mname) + 1); + ctf_strfree(mname); next: if ((ret = ctf_dwarf_sib(cup, memb, &sib)) != 0) @@ -1466,7 +1480,7 @@ next: if ((ctf_set_size(cup->cu_ctfp, base, size)) == CTF_ERR) { int e = ctf_errno(cup->cu_ctfp); (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "failed to set type size for %d to 0x%x: %s", base, + "failed to set type size for %d to 0x%x: %s\n", base, (uint32_t)size, ctf_errmsg(e)); return (ECTF_CONVBKERR); } @@ -1517,7 +1531,7 @@ ctf_dwarf_create_sou(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, ctf_dprintf("added sou %s (%d) (%ld) forward=%d\n", name, kind, base, decl == B_TRUE); if (name != NULL) - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); if (base == CTF_ERR) return (ctf_errno(cup->cu_ctfp)); *idp = base; @@ -1832,33 +1846,28 @@ ctf_dwarf_create_reference(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, ctf_id_t id; Dwarf_Die tdie; char *name; - size_t namelen; if ((ret = ctf_dwarf_string(cup, die, DW_AT_name, &name)) != 0 && ret != ENOENT) return (ret); - if (ret == ENOENT) { + if (ret == ENOENT) name = NULL; - namelen = 0; - } else { - namelen = strlen(name); - } ctf_dprintf("reference kind %d %s\n", kind, name != NULL ? name : "<>"); if ((ret = ctf_dwarf_refdie(cup, die, DW_AT_type, &tdie)) != 0) { if (ret != ENOENT) { - ctf_free(name, namelen); + ctf_strfree(name); return (ret); } if ((id = ctf_dwarf_void(cup)) == CTF_ERR) { - ctf_free(name, namelen); + ctf_strfree(name); return (ctf_errno(cup->cu_ctfp)); } } else { if ((ret = ctf_dwarf_convert_type(cup, tdie, &id, CTF_ADD_NONROOT)) != 0) { - ctf_free(name, namelen); + ctf_strfree(name); return (ret); } } @@ -1870,17 +1879,17 @@ ctf_dwarf_create_reference(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, *idp = id; } - ctf_free(name, namelen); + ctf_strfree(name); return (ret); } if ((*idp = ctf_add_reftype(cup->cu_ctfp, isroot, name, id, kind)) == CTF_ERR) { - ctf_free(name, namelen); + ctf_strfree(name); return (ctf_errno(cup->cu_ctfp)); } - ctf_free(name, namelen); + ctf_strfree(name); return (ctf_dwmap_add(cup, *idp, die, B_FALSE)); } @@ -1891,14 +1900,14 @@ ctf_dwarf_create_enum(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, int isroot) Dwarf_Die child; Dwarf_Unsigned dw; ctf_id_t id; - char *name; + char *enumname; int ret; - if ((ret = ctf_dwarf_string(cup, die, DW_AT_name, &name)) != 0 && - ret != ENOENT) + ret = ctf_dwarf_string(cup, die, DW_AT_name, &enumname); + if (ret != 0 && ret != ENOENT) return (ret); if (ret == ENOENT) - name = NULL; + enumname = NULL; /* * Enumerations may have a size associated with them, particularly if @@ -1910,20 +1919,21 @@ ctf_dwarf_create_enum(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, int isroot) size = (size_t)dw; } - id = ctf_add_enum(cup->cu_ctfp, isroot, name, size); - ctf_dprintf("added enum %s (%d)\n", name, id); - if (name != NULL) - ctf_free(name, strlen(name) + 1); - if (id == CTF_ERR) - return (ctf_errno(cup->cu_ctfp)); + id = ctf_add_enum(cup->cu_ctfp, isroot, enumname, size); + ctf_dprintf("added enum %s (%d)\n", + enumname == NULL ? "<anon>" : enumname, id); + if (id == CTF_ERR) { + ret = ctf_errno(cup->cu_ctfp); + goto out; + } *idp = id; if ((ret = ctf_dwmap_add(cup, id, die, B_FALSE)) != 0) - return (ret); + goto out; if ((ret = ctf_dwarf_child(cup, die, &child)) != 0) { if (ret == ENOENT) ret = 0; - return (ret); + goto out; } while (child != NULL) { @@ -1931,18 +1941,20 @@ ctf_dwarf_create_enum(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, int isroot) Dwarf_Signed sval; Dwarf_Unsigned uval; Dwarf_Die arg = child; + char *name; int eval; if ((ret = ctf_dwarf_sib(cup, arg, &child)) != 0) - return (ret); + break; if ((ret = ctf_dwarf_tag(cup, arg, &tag)) != 0) - return (ret); + break; if (tag != DW_TAG_enumerator) { if ((ret = ctf_dwarf_convert_type(cup, arg, NULL, - CTF_ADD_NONROOT)) != 0) - return (ret); + CTF_ADD_NONROOT)) != 0) { + break; + } continue; } @@ -1950,7 +1962,7 @@ ctf_dwarf_create_enum(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, int isroot) * DWARF v4 section 5.7 tells us we'll always have names. */ if ((ret = ctf_dwarf_string(cup, arg, DW_AT_name, &name)) != 0) - return (ret); + break; /* * We have to be careful here: newer GCCs generate DWARF where @@ -1961,32 +1973,62 @@ ctf_dwarf_create_enum(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, int isroot) if ((ret = ctf_dwarf_unsigned(cup, arg, DW_AT_const_value, &uval)) == 0) { eval = (int)uval; - } else if ((ret = ctf_dwarf_signed(cup, arg, DW_AT_const_value, - &sval)) == 0) { - eval = sval; + } else { + /* + * ctf_dwarf_unsigned will have left an error in the + * buffer + */ + *cup->cu_errbuf = '\0'; + + if ((ret = ctf_dwarf_signed(cup, arg, DW_AT_const_value, + &sval)) == 0) { + eval = sval; + } } if (ret != 0) { - if (ret != ENOENT) - return (ret); - - (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "encountered enumeration without constant value\n"); - return (ECTF_CONVBKERR); + if (ret == ENOENT) { + (void) snprintf(cup->cu_errbuf, cup->cu_errlen, + "encountered enumeration without constant " + "value\n"); + ret = ECTF_CONVBKERR; + } + ctf_strfree(name); + break; } ret = ctf_add_enumerator(cup->cu_ctfp, id, name, eval); if (ret == CTF_ERR) { - (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "failed to add enumarator %s (%d) to %d\n", - name, eval, id); - ctf_free(name, strlen(name) + 1); - return (ctf_errno(cup->cu_ctfp)); + ret = ctf_errno(cup->cu_ctfp); + + if (ret == ECTF_DTFULL && (cup->cu_handle->cch_flags & + CTF_ALLOW_TRUNCATION)) { + if (cup->cu_handle->cch_warncb != NULL) { + cup->cu_handle->cch_warncb( + cup->cu_handle->cch_warncb_arg, + "truncating enumeration %s at %s\n", + name, enumname == NULL ? "<anon>" : + enumname); + } + ret = 0; + } else { + (void) snprintf(cup->cu_errbuf, cup->cu_errlen, + "failed to add enumerator %s (%d) " + "to %s (%d)\n", name, eval, + enumname == NULL ? "<anon>" : enumname, id); + } + ctf_strfree(name); + break; } - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); } - return (0); +out: + + if (enumname != NULL) + ctf_strfree(enumname); + + return (ret); } /* @@ -2205,7 +2247,7 @@ ctf_dwarf_function_count(ctf_cu_t *cup, Dwarf_Die die, ctf_funcinfo_t *fip, fip->ctc_flags |= CTF_FUNC_VARARG; else fip->ctc_argc++; - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); } else if (tag == DW_TAG_formal_parameter) { fip->ctc_argc++; } else if (tag == DW_TAG_unspecified_parameters && @@ -2292,7 +2334,7 @@ ctf_dwarf_convert_function(ctf_cu_t *cup, Dwarf_Die die) if ((ret = ctf_dwarf_boolean(cup, die, DW_AT_declaration, &b)) != 0) { if (ret != ENOENT) { - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); return (ret); } } else if (b != 0) { @@ -2305,12 +2347,12 @@ ctf_dwarf_convert_function(ctf_cu_t *cup, Dwarf_Die die) */ ctf_dprintf("ignoring declaration of function %s (die %llx)\n", name, ctf_die_offset(cup, die)); - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); return (0); } if ((cdf = ctf_alloc(sizeof (ctf_dwfunc_t))) == NULL) { - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); return (ENOMEM); } bzero(cdf, sizeof (ctf_dwfunc_t)); @@ -2319,18 +2361,18 @@ ctf_dwarf_convert_function(ctf_cu_t *cup, Dwarf_Die die) if ((ret = ctf_dwarf_refdie(cup, die, DW_AT_type, &tdie)) == 0) { if ((ret = ctf_dwarf_convert_type(cup, tdie, &(cdf->cdf_fip.ctc_return), CTF_ADD_ROOT)) != 0) { - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); ctf_free(cdf, sizeof (ctf_dwfunc_t)); return (ret); } } else if (ret != ENOENT) { - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); ctf_free(cdf, sizeof (ctf_dwfunc_t)); return (ret); } else { if ((cdf->cdf_fip.ctc_return = ctf_dwarf_void(cup)) == CTF_ERR) { - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); ctf_free(cdf, sizeof (ctf_dwfunc_t)); return (ctf_errno(cup->cu_ctfp)); } @@ -2348,7 +2390,7 @@ ctf_dwarf_convert_function(ctf_cu_t *cup, Dwarf_Die die) */ if ((ret = ctf_dwarf_function_count(cup, die, &cdf->cdf_fip, B_FALSE)) != 0) { - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); ctf_free(cdf, sizeof (ctf_dwfunc_t)); return (ret); } @@ -2358,14 +2400,14 @@ ctf_dwarf_convert_function(ctf_cu_t *cup, Dwarf_Die die) uint_t argc = cdf->cdf_fip.ctc_argc; cdf->cdf_argv = ctf_alloc(sizeof (ctf_id_t) * argc); if (cdf->cdf_argv == NULL) { - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); ctf_free(cdf, sizeof (ctf_dwfunc_t)); return (ENOMEM); } if ((ret = ctf_dwarf_convert_fargs(cup, die, &cdf->cdf_fip, cdf->cdf_argv)) != 0) { ctf_free(cdf->cdf_argv, sizeof (ctf_id_t) * argc); - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); ctf_free(cdf, sizeof (ctf_dwfunc_t)); return (ret); } @@ -2376,7 +2418,7 @@ ctf_dwarf_convert_function(ctf_cu_t *cup, Dwarf_Die die) if ((ret = ctf_dwarf_isglobal(cup, die, &cdf->cdf_global)) != 0) { ctf_free(cdf->cdf_argv, sizeof (ctf_id_t) * cdf->cdf_fip.ctc_argc); - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); ctf_free(cdf, sizeof (ctf_dwfunc_t)); return (ret); } @@ -2432,7 +2474,7 @@ ctf_dwarf_convert_variable(ctf_cu_t *cup, Dwarf_Die die) return (0); if ((ret = ctf_dwarf_refdie(cup, die, DW_AT_type, &tdie)) != 0) { - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); return (ret); } @@ -2441,7 +2483,7 @@ ctf_dwarf_convert_variable(ctf_cu_t *cup, Dwarf_Die die) return (ret); if ((cdv = ctf_alloc(sizeof (ctf_dwvar_t))) == NULL) { - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); return (ENOMEM); } @@ -2450,7 +2492,7 @@ ctf_dwarf_convert_variable(ctf_cu_t *cup, Dwarf_Die die) if ((ret = ctf_dwarf_isglobal(cup, die, &cdv->cdv_global)) != 0) { ctf_free(cdv, sizeof (ctf_dwvar_t)); - ctf_free(name, strlen(name) + 1); + ctf_strfree(name); return (ret); } @@ -3036,7 +3078,7 @@ ctf_dwarf_free_die(ctf_cu_t *cup) ctf_dprintf("Trying to free name: %p\n", cup->cu_name); if (cup->cu_name != NULL) { - ctf_free(cup->cu_name, strlen(cup->cu_name) + 1); + ctf_strfree(cup->cu_name); cup->cu_name = NULL; } @@ -3049,7 +3091,7 @@ ctf_dwarf_free_die(ctf_cu_t *cup) ctf_dprintf("Trying to free functions\n"); for (cdf = ctf_list_next(&cup->cu_funcs); cdf != NULL; cdf = ndf) { ndf = ctf_list_next(cdf); - ctf_free(cdf->cdf_name, strlen(cdf->cdf_name) + 1); + ctf_strfree(cdf->cdf_name); if (cdf->cdf_fip.ctc_argc != 0) { ctf_free(cdf->cdf_argv, sizeof (ctf_id_t) * cdf->cdf_fip.ctc_argc); @@ -3060,7 +3102,7 @@ ctf_dwarf_free_die(ctf_cu_t *cup) ctf_dprintf("Trying to free variables\n"); for (cdv = ctf_list_next(&cup->cu_vars); cdv != NULL; cdv = ndv) { ndv = ctf_list_next(cdv); - ctf_free(cdv->cdv_name, strlen(cdv->cdv_name) + 1); + ctf_strfree(cdv->cdv_name); ctf_free(cdv, sizeof (ctf_dwvar_t)); } @@ -3124,9 +3166,9 @@ ctf_dwarf_count_dies(Dwarf_Debug dw, Dwarf_Error *derr, uint_t *ndies, * be able to finish the rest in a (potentially) multithreaded context. */ static int -ctf_dwarf_preinit_dies(int fd, Elf *elf, Dwarf_Debug dw, +ctf_dwarf_preinit_dies(ctf_convert_t *cch, int fd, Elf *elf, Dwarf_Debug dw, mutex_t *dwlock, Dwarf_Error *derr, uint_t ndies, ctf_cu_t *cdies, - uint_t flags, char *errbuf, size_t errlen) + char *errbuf, size_t errlen) { Dwarf_Unsigned hdrlen, abboff, nexthdr; Dwarf_Half addrsz, vers; @@ -3144,6 +3186,7 @@ ctf_dwarf_preinit_dies(int fd, Elf *elf, Dwarf_Debug dw, cup = &cdies[i++]; + cup->cu_handle = cch; cup->cu_fd = fd; cup->cu_elf = elf; cup->cu_dwarf = dw; @@ -3176,16 +3219,15 @@ ctf_dwarf_preinit_dies(int fd, Elf *elf, Dwarf_Debug dw, if (cu == NULL) { ctf_dprintf("cu %d - no cu data\n", i); (void) snprintf(cup->cu_errbuf, cup->cu_errlen, - "file does not contain DWARF data"); + "file does not contain DWARF data\n"); return (ECTF_CONVNODEBUG); } if (ctf_dwarf_string(cup, cu, DW_AT_name, &name) == 0) { - size_t len = strlen(name) + 1; char *b = basename(name); cup->cu_name = strdup(b); - ctf_free(name, len); + ctf_strfree(name); if (cup->cu_name == NULL) return (ENOMEM); } @@ -3212,13 +3254,20 @@ ctf_dwarf_preinit_dies(int fd, Elf *elf, Dwarf_Debug dw, * Missing DEBUG data for a .c file, return an * error unless this is permitted. */ - if (!(flags & CTF_ALLOW_MISSING_DEBUG)) { + if (!(cch->cch_flags & + CTF_ALLOW_MISSING_DEBUG)) { (void) snprintf( cup->cu_errbuf, cup->cu_errlen, - "file %s is missing debug info", + "missing debug information " + "(first seen in %s)\n", cup->cu_name); return (ECTF_CONVNODEBUG); } + if (cch->cch_warncb != NULL) { + cch->cch_warncb(cch->cch_warncb_arg, + "file %s is missing debug " + "information\n", cup->cu_name); + } } } else { added++; @@ -3275,9 +3324,11 @@ ctf_dwarf_init_die(ctf_cu_t *cup) * the -m option. */ static boolean_t -c_source_has_debug(const char *file, ctf_cu_t *cus, size_t nr_cus) +c_source_has_debug(ctf_convert_t *cch, const char *file, + ctf_cu_t *cus, size_t nr_cus) { const char *basename = strrchr(file, '/'); + ctf_convert_filelist_t *ccf; if (basename == NULL) basename = file; @@ -3293,6 +3344,14 @@ c_source_has_debug(const char *file, ctf_cu_t *cus, size_t nr_cus) strncmp(basename, "values-", strlen("values-")) == 0) return (B_TRUE); + for (ccf = list_head(&cch->cch_nodebug); ccf != NULL; + ccf = list_next(&cch->cch_nodebug, ccf)) { + if (ccf->ccf_basename != NULL && + strcmp(basename, ccf->ccf_basename) == 0) { + return (B_TRUE); + } + } + for (size_t i = 0; i < nr_cus; i++) { if (cus[i].cu_name != NULL && strcmp(basename, cus[i].cu_name) == 0) { @@ -3304,13 +3363,14 @@ c_source_has_debug(const char *file, ctf_cu_t *cus, size_t nr_cus) } static int -ctf_dwarf_check_missing(ctf_cu_t *cus, size_t nr_cus, Elf *elf, - char *errmsg, size_t errlen) +ctf_dwarf_check_missing(ctf_convert_t *cch, ctf_cu_t *cus, size_t nr_cus, + Elf *elf, char *errmsg, size_t errlen) { Elf_Scn *scn, *strscn; Elf_Data *data, *strdata; GElf_Shdr shdr; ulong_t i; + int ret = 0; scn = NULL; while ((scn = elf_nextscn(elf, scn)) != NULL) { @@ -3368,14 +3428,23 @@ ctf_dwarf_check_missing(ctf_cu_t *cus, size_t nr_cus, Elf *elf, if (len < 2 || strncmp(".c", &file[len - 2], 2) != 0) continue; - if (!c_source_has_debug(file, cus, nr_cus)) { - (void) snprintf(errmsg, errlen, - "file %s is missing debug info", file); - return (ECTF_CONVNODEBUG); + if (!c_source_has_debug(cch, file, cus, nr_cus)) { + if (cch->cch_warncb != NULL) { + cch->cch_warncb( + cch->cch_warncb_arg, + "file %s is missing debug information\n", + file); + } + if (ret != ECTF_CONVNODEBUG) { + (void) snprintf(errmsg, errlen, + "missing debug information " + "(first seen in %s)\n", file); + ret = ECTF_CONVNODEBUG; + } } } - return (0); + return (ret); } static int @@ -3488,11 +3557,11 @@ out: } int -ctf_dwarf_convert(int fd, Elf *elf, uint_t bsize, uint_t nthrs, uint_t flags, - ctf_file_t **fpp, char *errbuf, size_t errlen) +ctf_dwarf_convert(ctf_convert_t *cch, int fd, Elf *elf, ctf_file_t **fpp, + char *errbuf, size_t errlen) { int err, ret; - uint_t ndies, i; + uint_t ndies, i, bsize, nthrs; Dwarf_Debug dw; Dwarf_Error derr; ctf_cu_t *cdies = NULL, *cup; @@ -3542,15 +3611,21 @@ ctf_dwarf_convert(int fd, Elf *elf, uint_t bsize, uint_t nthrs, uint_t flags, bzero(cdies, sizeof (ctf_cu_t) * ndies); - if ((err = ctf_dwarf_preinit_dies(fd, elf, dw, &dwlock, &derr, - ndies, cdies, flags, errbuf, errlen)) != 0) { + if ((err = ctf_dwarf_preinit_dies(cch, fd, elf, dw, &dwlock, &derr, + ndies, cdies, errbuf, errlen)) != 0) { goto out; } - if (!(flags & CTF_ALLOW_MISSING_DEBUG) && - (err = ctf_dwarf_check_missing(cdies, ndies, - elf, errbuf, errlen)) != 0) { - goto out; + if ((err = ctf_dwarf_check_missing(cch, cdies, ndies, elf, + errbuf, errlen)) != 0) { + if (!(cch->cch_flags & CTF_ALLOW_MISSING_DEBUG)) { + goto out; + } + if (err != ECTF_CONVNODEBUG && *errbuf != '\0' && + cch->cch_warncb != NULL) { + cch->cch_warncb(cch->cch_warncb_arg, "%s", errbuf); + *errbuf = '\0'; + } } /* Only one cu, no merge required */ @@ -3570,8 +3645,8 @@ ctf_dwarf_convert(int fd, Elf *elf, uint_t bsize, uint_t nthrs, uint_t flags, * There's no need to have either more threads or a batch size larger * than the total number of dies, even if the user requested them. */ - nthrs = min(ndies, nthrs); - bsize = min(ndies, bsize); + nthrs = min(ndies, cch->cch_nthreads); + bsize = min(ndies, cch->cch_batchsize); if (workq_init(&wqp, nthrs) == -1) { err = errno; diff --git a/usr/src/lib/libctf/common/ctf_lib.c b/usr/src/lib/libctf/common/ctf_lib.c index 5177409200..f885b3d1c1 100644 --- a/usr/src/lib/libctf/common/ctf_lib.c +++ b/usr/src/lib/libctf/common/ctf_lib.c @@ -100,17 +100,11 @@ ctf_zopen(int *errp) return (zlib.z_dlp); /* library is already loaded */ /* - * Get the zone native root. For the tools build, we don't need - * this (it seems fair to impose that we always build the system in - * a native zone), and we want to allow build machines that are older - * that the notion of the native root, so we only actually make this - * call if we're not the tools build. + * Get the zone native root. For the tools build, we don't NEED this, + * but since we don't allow build machines that are older that the + * notion of the native root anymore, we do it all the time anyway. */ -#ifndef CTF_TOOLS_BUILD zroot = zone_get_nroot(); -#else - zroot = NULL; -#endif if (zroot != NULL) { (void) snprintf(buf, MAXPATHLEN, "%s/%s", zroot, _libctf_zlib); diff --git a/usr/src/lib/libctf/common/ctf_merge.c b/usr/src/lib/libctf/common/ctf_merge.c index a5888de8c0..6b0d89784c 100644 --- a/usr/src/lib/libctf/common/ctf_merge.c +++ b/usr/src/lib/libctf/common/ctf_merge.c @@ -1003,18 +1003,10 @@ ctf_merge_fini_input(ctf_merge_input_t *cmi) void ctf_merge_fini(ctf_merge_t *cmh) { - size_t len; ctf_merge_input_t *cmi; - if (cmh->cmh_label != NULL) { - len = strlen(cmh->cmh_label) + 1; - ctf_free(cmh->cmh_label, len); - } - - if (cmh->cmh_pname != NULL) { - len = strlen(cmh->cmh_pname) + 1; - ctf_free(cmh->cmh_pname, len); - } + ctf_strfree(cmh->cmh_label); + ctf_strfree(cmh->cmh_pname); while ((cmi = list_remove_head(&cmh->cmh_inputs)) != NULL) ctf_merge_fini_input(cmi); @@ -1074,11 +1066,7 @@ ctf_merge_label(ctf_merge_t *cmh, const char *label) if (dup == NULL) return (EAGAIN); - if (cmh->cmh_label != NULL) { - size_t len = strlen(cmh->cmh_label) + 1; - ctf_free(cmh->cmh_label, len); - } - + ctf_strfree(cmh->cmh_label); cmh->cmh_label = dup; return (0); } @@ -1272,10 +1260,7 @@ ctf_merge_uniquify(ctf_merge_t *cmh, ctf_file_t *u, const char *pname) dup = ctf_strdup(pname); if (dup == NULL) return (EINVAL); - if (cmh->cmh_pname != NULL) { - size_t len = strlen(cmh->cmh_pname) + 1; - ctf_free(cmh->cmh_pname, len); - } + ctf_strfree(cmh->cmh_pname); cmh->cmh_pname = dup; cmh->cmh_unique = u; return (0); diff --git a/usr/src/lib/libctf/common/libctf.h b/usr/src/lib/libctf/common/libctf.h index a44ff4eaba..05224b1cd7 100644 --- a/usr/src/lib/libctf/common/libctf.h +++ b/usr/src/lib/libctf/common/libctf.h @@ -25,6 +25,7 @@ */ /* * Copyright (c) 2019, Joyent, Inc. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ /* @@ -37,7 +38,7 @@ * In the meantime, be aware that any program linked with libctf in this * release of illumos is almost guaranteed to break in the next release. * - * In short, do not user this header file or libctf for any purpose. + * In short, do not use this header file or libctf for any purpose. */ #ifndef _LIBCTF_H @@ -75,16 +76,54 @@ extern int ctf_diff_functions(ctf_diff_t *, ctf_diff_func_f, void *); extern int ctf_diff_objects(ctf_diff_t *, ctf_diff_obj_f, void *); extern void ctf_diff_fini(ctf_diff_t *); -/* - * Normally, we return a failure if we find a C-derived compilation unit that - * lacks DWARF or CTF (as required). This flag over-rides this check. - */ -#define CTF_ALLOW_MISSING_DEBUG 0x01 +#define CTF_CONVERT_DEFAULT_BATCHSIZE 256 +#define CTF_CONVERT_DEFAULT_NTHREADS 4 + +typedef enum ctf_convert_flag { + /* + * Normally, we return a failure if we find a C-derived compilation + * unit that lacks DWARF or CTF (as required). This flag over-rides + * this check. + */ + CTF_ALLOW_MISSING_DEBUG = 0x01, + /* + * Normally, we return a failure if we can't fully convert a structure + * to CTF format, such as an enum with too many values. This flag + * allows us to continue and convert what we can. + */ + CTF_ALLOW_TRUNCATION = 0x02, + /* + * Conversion is not usually attempted for objects that don't appear + * to be built from C sources. This flag overrides this and attempts + * conversion anyway. + */ + CTF_FORCE_CONVERSION = 0x04 +} ctf_convert_flag_t; + +#define CTF_CONVERT_ALL_FLAGS (CTF_ALLOW_MISSING_DEBUG | \ + CTF_ALLOW_TRUNCATION | \ + CTF_FORCE_CONVERSION) + +/* opaque handle for ctfconvert functions */ +struct ctf_convert_handle; +typedef struct ctf_convert_handle ctf_convert_t; + +extern ctf_convert_t *ctf_convert_init(int *); +extern void ctf_convert_fini(ctf_convert_t *); + +typedef void (*ctf_convert_warn_f)(void *, const char *, ...); +/* Any warning callback must be MT-Safe if multiple threads are used */ +extern int ctf_convert_set_warncb(ctf_convert_t *, ctf_convert_warn_f, void *); +extern int ctf_convert_set_batchsize(ctf_convert_t *, uint_t); +extern int ctf_convert_set_flags(ctf_convert_t *, ctf_convert_flag_t); +extern int ctf_convert_set_label(ctf_convert_t *, const char *); +extern int ctf_convert_set_nthreads(ctf_convert_t *, uint_t); +extern int ctf_convert_add_ignore(ctf_convert_t *, const char *); + +extern ctf_file_t *ctf_elfconvert(ctf_convert_t *, int, Elf *, int *, char *, + size_t); +extern ctf_file_t *ctf_fdconvert(ctf_convert_t *, int, int *, char *, size_t); -extern ctf_file_t *ctf_elfconvert(int, Elf *, const char *, uint_t, uint_t, - uint_t, int *, char *, size_t); -extern ctf_file_t *ctf_fdconvert(int, const char *, uint_t, uint_t, uint_t, - int *, char *, size_t); typedef enum ctf_hsc_ret { CHR_ERROR = -1, diff --git a/usr/src/lib/libctf/common/libctf_impl.h b/usr/src/lib/libctf/common/libctf_impl.h index 0921a3ec1a..8028dc0f8f 100644 --- a/usr/src/lib/libctf/common/libctf_impl.h +++ b/usr/src/lib/libctf/common/libctf_impl.h @@ -11,6 +11,7 @@ /* * Copyright 2019 Joyent, Inc. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ #ifndef _LIBCTF_IMPL_H @@ -24,15 +25,31 @@ #include <libelf.h> #include <libctf.h> #include <ctf_impl.h> +#include <sys/list.h> #ifdef __cplusplus extern "C" { #endif -typedef int (*ctf_convert_f)(int, Elf *, uint_t, uint_t, uint_t, - ctf_file_t **, char *, size_t); -extern int ctf_dwarf_convert(int, Elf *, uint_t, uint_t, uint_t, - ctf_file_t **, char *, size_t); +typedef struct ctf_convert_filelist { + list_node_t ccf_node; + char *ccf_basename; +} ctf_convert_filelist_t; + +struct ctf_convert_handle { + char *cch_label; + uint_t cch_flags; + uint_t cch_nthreads; + uint_t cch_batchsize; + ctf_convert_warn_f cch_warncb; + list_t cch_nodebug; + void *cch_warncb_arg; +}; + +typedef int (*ctf_convert_f)(ctf_convert_t *, int, Elf *, ctf_file_t **, + char *, size_t); +extern int ctf_dwarf_convert(ctf_convert_t *, int, Elf *, ctf_file_t **, + char *, size_t); /* * Symbol walking diff --git a/usr/src/lib/libctf/common/mapfile-vers b/usr/src/lib/libctf/common/mapfile-vers index 9281bbfff5..beb313d668 100644 --- a/usr/src/lib/libctf/common/mapfile-vers +++ b/usr/src/lib/libctf/common/mapfile-vers @@ -24,6 +24,7 @@ # # Copyright 2019 Joyent, Inc. +# Copyright 2020 OmniOS Community Edition (OmniOSce) Association. # # @@ -66,6 +67,14 @@ SYMBOL_VERSION SUNWprivate_1.2 { ctf_add_typedef; ctf_add_union; ctf_add_volatile; + ctf_convert_add_ignore; + ctf_convert_fini; + ctf_convert_init; + ctf_convert_set_batchsize; + ctf_convert_set_flags; + ctf_convert_set_label; + ctf_convert_set_nthreads; + ctf_convert_set_warncb; ctf_create; ctf_dataptr; ctf_delete_type; diff --git a/usr/src/lib/libproc/common/Psymtab.c b/usr/src/lib/libproc/common/Psymtab.c index fe0b0075e0..4d89eba672 100644 --- a/usr/src/lib/libproc/common/Psymtab.c +++ b/usr/src/lib/libproc/common/Psymtab.c @@ -755,6 +755,7 @@ static ctf_file_t * Pconvert_file_ctf(file_info_t *fptr) { int err; + ctf_convert_t *cch; ctf_file_t *fp; char errmsg[1024]; @@ -770,20 +771,25 @@ Pconvert_file_ctf(file_info_t *fptr) */ if (fptr->file_cvt == B_TRUE) return (NULL); + + cch = ctf_convert_init(&err); + if (cch == NULL) + return (NULL); + fptr->file_cvt = B_TRUE; fp = NULL; if (fptr->file_dbgelf != NULL) { - fp = ctf_elfconvert(fptr->file_fd, fptr->file_dbgelf, NULL, 1, - 1, 0, &err, errmsg, sizeof (errmsg)); + fp = ctf_elfconvert(cch, fptr->file_fd, fptr->file_dbgelf, &err, + errmsg, sizeof (errmsg)); if (fp == NULL) { dprintf("failed to convert %s: %s\n", fptr->file_pname, err == ECTF_CONVBKERR ? errmsg : ctf_errmsg(err)); } } if (fp == NULL) { - fp = ctf_elfconvert(fptr->file_fd, fptr->file_elf, NULL, 1, 1, - 0, &err, errmsg, sizeof (errmsg)); + fp = ctf_elfconvert(cch, fptr->file_fd, fptr->file_elf, &err, + errmsg, sizeof (errmsg)); if (fp == NULL) { dprintf("failed to convert %s: %s\n", fptr->file_pname, err == ECTF_CONVBKERR ? errmsg : ctf_errmsg(err)); @@ -793,6 +799,7 @@ Pconvert_file_ctf(file_info_t *fptr) fptr->file_ctfp = fp; } + ctf_convert_fini(cch); return (NULL); } diff --git a/usr/src/lib/pylibbe/common/libbe_py.c b/usr/src/lib/pylibbe/common/libbe_py.c index 6402e0daad..554e029fda 100644 --- a/usr/src/lib/pylibbe/common/libbe_py.c +++ b/usr/src/lib/pylibbe/common/libbe_py.c @@ -22,7 +22,7 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2012 OmniTI Computer Consulting, Inc. All rights reserved. - * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ #include <Python.h> @@ -51,7 +51,7 @@ enum { PyObject *beCreateSnapshot(PyObject *, PyObject *); PyObject *beCopy(PyObject *, PyObject *); PyObject *beList(PyObject *, PyObject *, PyObject *); -PyObject *beActivate(PyObject *, PyObject *); +PyObject *beActivate(PyObject *, PyObject *, PyObject *); PyObject *beDestroy(PyObject *, PyObject *); PyObject *beDestroySnapshot(PyObject *, PyObject *); PyObject *beRename(PyObject *, PyObject *); @@ -93,7 +93,6 @@ static boolean_t convertPyArgsToNvlist(nvlist_t **nvList, int numArgs, ...); * Scope: * Public */ -/* ARGSUSED */ PyObject * beCreateSnapshot(PyObject *self, PyObject *args) { @@ -159,7 +158,6 @@ beCreateSnapshot(PyObject *self, PyObject *args) * Scope: * Public */ -/* ARGSUSED */ PyObject * beCopy(PyObject *self, PyObject *args) { @@ -285,7 +283,6 @@ beCopy(PyObject *self, PyObject *args) * Scope: * Public */ -/* ARGSUSED */ PyObject * beList(PyObject *self, PyObject *args, PyObject *keywds) { @@ -413,7 +410,10 @@ done: * to activate a Boot Environment * Parameters: * args - pointer to a python object containing: - * beName - The name of the BE to activate + * bename - The name of the BE to activate + * temporary - If True, perform a temporary BE activation + * If False, remove a temporary BE activation + * If not present, do nothing in regard to temporary activation * * Returns a pointer to a python object: * BE_SUCCESS - Success @@ -421,28 +421,36 @@ done: * Scope: * Public */ -/* ARGSUSED */ PyObject * -beActivate(PyObject *self, PyObject *args) +beActivate(PyObject *self, PyObject *args, PyObject *keywds) { char *beName = NULL; int ret = BE_PY_SUCCESS; nvlist_t *beAttrs = NULL; + int temp = -1; - if (!PyArg_ParseTuple(args, "z", &beName)) { - return (Py_BuildValue("i", BE_PY_ERR_PARSETUPLE)); + static char *kwlist[] = {"bename", "temporary", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, keywds, "z|i", + kwlist, &beName, &temp)) { + ret = BE_PY_ERR_PARSETUPLE; + goto done; } - if (!convertPyArgsToNvlist(&beAttrs, 2, BE_ATTR_ORIG_BE_NAME, beName)) { - nvlist_free(beAttrs); - return (Py_BuildValue("i", BE_PY_ERR_NVLIST)); + if (!convertPyArgsToNvlist(&beAttrs, 2, BE_ATTR_ORIG_BE_NAME, beName) || + beAttrs == NULL) { + ret = BE_PY_ERR_NVLIST; + goto done; } - if (beAttrs == NULL) { - return (Py_BuildValue("i", BE_PY_ERR_NVLIST)); + if (temp != -1 && nvlist_add_boolean_value(beAttrs, + BE_ATTR_ACTIVE_NEXTBOOT, temp == 0 ? B_FALSE : B_TRUE) != 0) { + ret = BE_PY_ERR_NVLIST; + goto done; } ret = be_activate(beAttrs); +done: nvlist_free(beAttrs); return (Py_BuildValue("i", ret)); } @@ -461,7 +469,6 @@ beActivate(PyObject *self, PyObject *args) * Scope: * Public */ -/* ARGSUSED */ PyObject * beDestroy(PyObject *self, PyObject *args) { @@ -520,7 +527,6 @@ beDestroy(PyObject *self, PyObject *args) * Scope: * Public */ -/* ARGSUSED */ PyObject * beDestroySnapshot(PyObject *self, PyObject *args) { @@ -564,7 +570,6 @@ beDestroySnapshot(PyObject *self, PyObject *args) * Scope: * Public */ -/* ARGSUSED */ PyObject * beRename(PyObject *self, PyObject *args) { @@ -609,7 +614,6 @@ beRename(PyObject *self, PyObject *args) * Scope: * Public */ -/* ARGSUSED */ PyObject * beMount(PyObject *self, PyObject *args) { @@ -652,7 +656,6 @@ beMount(PyObject *self, PyObject *args) * Scope: * Public */ -/* ARGSUSED */ PyObject * beUnmount(PyObject *self, PyObject *args) { @@ -707,7 +710,6 @@ beUnmount(PyObject *self, PyObject *args) * Scope: * Public */ -/* ARGSUSED */ PyObject * beRollback(PyObject *self, PyObject *args) { @@ -753,7 +755,6 @@ beRollback(PyObject *self, PyObject *args) * Scope: * Public */ -/* ARGSUSED */ PyObject * bePrintErrors(PyObject *self, PyObject *args) { @@ -778,7 +779,6 @@ bePrintErrors(PyObject *self, PyObject *args) * Scope: * Public */ -/* ARGSUSED */ PyObject * beGetErrDesc(PyObject *self, PyObject *args) { @@ -812,7 +812,6 @@ beGetErrDesc(PyObject *self, PyObject *args) * Scope: * Public */ -/* ARGSUSED */ PyObject * beVerifyBEName(PyObject *self, PyObject *args) { @@ -1038,6 +1037,7 @@ convertPyArgsToNvlist(nvlist_t **nvList, int numArgs, ...) (void) printf("nvlist_add_string failed for %s (%s).\n", pt, pt2); nvlist_free(*nvList); + *nvList = NULL; return (B_FALSE); } } @@ -1097,7 +1097,8 @@ static struct PyMethodDef libbeMethods[] = { {"beList", (PyCFunction)(uintptr_t)beList, METH_VARARGS | METH_KEYWORDS, "List BE info."}, {"beRename", beRename, METH_VARARGS, "Rename a BE."}, - {"beActivate", beActivate, METH_VARARGS, "Activate a BE."}, + {"beActivate", (PyCFunction)(uintptr_t)beActivate, + METH_VARARGS | METH_KEYWORDS, "Activate a BE."}, {"beRollback", beRollback, METH_VARARGS, "Rollback a BE."}, {"bePrintErrors", bePrintErrors, METH_VARARGS, "Enable/disable error printing."}, diff --git a/usr/src/man/man1/ar.1 b/usr/src/man/man1/ar.1 index f783fea190..5a2ff989f2 100644 --- a/usr/src/man/man1/ar.1 +++ b/usr/src/man/man1/ar.1 @@ -44,11 +44,10 @@ .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. .\" -.TH AR 1 "Sep 10, 2013" +.TH AR 1 "December 28, 2020" .SH NAME ar \- maintain portable archive or library .SH SYNOPSIS -.LP .nf \fB/usr/bin/ar\fR \fB-d\fR [\fB-Vv\fR] \fIarchive\fR \fIfile\fR... .fi @@ -119,8 +118,6 @@ ar \- maintain portable archive or library .fi .SH DESCRIPTION -.sp -.LP The \fBar\fR utility maintains groups of files combined into a single archive file. Its main use is to create and update library files. However, it can be used for any similar purpose. The magic string and the file headers used by @@ -140,8 +137,6 @@ accessible to the user. Whenever the \fBar\fR command is used to create or update the contents of such an archive, the symbol table is rebuilt. The \fB-s\fR option described below forces the symbol table to be rebuilt. .SH OPTIONS -.sp -.LP The following options are supported: .sp .ne 2 @@ -200,7 +195,7 @@ Deletes one or more \fIfile\fRs from \fIarchive\fR. .ad .RS 6n Positions new \fIfile\fRs in \fIarchive\fR before the file named by the -\fIposname\fR operand. This option is quivalent to \fB-b\fR. +\fIposname\fR operand. This option is equivalent to \fB-b\fR. .RE .sp @@ -331,8 +326,6 @@ Prints its version number on standard error. .RE .SS "\fB/usr/xpg4/bin/ar\fR" -.sp -.LP The following options are supported for \fB/usr/xpg4/bin/ar\fR: .sp .ne 2 @@ -360,8 +353,6 @@ is being extracted, the results are undefined. The modification time of each .RE .SH OPERANDS -.sp -.LP The following operands are supported: .sp .ne 2 @@ -396,8 +387,6 @@ options \fB-m\fR and \fB-r\fR. .RE .SH ENVIRONMENT VARIABLES -.sp -.LP See \fBenviron\fR(5) for descriptions of the following environment variables that affect the execution of \fBar\fR: \fBLANG\fR, \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, \fBLC_TIME\fR, and \fBNLSPATH\fR. @@ -423,8 +412,6 @@ timezone is used. .RE .SH EXIT STATUS -.sp -.LP The following exit values are returned: .sp .ne 2 @@ -445,13 +432,8 @@ An error occurred. .RE .SH ATTRIBUTES -.sp -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .SS "\fB/usr/bin/ar\fR" -.sp - -.sp .TS box; c | c @@ -462,9 +444,6 @@ Interface Stability Committed .TE .SS "\fB/usr/xpg4/bin/ar\fR" -.sp - -.sp .TS box; c | c @@ -477,14 +456,10 @@ Standard See \fBstandards\fR(5). .TE .SH SEE ALSO -.sp -.LP \fBbasename\fR(1), \fBcpio\fR(1), \fBld\fR(1), \fBlorder\fR(1), \fBstrip\fR(1), \fBtar\fR(1), \fBar.h\fR(3HEAD), \fBa.out\fR(4), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) .SH NOTES -.sp -.LP If the same file is mentioned twice in an argument list, it may be put in the archive twice. .sp diff --git a/usr/src/man/man1/ctfdump.1 b/usr/src/man/man1/ctfdump.1 index b80c856eaf..8d63b2a0a5 100644 --- a/usr/src/man/man1/ctfdump.1 +++ b/usr/src/man/man1/ctfdump.1 @@ -11,7 +11,7 @@ .\" .\" Copyright 2018, Joyent, Inc. .\" -.Dd Oct 2, 2018 +.Dd December 28, 2020 .Dt CTFDUMP 1 .Os .Sh NAME @@ -141,7 +141,7 @@ container. .Bd -filled -compact Dump the type information contained in the .Sy CTF -conatiner. +container. .Ed .It Fl u Ar outfile .Bd -filled -compact diff --git a/usr/src/man/man1/demangle.1 b/usr/src/man/man1/demangle.1 index ca2dbef35a..20037f6721 100644 --- a/usr/src/man/man1/demangle.1 +++ b/usr/src/man/man1/demangle.1 @@ -15,7 +15,7 @@ .\" .\" Copyright 2020 Joyent, Inc. .\" -.Dd March 3, 2020 +.Dd December 28, 2020 .Dt DEMANGLE 1 .Os .Sh NAME @@ -63,7 +63,7 @@ is output unchanged. In the second method, .Nm reads standard in, and whenever it encounters a potential symbol, it will -attempt to replace the symbol in stdandard out with the demangled version. +attempt to replace the symbol in standard out with the demangled version. If the symbol cannot be demangled, it is output unchanged. .Pp For either method, if an error other than attempting to demangle an non-mangled diff --git a/usr/src/man/man1/lari.1 b/usr/src/man/man1/lari.1 index 39e4ff3531..ae51c87363 100644 --- a/usr/src/man/man1/lari.1 +++ b/usr/src/man/man1/lari.1 @@ -3,11 +3,10 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH LARI 1 "Nov 28, 2007" +.TH LARI 1 "December 28, 2020" .SH NAME lari \- link analysis of runtime interfaces .SH SYNOPSIS -.LP .nf \fBlari\fR [\fB-bCDsVv\fR] [\fB-a\fR | \fB-i\fR | \fB-o\fR] \fIfile\fR | \fIdirectory\fR... .fi @@ -18,8 +17,6 @@ lari \- link analysis of runtime interfaces .fi .SH DESCRIPTION -.sp -.LP The \fBlari\fR utility analyzes the interface requirements of dynamic \fBELF\fR objects. Two basic modes of operation are available. The first mode displays runtime interface information. The second mode generates interface definitions. @@ -99,8 +96,6 @@ associated \fImapfile\fR directives. See the \fILinker and Libraries Guide\fR for more details on using \fImapfiles\fR to version objects. An initial version of these \fImapfiles\fR can be created by \fBlari\fR. .SH OPTIONS -.sp -.LP The following options are supported. .sp .ne 2 @@ -295,7 +290,7 @@ This symbol definition has been directly bound to. .ad .RS 11n This symbol definition provides for an interposer. An object that explicitly -identifies itself as an interposor defines all global symbols as interposers. +identifies itself as an interposer defines all global symbols as interposers. See the \fB-z\fR \fBinterpose\fR option of \fBld\fR(1), and the \fBLD_PRELOAD\fR variable of \fBld.so.1\fR(1). Individual symbols within a dynamic executable can be defined as interposers by using the \fBINTERPOSE\fR @@ -391,8 +386,6 @@ See the \fILinker and Libraries Guide\fR for more details of these symbol classifications. .SH EXTENDED DESCRIPTION .SS "Interesting Information" -.sp -.LP By default, or specifically using the \fB-i\fR option, \fBlari\fR filters any runtime interface information to present interesting events. This filtering is carried out mainly to reduce the amount of information that can be generated @@ -473,8 +466,6 @@ explicitly established, instances can exist that are unexpected and surprising. Directly bound symbols, and symbols with protected visibility, are output as interesting information. .SS "Overhead Information" -.sp -.LP When using the \fB-o\fR option, \fBlari\fR displays symbol definitions that might be considered overhead. .sp @@ -555,7 +546,6 @@ bindings of this type require relocation processing at application start up, rather than the deferred relocation processing used when calling functions directly. Use of this address also requires an indirection at runtime. .SH EXAMPLES -.LP \fBExample 1 \fRAnalyzing a case of multiple bindings .sp .LP @@ -649,7 +639,6 @@ foo.so { .sp .SH FILES -.sp .ne 2 .na \fB\fB$TMPDIR/lari.dbg.\fIfile\fR\fR\fR @@ -659,8 +648,6 @@ Binding output produced by \fBldd\fR(1). .RE .SH ATTRIBUTES -.sp -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -678,8 +665,6 @@ Interface Stability See below. .LP The human readable output is Uncommitted. The options are Committed. .SH SEE ALSO -.sp -.LP \fBld\fR(1), \fBldd\fR(1), \fBld.so.1\fR(1), \fBdlopen\fR(3C), \fBdlsym\fR(3C), \fBattributes\fR(5) .sp diff --git a/usr/src/man/man1/ld.so.1.1 b/usr/src/man/man1/ld.so.1.1 index 19afbbf3d6..40145e65b9 100644 --- a/usr/src/man/man1/ld.so.1.1 +++ b/usr/src/man/man1/ld.so.1.1 @@ -4,11 +4,10 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH LD.SO.1 1 "May 8, 2014" +.TH LD.SO.1 1 "December 28, 2020" .SH NAME ld.so.1 \- runtime linker for dynamic objects .SH SYNOPSIS -.LP .nf \fB/lib/ld.so.1\fR .fi @@ -19,8 +18,6 @@ ld.so.1 \- runtime linker for dynamic objects .fi .SH DESCRIPTION -.sp -.LP Dynamic applications consist of one or more dynamic objects. A dynamic application is typically a dynamic executable and one or more shared object dependencies. As part of the initialization and execution of a dynamic @@ -40,7 +37,7 @@ link-editor is the name of the runtime linker, \fBld.so.1\fR. During the process of executing a dynamic executable, the kernel maps the file, and locates the required interpreter. See \fBexec\fR(2) and \fBmmapobj\fR(2). The kernel maps in, and transfers control to, this interpreter. Sufficient -information is passed to the interpretor to allow the interpreter to continue +information is passed to the interpreter to allow the interpreter to continue to bind, and then execute the application. .sp .LP @@ -143,8 +140,6 @@ runpath is specified when the dynamic object is constructed using the \fB-R\fR option to \fBld\fR(1). The environment variable \fBLD_LIBRARY_PATH\fR can be used to indicate directories to be searched before the default directories. .SS "Command Line Usage" -.sp -.LP Typically, the runtime linker is invoked indirectly through executing a dynamic executable that declares the runtime linker as its interpreter. The runtime linker can also be executed directly from the command line. This mechanism is @@ -168,8 +163,6 @@ VARIABLES. .RE .SH ENVIRONMENT VARIABLES -.sp -.LP Each environment variable can be specified with a \fB_32\fR or \fB_64\fR suffix. This makes the environment variable specific, respectively, to 32-bit or 64-bit processes. This environment variable overrides any non-suffixed @@ -598,8 +591,6 @@ Notice that environment variable names beginning with the characters '\fBLD_\fR' are reserved for possible future enhancements to \fBld\fR(1) and \fBld.so.1\fR. .SH SECURITY -.sp -.LP Secure processes have some restrictions applied to the evaluation of their dependencies and runpaths to prevent malicious dependency substitution or symbol interposition. @@ -671,7 +662,6 @@ When creating a secure process, relative path names should \fBnot\fR be used to express dependencies, or to construct \fBdlopen\fR(3C) path names. This restriction should be applied to the application and to \fBall\fR dependencies. .SH EXAMPLES -.LP \fBExample 1 \fRUsing LD_FLAGS to group environment variable information .sp .LP @@ -702,7 +692,6 @@ example% \fBLD_FLAGS_64=library_path=/lib/one/64,preload=foo.so\fR .sp .SH FILES -.sp .ne 2 .na \fB\fB/lib/ld.so.1\fR\fR @@ -803,8 +792,6 @@ Default configuration file for 64-bit applications. .RE .SH SEE ALSO -.sp -.LP \fBcrle\fR(1), \fBgprof\fR(1), \fBlari\fR(1), \fBld\fR(1), \fBldd\fR(1), \fBexec\fR(2), \fBissetugid\fR(2), \fBmmapobj\fR(2), \fBprofil\fR(2), \fBdladdr\fR(3C), \fBdlclose\fR(3C), \fBdldump\fR(3C), \fBdlerror\fR(3C), @@ -814,8 +801,6 @@ Default configuration file for 64-bit applications. .LP \fILinker and Libraries Guide\fR .SH NOTES -.sp -.LP Care should be exercised when using \fBLD_PROFILE\fR in combination with other process monitoring techniques, such as users of \fBproc\fR(4). Multiple process monitoring techniques can result in deadlock conditions that leave the profile diff --git a/usr/src/man/man1/pktool.1 b/usr/src/man/man1/pktool.1 index 491d7c6493..52869c4106 100644 --- a/usr/src/man/man1/pktool.1 +++ b/usr/src/man/man1/pktool.1 @@ -3,18 +3,15 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the .\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH PKTOOL 1 "Mar 23, 2009" +.TH PKTOOL 1 "December 28, 2020" .SH NAME pktool \- manage certificates and keys .SH SYNOPSIS -.LP .nf \fBpktool\fR [\fB-f\fR \fIoption_file\fR] [\fB-i\fR] \fIsubcommand\fR \fIsubcommand_options\fR ... .fi .SH DESCRIPTION -.sp -.LP The \fBpktool\fR command allows users to manage the certificates and keys on multiple keystores including PKCS#11 tokens (that is, Cryptographic Framework), Netscape Security Services (NSS) tokens, and standard file based keystore for @@ -26,8 +23,6 @@ Revocation List (CRL). \fBpktool\fR does not provide support for creating CRLs, signing CRLs, or exporting CRLs. The CRL support for the PKCS#11 keystore is file-based. .SH OPTIONS -.sp -.LP The following command options are supported: .sp .ne 2 @@ -97,8 +92,6 @@ The resulting \fBsubject-DN\fR is: .RE .SH SUBCOMMANDS -.sp -.LP The following subcommands are supported: .sp .ne 2 @@ -719,8 +712,6 @@ synonym for \fB-?\fR. .RE .SH USAGE -.sp -.LP The \fBpktool\fR subcommands support the following options: .sp .ne 2 @@ -887,7 +878,7 @@ For the \fBgencert\fR and \fBgencsr\fR subcommands, the valid private key types are: \fBrsa\fR, or \fBdsa\fR. The default key type is \fBrsa\fR. .sp For the \fBgenkey\fR subcommand, the valid symmetric key types are: \fBaes\fR, -\fBarcfou\fRr, \fBdes\fR, \fB3des\fR, or \fBgeneric\fR. The default key type is +\fBarcfour\fR, \fBdes\fR, \fB3des\fR, or \fBgeneric\fR. The default key type is \fBaes\fR. .sp .in +2 @@ -1249,7 +1240,6 @@ command line option has a higher priority than the environment variable. .RE .SH EXAMPLES -.LP \fBExample 1 \fRGenerating a Self-Signed Certificate .sp .LP @@ -1301,8 +1291,6 @@ file into the keystore indicated in the command: .sp .SH EXIT STATUS -.sp -.LP The following exit values are returned: .sp .ne 2 @@ -1323,8 +1311,6 @@ An error occurred. .RE .SH ATTRIBUTES -.sp -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -1339,8 +1325,6 @@ Interface Stability Committed .TE .SH SEE ALSO -.sp -.LP \fBattributes\fR(5), \fBpkcs11_softtoken\fR(5) .sp .LP diff --git a/usr/src/man/man1/print.1 b/usr/src/man/man1/print.1 index 3aefc897c8..d872fa475d 100644 --- a/usr/src/man/man1/print.1 +++ b/usr/src/man/man1/print.1 @@ -5,38 +5,32 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH PRINT 1 "Mar 27, 2008" +.TH PRINT 1 "December 28, 2020" .SH NAME print \- shell built-in function to output characters to the screen or window .SH SYNOPSIS .SS "ksh" -.LP .nf \fBprint\fR [\fB-Rnprsu\fR [\fIn\fR]] [\fIarg\fR]... .fi .SS "ksh93" -.LP .nf \fBprint\fR [\fB-Renprs\fR] [\fB-f\fR \fIformat\fR] [\fB-u\fR \fIfd\fR] [\fIstring\fR...] .fi .SH DESCRIPTION .SS "ksh" -.sp -.LP The shell output mechanism. When no options are specified, or when an option followed by \fB\&'\fR a \fB\(mi\fR is specified, or when just \fB-\fR is specified, the arguments are printed on standard output as described by \fBecho\fR(1). .SS "ksh93" -.sp -.LP By default, \fBprint\fR writes each string operand to standard output and appends a NEWLINE character. .sp .LP -Unless, the \fB-r\fR, \fB-R\fR, or \fB-f\fR option is speciifed, each \fB\e\fR +Unless, the \fB-r\fR, \fB-R\fR, or \fB-f\fR option is specified, each \fB\e\fR character in each string operand is processed specially as follows: .sp .ne 2 @@ -132,8 +126,6 @@ The 8-bit character whose \fBASCII\fR code is the \fB1\fR-, \fB2\fR-, or .SH OPTIONS .SS "ksh" -.sp -.LP The following options are supported by \fBksh\fR: .sp .ne 2 @@ -185,8 +177,6 @@ placed. The default is 1. .RE .SS "ksh93" -.sp -.LP The following options are supported by \fBksh93\fR: .sp .ne 2 @@ -271,8 +261,6 @@ default value is \fB1\fR. .RE .SH EXIT STATUS -.sp -.LP The following exit values are returned: .sp .ne 2 @@ -293,7 +281,5 @@ Output file is not open for writing. .RE .SH SEE ALSO -.sp -.LP \fBecho\fR(1), \fBksh\fR(1), \fBksh93\fR(1), \fBprintf\fR(1), \fBattributes\fR(5) diff --git a/usr/src/man/man1/tnfdump.1 b/usr/src/man/man1/tnfdump.1 index 77cfb22b6b..6093cf7dc4 100644 --- a/usr/src/man/man1/tnfdump.1 +++ b/usr/src/man/man1/tnfdump.1 @@ -3,24 +3,21 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH TNFDUMP 1 "Jan 22, 2001" +.TH TNFDUMP 1 "December 28, 2020" .SH NAME tnfdump \- convert binary TNF file to ASCII .SH SYNOPSIS -.LP .nf \fBtnfdump\fR [\fB-r\fR] [\fB-x\fR] \fItnf_file\fR... .fi .SH DESCRIPTION -.LP The \fBtnfdump\fR utility converts the specified binary \fBTNF\fR trace files to \fBASCII\fR. The \fBASCII\fR output can be used to do performance analysis. The default mode (without the \fB-r\fR option) prints all the event records (that were generated by \fBTNF_PROBE\fR(3TNF)) and the event descriptor records only. It also orders the events by time. .SH OPTIONS -.LP The following option is supported: .sp .ne 2 @@ -29,7 +26,7 @@ The following option is supported: .ad .RS 6n Does a raw conversion of \fBTNF\fR to \fBASCII\fR. The output is a literal -transalation of the binary \fBTNF\fR file and includes all the records in the +translation of the binary \fBTNF\fR file and includes all the records in the file. This output is useful only if you have a good understanding of \fBTNF\fR. A sample output is listed in EXAMPLES below. .RE @@ -45,10 +42,8 @@ instead of decimal format. .RE .SH RETURN VALUES -.LP \fBtnfdump\fR returns \fB0\fR on successful exit. .SH EXAMPLES -.LP \fBExample 1 \fRConverting a file into ASCII .sp .LP @@ -345,6 +340,5 @@ unsigned arguments. Their values are printed in hexadecimal when requested by option \fB-x\fR. .SH SEE ALSO -.LP \fBprex\fR(1), \fBgethrtime\fR(3C), \fBTNF_DECLARE_RECORD\fR(3TNF), \fBTNF_PROBE\fR(3TNF), \fBtnf_process_disable\fR(3TNF), \fBattributes\fR(5) diff --git a/usr/src/man/man1m/wificonfig.1m b/usr/src/man/man1m/wificonfig.1m index 1772ec890f..3bfe7132ab 100644 --- a/usr/src/man/man1m/wificonfig.1m +++ b/usr/src/man/man1m/wificonfig.1m @@ -3,11 +3,10 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH WIFICONFIG 1M "Oct 31, 2007" +.TH WIFICONFIG 1M "December 28, 2020" .SH NAME wificonfig \- WLAN configuration .SH SYNOPSIS -.LP .nf \fBwificonfig\fR [\fB-R\fR \fIroot_path\fR] [\fB-i\fR \fIinterface\fR] autoconf [\fIwait\fR={\fIn\fR|\fIforever\fR}] @@ -117,8 +116,6 @@ wificonfig \- WLAN configuration .fi .SH DESCRIPTION -.sp -.LP \fBwificonfig\fR defines a set of subcommands and parameters to configure \fBWiFi\fR interfaces in the system. A driver may support all parameters or a subset of these parameters. @@ -167,8 +164,6 @@ configure the interface. (See the \fBautoconf\fR subcommand for the heuristics). A few subcommands (\fBlistprefer\fR, \fBsetprefer\fR, \fBremoveprefer\fR) are defined to manipulate the Preference List. .SH OPTIONS -.sp -.LP The following options are supported: .sp .ne 2 @@ -191,8 +186,6 @@ Configuration Profiles and \fBWEP\fR keys. .RE .SS "OPERANDS" -.sp -.LP The following operand is supported: .sp .ne 2 @@ -207,8 +200,6 @@ profile name. .RE .SS "SUBCOMMANDS" -.sp -.LP The following subcommands are supported: .sp .ne 2 @@ -265,7 +256,7 @@ parameter is set as "profile". .sp If the \fBWLAN\fRs in the Preference list are available, the user can specify the number of seconds to wait before \fBconnect\fR returns using the wait -option. By default (without the wait option), \fBconnect\fR trys for 10 +option. By default (without the wait option), \fBconnect\fR tries for 10 seconds. If "\fIforever\fR" or -1 follows the wait option, \fBwificonfig\fR tries until the \fBNIC\fR is successfully connected to the profile or essid that was specified. @@ -275,7 +266,7 @@ whether or not a Configuration Profile was found for the specified name: .sp .in +2 .nf -Connecting to profile <name> +Connecting to profile <name> Connecting to essid <name> .fi .in -2 @@ -781,7 +772,6 @@ subcommand. .RE .SH EXAMPLES -.LP \fBExample 1 \fRListing the Parameters Supported by a Driver .sp .LP @@ -884,10 +874,10 @@ To display the history of the \fBWLAN\fRs: WLAN history: essid bssid encryption last seen - myXXX 00:0f:24:11:12:14 WEP Fri Sep 13 09:15:24 2004 - my_office_ssid 00:0f:24:11:12:15 WEP Fri Sep 13 13:20:04 2004 - my_neighbor1 00:0f:24:11:12:16 NONE Fri Sep 14 08:01:26 2004 - my_neighbor2 00:0f:24:11:12:17 WEP Fri Sep 18 21:33:12 2004 + myXXX 00:0f:24:11:12:14 WEP Fri Sep 13 09:15:24 2004 + my_office_ssid 00:0f:24:11:12:15 WEP Fri Sep 13 13:20:04 2004 + my_neighbor1 00:0f:24:11:12:16 NONE Fri Sep 14 08:01:26 2004 + my_neighbor2 00:0f:24:11:12:17 WEP Fri Sep 18 21:33:12 2004 .fi .in -2 .sp @@ -910,7 +900,7 @@ To configure the interface according to the previously saved Preference List: .sp .LP If the Preference List is empty, or none of the \fBWLAN\fRs listed by the -Proference List can be found, \fBwificonfig\fR uses the default configuration, +Preference List can be found, \fBwificonfig\fR uses the default configuration, directs the interface to scan and join the \fBWLAN\fR using the built-in heuristics specified above. @@ -1011,7 +1001,6 @@ roomlinx 00:40:96:a0:ab:39 access point none 8 .sp .SH EXIT STATUS -.sp .ne 2 .na \fB\fB0\fR\fR @@ -1049,8 +1038,6 @@ Minor error .RE .SH ATTRIBUTES -.sp -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -1065,6 +1052,4 @@ Interface Stability Unstable .TE .SH SEE ALSO -.sp -.LP \fBps\fR(1), \fBifconfig\fR(1M), \fBattributes\fR(5), \fBath\fR(7D) diff --git a/usr/src/man/man3c/cond_init.3c b/usr/src/man/man3c/cond_init.3c index d90296e420..198594167c 100644 --- a/usr/src/man/man3c/cond_init.3c +++ b/usr/src/man/man3c/cond_init.3c @@ -44,7 +44,7 @@ .\" Copyright (c) 2001, The IEEE and The Open Group. All Rights Reserved. .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. .\" -.TH COND_INIT 3C "February 15, 2020" +.TH COND_INIT 3C "December 28, 2020" .SH NAME cond_init, cond_wait, cond_timedwait, cond_reltimedwait, cond_signal, cond_broadcast, cond_destroy \- condition variables @@ -435,7 +435,7 @@ The \fBcond_timedwait()\fR and \fBcond_reltimedwait()\fR functions are similar to \fBcond_wait()\fR, except that the calling thread will not wait for the condition to become true past the absolute time specified by \fIabstime\fR or the relative time specified by \fIreltime\fR. Note that \fBcond_timedwait()\fR -or \fBcond_reltimedwait()\fR might continue to block as it trys to reacquire +or \fBcond_reltimedwait()\fR might continue to block as it tries to reacquire the mutex pointed to by \fImp\fR, which may be locked by another thread. If either \fBcond_timedwait()\fR or \fBcond_reltimedwait()\fR returns because of a timeout, it returns the error value \fBETIME\fR. diff --git a/usr/src/man/man3c/mbsrtowcs.3c b/usr/src/man/man3c/mbsrtowcs.3c index bf4d3a04d9..05efa21401 100644 --- a/usr/src/man/man3c/mbsrtowcs.3c +++ b/usr/src/man/man3c/mbsrtowcs.3c @@ -44,12 +44,11 @@ .\" Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" -.TH MBSRTOWCS 3C "Jun 28, 2014" +.TH MBSRTOWCS 3C "December 28, 2020" .SH NAME mbsnrtowcs, mbsnrtowcs_l, mbsrtowcs, mbsrtowcs_l \- convert a character string to a wide-character string (restartable) .SH SYNOPSIS -.LP .nf #include <wchar.h> @@ -75,7 +74,6 @@ to a wide-character string (restartable) \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR, \fBlocale_t\fR \fIloc\fR); .fi .SH DESCRIPTION -.LP These function converts a sequence of characters, beginning in the conversion state described by the object pointed to by \fIps\fR, from the array indirectly pointed to by \fIsrc\fR into a sequence of corresponding @@ -124,7 +122,6 @@ current locale. See \fBenviron\fR(5). The functions \fBmbsrtowcs_l()\fR and \fBmbsnrtowcs()\fR, except that instead of using the current locale, they use the locale specified by \fIloc\fR. .SH RETURN VALUES -.LP If the input conversion encounters a sequence of bytes that do not form a valid character, an encoding error occurs. In this case, these functions store the value of the macro \fBEILSEQ\fR in \fBerrno\fR and return @@ -132,8 +129,7 @@ functions store the value of the macro \fBEILSEQ\fR in \fBerrno\fR and return the number of characters successfully converted, not including the terminating null (if any). .SH ERRORS -.LP -Theses functions may fail if: +These functions may fail if: .sp .ne 2 .na @@ -153,7 +149,6 @@ state. Invalid character sequence is detected. .RE .SH ATTRIBUTES -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .TS box; @@ -183,7 +178,6 @@ multithreaded applications, otherwise they use an internal \fBmbstate_t\fR object and are Unsafe in multithreaded applications. .SH SEE ALSO -.LP \fBmbrtowc\fR(3C), \fBmbsinit\fR(3C), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale()\fR, \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3curses/curs_kernel.3curses b/usr/src/man/man3curses/curs_kernel.3curses index 34c4e63d9d..2c8a38b49f 100644 --- a/usr/src/man/man3curses/curs_kernel.3curses +++ b/usr/src/man/man3curses/curs_kernel.3curses @@ -4,13 +4,12 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH CURS_KERNEL 3CURSES "Dec 31, 1996" +.TH CURS_KERNEL 3CURSES "December 28, 2020" .SH NAME curs_kernel, def_prog_mode, def_shell_mode, reset_prog_mode, reset_shell_mode, resetty, savetty, getsyx, setsyx, ripoffline, curs_set, napms \- low-level curses routines .SH SYNOPSIS -.LP .nf \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lcurses\fR [ \fIlibrary\fR ... ] #include <curses.h> @@ -69,10 +68,8 @@ curses routines .fi .SH DESCRIPTION -.sp -.LP The following routines give low-level access to various \fBcurses\fR -functionality. Theses routines typically are used inside library routines. +functionality. These routines typically are used inside library routines. .sp .LP The \fBdef_prog_mode()\fR and \fBdef_shell_mode()\fR routines save the current @@ -139,14 +136,10 @@ the previous \fIcursor\fR state is returned; otherwise, \fBERR\fR is returned. .LP The \fBnapms()\fR routine is used to sleep for \fIms\fR milliseconds. .SH RETURN VALUES -.sp -.LP Except for \fBcurs_set()\fR, these routines always return \fBOK\fR. \fBcurs_set()\fR returns the previous cursor state, or \fBERR\fR if the requested \fIvisibility\fR is not supported. .SH ATTRIBUTES -.sp -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -161,14 +154,10 @@ MT-Level Unsafe .TE .SH SEE ALSO -.sp -.LP \fBcurs_initscr\fR(3CURSES), \fBcurs_outopts\fR(3CURSES), \fBcurs_refresh\fR(3CURSES), \fBcurs_scr_dump\fR(3CURSES), \fBcurs_slk\fR(3CURSES), \fBcurses\fR(3CURSES), \fBattributes\fR(5) .SH NOTES -.sp -.LP The header <\fBcurses.h\fR> automatically includes the headers <\fBstdio.h\fR> and <\fBunctrl.h\fR>. .sp diff --git a/usr/src/man/man3iscsit/it_portal_create.3iscsit b/usr/src/man/man3iscsit/it_portal_create.3iscsit index ef12705a7a..e6c387ef3c 100644 --- a/usr/src/man/man3iscsit/it_portal_create.3iscsit +++ b/usr/src/man/man3iscsit/it_portal_create.3iscsit @@ -3,11 +3,10 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH IT_PORTAL_CREATE 3ISCSIT "Oct 1, 2008" +.TH IT_PORTAL_CREATE 3ISCSIT "December 28, 2020" .SH NAME it_portal_create, it_portal_delete \- create and delete iSCSI portals .SH SYNOPSIS -.LP .nf cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-liscsit\fR [ \fIlibrary\fR\&.\|.\|. ] #include <libiscsit.h> @@ -23,7 +22,6 @@ cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-liscsit\fR [ \fIlibrary\fR\&. .fi .SH PARAMETERS -.sp .ne 2 .na \fB\fIcfg\fR\fR @@ -56,14 +54,12 @@ a pointer to the \fBit_portal_t\fR structure representing the portal \fB\fIportal_ip_port\fR\fR .ad .RS 18n -a string containing an appropriatedly formatted IP address:port. Both IPv4 and +a string containing an appropriately formatted IP address:port. Both IPv4 and IPv6 addresses are permitted. IPv6 addresses should be enclosed in square brackets ('[', ']'). .RE .SH DESCRIPTION -.sp -.LP The \fBit_portal_create()\fR function adds an \fBit_portal_t\fR structure representing a new portal to the specified target portal group. A portal may belong to one and only one target portal group. @@ -77,13 +73,9 @@ Configuration changes as a result of these functions are not instantiated until the modified configuration is committed by calling \fBit_config_commit\fR(3ISCSIT). .SH RETURN VALUES -.sp -.LP The \fBit_portal_create()\fR function returns 0 on success and an error value on failure. .SH ERRORS -.sp -.LP The \fBit_portal_create()\fR function will fail if: .sp .ne 2 @@ -113,8 +105,6 @@ Resources could not be allocated. .RE .SH ATTRIBUTES -.sp -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -131,8 +121,6 @@ MT-Level MT-Safe .TE .SH SEE ALSO -.sp -.LP \fBit_ini_create\fR(3ISCSIT), \fBit_tgt_create\fR(3ISCSIT), \fBit_tpg_create\fR(3ISCSIT), \fBlibiscsit\fR(3LIB), \fBit_config_commit\fR(3ISCSIT), \fBlibiscsit\fR(3LIB), \fBlibnvpair\fR(3LIB), diff --git a/usr/src/man/man3lgrp/lgrp_affinity_get.3lgrp b/usr/src/man/man3lgrp/lgrp_affinity_get.3lgrp index d9d5315c4e..3fed0a871f 100644 --- a/usr/src/man/man3lgrp/lgrp_affinity_get.3lgrp +++ b/usr/src/man/man3lgrp/lgrp_affinity_get.3lgrp @@ -3,11 +3,10 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH LGRP_AFFINITY_GET 3LGRP "Apr 16, 2003" +.TH LGRP_AFFINITY_GET 3LGRP "December 28, 2020" .SH NAME -lgrp_affinity_get, lgrp_affinity_set \- get of set lgroup affinity +lgrp_affinity_get, lgrp_affinity_set \- get or set lgroup affinity .SH SYNOPSIS -.LP .nf cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-llgrp\fR [ \fIlibrary \&.\|.\|.\fR ] #include <sys/lgrp_user.h> @@ -23,7 +22,6 @@ cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-llgrp\fR [ \fIlibrary \&.\|. .fi .SH DESCRIPTION -.LP The \fBlgrp_affinity_get()\fR function returns the affinity that the LWP or set of LWPs specified by the \fIidtype\fR and \fIid\fR arguments have for the given lgroup. @@ -86,7 +84,7 @@ home lgroup for which it has a strong affinity. .LP The \fBLGRP_AFF_WEAK\fR affinity is a hint to the operating system that the calling thread has a weak affinity for the given lgroup. If a thread has a -weak affinity for its home lgroup, the operating system interpets this to mean +weak affinity for its home lgroup, the operating system interprets this to mean that thread does not mind whether it is rehomed, unlike \fBLGRP_AFF_STRONG\fR. Load balancing, dynamic reconfiguration, processor binding, or processor set binding and manipulation are examples of events that can cause the operating @@ -98,7 +96,6 @@ remove a thread's affinity for a particular lgroup. Initially, each thread has no affinity to any lgroup. If a thread has no lgroup affinities set, the operating system chooses a home lgroup for the thread with no affinity set. .SH RETURN VALUES -.LP Upon successful completion, \fBlgrp_affinity_get()\fR returns the affinity for the given lgroup. .sp @@ -109,7 +106,6 @@ Upon successful completion, \fBlgrp_affinity_set()\fR return 0. Otherwise, both functions return \(mi1 and set \fBerrno\fR to indicate the error. .SH ERRORS -.LP The \fBlgrp_affinity_get()\fR and \fBlgrp_affinity_set()\fR functions will fail if: .sp @@ -142,7 +138,6 @@ The specified lgroup or LWP(s) was not found. .RE .SH ATTRIBUTES -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -159,5 +154,4 @@ MT-Level MT-Safe .TE .SH SEE ALSO -.LP \fBlgrp_home\fR(3LGRP), \fBliblgrp\fR(3LIB), \fBattributes\fR(5) diff --git a/usr/src/man/man3m/fex_set_handling.3m b/usr/src/man/man3m/fex_set_handling.3m index ba74f0f159..3a2585025b 100644 --- a/usr/src/man/man3m/fex_set_handling.3m +++ b/usr/src/man/man3m/fex_set_handling.3m @@ -3,12 +3,11 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH FEX_SET_HANDLING 3M "Jul 12, 2006" "SunOS 5.11" "Mathematical Library Functions" +.TH FEX_SET_HANDLING 3M "December 28, 2020" "SunOS 5.11" "Mathematical Library Functions" .SH NAME fex_set_handling, fex_get_handling, fex_getexcepthandler, fex_setexcepthandler \- control floating point exception handling modes .SH SYNOPSIS -.LP .nf c99 [ \fIflag\fR... ] \fIfile\fR... -lm [ \fIlibrary\fR... ] #include <fenv.h> @@ -32,8 +31,6 @@ c99 [ \fIflag\fR... ] \fIfile\fR... -lm [ \fIlibrary\fR... ] .fi .SH DESCRIPTION -.sp -.LP These functions provide control of floating point exception handling modes. For each function, the \fIex\fR argument specifies one or more exceptions indicated by a bitwise-OR of any of the following values defined in <\fBfenv.h\fR>: @@ -307,7 +304,7 @@ the value contained in \fBinfo->res\fR on exit is substituted for the result of the operation, the flags indicated by \fBinfo->flags\fR are set, and execution resumes at the point where the exception occurred. The handler might modify \fBinfo->res\fR and \fBinfo->flags\fR to supply any desired result value and -flags. Alternatively, if the exception is underflow or overflow, the hander +flags. Alternatively, if the exception is underflow or overflow, the handler might set .sp .LP @@ -348,13 +345,9 @@ structure pointed to by \fIbuf\fR. This data structure must have been set by a previous call to \fBfex_getexcepthandler()\fR. Otherwise the effect on the indicated modes is undefined. .SH RETURN VALUES -.sp -.LP The \fBfex_set_handling()\fR function returns a non-zero value if the requested exception handling mode is established. Otherwise, it returns 0. .SH EXAMPLES -.sp -.LP The following example demonstrates how to substitute a predetermined value for the result of a 0/0 invalid operation. .sp @@ -424,8 +417,6 @@ When \fIx\fR = 0, \fIf(x)\fR is computed as 0/0 and an invalid operation exception occurs. In this example, the value 2.0 is substituted for the result. .SH ATTRIBUTES -.sp -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -442,16 +433,12 @@ MT-Level MT-Safe (see Notes) .TE .SH SEE ALSO -.sp -.LP \fBsigfpe\fR(3C), \fBfeclearexcept\fR(3M), \fBfegetenv\fR(3M), \fBfex_set_log\fR(3M), \fBattributes\fR(5) .sp .LP \fINumerical Computation Guide\fR .SH NOTES -.sp -.LP In a multithreaded application, the preceding functions affect exception handling modes only for the calling thread. .sp diff --git a/usr/src/man/man3resolv/resolver.3resolv b/usr/src/man/man3resolv/resolver.3resolv index f54bda17d1..cf5b7037da 100644 --- a/usr/src/man/man3resolv/resolver.3resolv +++ b/usr/src/man/man3resolv/resolver.3resolv @@ -1,7 +1,7 @@ '\" te .\" Portions Copyright 1989 AT&T Portions Copyright (c) 1985, 1995 Regents of the University of California. .\" Copyright (C) 2006, Sun Microsystems, Inc. All Rights Reserved -.TH RESOLVER 3RESOLV "April 9, 2016" +.TH RESOLVER 3RESOLV "December 28, 2020" .SH NAME resolver, res_ninit, fp_resstat, res_hostalias, res_nquery, res_nsearch, res_nquerydomain, res_nmkquery, res_nsend, res_nclose, res_nsendsigned, @@ -9,7 +9,6 @@ dn_comp, dn_expand, hstrerror, res_init, res_query, res_search, res_mkquery, res_send, herror, res_getservers, res_setservers, res_ndestroy \- resolver routines .SH SYNOPSIS -.LP .nf BIND 8.2.2 Interfaces .fi @@ -163,7 +162,6 @@ Deprecated Interfaces .fi .SH DESCRIPTION -.LP These routines are used for making, sending, and interpreting query and reply messages with Internet domain name servers. .sp @@ -326,7 +324,6 @@ the header would be updated. .RE .SS "\fBres_ninit()\fR, \fBres_init()\fR" -.LP The \fBres_ninit()\fR and \fBres_init()\fR routines read the configuration file, if any is present, to get the default domain name, search list and the Internet address of the local name server(s). See \fBresolv.conf\fR(4). If no @@ -345,7 +342,6 @@ are inherited from the configuration file's \fBoptions\fR command. See \fBRES_OPTIONS\fR environment variable. Initialization normally occurs on the first call to one of the other resolver routines. .SS "\fBres_nquery()\fR, \fBres_query()\fR" -.LP The \fBres_nquery()\fR and \fBres_query()\fR functions provide interfaces to the server query mechanism. They construct a query, send it to the local server, await a response, and make preliminary checks on the reply. The query @@ -364,12 +360,11 @@ by the previous query. \fIanswer\fR must be large enough to receive a maximum \fBUDP\fR response from the server or parts of the \fIanswer\fR will be silently discarded. The default maximum \fBUDP\fR response size is 512 bytes. .SS "\fBres_nsearch()\fR, \fBres_search()\fR" -.LP The \fBres_nsearch()\fR and \fBres_search()\fR routines make a query and await a response, just like like \fBres_nquery()\fR and \fBres_query()\fR. In addition, they implement the default and search rules controlled by the \fBRES_DEFNAMES\fR and \fBRES_DNSRCH\fR options. They return the length of the -first successful reply which is stored in \fIanswer\fR. On error, they reurn +first successful reply which is stored in \fIanswer\fR. On error, they return -1. .sp .LP @@ -381,12 +376,10 @@ by the previous query. \fIanswer\fR must be large enough to receive a maximum \fBUDP\fR response from the server or parts of the \fIanswer\fR will be silently discarded. The default maximum \fBUDP\fR response size is 512 bytes. .SS "\fBres_nquerydomain()\fR" -.LP The \fBres_nquerydomain()\fR function calls \fBres_query()\fR on the concatenation of \fIname\fR and \fIdomain\fR, removing a trailing dot from \fIname\fR if \fIdomain\fR is \fINULL\fR. .SS "\fBres_nmkquery()\fR, \fBres_mkquery()\fR" -.LP These routines are used by \fBres_nquery()\fR and \fBres_query()\fR. The \fBres_nmkquery()\fR and \fBres_mkquery()\fR functions construct a standard query message and place it in \fIbuf\fR. The routine returns the \fIsize\fR of @@ -395,7 +388,6 @@ the query, or -1 if the query is larger than \fIbuflen\fR. The query type <\fBarpa/nameser.h\fR>. The domain name for the query is given by \fIdname\fR. \fInewrr\fR is currently unused but is intended for making update messages. .SS "\fBres_nsend()\fR, \fBres_send()\fR, \fBres_nsendsigned()\fR" -.LP The \fBres_nsend()\fR, \fBres_send()\fR, and \fBres_nsendsigned()\fR routines send a pre-formatted query that returns an \fIanswer\fR. The routine calls \fBres_ninit()\fR or \fBres_init()\fR. If \fBRES_INIT\fR is not set, the @@ -414,26 +406,21 @@ by the previous query. \fIanswer\fR must be large enough to receive a maximum \fBUDP\fR response from the server or parts of the \fIanswer\fR will be silently discarded. The default maximum \fBUDP\fR response size is 512 bytes. .SS "\fBfp_resstat()\fR" -.LP The function \fBfp_resstat()\fR prints out the active flag bits in \fIstatp\fR->\fBoptions\fR preceded by the text "\fB;; res options:\fR" on \fIfile\fR. .SS "\fBres_hostalias()\fR" -.LP The function \fBres_hostalias()\fR looks up \fIname\fR in the file referred to by the \fBHOSTALIASES\fR environment variable and returns the fully qualified host name. If \fIname\fR is not found or an error occurs, \fBNULL\fR is returned. \fBres_hostalias()\fR stores the result in \fIbuf\fR. .SS "\fBres_nclose()\fR" -.LP The \fBres_nclose()\fR function closes any open files referenced through \fIstatp\fR. .SS "\fBres_ndestroy()\fR" -.LP The \fBres_ndestroy()\fR function calls \fBres_nclose()\fR, then frees any memory allocated by \fBres_ninit()\fR referenced through \fIstatp\fR. .SS "\fBdn_comp()\fR" -.LP The \fBdn_comp()\fR function compresses the domain name \fIexp_dn\fR and stores it in \fIcomp_dn\fR. The \fBdn_comp()\fR function returns the size of the compressed name, or \fB\(mi1\fR if there were errors. \fIlength\fR is the size @@ -451,7 +438,6 @@ labels inserted into the message by \fBdn_comp()\fR as the name is compressed. If \fIdnptrs\fR is \fINULL\fR, names are not compressed. If \fIlastdnptr\fR is \fINULL\fR, \fBdn_comp()\fR does not update the list of labels. .SS "\fBdn_expand()\fR" -.LP The \fBdn_expand()\fR function expands the compressed domain name \fIcomp_dn\fR to a full domain name. The compressed name is contained in a query or reply message. \fImsg\fR is a pointer to the beginning of that message. The @@ -459,7 +445,6 @@ uncompressed name is placed in the buffer indicated by \fIexp_dn\fR, which is of size \fIlength\fR. The \fBdn_expand()\fR function returns the size of the compressed name, or \fB\(mi1\fR if there was an error. .SS "\fBhstrerror()\fR, \fBherror()\fR" -.LP The variables \fIstatp->res_h_errno\fR and \fI_res.res_h_errno\fR and external variable \fIh_errno\fR are set whenever an error occurs during a resolver operation. The following definitions are given in <\fBnetdb.h\fR>: @@ -486,7 +471,6 @@ message corresponding to the value of \fIh_errno\fR. The \fBhstrerror()\fR function returns a string, which is the message text that corresponds to the value of the \fIerr\fR parameter. .SS "\fBres_setservers()\fR, \fBres_getservers()\fR" -.LP The functions \fBres_getservers()\fR and \fBres_setservers()\fR are used to get and set the list of servers to be queried. .SH FILES @@ -499,7 +483,6 @@ resolver configuration file .RE .SH ATTRIBUTES -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -517,7 +500,6 @@ T} .TE .SH SEE ALSO -.LP \fBdomainname\fR(1M), \fBgethostbyname\fR(3NSL), \fBlibresolv\fR(3LIB), \fBresolv.conf\fR(4), \fBattributes\fR(5) .sp @@ -545,7 +527,6 @@ November 1987. Vixie, Paul, Dunlap, Kevin J., Karels, Michael J. \fIName Server Operations Guide for BIND\fR. Internet Software Consortium, 1996. .SH NOTES -.LP When the caller supplies a work buffer, for example the \fIanswer\fR buffer argument to \fBres_nsend()\fR or \fBres_send()\fR, the buffer should be aligned on an eight byte boundary. Otherwise, an error such as a \fBSIGBUS\fR may diff --git a/usr/src/man/man4/bart_manifest.4 b/usr/src/man/man4/bart_manifest.4 index 133b85a6d6..dd2950a25f 100644 --- a/usr/src/man/man4/bart_manifest.4 +++ b/usr/src/man/man4/bart_manifest.4 @@ -3,12 +3,10 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH BART_MANIFEST 4 "Sep 9, 2003" +.TH BART_MANIFEST 4 "December 28, 2020" .SH NAME bart_manifest \- system audit manifest file .SH DESCRIPTION -.sp -.LP The \fBbart\fR(1M) command generates a manifest that describes the contents of a managed host. A manifest consists of a header and entries. Each entry represents a single file. Entries are sorted in ascending order by file name. @@ -33,8 +31,6 @@ This comment block lists the attributes reported for each file type. .LP To see the format of a manifest file, see \fBEXAMPLES\fR. .SS "Manifest File Entries" -.sp -.LP Each manifest file entry is a single line of one of the following forms, depending on the file type: .sp @@ -243,14 +239,12 @@ block device files only. .RE .SS "Quoting Syntax" -.sp -.LP The rules file supports a quoting syntax for representing nonstandard file names. .sp .LP -When generating a manifest for file names that embeded TAB, SPACE, or NEWLINE -characters, the special characters are encoded in their octal forms. +When generating a manifest for file names that contain embedded TAB, SPACE, or +NEWLINE characters, the special characters are encoded in their octal forms. .sp .sp @@ -274,7 +268,6 @@ _ .TE .SH EXAMPLES -.LP \fBExample 1 \fRSample Manifest File .sp .LP @@ -310,6 +303,4 @@ the encoded versions of the file names to correctly handle special characters. .in -2 .SH SEE ALSO -.sp -.LP \fBdate\fR(1), \fBbart\fR(1M), \fBbart_rules\fR(4), \fBattributes\fR(5) diff --git a/usr/src/man/man4/crypt.conf.4 b/usr/src/man/man4/crypt.conf.4 index 58134ea715..f86fdf8d2c 100644 --- a/usr/src/man/man4/crypt.conf.4 +++ b/usr/src/man/man4/crypt.conf.4 @@ -3,18 +3,15 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH CRYPT.CONF 4 "Jun 10, 2002" +.TH CRYPT.CONF 4 "December 28, 2020" .SH NAME crypt.conf \- configuration file for pluggable crypt modules .SH SYNOPSIS -.LP .nf /etc/security/crypt.conf .fi .SH DESCRIPTION -.sp -.LP \fBcrypt.conf\fR is the configuration file for the pluggable crypt architecture. Each crypt module must provide a function to generate a password hash, \fBcrypt_genhash_impl\fR(3C), and a function to generate the salt, @@ -42,7 +39,6 @@ is the responsibility of the module to parse and interpret the options. The any module-specific parameters that control the output of the hashing algorithm. .SH EXAMPLES -.LP \fBExample 1 \fRProvide compatibility for md5crypt-generated passwords. .sp .LP @@ -78,7 +74,7 @@ algorithm names 1 and 2. md5 /usr/lib/security/$ISA/crypt_md5.so rot13 /usr/lib/security/$ISA/crypt_rot13.so -# For *BSD/Linux compatibilty +# For *BSD/Linux compatibility # 1 is md5, 2 is Blowfish 1 /usr/lib/security/$ISA/crypt_bsdmd5.so 2 /usr/lib/security/$ISA/crypt_bsdbf.so @@ -86,8 +82,6 @@ rot13 /usr/lib/security/$ISA/crypt_rot13.so .in -2 .SH ATTRIBUTES -.sp -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -102,8 +96,6 @@ Interface Stability Evolving .TE .SH SEE ALSO -.sp -.LP \fBpasswd\fR(1), \fBcrypt\fR(3C), \fBcrypt_genhash_impl\fR(3C), \fBcrypt_gensalt\fR(3C), \fBcrypt_gensalt_impl\fR(3C), \fBgetpassphrase\fR(3C), \fBpasswd\fR(4), \fBattributes\fR(5), \fBcrypt_unix\fR(5) diff --git a/usr/src/man/man4/nfs.4 b/usr/src/man/man4/nfs.4 index 29b60bf5e2..95822c75e6 100644 --- a/usr/src/man/man4/nfs.4 +++ b/usr/src/man/man4/nfs.4 @@ -20,7 +20,7 @@ .\" Copyright 2016 Nexenta Systems, Inc. .\" Copyright 2020 Joyent, Inc. .\" -.Dd February 4, 2020 +.Dd December 28, 2020 .Dt NFS 4 .Os .Sh NAME @@ -134,7 +134,7 @@ is equivalent to on the .Nm nfsd command line. -Mutually exlusive of +Mutually exclusive of .Sy device . For the UDP protocol, only version 2 and version 3 service is established. NFS Version 4 is not supported for the UDP protocol. diff --git a/usr/src/man/man4/process.4 b/usr/src/man/man4/process.4 index d709decfce..4a61edb777 100644 --- a/usr/src/man/man4/process.4 +++ b/usr/src/man/man4/process.4 @@ -4,18 +4,15 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH PROCESS 4 "Sept 6, 2016" +.TH PROCESS 4 "December 28, 2020" .SH NAME process \- process contract type .SH SYNOPSIS -.LP .nf \fB/system/contract/process\fR .fi .SH DESCRIPTION -.sp -.LP Process contracts allow processes to create a fault boundary around a set of subprocesses and observe events which occur within that boundary. .sp @@ -24,8 +21,6 @@ Process contracts are managed using the \fBcontract\fR(4) file system and the \fBlibcontract\fR(3LIB) library. The process contract type directory is \fB/system/contract/process\fR. .SS "CREATION" -.sp -.LP A process contract is created when an LWP that has an active process contract template calls \fBfork\fR(2). Initially, the child process created by \fBfork()\fR is the only resource managed by the contract. When an LWP that @@ -33,8 +28,6 @@ does not have an active process contract template calls \fBfork()\fR, the child process created by \fBfork()\fR is added as a resource to the process contract of which the parent was a member. .SS "EVENT TYPES" -.sp -.LP The following events types are defined: .sp .ne 2 @@ -100,8 +93,6 @@ A process was killed because of an uncorrectable hardware error. .RE .SS "TERMS" -.sp -.LP The following common contract terms, defined in \fBcontract\fR(4), have process-contract specific attributes: .sp @@ -302,7 +293,7 @@ in its effective set. .RS 4n Specifies the ID of an empty process contract held by the caller whose inherited process contracts are to be transferred to the newly created -contract. Use \fBct_pr_tmpl_set_transfer\fR(3CONTRACT) to set the tranfer +contract. Use \fBct_pr_tmpl_set_transfer\fR(3CONTRACT) to set the transfer contract. Attempts to specify a contract not held by the calling process, or a contract which still has processes in it, fail. .sp @@ -310,8 +301,6 @@ The default transfer term is \fB0\fR, that is, no contract. .RE .SS "STATUS" -.sp -.LP In addition to the standard items, the status object read from a status file descriptor contains the following items to obtain this information respectively: @@ -437,8 +426,6 @@ when observed by processes in the non-global zone. .RE .SS "EVENTS" -.sp -.LP In addition to the standard items, an event generated by a process contract contains the following information: .sp @@ -550,7 +537,6 @@ The PID of the process which sent the signal. Use .RE .SH FILES -.sp .ne 2 .na \fB\fB/usr/include/sys/contract/process.h\fR\fR @@ -561,8 +547,6 @@ Contains definitions of event-type macros. .RE .SH SEE ALSO -.sp -.LP \fBctrun\fR(1), \fBctstat\fR(1), \fBctwatch\fR(1), \fBcoreadm\fR(1M), \fBclose\fR(2), \fBfork\fR(2), \fBioctl\fR(2), \fBopen\fR(2), \fBpoll\fR(2), \fBct_pr_event_get_exitstatus\fR(3CONTRACT), diff --git a/usr/src/man/man4/smb.4 b/usr/src/man/man4/smb.4 index d6296f2ea8..cecabe8179 100644 --- a/usr/src/man/man4/smb.4 +++ b/usr/src/man/man4/smb.4 @@ -17,7 +17,7 @@ .\" fields enclosed by brackets "[]" replaced with your own identifying .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" -.TH SMB 4 "May 16, 2020" +.TH SMB 4 "December 28, 2020" .SH NAME smb \- configuration properties for Solaris CIFS server .SH DESCRIPTION @@ -162,7 +162,7 @@ when encryption is On (see \fBencrypt\fR property) and negotiated SMB dialect is .sp When the property is set the valid values are aes-128-ccm and aes-128-gcm. If aes-128-gcm is selected both CCM and GCM are allowed, but GCM is preferred. -If aes-128-ccm is seelcted it is the only allowed cipher. If the property is not +If aes-128-ccm is selected it is the only allowed cipher. If the property is not set explicitly the default value is used - aes-128-gcm. .sp The property can be set to one of these values: diff --git a/usr/src/man/man4/sysbus.4 b/usr/src/man/man4/sysbus.4 index 4c171db2e4..77970edacc 100644 --- a/usr/src/man/man4/sysbus.4 +++ b/usr/src/man/man4/sysbus.4 @@ -3,16 +3,14 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH SYSBUS 4 "Nov 18, 2004" +.TH SYSBUS 4 "December 28, 2020" .SH NAME sysbus, isa \- device tree properties for ISA bus device drivers .SH DESCRIPTION -.sp -.LP -Solaris for x86 supports the \fBISA\fR bus as the system bus. Drivers for -devices on this buse use the device tree built by the booting system to +Solaris for x86 supports the \fBISA\fR bus as the system bus. Drivers for +devices on this bus use the device tree built by the booting system to retrieve the necessary system resources used by the driver. These resources -include device I/O port addresses, any interrupt capabilities that the device +include device I/O port addresses, any interrupt capabilities that the device can have, any DMA channels it can require, and any memory-mapped addresses it can occupy. .sp @@ -42,7 +40,7 @@ file for the driver. Each entry in the array of integers for the the \fBinterrupts\fR property to specify the \fBIPL\fR value that is used by the system for this interrupt in this driver. This is the priority that this device's interrupt handler receives relative to the interrupt handlers of other -drivers. The priority is an integer from \fB1\fR to \fB16\fR. Generally, +drivers. The priority is an integer from \fB1\fR to \fB16\fR. Generally, disks are assigned a priority of \fB5\fR, while mice and printers are lower, and serial communication devices are higher, typically \fB7\fR. \fB10\fR is reserved by the system and must not be used. Priorities \fB11\fR and greater @@ -69,14 +67,14 @@ associated with the device on the bus. The first integer of the tuple specifies the memory type, \fB0\fR specifies a memory range and \fB1\fR specifies an I/O range. The second integer specifies the base address of the memory range. The third integer of each 3-tuple -specifies the size, in bytes, of the mappable region. +specifies the size, in bytes, of the mappable region. .sp The driver can refer to the elements of this array by index, and construct kernel mappings to these addresses using \fBddi_map_regs\fR(9F). The index into -the array is passed as the \fIrnumber\fR argument of \fBddi_map_regs()\fR. +the array is passed as the \fIrnumber\fR argument of \fBddi_map_regs()\fR. .sp -All \fBsysbus\fR devices have \fBreg\fR properties. The first tuple of this -property is used to construct the address part of the device name under +All \fBsysbus\fR devices have \fBreg\fR properties. The first tuple of this +property is used to construct the address part of the device name under \fB/devices\fR. In the case of \fBPlug and Play ISA\fR devices, the first tuple is a special tuple that does not denote a memory range, but is used by the system only to create the address part of the device name. This special tuple @@ -106,8 +104,6 @@ devices that use DMA channels have a \fBdma-channels\fR property. .RE .SH ATTRIBUTES -.sp -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -122,8 +118,6 @@ Architecture x86 .TE .SH SEE ALSO -.sp -.LP \fBprtconf\fR(1M), \fBdriver.conf\fR(4), \fBscsi\fR(4), \fBattributes\fR(5), \fBddi_add_intr\fR(9F), \fBddi_intr_hilevel\fR(9F), \fBddi_map_regs\fR(9F), \fBddi_prop_op\fR(9F) diff --git a/usr/src/man/man4/terminfo.4 b/usr/src/man/man4/terminfo.4 index d1d5577d62..cadbccc0ef 100644 --- a/usr/src/man/man4/terminfo.4 +++ b/usr/src/man/man4/terminfo.4 @@ -4,17 +4,15 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH TERMINFO 4 "April 9, 2016" +.TH TERMINFO 4 "December 28, 2020" .SH NAME terminfo \- terminal and printer capability database .SH SYNOPSIS -.LP .nf \fB/usr/share/lib/terminfo/?/*\fR .fi .SH DESCRIPTION -.LP The \fBterminfo\fR database describes the capabilities of devices such as terminals and printers. Devices are described in \fBterminfo\fR source files by specifying a set of capabilities, by quantifying certain aspects of the device, @@ -109,7 +107,6 @@ The \fBterminfo\fR reference manual page is organized in two sections: \fBPART 2: PRINTER CAPABILITIES\fR .RE .SS "PART 1: DEVICE CAPABILITIES" -.LP Capabilities in \fBterminfo\fR are of three types: Boolean capabilities (which show that a device has or does not have a particular feature), numeric capabilities (which quantify particular features of a device), and string @@ -443,7 +440,6 @@ insert_padding ip ip Insert pad after .sp .SS "key_Strings" -.LP The ``\fBkey_\fR'' strings are sent by specific keys. The ``\fBkey_\fR'' descriptions include the macro, defined in \fB<curses.h>\fR, for the code returned by the \fBcurses\fR routine \fBgetch\fR when the key is pressed (see @@ -905,7 +901,6 @@ zero_motion zerom Zx No motion for the .sp .SS "Sample Entry" -.LP The following entry, which describes the AT&T 610 terminal, is among the more complex entries in the \fBterminfo\fR file as of this writing. .sp @@ -946,7 +941,6 @@ complex entries in the \fBterminfo\fR file as of this writing. .in -2 .SS "Types of Capabilities in the Sample Entry" -.LP The sample entry shows the formats for the three types of \fBterminfo\fR capabilities listed: Boolean, numeric, and string. All capabilities specified in the \fBterminfo\fR source file must be followed by commas, including the @@ -1008,7 +1002,6 @@ period before the capability name. For example, see the second \fBind\fR in the example above. Note that capabilities are defined in a left-to-right order and, therefore, a prior definition will override a later definition. .SS "Preparing Descriptions" -.LP The most effective way to prepare a device description is by imitating the description of a similar device in \fBterminfo\fR and building up a description gradually, using partial descriptions with \fBvi\fR to check that they are @@ -1024,7 +1017,6 @@ from the middle of the screen, and then press the \fBu\fR key several times quickly. If the display is corrupted, more padding is usually needed. A similar test can be used for insert-character. .SS "Section 1-1: Basic Capabilities" -.LP The number of columns on each line for the device is given by the \fBcols\fR numeric capability. If the device has a screen, then the number of lines on the screen is given by the \fBlines\fR capability. If the device wraps around to @@ -1113,7 +1105,6 @@ adm3 | lsi adm3, .sp .SS "Section 1-2: Parameterized Strings" -.LP Cursor addressing and other strings requiring parameters are described by a parameterized string capability, with \fBprintf\fR-like escapes (\fB%\fR\fIx\fR) in it. For example, to address the cursor, the \fBcup\fR @@ -1348,7 +1339,6 @@ space (32), adds them (pushing the sum on the stack in place of the two previous values), and outputs that value as a character. Then the same is done for the second parameter. More complex arithmetic is possible using the stack. .SS "Section 1-3: Cursor Motions" -.LP If the terminal has a fast way to home the cursor (to very upper left corner of screen) then this can be given as \fBhome\fR; similarly a fast way of getting to the lower left-hand corner can be given as \fBll\fR; this may involve going @@ -1382,7 +1372,6 @@ command character to be the one used by \fBterminfo\fR. If the \fBsmcup\fR sequence will not restore the screen after an \fBrmcup\fR sequence is output (to the state prior to outputting \fBrmcup\fR), specify \fBnrrmc\fR. .SS "Section 1-4: Area Clears" -.LP If the terminal can clear from the current position to the end of the line, leaving the cursor where it is, this should be given as \fBel\fR. If the terminal can clear from the beginning of the line to the current position @@ -1392,7 +1381,6 @@ then this should be given as \fBed\fR. \fBed\fR is only defined from the first column of a line. (Thus, it can be simulated by a request to delete a large number of lines, if a true \fBed\fR is not available.) .SS "Section 1-5: Insert/Delete Line" -.LP If the terminal can open a new blank line before the line where the cursor is, this should be given as \fBil1\fR; this is done only from the first position of a line. The cursor must then appear on the newly blank line. If the terminal @@ -1438,7 +1426,6 @@ be given. These indicate that deleting a line or scrolling a full screen may bring non-blank lines up from below or that scrolling back with \fBri\fR may bring down non-blank lines. .SS "Section 1-6: Insert/Delete Character" -.LP There are two basic kinds of intelligent terminals with respect to insert/delete character operations which can be described using \fBterminfo.\fR The most common insert/delete character operations affect only the characters @@ -1500,7 +1487,6 @@ terminal needs to be placed in for \fBdch1\fR to work). A command to erase \fIn\fR characters (equivalent to outputting \fIn\fR blanks without moving the cursor) can be given as \fBech\fR with one parameter. .SS "Section 1-7: Highlighting, Underlining, and Visible Bells" -.LP Your device may have one or more kinds of display attributes that allow you to highlight selected characters when they appear on the screen. The following display modes (shown with the names by which they are set) may be available: a @@ -1582,7 +1568,7 @@ needs the following escape sequences to turn on various modes. .TS c c c c c c . -tparm +tparm parameter attribute escape sequence _ none \eE[0m @@ -1645,7 +1631,6 @@ Putting this all together into the \fBsgr\fR sequence gives: .LP Remember that \fBsgr\fR and \fBsgr0\fR must always be specified. .SS "Section 1-8: Keypad" -.LP If the device has a keypad that transmits sequences when the keys are pressed, this information can also be specified. Note that it is not possible to handle devices where the keypad only works in local (this applies, for example, to the @@ -1687,7 +1672,6 @@ and off, give them in \fBsmln\fR and \fBrmln\fR. \fBsmln\fR is normally output after one or more \fBpln\fR sequences to make sure that the change becomes visible. .SS "Section 1-9: Tabs and Initialization" -.LP If the device has hardware tabs, the command to advance to the next tab stop can be given as \fBht\fR (usually control I). A ``backtab'' command that moves leftward to the next tab stop can be given as \fBcbt\fR. By convention, if tty @@ -1743,7 +1727,6 @@ Any margin can be cleared with \fBmgc\fR. (For instructions on how to specify commands to set and clear margins, see "Margins" below under "PRINTER CAPABILITIES".) .SS "Section 1-10: Delays" -.LP Certain capabilities control padding in the \fBtty\fR driver. These are primarily needed by hard-copy terminals, and are used by \fBtput\fR \fBinit\fR to set tty modes appropriately. Delays embedded in the capabilities \fBcr\fR, @@ -1752,7 +1735,6 @@ appropriate delay bits to be set in the tty driver. If \fBpb\fR (padding baud rate) is given, these values can be ignored at baud rates below the value of \fBpb\fR. .SS "Section 1-11: Status Lines" -.LP If the terminal has an extra ``status line'' that is not normally used by software, this fact can be indicated. If the status line is viewed as an extra line below the bottom line, into which one can cursor address normally (such as @@ -1776,7 +1758,6 @@ line is a different width (possibly because the terminal does not allow an entire line to be loaded) the width, in columns, can be indicated with the numeric parameter \fBwsl\fR. .SS "Section 1-12: Line Graphics" -.LP If the device has a line drawing alternate character set, the mapping of glyph to character would be given in \fBacsc\fR. The definition of this string is based on the alternate character set used in the DEC VT100 terminal, extended @@ -1847,7 +1828,6 @@ Now write down the characters left to right, as in In addition, \fBterminfo\fR allows you to define multiple character sets. See Section 2-5 for details. .SS "Section 1-13: Color Manipulation" -.LP Let us define two methods of color manipulation: the Tektronix method and the HP method. The Tektronix method uses a set of N predefined colors (usually 8) from which a user can select "current" foreground and background colors. Thus a @@ -1938,7 +1918,6 @@ cannot coexist with colors. For example, if the terminal uses colors to simulate reverse video (bit number 2 and decimal value 4) and bold (bit number 5 and decimal value 32), the resulting value for \fBncv\fR will be 36 (4 + 32). .SS "Section 1-14: Miscellaneous" -.LP If the terminal requires other than a null (zero) character as a pad, then this can be given as \fBpad\fR. Only the first character of the \fBpad\fR string is used. If the terminal does not have a pad character, specify \fBnpc\fR. @@ -2009,7 +1988,6 @@ screen when the printer is on, specify \fBmc5i\fR (silent printer). All text, including \fBmc4\fR, is transparently passed to the printer while an \fBmc5p\fR is in effect. .SS "Section 1-15: Special Cases" -.LP The working model used by \fBterminfo\fR fits most terminals reasonably well. However, some terminals do not completely match that model, requiring special support by \fBterminfo\fR. These are not meant to be construed as deficiencies @@ -2044,7 +2022,6 @@ Those Beehive Superbee terminals which do not transmit the escape or control\(miC characters, should specify \fBxsb\fR, indicating that the f1 key is to be used for escape and the f2 key for control C. .SS "Section 1-16: Similar Terminals" -.LP If there are two very similar terminals, one can be defined as being just like the other with certain exceptions. The string capability \fBuse\fR can be given with the name of the similar terminal. The capabilities given before \fBuse\fR @@ -2067,20 +2044,17 @@ defines an AT&T4424 terminal that does not have the \fBrev\fR, \fBsgr\fR, and different modes for a terminal, or for different user preferences. More than one \fBuse\fR capability may be given. .SS "PART 2: PRINTER CAPABILITIES" -.LP The \fBterminfo\fR database allows you to define capabilities of printers as well as terminals. To find out what capabilities are available for printers as well as for terminals, see the two lists under "DEVICE CAPABILITIES" that list capabilities by variable and by capability name. .SS "Section 2-1: Rounding Values" -.LP Because parameterized string capabilities work only with integer values, we recommend that \fBterminfo\fR designers create strings that expect numeric values that have been rounded. Application designers should note this and should always round values to the nearest integer before using them with a parameterized string capability. .SS "Section 2-2: Printer Resolution" -.LP A printer's resolution is defined to be the smallest spacing of characters it can achieve. In general printers have independent resolution horizontally and vertically. Thus the vertical resolution of a printer can be determined by @@ -2122,7 +2096,6 @@ capability would give the width of a page in columns. In ``micro mode,'' many printers the micro mode may be concomitant with normal mode, so that all the capabilities work at the same time. .SS "Section 2-3: Specifying Printer Resolution" -.LP The printing resolution of a printer is given in several ways. Each specifies the resolution as the number of smallest steps per distance: .sp @@ -2289,7 +2262,6 @@ $V sub italic cpi$, $V sub italic lpi$, $V sub italic chr$, and $V sub italic cvr$ are the arguments used with \fBcpi\fR, \fBlpi\fR, \fBchr\fR, and \fBcvr\fR, respectively. The prime marks (\|'\|) indicate the old values. .SS "Section 2-4: Capabilities that Cause Movement" -.LP In the following descriptions, ``movement'' refers to the motion of the ``current position.'' With video terminals this would be the cursor; with some printers this is the carriage position. Other printers have different @@ -2453,7 +2425,6 @@ Miscellaneous Motion Strings .sp .SS "Margins" -.LP \fBterminfo\fR provides two strings for setting margins on terminals: one for the left and one for the right margin. Printers, however, have two additional margins, for the top and bottom margins of each page. Furthermore, some @@ -2516,7 +2487,6 @@ the bottom line of the page. .LP All margins can be cleared with \fBmgc\fR. .SS "Shadows, Italics, Wide Characters" -.LP Five new sets of strings describe the capabilities printers have of enhancing printed text. .sp @@ -2594,7 +2564,6 @@ affecting shadow, italicized, widened, superscript, or subscript printing. Conversely, if \fBmsgr\fR is not set, a program should end these modes before attempting any motion. .SS "Section 2-5: Alternate Character Sets" -.LP In addition to allowing you to define line graphics (described in Section 1-12), \fBterminfo\fR lets you define alternate character sets. The following capabilities cover printers and terminals with multiple selectable or definable @@ -2680,7 +2649,6 @@ are not available, the strings should not be defined. For printers that have manually changed print-wheels or font cartridges, the boolean \fBdaisy\fR is set. .SS "Section 2-6: Dot-Matrix Graphics" -.LP Dot-matrix printers typically have the capability of reproducing ``raster-graphics'' images. Three new numeric capabilities and three new string capabilities can help a program draw raster-graphics images independent of the @@ -2703,7 +2671,7 @@ Dot-Matrix Graphics .sp .LP -The \fBsbim\fR sring is used with a single argument, \fIB\fR, the width of the +The \fBsbim\fR string is used with a single argument, \fIB\fR, the width of the image in dots. .sp .LP @@ -2769,7 +2737,6 @@ the decimal values are further offset by the value 63. The \fBporder\fR string for these printers would be \fB,,6,5,4,3,2,1;63\fR, or alternately \fBo,o,6,5,4,3,2,1;63\fR. .SS "Section 2-7: Effect of Changing Printing Resolution" -.LP If the control sequences to change the character pitch or the line pitch are used, the pin or dot spacing may change: .sp @@ -2829,7 +2796,6 @@ in steps per inch, before using \fBlpi\fR and after using \fBlpi\fR, respectively. Thus, the changes in the dots per inch for dot-matrix graphics follow the changes in steps per inch for printer resolution. .SS "Section 2-8: Print Quality" -.LP Many dot-matrix printers can alter the dot spacing of printed text to produce near ``letter quality'' printing or ``draft quality'' printing. Usually it is important to be able to choose one or the other because the rate of printing @@ -2853,7 +2819,6 @@ The capabilities are listed in decreasing levels of quality. If a printer doesn't have all three levels, one or two of the strings should be left blank as appropriate. .SS "Section 2-9: Printing Rate and Buffer Size" -.LP Because there is no standard protocol that can be used to keep a program synchronized with a printer, and because modern printers can buffer data before printing it, a program generally cannot determine at any time what has been @@ -2939,12 +2904,10 @@ terminal (escape sequences that set margins and tabs) .RE .SH SEE ALSO -.LP \fBls\fR(1), \fBpg\fR(1), \fBstty\fR(1), \fBtput\fR(1), \fBtty\fR(1), \fBvi\fR(1), \fBinfocmp\fR(1M), \fBtic\fR(1M), \fBprintf\fR(3C), \fBcurses\fR(3CURSES), \fBcurses\fR(3XCURSES) .SH NOTES -.LP The most effective way to prepare a terminal description is by imitating the description of a similar terminal in \fBterminfo\fR and to build up a description gradually, using partial descriptions with a screen oriented diff --git a/usr/src/man/man7d/cpqary3.7d b/usr/src/man/man7d/cpqary3.7d index 5f52d849a6..1ed77081ee 100644 --- a/usr/src/man/man7d/cpqary3.7d +++ b/usr/src/man/man7d/cpqary3.7d @@ -11,11 +11,10 @@ .\" .\" Copyright (C) 2013 Hewlett-Packard Development Company, L.P. .\" -.TH CPQARY3 7D Aug 26, 2013" +.TH CPQARY3 7D "December 28, 2020" .SH NAME cpqary3 - provides disk and SCSI tape support for HP Smart Array controllers .SH DESCRIPTION -.LP The cpqary3 module provides low-level interface routines between the common disk I/O subsystem and the HP SMART Array controllers. The cpqary3 driver provides disk and SCSI tape support for the HP Smart Array controllers. @@ -32,7 +31,7 @@ controller can support up to 32 logical volumes. In addition, each controller supports up to a maximum of 28 connected SCSI tape drives. With 1.90 and later versions of cpqary3 driver, HP Smart Array SAS controllers, having Firmware Revision 5.10 or later, will support 64 logical drives. This -firmware also supports Dual Domian Multipath configurations. +firmware also supports Dual Domain Multipath configurations. .LP The driver attempts to initialize itself in accordance with the information found in the configuration file, /kernel/drv/cpqary3.conf. @@ -77,7 +76,6 @@ then target ID entries for tape drives from 65 to 65+N must be added in .BR sd (7D), .BR st (7D) .SH NOTES -.LP The Smart Array controllers supported by the current version of the cpqary3 driver do not support 'format unit' SCSI command. Hence, selecting \&'format' option under 'format' utility main menu is not supported. In addition, diff --git a/usr/src/man/man7i/vt.7i b/usr/src/man/man7i/vt.7i index c81860b4f2..67659e830b 100644 --- a/usr/src/man/man7i/vt.7i +++ b/usr/src/man/man7i/vt.7i @@ -14,7 +14,7 @@ .\" If applicable, add the following below this CDDL HEADER, with the .\" fields enclosed by brackets "[]" replaced with your own identifying .\" information: Portions Copyright [yyyy] [name of copyright owner] -.Dd October 29, 2017 +.Dd December 28, 2020 .Dt VT 7I .Os .Sh NAME @@ -277,7 +277,7 @@ to .Dv KD_TEXT or a VT of .Dv KD_TEXT -mode is actived from a previous active VT of +mode is activated from a previous active VT of .Dv KD_GRAPHICS mode, the virtual console manager initiates a .Dv KDSETMODE diff --git a/usr/src/man/man7p/ip6.7p b/usr/src/man/man7p/ip6.7p index c196466c81..c88233ed39 100644 --- a/usr/src/man/man7p/ip6.7p +++ b/usr/src/man/man7p/ip6.7p @@ -3,11 +3,10 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH IP6 7P "Dec 2, 2008" +.TH IP6 7P "December 28, 2020" .SH NAME ip6 \- Internet Protocol Version 6 .SH SYNOPSIS -.LP .nf #include <sys/socket.h> #include <netinet/in.h> @@ -25,8 +24,6 @@ t = t_open ("/dev/rawip6", O_RDWR); .fi .SH DESCRIPTION -.sp -.LP The \fBIPv6\fR protocol is the next generation of the internetwork datagram delivery protocol of the Internet protocol family. Programs may use \fBIPv6\fR through higher-level protocols such as the Transmission Control Protocol @@ -37,8 +34,6 @@ Transport Level Interface (\fBTLI\fR). The protocol options and \fBIPv6\fR extension headers defined in the \fBIPv6\fR specification may be set in outgoing datagrams. .SH APPLICATION PROGRAMMING INTERFACE -.sp -.LP The \fBSTREAMS\fR driver \fB/dev/rawip6\fR is the \fBTLI\fR transport provider that provides raw access to \fBIPv6\fR. .sp @@ -82,7 +77,7 @@ The socket options supported at the \fBIPv6\fR level are: .ad .RS 24n Limit reception and transmission of packets to this interface. Takes an integer -as an argument; the integer is the selected interace index. +as an argument; the integer is the selected interface index. .RE .sp @@ -578,8 +573,6 @@ reconstructed within a short time period. Errors in sending discovered at the network interface driver layer are passed by IPv6 back up to the user process. .SH SEE ALSO -.sp -.LP \fBsvcs\fR(1), \fBndd\fR(1M), \fBrouteadm\fR(1M), \fBsvcadm\fR(1M), \fBread\fR(2), \fBwrite\fR(2), \fBbind\fR(3SOCKET), \fBconnect\fR(3SOCKET), \fBgetsockopt\fR(3SOCKET), \fBrecv\fR(3SOCKET), \fBrecvmsg\fR(3SOCKET), @@ -596,8 +589,6 @@ Specification\fR. The Internet Society. December, 1998. Stevens, W., and Thomas, M. \fIRFC 2292, Advanced Sockets API for IPv6\fR. Network Working Group. February 1998. .SH DIAGNOSTICS -.sp -.LP A socket operation may fail with one of the following errors returned: .sp .ne 2 @@ -766,8 +757,6 @@ Invalid socket type for the option. .RE .SH NOTES -.sp -.LP Applications using the sockets \fBAPI\fR must use the Advanced Sockets \fBAPI\fR for \fBIPv6\fR (\fIRFC 2292\fR) to see elements of the inbound packet's \fBIPv6\fR header or extension headers. diff --git a/usr/src/man/man7p/pf_key.7p b/usr/src/man/man7p/pf_key.7p index 453dc81aa0..1c904048f4 100644 --- a/usr/src/man/man7p/pf_key.7p +++ b/usr/src/man/man7p/pf_key.7p @@ -4,11 +4,10 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH PF_KEY 7P "Jan 12, 2018" +.TH PF_KEY 7P "December 28, 2020" .SH NAME pf_key \- Security association database interface .SH SYNOPSIS -.LP .nf #include <sys/types.h> #include <sys/socket.h> @@ -20,7 +19,6 @@ pf_key \- Security association database interface .fi .SH DESCRIPTION -.LP Keying information for IPsec security services is maintained in security association databases (\fBSADB\fRs). The security associations (\fBSA\fRs) are used to protect both inbound and outbound packets. @@ -52,7 +50,6 @@ message and all extensions must be eight-byte aligned. An example message is the \fBGET\fR message, which requires the base header, the \fBSA \fRextension, and the \fBADDRESS_DST\fR extension. .SS "Messages" -.LP Messages include: .sp .in +2 @@ -229,7 +226,7 @@ struct sadb_key { .fi .in -2 -.SS "Indentity Extension" +.SS "Identity Extension" .in +2 .nf struct sadb_ident { @@ -411,7 +408,6 @@ struct sadb_x_pair { .in -2 .SS "Message Use and Behavior" -.LP Each message has a behavior. A behavior is defined as where the initial message travels, for example, user to kernel, and what subsequent actions are expected to take place. Contents of messages are illustrated as: @@ -512,7 +508,6 @@ Message exceeds the maximum length allowed. .LP The following are examples of message use and behavior: .SS "\fBSADB_GETSPI\fR" -.LP Send a \fBSADB_GETSPI\fR message from a user process to the kernel. .sp .in +2 @@ -532,7 +527,6 @@ The kernel returns the \fBSADB_GETSPI\fR message to all listening processes. .in -2 .SS "\fBSADB_UPDATE\fR" -.LP Send a \fBSADB_UPDATE\fR message from a user process to the kernel. .sp .in +2 @@ -560,7 +554,6 @@ security association contained in that extension. The resulting security association "pair" can be updated or as a single entity using the \fBSADB_X_UPDATEPAIR\fR or \fBSADB_X_DELPAIR\fR message types. .SS "\fBSADB_ADD\fR" -.LP Send a \fBSADB_ADD\fR message from a user process to the kernel. .sp .in +2 @@ -582,7 +575,6 @@ The kernel returns the \fBSADB_ADD\fR message to all listening processes. .in -2 .SS "\fBSADB_X_UPDATEPAIR\fR" -.LP Send a \fBSADB_X_UPDATEPAIR\fR message from a user process to the kernel. This message type is used to update the lifetime values of a security association and the lifetime values of the security association it is paired @@ -595,7 +587,6 @@ with. .in -2 .SS "\fBSADB_DELETE | SADB_X_DELPAIR\fR" -.LP Send a \fBSADB_DELETE\fR message from a user process to the kernel. The \fBSADB_X_DELPAIR\fR message type will request deletion of the security association and the security association it is paired with. @@ -617,7 +608,6 @@ The kernel returns the \fBSADB_DELETE\fR message to all listening processes. .in -2 .SS "\fBSADB_GET\fR" -.LP Send a \fBSADB_GET\fR message from a user process to the kernel. .sp .in +2 @@ -639,7 +629,6 @@ The kernel returns the \fBSADB_GET\fR message to the socket that sent the .in -2 .SS "\fBSADB_ACQUIRE\fR" -.LP The kernel sends a \fBSADB_ACQUIRE\fR message to registered sockets. Note that any \fBGETSPI\fR, \fBADD\fR, or \fBUPDATE\fR calls in reaction to an \fBACQUIRE\fR must fill in the \fBsadb_msg_seq\fR of those messages with the @@ -678,7 +667,6 @@ If key management fails, send an \fBSADB_ACQUIRE\fR to indicate failure. .in -2 .SS "\fBSADB_X_INVERSE_ACQUIRE\fR" -.LP For inbound Key Management processing, a Key Management application may wish to consult the kernel for its policy. The application should send to the kernel: .sp @@ -700,7 +688,6 @@ The kernel returns a message similar to a kernel-generated extended ACQUIRE: .in -2 .SS "\fBSADB_REGISTER\fR" -.LP Send a \fBSADB_REGISTER\fR message from a user process to the kernel. .sp .in +2 @@ -738,7 +725,6 @@ extended ACQUIREs. Which returns a series of SADB_REGISTER replies (one for each security protocol registered) from the kernel. .SS "\fBSADB_EXPIRE\fR" -.LP The kernel sends a \fBSADB_EXPIRE\fR message to all listeners when the soft limit of a security association has been expired. .sp @@ -749,7 +735,6 @@ limit of a security association has been expired. .in -2 .SS "\fBSADB_FLUSH\fR" -.LP Send a \fBSADB_FLUSH\fR message from a user process to the kernel. .sp .in +2 @@ -769,7 +754,6 @@ The kernel returns the \fBSADB_FLUSH\fR message to all listening sockets. .in -2 .SS "\fBSADB_DUMP\fR" -.LP Send a \fBSADB_DUMP\fR message from a user process to the kernel. .sp .in +2 @@ -802,7 +786,6 @@ To mark the end of a dump a single base header arrives with its .in -2 .SS "\fBSADB_X_PROMISC\fR" -.LP Send a \fBSADB_X_PROMISC\fR message from a user process to the kernel. .sp .in +2 @@ -822,7 +805,6 @@ The kernel returns the \fBSADB_X_PROMISC\fR message to all listening processes. .in -2 .SH DIAGNOSTICS -.LP The message returning from the kernel will contain a diagnostic value in the base message header, the diagnostic value will indicate if action requested by the original message was a success. @@ -939,7 +921,6 @@ Diagnostic Values: .in -2 .SH ATTRIBUTES -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -953,7 +934,6 @@ Interface Stability Evolving .TE .SH SEE ALSO -.LP \fBin.iked\fR(1M), \fBipseckey\fR(1M), \fBsockaddr\fR(3SOCKET), \fBipsec\fR(7P), \fBipsecah\fR(7P), \fBipsecesp\fR(7P), \fBroute\fR(7P), \fBudp\fR(7P) @@ -962,6 +942,5 @@ Interface Stability Evolving McDonald, D.L., Metz, C.W., and Phan, B.G., \fIRFC 2367, PF_KEY Key Management API, Version 2\fR, The Internet Society, July 1998. .SH NOTES -.LP Time-based lifetimes may not expire with exact precision in seconds because kernel load may affect the aging of \fBSA\fR's. diff --git a/usr/src/man/man9f/usb_pipe_close.9f b/usr/src/man/man9f/usb_pipe_close.9f index 571ca577ca..65de310245 100644 --- a/usr/src/man/man9f/usb_pipe_close.9f +++ b/usr/src/man/man9f/usb_pipe_close.9f @@ -4,11 +4,10 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH USB_PIPE_CLOSE 9F "Sep 16, 2016" +.TH USB_PIPE_CLOSE 9F "December 28, 2020" .SH NAME usb_pipe_close \- Close and cleanup a USB device pipe .SH SYNOPSIS -.LP .nf #include <sys/usb/usba.h> @@ -22,7 +21,6 @@ usb_pipe_close \- Close and cleanup a USB device pipe .fi .SH INTERFACE LEVEL -.LP Solaris DDI specific (Solaris DDI) .SH PARAMETERS .ne 2 @@ -72,7 +70,6 @@ Second argument to callback function. .RE .SH DESCRIPTION -.LP The \fBusb_pipe_close()\fR function closes the pipe pointed to by \fIpipe_handle\fR, releases all related resources and then frees the pipe handle. This function stops polling if the pipe to be closed is an interrupt-IN @@ -155,9 +152,8 @@ Error starting asynchronous request. .RE .SH RETURN VALUES -.LP Status is returned to the caller via the callback handler's rval argument. -Possible callback hander rval argument values are: +Possible callback handler rval argument values are: .sp .ne 2 .na @@ -201,7 +197,7 @@ Pipe handle specifies the default control pipe. .ad .RS 23n Asynchronous resources are unavailable. In this case, USB_CB_ASYNC_REQ_FAILED -is passed in as the \fIcallback_flags\fR arg to the callback hander. +is passed in as the \fIcallback_flags\fR arg to the callback handler. .RE .sp @@ -215,7 +211,6 @@ Note that messages mirroring the above errors are logged to the console logfile on error. (This provides status for calls which otherwise could provide status). .SH CONTEXT -.LP May be called from user or kernel context regardless of arguments. May not be called from a callback executing in interrupt context. Please see \fBusb_callback_flags\fR(9S) for more information on callbacks. @@ -243,7 +238,6 @@ usb_pipe_close(dip, pipe, 0, close_callback, callback_arg); .in -2 .SH ATTRIBUTES -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -260,7 +254,6 @@ Interface stability Committed .TE .SH SEE ALSO -.LP \fBattributes\fR(5), \fBusb_get_status\fR(9F), \fBusb_pipe_drain_reqs\fR(9F), \fBusb_pipe_get_state\fR(9F), \fBusb_pipe_xopen\fR(9F), \fBusb_pipe_reset\fR(9F), \fBusb_callback_flags\fR(9S) diff --git a/usr/src/man/man9f/usb_pipe_reset.9f b/usr/src/man/man9f/usb_pipe_reset.9f index 5f7a516613..6bba298b4b 100644 --- a/usr/src/man/man9f/usb_pipe_reset.9f +++ b/usr/src/man/man9f/usb_pipe_reset.9f @@ -3,11 +3,10 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH USB_PIPE_RESET 9F "Sep 16, 2016" +.TH USB_PIPE_RESET 9F "December 28, 2020" .SH NAME usb_pipe_reset \- Abort queued requests from a USB pipe and reset the pipe .SH SYNOPSIS -.LP .nf #include <sys/usb/usba.h> @@ -19,7 +18,6 @@ usb_pipe_reset \- Abort queued requests from a USB pipe and reset the pipe .fi .SH INTERFACE LEVEL -.LP Solaris DDI specific (Solaris DDI) .SH PARAMETERS .ne 2 @@ -68,7 +66,6 @@ Second argument to callback function. .RE .SH DESCRIPTION -.LP Call \fBusb_pipe_reset()\fR to reset a pipe which is in an error state, or to abort a current request and clear the pipe. The \fBusb_pipe_reset()\fR function can be called on any pipe other than the default control pipe. @@ -158,9 +155,8 @@ USB_CB_ASYNC_REQ_FAILED \(em Error starting asynchronous request. .RE .SH RETURN VALUES -.LP Status is returned to the caller via the callback handler's rval argument. -Possible callback hander rval argument values are: +Possible callback handler rval argument values are: .sp .ne 2 .na @@ -214,7 +210,7 @@ Called from interrupt context with the USB_FLAGS_SLEEP flag set. .ad .RS 23n Asynchronous resources are unavailable. In this case, USB_CB_ASYNC_REQ_FAILED -is passed in as the \fIcallback_flags\fR arg to the callback hander. +is passed in as the \fIcallback_flags\fR arg to the callback handler. .RE .sp @@ -235,7 +231,6 @@ Note that messages mirroring the above errors are logged to the console logfile on error. This provides status for calls which could not otherwise provide status. .SH CONTEXT -.LP May be called from user or kernel context regardless of arguments. May be called from any callback with the USB_FLAGS_SLEEP clear. May not be called from a callback executing in interrupt context if the USB_FLAGS_SLEEP flag is set. @@ -264,7 +259,6 @@ usb_pipe_reset(dip, bulk_pipe, USB_FLAGS_SLEEP, NULL, NULL); .in -2 .SH ATTRIBUTES -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -281,7 +275,6 @@ Interface stability Committed .TE .SH SEE ALSO -.LP \fBattributes\fR(5), \fBusb_get_cfg\fR(9F), \fBusb_pipe_bulk_xfer\fR(9F), \fBusb_pipe_close\fR(9F), \fBusb_get_status\fR(9F), \fBusb_pipe_ctrl_xfer\fR(9F), \fBusb_pipe_drain_reqs\fR(9F), diff --git a/usr/src/test/zfs-tests/cmd/libzfs_input_check/libzfs_input_check.c b/usr/src/test/zfs-tests/cmd/libzfs_input_check/libzfs_input_check.c index 1636875557..e38ee801c8 100644 --- a/usr/src/test/zfs-tests/cmd/libzfs_input_check/libzfs_input_check.c +++ b/usr/src/test/zfs-tests/cmd/libzfs_input_check/libzfs_input_check.c @@ -751,7 +751,7 @@ zfs_ioc_input_tests(const char *pool) (void) snprintf(clone, sizeof (clone), "%s/test-fs-clone", pool); (void) snprintf(backup, sizeof (backup), "%s/backup", pool); - err = lzc_create(dataset, DMU_OST_ZFS, NULL, NULL, 0); + err = lzc_create(dataset, LZC_DATSET_TYPE_ZFS, NULL, NULL, 0); if (err) { (void) fprintf(stderr, "could not create '%s': %s\n", dataset, strerror(errno)); diff --git a/usr/src/tools/ctf/common/list.c b/usr/src/tools/ctf/common/list.c deleted file mode 100644 index c01de9b924..0000000000 --- a/usr/src/tools/ctf/common/list.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Routines for manipulating linked lists - */ - -#include <stdio.h> -#include <assert.h> -#include <stdlib.h> - -#include "list.h" -#include "memory.h" - -struct list { - void *l_data; - struct list *l_next; -}; - -/* Add an element to a list */ -void -list_add(list_t **list, void *data) -{ - list_t *le; - - le = xmalloc(sizeof (list_t)); - le->l_data = data; - le->l_next = *list; - *list = le; -} - -/* Add an element to a sorted list */ -void -slist_add(list_t **list, void *data, int (*cmp)(void *, void *)) -{ - list_t **nextp; - - for (nextp = list; *nextp; nextp = &((*nextp)->l_next)) { - if (cmp((*nextp)->l_data, data) > 0) - break; - } - - list_add(nextp, data); -} - -/*ARGSUSED2*/ -static int -list_defcmp(void *d1, void *d2, void *private) -{ - return (d1 != d2); -} - -void * -list_remove(list_t **list, void *data, int (*cmp)(void *, void *, void *), - void *private) -{ - list_t *le, **le2; - void *led; - - if (!cmp) - cmp = list_defcmp; - - for (le = *list, le2 = list; le; le2 = &le->l_next, le = le->l_next) { - if (cmp(le->l_data, data, private) == 0) { - *le2 = le->l_next; - led = le->l_data; - free(le); - return (led); - } - } - - return (NULL); -} - -void -list_free(list_t *list, void (*datafree)(void *, void *), void *private) -{ - list_t *le; - - while (list) { - le = list; - list = list->l_next; - if (le->l_data && datafree) - datafree(le->l_data, private); - free(le); - } -} - -/* - * This iterator is specifically designed to tolerate the deletion of the - * node being iterated over. - */ -int -list_iter(list_t *list, int (*func)(void *, void *), void *private) -{ - list_t *lnext; - int cumrc = 0; - int cbrc; - - while (list) { - lnext = list->l_next; - if ((cbrc = func(list->l_data, private)) < 0) - return (cbrc); - cumrc += cbrc; - list = lnext; - } - - return (cumrc); -} - -/*ARGSUSED*/ -static int -list_count_cb(void *data, void *private) -{ - return (1); -} - -int -list_count(list_t *list) -{ - return (list_iter(list, list_count_cb, NULL)); -} - -int -list_empty(list_t *list) -{ - return (list == NULL); -} - -void * -list_find(list_t *list, void *tmpl, int (*cmp)(void *, void *)) -{ - for (; list; list = list->l_next) { - if (cmp(list->l_data, tmpl) == 0) - return (list->l_data); - } - - return (NULL); -} - -void * -list_first(list_t *list) -{ - return (list ? list->l_data : NULL); -} - -void -list_concat(list_t **list1, list_t *list2) -{ - list_t *l, *last; - - for (l = *list1, last = NULL; l; last = l, l = l->l_next) - continue; - - if (last == NULL) - *list1 = list2; - else - last->l_next = list2; -} - -/* - * Merges two sorted lists. Equal nodes (as determined by cmp) are retained. - */ -void -slist_merge(list_t **list1p, list_t *list2, int (*cmp)(void *, void *)) -{ - list_t *list1, *next2; - list_t *last1 = NULL; - - if (*list1p == NULL) { - *list1p = list2; - return; - } - - list1 = *list1p; - while (list2 != NULL) { - if (cmp(list1->l_data, list2->l_data) > 0) { - next2 = list2->l_next; - - if (last1 == NULL) { - /* Insert at beginning */ - *list1p = last1 = list2; - list2->l_next = list1; - } else { - list2->l_next = list1; - last1->l_next = list2; - last1 = list2; - } - - list2 = next2; - } else { - - last1 = list1; - list1 = list1->l_next; - - if (list1 == NULL) { - /* Add the rest to the end of list1 */ - last1->l_next = list2; - list2 = NULL; - } - } - } -} diff --git a/usr/src/tools/ctf/common/list.h b/usr/src/tools/ctf/common/list.h deleted file mode 100644 index 2e41271d0f..0000000000 --- a/usr/src/tools/ctf/common/list.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LIST_H -#define _LIST_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Routines for manipulating linked lists - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct list list_t; - -void list_add(list_t **, void *); -void slist_add(list_t **, void *, int (*)(void *, void *)); -void *list_remove(list_t **, void *, int (*)(void *, void *, void *), void *); -void list_free(list_t *, void (*)(void *, void *), void *); -void *list_find(list_t *, void *, int (*)(void *, void *)); -void *list_first(list_t *); -int list_iter(list_t *, int (*)(void *, void *), void *); -int list_count(list_t *); -int list_empty(list_t *); -void list_concat(list_t **, list_t *); -void slist_merge(list_t **, list_t *, int (*)(void *, void *)); - -#ifdef __cplusplus -} -#endif - -#endif /* _LIST_H */ diff --git a/usr/src/tools/ctf/stabs/Makefile.com b/usr/src/tools/ctf/stabs/Makefile.com index 901acd2584..06a2622d18 100644 --- a/usr/src/tools/ctf/stabs/Makefile.com +++ b/usr/src/tools/ctf/stabs/Makefile.com @@ -32,7 +32,6 @@ SRCS = \ fth_enum.c \ fth_struct.c \ genassym.c \ - list.c \ memory.c \ utils.c @@ -41,7 +40,7 @@ include ../../Makefile.ctf LDLIBS += -lctf NATIVE_LIBS += libctf.so -OBJS = $(SRCS:%.c=%.o) +OBJS = $(SRCS:%.c=%.o) list.o CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused @@ -58,6 +57,9 @@ $(PROG): $(OBJS) %.o: ../common/%.c $(COMPILE.c) $< +%.o: $(SRC)/common/list/%.c + $(COMPILE.c) $< + $(ROOTONBLDMACHPROG): $(PROG) install: $(ROOTONBLDMACHPROG) diff --git a/usr/src/tools/ctf/stabs/common/fth_struct.c b/usr/src/tools/ctf/stabs/common/fth_struct.c index d3bd2ef0d1..30e450e9d5 100644 --- a/usr/src/tools/ctf/stabs/common/fth_struct.c +++ b/usr/src/tools/ctf/stabs/common/fth_struct.c @@ -24,7 +24,9 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. + */ /* * Used to dump structures and unions in forth mode. @@ -103,20 +105,21 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/list.h> #include "ctf_headers.h" #include "forth.h" -#include "list.h" #include "memory.h" static ctf_id_t fth_str_curtid; -static list_t *fth_str_curmems; +static list_t fth_str_curmems; /* * Node type for the member-storage list (fth_str_curmems) built by * fth_struct_members() */ typedef struct fth_str_mem { + list_node_t fsm_node; char *fsm_memname; char *fsm_format; ctf_id_t fsm_tid; @@ -147,6 +150,21 @@ fth_struct_memcmp(void *m1, void *m2) } static void +fth_slist_add(fth_str_mem_t *mem) +{ + fth_str_mem_t *l; + + for (l = list_head(&fth_str_curmems); l != NULL; + l = list_next(&fth_str_curmems, l)) { + if (fth_struct_memcmp(l, mem) > 0) { + list_insert_before(&fth_str_curmems, l, mem); + return; + } + } + list_insert_tail(&fth_str_curmems, mem); +} + +static void fth_free_str_mem(fth_str_mem_t *mem) { free(mem->fsm_memname); @@ -161,7 +179,8 @@ fth_struct_header(ctf_id_t tid) ssize_t sz; fth_str_curtid = tid; - fth_str_curmems = NULL; + list_create(&fth_str_curmems, sizeof (fth_str_mem_t), + offsetof(fth_str_mem_t, fsm_node)); if ((sz = ctf_type_size(ctf, fth_str_curtid)) == CTF_ERR) return (parse_warn("Can't get size for %s", fth_curtype)); @@ -418,7 +437,7 @@ fth_struct_members_cb(const char *memname, ctf_id_t tid, ulong_t off, void *arg) mem->fsm_tid = tid; mem->fsm_off = off; - slist_add(&fth_str_curmems, mem, fth_struct_memcmp); + fth_slist_add(mem); return (0); } @@ -453,20 +472,20 @@ fth_struct_members(char *memfilter, char *format) static int fth_struct_trailer(void) { - if (list_count(fth_str_curmems) == 0) { + fth_str_mem_t *mem; + + if (list_is_empty(&fth_str_curmems)) { if (fth_struct_members(NULL, NULL) < 0) return (-1); } - while (!list_empty(fth_str_curmems)) { - fth_str_mem_t *mem = list_remove(&fth_str_curmems, - list_first(fth_str_curmems), NULL, NULL); - + while ((mem = list_remove_head(&fth_str_curmems)) != NULL) { if (fth_print_member(mem, 0) < 0) return (-1); fth_free_str_mem(mem); } + list_destroy(&fth_str_curmems); (void) fprintf(out, "\n"); (void) fprintf(out, "kdbg-words definitions\n"); diff --git a/usr/src/tools/scripts/ctfconvert.1onbld b/usr/src/tools/scripts/ctfconvert.1onbld index 3a75cc0b16..8d9e26b5da 100644 --- a/usr/src/tools/scripts/ctfconvert.1onbld +++ b/usr/src/tools/scripts/ctfconvert.1onbld @@ -10,7 +10,7 @@ .\" .\" Copyright 2020 OmniOS Community Edition (OmniOSce) Association. .\" -.Dd October 23, 2020 +.Dd December 07, 2020 .Dt ctfconvert 1ONBLD .Os .Sh NAME @@ -18,10 +18,11 @@ .Nd Convert ELF object debug data to CTF container .Sh SYNOPSIS .Nm -.Op Fl ikm +.Op Fl fikms .Op Fl b Ar batchsize .Op Fl j Ar threads .Op Fl l Ar label | Fl L Ar labelenv +.Op Fl M Ar ignorefile .Op Fl o Ar outfile .Ar ELF_object .Sh DESCRIPTION @@ -45,6 +46,13 @@ option is present, the source file will be removed if an error occurs. .Sh OPTIONS The following options are supported: .Bl -tag -width Ar +.It Fl f +Always attempt conversion. +This option causes +.Nm +to attempt conversion even for files where it does not seem appropriate. +This is occasionally necessary to convert objects which have had some +local symbols removed from the symbol table. .It Fl i Ignore files not built partially from C sources. .Nm @@ -53,9 +61,16 @@ will usually check to see if at least one of the input files was a .Sq .c file, and exit with an error if not. -The +With the .Fl i -option overrides this check and allows processing to continue. +option, the check is still done but +.Nm +will exit with a success status instead of an error. +In either case, conversion is not attempted. +To attempt conversion even when the object does not appear to have been built +from C sources, use the +.Fl f +option. .It Fl k When processing a file in-place and an error occurs, keep the input file rather than deleting it. @@ -74,7 +89,24 @@ option relaxes this restriction allowing processing of such files. Note that if the file contains no debug data in any of the compilation units then this flag will cause .Nm -to exit successfully without taking any action, and can mask missing CTF data. +to exit successfully without taking any action, and can mask missing debug data. +.It Fl M Ar ignorefile +Allow +.Ar ELF_object +to have missing debug data in selected source files. +The source files to ignore are specified as a list of file basenames (without +any directory component) in +.Ar ignorefile . +Each file should be listed on its own line, separated by a newline. +It is not possible to encode a file name that contains a newline and any other +white-space within the line is considered to be part of the file name being +specified. +The +.Sq / +character may not appear in the file name. +Empty lines and any line which has a +.Sq # +character in the first column are ignored. .It Fl b Ar batchsize Batch-process this many compilation units from the source file at once (default 256). This helps to reduce memory usage when processing large objects which @@ -89,6 +121,17 @@ variable. .It Fl o Ar outfile Write the new object with added CTF ta to the specified output file, rather than updating the input in-place. +.It Fl s +This option allows truncation of data that cannot be converted to CTF format +because it exceeds the allowed size. +Without this option being provided, conversion of such data would produce a +fatal error. +The current implementation allows truncation of +.Vt enum +definitions. +When this occurs the resulting CTF data does not contain all possible +.Vt enum +values and a warning will be produced for each truncation. .El .Sh OPERANDS The following operands are supported: @@ -110,6 +153,11 @@ The command line interface of .Nm is .Sy Uncommitted . +The output of +.Nm +is +.Sy Not-An-Interface +and may change at any time. .Sh SEE ALSO .Xr ctfdiff 1 , .Xr ctfdump 1 , diff --git a/usr/src/uts/common/fs/zfs/dbuf.c b/usr/src/uts/common/fs/zfs/dbuf.c index ae0b1fc878..a8569e9a88 100644 --- a/usr/src/uts/common/fs/zfs/dbuf.c +++ b/usr/src/uts/common/fs/zfs/dbuf.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2012, 2018 by Delphix. All rights reserved. + * Copyright (c) 2012, 2019 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. @@ -176,6 +176,7 @@ dbuf_cons(void *vdb, void *unused, int kmflag) bzero(db, sizeof (dmu_buf_impl_t)); mutex_init(&db->db_mtx, NULL, MUTEX_DEFAULT, NULL); + rw_init(&db->db_rwlock, NULL, RW_DEFAULT, NULL); cv_init(&db->db_changed, NULL, CV_DEFAULT, NULL); multilist_link_init(&db->db_cache_link); zfs_refcount_create(&db->db_holds); @@ -189,6 +190,7 @@ dbuf_dest(void *vdb, void *unused) { dmu_buf_impl_t *db = vdb; mutex_destroy(&db->db_mtx); + rw_destroy(&db->db_rwlock); cv_destroy(&db->db_changed); ASSERT(!multilist_link_active(&db->db_cache_link)); zfs_refcount_destroy(&db->db_holds); @@ -789,10 +791,10 @@ dbuf_verify(dmu_buf_impl_t *db) db->db.db_object); /* * dnode_grow_indblksz() can make this fail if we don't - * have the struct_rwlock. XXX indblksz no longer + * have the parent's rwlock. XXX indblksz no longer * grows. safe to do this now? */ - if (RW_WRITE_HELD(&dn->dn_struct_rwlock)) { + if (RW_LOCK_HELD(&db->db_parent->db_rwlock)) { ASSERT3P(db->db_blkptr, ==, ((blkptr_t *)db->db_parent->db.db_data + db->db_blkid % epb)); @@ -868,6 +870,44 @@ dbuf_clear_data(dmu_buf_impl_t *db) db->db_state = DB_UNCACHED; } +/* + * This function is used to lock the parent of the provided dbuf. This should be + * used when modifying or reading db_blkptr. + */ +db_lock_type_t +dmu_buf_lock_parent(dmu_buf_impl_t *db, krw_t rw, void *tag) +{ + enum db_lock_type ret = DLT_NONE; + if (db->db_parent != NULL) { + rw_enter(&db->db_parent->db_rwlock, rw); + ret = DLT_PARENT; + } else if (dmu_objset_ds(db->db_objset) != NULL) { + rrw_enter(&dmu_objset_ds(db->db_objset)->ds_bp_rwlock, rw, + tag); + ret = DLT_OBJSET; + } + /* + * We only return a DLT_NONE lock when it's the top-most indirect block + * of the meta-dnode of the MOS. + */ + return (ret); +} + +/* + * We need to pass the lock type in because it's possible that the block will + * move from being the topmost indirect block in a dnode (and thus, have no + * parent) to not the top-most via an indirection increase. This would cause a + * panic if we didn't pass the lock type in. + */ +void +dmu_buf_unlock_parent(dmu_buf_impl_t *db, db_lock_type_t type, void *tag) +{ + if (type == DLT_PARENT) + rw_exit(&db->db_parent->db_rwlock); + else if (type == DLT_OBJSET) + rrw_exit(&dmu_objset_ds(db->db_objset)->ds_bp_rwlock, tag); +} + static void dbuf_set_data(dmu_buf_impl_t *db, arc_buf_t *buf) { @@ -1042,8 +1082,13 @@ dbuf_read_verify_dnode_crypt(dmu_buf_impl_t *db, uint32_t flags) return (err); } +/* + * Drops db_mtx and the parent lock specified by dblt and tag before + * returning. + */ static int -dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) +dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags, + db_lock_type_t dblt, void *tag) { dnode_t *dn; zbookmark_phys_t zb; @@ -1053,11 +1098,11 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) DB_DNODE_ENTER(db); dn = DB_DNODE(db); ASSERT(!zfs_refcount_is_zero(&db->db_holds)); - /* We need the struct_rwlock to prevent db_blkptr from changing. */ - ASSERT(RW_LOCK_HELD(&dn->dn_struct_rwlock)); ASSERT(MUTEX_HELD(&db->db_mtx)); ASSERT(db->db_state == DB_UNCACHED); ASSERT(db->db_buf == NULL); + ASSERT(db->db_parent == NULL || + RW_LOCK_HELD(&db->db_parent->db_rwlock)); if (db->db_blkid == DMU_BONUS_BLKID) { /* @@ -1094,6 +1139,7 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) DB_DNODE_EXIT(db); db->db_state = DB_CACHED; mutex_exit(&db->db_mtx); + dmu_buf_unlock_parent(db, dblt, tag); return (0); } @@ -1134,6 +1180,7 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) DB_DNODE_EXIT(db); db->db_state = DB_CACHED; mutex_exit(&db->db_mtx); + dmu_buf_unlock_parent(db, dblt, tag); return (0); } @@ -1150,12 +1197,14 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) "object set %llu", dmu_objset_id(db->db_objset)); DB_DNODE_EXIT(db); mutex_exit(&db->db_mtx); + dmu_buf_unlock_parent(db, dblt, tag); return (SET_ERROR(EIO)); } err = dbuf_read_verify_dnode_crypt(db, flags); if (err != 0) { DB_DNODE_EXIT(db); + dmu_buf_unlock_parent(db, dblt, tag); mutex_exit(&db->db_mtx); return (err); } @@ -1175,11 +1224,18 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) if ((flags & DB_RF_NO_DECRYPT) && BP_IS_PROTECTED(db->db_blkptr)) zio_flags |= ZIO_FLAG_RAW; - - err = arc_read(zio, db->db_objset->os_spa, db->db_blkptr, + /* + * The zio layer will copy the provided blkptr later, but we need to + * do this now so that we can release the parent's rwlock. We have to + * do that now so that if dbuf_read_done is called synchronously (on + * an l1 cache hit) we don't acquire the db_mtx while holding the + * parent's rwlock, which would be a lock ordering violation. + */ + blkptr_t bp = *db->db_blkptr; + dmu_buf_unlock_parent(db, dblt, tag); + (void) arc_read(zio, db->db_objset->os_spa, &bp, dbuf_read_done, db, ZIO_PRIORITY_SYNC_READ, zio_flags, &aflags, &zb); - return (err); } @@ -1278,8 +1334,6 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) DB_DNODE_ENTER(db); dn = DB_DNODE(db); - if ((flags & DB_RF_HAVESTRUCT) == 0) - rw_enter(&dn->dn_struct_rwlock, RW_READER); prefetch = db->db_level == 0 && db->db_blkid != DMU_BONUS_BLKID && (flags & DB_RF_NOPREFETCH) == 0 && dn != NULL && @@ -1316,29 +1370,32 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) dbuf_set_data(db, db->db_buf); } mutex_exit(&db->db_mtx); - if (err == 0 && prefetch) - dmu_zfetch(&dn->dn_zfetch, db->db_blkid, 1, B_TRUE); - if ((flags & DB_RF_HAVESTRUCT) == 0) - rw_exit(&dn->dn_struct_rwlock); + if (err == 0 && prefetch) { + dmu_zfetch(&dn->dn_zfetch, db->db_blkid, 1, B_TRUE, + flags & DB_RF_HAVESTRUCT); + } DB_DNODE_EXIT(db); } else if (db->db_state == DB_UNCACHED) { spa_t *spa = dn->dn_objset->os_spa; boolean_t need_wait = B_FALSE; + db_lock_type_t dblt = dmu_buf_lock_parent(db, RW_READER, FTAG); + if (zio == NULL && db->db_blkptr != NULL && !BP_IS_HOLE(db->db_blkptr)) { zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); need_wait = B_TRUE; } - err = dbuf_read_impl(db, zio, flags); - - /* dbuf_read_impl has dropped db_mtx for us */ - - if (!err && prefetch) - dmu_zfetch(&dn->dn_zfetch, db->db_blkid, 1, B_TRUE); + err = dbuf_read_impl(db, zio, flags, dblt, FTAG); + /* + * dbuf_read_impl has dropped db_mtx and our parent's rwlock + * for us + */ + if (!err && prefetch) { + dmu_zfetch(&dn->dn_zfetch, db->db_blkid, 1, B_TRUE, + flags & DB_RF_HAVESTRUCT); + } - if ((flags & DB_RF_HAVESTRUCT) == 0) - rw_exit(&dn->dn_struct_rwlock); DB_DNODE_EXIT(db); if (!err && need_wait) @@ -1353,10 +1410,10 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) * occurred and the dbuf went to UNCACHED. */ mutex_exit(&db->db_mtx); - if (prefetch) - dmu_zfetch(&dn->dn_zfetch, db->db_blkid, 1, B_TRUE); - if ((flags & DB_RF_HAVESTRUCT) == 0) - rw_exit(&dn->dn_struct_rwlock); + if (prefetch) { + dmu_zfetch(&dn->dn_zfetch, db->db_blkid, 1, B_TRUE, + flags & DB_RF_HAVESTRUCT); + } DB_DNODE_EXIT(db); /* Skip the wait per the caller's request. */ @@ -1536,7 +1593,9 @@ dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid, if (db->db_state == DB_CACHED) { ASSERT(db->db.db_data != NULL); arc_release(db->db_buf, db); + rw_enter(&db->db_rwlock, RW_WRITER); bzero(db->db.db_data, db->db.db_size); + rw_exit(&db->db_rwlock); arc_buf_freeze(db->db_buf); } @@ -1558,15 +1617,6 @@ dbuf_new_size(dmu_buf_impl_t *db, int size, dmu_tx_t *tx) DB_DNODE_ENTER(db); dn = DB_DNODE(db); - /* XXX does *this* func really need the lock? */ - ASSERT(RW_WRITE_HELD(&dn->dn_struct_rwlock)); - - /* - * This call to dmu_buf_will_dirty() with the dn_struct_rwlock held - * is OK, because there can be no other references to the db - * when we are changing its size, so no concurrent DB_FILL can - * be happening. - */ /* * XXX we should be doing a dbuf_read, checking the return * value and returning that up to our callers @@ -1643,8 +1693,8 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) dnode_t *dn; objset_t *os; dbuf_dirty_record_t **drp, *dr; - int drop_struct_lock = FALSE; int txgoff = tx->tx_txg & TXG_MASK; + boolean_t drop_struct_rwlock = B_FALSE; ASSERT(tx->tx_txg != 0); ASSERT(!zfs_refcount_is_zero(&db->db_holds)); @@ -1846,15 +1896,21 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) return (dr); } - /* - * The dn_struct_rwlock prevents db_blkptr from changing - * due to a write from syncing context completing - * while we are running, so we want to acquire it before - * looking at db_blkptr. - */ if (!RW_WRITE_HELD(&dn->dn_struct_rwlock)) { rw_enter(&dn->dn_struct_rwlock, RW_READER); - drop_struct_lock = TRUE; + drop_struct_rwlock = B_TRUE; + } + + /* + * If we are overwriting a dedup BP, then unless it is snapshotted, + * when we get to syncing context we will need to decrement its + * refcount in the DDT. Prefetch the relevant DDT block so that + * syncing context won't have to wait for the i/o. + */ + if (db->db_blkptr != NULL) { + db_lock_type_t dblt = dmu_buf_lock_parent(db, RW_READER, FTAG); + ddt_prefetch(os->os_spa, db->db_blkptr); + dmu_buf_unlock_parent(db, dblt, FTAG); } /* @@ -1867,19 +1923,12 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) dn->dn_next_nlevels[(tx->tx_txg-1) & TXG_MASK] > db->db_level || dn->dn_next_nlevels[(tx->tx_txg-2) & TXG_MASK] > db->db_level); - /* - * If we are overwriting a dedup BP, then unless it is snapshotted, - * when we get to syncing context we will need to decrement its - * refcount in the DDT. Prefetch the relevant DDT block so that - * syncing context won't have to wait for the i/o. - */ - ddt_prefetch(os->os_spa, db->db_blkptr); if (db->db_level == 0) { ASSERT(!db->db_objset->os_raw_receive || dn->dn_maxblkid >= db->db_blkid); dnode_new_blkid(dn, db->db_blkid, tx, - drop_struct_lock, B_FALSE); + drop_struct_rwlock, B_FALSE); ASSERT(dn->dn_maxblkid >= db->db_blkid); } @@ -1890,15 +1939,14 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) if (db->db_parent == NULL || db->db_parent == dn->dn_dbuf) { int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - - parent = dbuf_hold_level(dn, db->db_level+1, + parent = dbuf_hold_level(dn, db->db_level + 1, db->db_blkid >> epbs, FTAG); ASSERT(parent != NULL); parent_held = TRUE; } - if (drop_struct_lock) + if (drop_struct_rwlock) rw_exit(&dn->dn_struct_rwlock); - ASSERT3U(db->db_level+1, ==, parent->db_level); + ASSERT3U(db->db_level + 1, ==, parent->db_level); di = dbuf_dirty(parent, tx); if (parent_held) dbuf_rele(parent, FTAG); @@ -1919,14 +1967,14 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) } mutex_exit(&db->db_mtx); } else { - ASSERT(db->db_level+1 == dn->dn_nlevels); + ASSERT(db->db_level + 1 == dn->dn_nlevels); ASSERT(db->db_blkid < dn->dn_nblkptr); ASSERT(db->db_parent == NULL || db->db_parent == dn->dn_dbuf); mutex_enter(&dn->dn_mtx); ASSERT(!list_link_active(&dr->dr_dirty_node)); list_insert_tail(&dn->dn_dirty_records[txgoff], dr); mutex_exit(&dn->dn_mtx); - if (drop_struct_lock) + if (drop_struct_rwlock) rw_exit(&dn->dn_struct_rwlock); } @@ -2447,10 +2495,12 @@ dbuf_findbp(dnode_t *dn, int level, uint64_t blkid, int fail_sparse, *parentp = NULL; return (err); } + rw_enter(&(*parentp)->db_rwlock, RW_READER); *bpp = ((blkptr_t *)(*parentp)->db.db_data) + (blkid & ((1ULL << epbs) - 1)); if (blkid > (dn->dn_phys->dn_maxblkid >> (level * epbs))) ASSERT(BP_IS_HOLE(*bpp)); + rw_exit(&(*parentp)->db_rwlock); return (0); } else { /* the block is referenced from the dnode */ @@ -2695,7 +2745,7 @@ dbuf_prefetch(dnode_t *dn, int64_t level, uint64_t blkid, zio_priority_t prio, if (blkid > dn->dn_maxblkid) return; - if (dnode_block_freed(dn, blkid)) + if (level == 0 && dnode_block_freed(dn, blkid)) return; /* @@ -2841,7 +2891,9 @@ dbuf_hold_copy(dnode_t *dn, dmu_buf_impl_t *db, dbuf_dirty_record_t *dr) DBUF_GET_BUFC_TYPE(db), db->db.db_size)); } + rw_enter(&db->db_rwlock, RW_WRITER); bcopy(data->b_data, db->db.db_data, arc_buf_size(data)); + rw_exit(&db->db_rwlock); } /* @@ -2967,7 +3019,6 @@ int dbuf_spill_set_blksz(dmu_buf_t *db_fake, uint64_t blksz, dmu_tx_t *tx) { dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; - dnode_t *dn; if (db->db_blkid != DMU_SPILL_BLKID) return (SET_ERROR(ENOTSUP)); @@ -2976,12 +3027,7 @@ dbuf_spill_set_blksz(dmu_buf_t *db_fake, uint64_t blksz, dmu_tx_t *tx) ASSERT3U(blksz, <=, spa_maxblocksize(dmu_objset_spa(db->db_objset))); blksz = P2ROUNDUP(blksz, SPA_MINBLOCKSIZE); - DB_DNODE_ENTER(db); - dn = DB_DNODE(db); - rw_enter(&dn->dn_struct_rwlock, RW_WRITER); dbuf_new_size(db, blksz, tx); - rw_exit(&dn->dn_struct_rwlock); - DB_DNODE_EXIT(db); return (0); } @@ -3697,9 +3743,9 @@ dbuf_write_ready(zio_t *zio, arc_buf_t *buf, void *vdb) mutex_exit(&db->db_mtx); - rw_enter(&dn->dn_struct_rwlock, RW_WRITER); + db_lock_type_t dblt = dmu_buf_lock_parent(db, RW_WRITER, FTAG); *db->db_blkptr = *bp; - rw_exit(&dn->dn_struct_rwlock); + dmu_buf_unlock_parent(db, dblt, FTAG); } /* ARGSUSED */ @@ -3740,9 +3786,9 @@ dbuf_write_children_ready(zio_t *zio, arc_buf_t *buf, void *vdb) * anybody from reading the blocks we're about to * zero out. */ - rw_enter(&dn->dn_struct_rwlock, RW_WRITER); + rw_enter(&db->db_rwlock, RW_WRITER); bzero(db->db.db_data, db->db.db_size); - rw_exit(&dn->dn_struct_rwlock); + rw_exit(&db->db_rwlock); } DB_DNODE_EXIT(db); } @@ -3932,7 +3978,7 @@ dbuf_remap_impl_callback(uint64_t vdev, uint64_t offset, uint64_t size, } static void -dbuf_remap_impl(dnode_t *dn, blkptr_t *bp, dmu_tx_t *tx) +dbuf_remap_impl(dnode_t *dn, blkptr_t *bp, krwlock_t *rw, dmu_tx_t *tx) { blkptr_t bp_copy = *bp; spa_t *spa = dmu_objset_spa(dn->dn_objset); @@ -3946,14 +3992,16 @@ dbuf_remap_impl(dnode_t *dn, blkptr_t *bp, dmu_tx_t *tx) if (spa_remap_blkptr(spa, &bp_copy, dbuf_remap_impl_callback, &drica)) { /* - * The struct_rwlock prevents dbuf_read_impl() from + * The db_rwlock prevents dbuf_read_impl() from * dereferencing the BP while we are changing it. To * avoid lock contention, only grab it when we are actually * changing the BP. */ - rw_enter(&dn->dn_struct_rwlock, RW_WRITER); + if (rw != NULL) + rw_enter(rw, RW_WRITER); *bp = bp_copy; - rw_exit(&dn->dn_struct_rwlock); + if (rw != NULL) + rw_exit(rw); } } @@ -4026,7 +4074,7 @@ dbuf_remap(dnode_t *dn, dmu_buf_impl_t *db, dmu_tx_t *tx) if (db->db_level > 0) { blkptr_t *bp = db->db.db_data; for (int i = 0; i < db->db.db_size >> SPA_BLKPTRSHIFT; i++) { - dbuf_remap_impl(dn, &bp[i], tx); + dbuf_remap_impl(dn, &bp[i], &db->db_rwlock, tx); } } else if (db->db.db_object == DMU_META_DNODE_OBJECT) { dnode_phys_t *dnp = db->db.db_data; @@ -4034,7 +4082,10 @@ dbuf_remap(dnode_t *dn, dmu_buf_impl_t *db, dmu_tx_t *tx) DMU_OT_DNODE); for (int i = 0; i < db->db.db_size >> DNODE_SHIFT; i++) { for (int j = 0; j < dnp[i].dn_nblkptr; j++) { - dbuf_remap_impl(dn, &dnp[i].dn_blkptr[j], tx); + krwlock_t *lock = (dn->dn_dbuf == NULL ? NULL : + &dn->dn_dbuf->db_rwlock); + dbuf_remap_impl(dn, &dnp[i].dn_blkptr[j], lock, + tx); } } } diff --git a/usr/src/uts/common/fs/zfs/dmu.c b/usr/src/uts/common/fs/zfs/dmu.c index 67ad5d10f6..6620fbc43e 100644 --- a/usr/src/uts/common/fs/zfs/dmu.c +++ b/usr/src/uts/common/fs/zfs/dmu.c @@ -172,8 +172,8 @@ dmu_buf_hold_noread_by_dnode(dnode_t *dn, uint64_t offset, uint64_t blkid; dmu_buf_impl_t *db; - blkid = dbuf_whichblock(dn, 0, offset); rw_enter(&dn->dn_struct_rwlock, RW_READER); + blkid = dbuf_whichblock(dn, 0, offset); db = dbuf_hold(dn, blkid, tag); rw_exit(&dn->dn_struct_rwlock); @@ -197,8 +197,8 @@ dmu_buf_hold_noread(objset_t *os, uint64_t object, uint64_t offset, err = dnode_hold(os, object, FTAG, &dn); if (err) return (err); - blkid = dbuf_whichblock(dn, 0, offset); rw_enter(&dn->dn_struct_rwlock, RW_READER); + blkid = dbuf_whichblock(dn, 0, offset); db = dbuf_hold(dn, blkid, tag); rw_exit(&dn->dn_struct_rwlock); dnode_rele(dn, FTAG); @@ -605,7 +605,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length, if ((flags & DMU_READ_NO_PREFETCH) == 0 && DNODE_META_IS_CACHEABLE(dn) && length <= zfetch_array_rd_sz) { dmu_zfetch(&dn->dn_zfetch, blkid, nblks, - read && DNODE_IS_CACHEABLE(dn)); + read && DNODE_IS_CACHEABLE(dn), B_TRUE); } rw_exit(&dn->dn_struct_rwlock); @@ -737,7 +737,6 @@ dmu_prefetch(objset_t *os, uint64_t object, int64_t level, uint64_t offset, if (err != 0) return; - rw_enter(&dn->dn_struct_rwlock, RW_READER); /* * offset + len - 1 is the last byte we want to prefetch for, and offset * is the first. Then dbuf_whichblk(dn, level, off + len - 1) is the @@ -745,6 +744,7 @@ dmu_prefetch(objset_t *os, uint64_t object, int64_t level, uint64_t offset, * offset) is the first. Then the number we need to prefetch is the * last - first + 1. */ + rw_enter(&dn->dn_struct_rwlock, RW_READER); if (level > 0 || dn->dn_datablkshift != 0) { nblks = dbuf_whichblock(dn, level, offset + len - 1) - dbuf_whichblock(dn, level, offset) + 1; @@ -757,7 +757,6 @@ dmu_prefetch(objset_t *os, uint64_t object, int64_t level, uint64_t offset, for (int i = 0; i < nblks; i++) dbuf_prefetch(dn, level, blkid + i, pri, 0); } - rw_exit(&dn->dn_struct_rwlock); dnode_rele(dn, FTAG); diff --git a/usr/src/uts/common/fs/zfs/dmu_objset.c b/usr/src/uts/common/fs/zfs/dmu_objset.c index 884f0b36bb..a98097a8ee 100644 --- a/usr/src/uts/common/fs/zfs/dmu_objset.c +++ b/usr/src/uts/common/fs/zfs/dmu_objset.c @@ -684,8 +684,9 @@ dmu_objset_hold_flags(const char *name, boolean_t decrypt, void *tag, dsl_pool_t *dp; dsl_dataset_t *ds; int err; - ds_hold_flags_t flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : 0; + ds_hold_flags_t flags; + flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : DS_HOLD_FLAG_NONE; err = dsl_pool_hold(name, tag, &dp); if (err != 0) return (err); @@ -758,8 +759,9 @@ dmu_objset_own(const char *name, dmu_objset_type_t type, dsl_pool_t *dp; dsl_dataset_t *ds; int err; - ds_hold_flags_t flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : 0; + ds_hold_flags_t flags; + flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : DS_HOLD_FLAG_NONE; err = dsl_pool_hold(name, FTAG, &dp); if (err != 0) return (err); @@ -797,8 +799,9 @@ dmu_objset_own_obj(dsl_pool_t *dp, uint64_t obj, dmu_objset_type_t type, { dsl_dataset_t *ds; int err; - ds_hold_flags_t flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : 0; + ds_hold_flags_t flags; + flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : DS_HOLD_FLAG_NONE; err = dsl_dataset_own_obj(dp, obj, flags, tag, &ds); if (err != 0) return (err); @@ -815,9 +818,10 @@ dmu_objset_own_obj(dsl_pool_t *dp, uint64_t obj, dmu_objset_type_t type, void dmu_objset_rele_flags(objset_t *os, boolean_t decrypt, void *tag) { - ds_hold_flags_t flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : 0; - + ds_hold_flags_t flags; dsl_pool_t *dp = dmu_objset_pool(os); + + flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : DS_HOLD_FLAG_NONE; dsl_dataset_rele_flags(os->os_dsl_dataset, flags, tag); dsl_pool_rele(dp, tag); } @@ -845,7 +849,9 @@ dmu_objset_refresh_ownership(dsl_dataset_t *ds, dsl_dataset_t **newds, { dsl_pool_t *dp; char name[ZFS_MAX_DATASET_NAME_LEN]; + ds_hold_flags_t flags; + flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : DS_HOLD_FLAG_NONE; VERIFY3P(ds, !=, NULL); VERIFY3P(ds->ds_owner, ==, tag); VERIFY(dsl_dataset_long_held(ds)); @@ -854,21 +860,22 @@ dmu_objset_refresh_ownership(dsl_dataset_t *ds, dsl_dataset_t **newds, dp = ds->ds_dir->dd_pool; dsl_pool_config_enter(dp, FTAG); - dsl_dataset_disown(ds, decrypt, tag); - VERIFY0(dsl_dataset_own(dp, name, - (decrypt) ? DS_HOLD_FLAG_DECRYPT : 0, tag, newds)); + dsl_dataset_disown(ds, flags, tag); + VERIFY0(dsl_dataset_own(dp, name, flags, tag, newds)); dsl_pool_config_exit(dp, FTAG); } void dmu_objset_disown(objset_t *os, boolean_t decrypt, void *tag) { + ds_hold_flags_t flags; + + flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : DS_HOLD_FLAG_NONE; /* * Stop upgrading thread */ dmu_objset_upgrade_stop(os); - dsl_dataset_disown(os->os_dsl_dataset, - (decrypt) ? DS_HOLD_FLAG_DECRYPT : 0, tag); + dsl_dataset_disown(os->os_dsl_dataset, flags, tag); } void diff --git a/usr/src/uts/common/fs/zfs/dmu_recv.c b/usr/src/uts/common/fs/zfs/dmu_recv.c index 39f365652e..03e0fee4ff 100644 --- a/usr/src/uts/common/fs/zfs/dmu_recv.c +++ b/usr/src/uts/common/fs/zfs/dmu_recv.c @@ -201,7 +201,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx) struct drr_begin *drrb = drba->drba_cookie->drc_drrb; uint64_t fromguid = drrb->drr_fromguid; int flags = drrb->drr_flags; - ds_hold_flags_t dsflags = 0; + ds_hold_flags_t dsflags = DS_HOLD_FLAG_NONE; int error; uint64_t featureflags = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo); dsl_dataset_t *ds; @@ -399,7 +399,7 @@ dmu_recv_begin_sync(void *arg, dmu_tx_t *tx) dsl_dataset_t *ds, *newds; objset_t *os; uint64_t dsobj; - ds_hold_flags_t dsflags = 0; + ds_hold_flags_t dsflags = DS_HOLD_FLAG_NONE; int error; uint64_t crflags = 0; dsl_crypto_params_t dummy_dcp = { 0 }; @@ -541,7 +541,7 @@ dmu_recv_resume_begin_check(void *arg, dmu_tx_t *tx) dsl_pool_t *dp = dmu_tx_pool(tx); struct drr_begin *drrb = drba->drba_cookie->drc_drrb; int error; - ds_hold_flags_t dsflags = 0; + ds_hold_flags_t dsflags = DS_HOLD_FLAG_NONE; uint64_t featureflags = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo); dsl_dataset_t *ds; const char *tofs = drba->drba_cookie->drc_tofs; @@ -670,7 +670,7 @@ dmu_recv_resume_begin_sync(void *arg, dmu_tx_t *tx) uint64_t featureflags = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo); dsl_dataset_t *ds; objset_t *os; - ds_hold_flags_t dsflags = 0; + ds_hold_flags_t dsflags = DS_HOLD_FLAG_NONE; uint64_t dsobj; /* 6 extra bytes for /%recv */ char recvname[ZFS_MAX_DATASET_NAME_LEN + 6]; @@ -1824,8 +1824,9 @@ static void dmu_recv_cleanup_ds(dmu_recv_cookie_t *drc) { dsl_dataset_t *ds = drc->drc_ds; - ds_hold_flags_t dsflags = (drc->drc_raw) ? 0 : DS_HOLD_FLAG_DECRYPT; + ds_hold_flags_t dsflags; + dsflags = (drc->drc_raw) ? DS_HOLD_FLAG_NONE : DS_HOLD_FLAG_DECRYPT; /* * Wait for the txg sync before cleaning up the receive. For * resumable receives, this ensures that our resume state has @@ -2832,11 +2833,12 @@ add_ds_to_guidmap(const char *name, avl_tree_t *guid_map, uint64_t snapobj, dsl_dataset_t *snapds; guid_map_entry_t *gmep; objset_t *os; - ds_hold_flags_t dsflags = (raw) ? 0 : DS_HOLD_FLAG_DECRYPT; + ds_hold_flags_t dsflags; int err; ASSERT(guid_map != NULL); + dsflags = (raw) ? DS_HOLD_FLAG_NONE : DS_HOLD_FLAG_DECRYPT; err = dsl_pool_hold(name, FTAG, &dp); if (err != 0) return (err); diff --git a/usr/src/uts/common/fs/zfs/dmu_send.c b/usr/src/uts/common/fs/zfs/dmu_send.c index 34cfa2c011..d91a48e2ca 100644 --- a/usr/src/uts/common/fs/zfs/dmu_send.c +++ b/usr/src/uts/common/fs/zfs/dmu_send.c @@ -1222,9 +1222,10 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, dsl_pool_t *dp; dsl_dataset_t *ds; dsl_dataset_t *fromds = NULL; - ds_hold_flags_t dsflags = (rawok) ? 0 : DS_HOLD_FLAG_DECRYPT; + ds_hold_flags_t dsflags; int err; + dsflags = (rawok) ? DS_HOLD_FLAG_NONE : DS_HOLD_FLAG_DECRYPT; err = dsl_pool_hold(pool, FTAG, &dp); if (err != 0) return (err); @@ -1287,9 +1288,10 @@ dmu_send(const char *tosnap, const char *fromsnap, boolean_t embedok, dsl_pool_t *dp; dsl_dataset_t *ds; int err; - ds_hold_flags_t dsflags = (rawok) ? 0 : DS_HOLD_FLAG_DECRYPT; + ds_hold_flags_t dsflags; boolean_t owned = B_FALSE; + dsflags = (rawok) ? DS_HOLD_FLAG_NONE : DS_HOLD_FLAG_DECRYPT; if (fromsnap != NULL && strpbrk(fromsnap, "@#") == NULL) return (SET_ERROR(EINVAL)); diff --git a/usr/src/uts/common/fs/zfs/dmu_zfetch.c b/usr/src/uts/common/fs/zfs/dmu_zfetch.c index 5d6f20d072..60e0f36a5e 100644 --- a/usr/src/uts/common/fs/zfs/dmu_zfetch.c +++ b/usr/src/uts/common/fs/zfs/dmu_zfetch.c @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2013, 2015 by Delphix. All rights reserved. + * Copyright (c) 2013, 2017 by Delphix. All rights reserved. */ #include <sys/zfs_context.h> @@ -204,7 +204,8 @@ dmu_zfetch_stream_create(zfetch_t *zf, uint64_t blkid) * TRUE -- prefetch predicted data blocks plus following indirect blocks. */ void -dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t nblks, boolean_t fetch_data) +dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t nblks, boolean_t fetch_data, + boolean_t have_lock) { zstream_t *zs; int64_t pf_start, ipf_start, ipf_istart, ipf_iend; @@ -233,6 +234,9 @@ dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t nblks, boolean_t fetch_data) if (blkid == 0) return; + if (!have_lock) + rw_enter(&zf->zf_dnode->dn_struct_rwlock, RW_READER); + rw_enter(&zf->zf_rwlock, RW_READER); /* @@ -257,6 +261,10 @@ dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t nblks, boolean_t fetch_data) /* Already prefetched this before. */ mutex_exit(&zs->zs_lock); rw_exit(&zf->zf_rwlock); + if (!have_lock) { + rw_exit(&zf->zf_dnode-> + dn_struct_rwlock); + } return; } break; @@ -274,6 +282,8 @@ dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t nblks, boolean_t fetch_data) if (rw_tryupgrade(&zf->zf_rwlock)) dmu_zfetch_stream_create(zf, end_of_access_blkid); rw_exit(&zf->zf_rwlock); + if (!have_lock) + rw_exit(&zf->zf_dnode->dn_struct_rwlock); return; } @@ -353,5 +363,7 @@ dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t nblks, boolean_t fetch_data) dbuf_prefetch(zf->zf_dnode, 1, iblk, ZIO_PRIORITY_ASYNC_READ, ARC_FLAG_PREDICTIVE_PREFETCH); } + if (!have_lock) + rw_exit(&zf->zf_dnode->dn_struct_rwlock); ZFETCHSTAT_BUMP(zfetchstat_hits); } diff --git a/usr/src/uts/common/fs/zfs/dnode.c b/usr/src/uts/common/fs/zfs/dnode.c index 6550a1f066..53aeb42c0e 100644 --- a/usr/src/uts/common/fs/zfs/dnode.c +++ b/usr/src/uts/common/fs/zfs/dnode.c @@ -1346,7 +1346,6 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots, } blk = dbuf_whichblock(mdn, 0, object * sizeof (dnode_phys_t)); - db = dbuf_hold(mdn, blk, FTAG); if (drop_struct_lock) rw_exit(&mdn->dn_struct_rwlock); @@ -1783,10 +1782,11 @@ dnode_set_blksz(dnode_t *dn, uint64_t size, int ibs, dmu_tx_t *tx) /* resize the old block */ err = dbuf_hold_impl(dn, 0, 0, TRUE, FALSE, FTAG, &db); - if (err == 0) + if (err == 0) { dbuf_new_size(db, size, tx); - else if (err != ENOENT) + } else if (err != ENOENT) { goto fail; + } dnode_setdblksz(dn, size); dnode_setdirty(dn, tx); @@ -2021,7 +2021,6 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) int trunc = FALSE; int epbs; - rw_enter(&dn->dn_struct_rwlock, RW_WRITER); blksz = dn->dn_datablksz; blkshift = dn->dn_datablkshift; epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; @@ -2038,7 +2037,7 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) head = P2NPHASE(off, blksz); blkoff = P2PHASE(off, blksz); if ((off >> blkshift) > dn->dn_maxblkid) - goto out; + return; } else { ASSERT(dn->dn_maxblkid == 0); if (off == 0 && len >= blksz) { @@ -2047,12 +2046,15 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) */ blkid = 0; nblks = 1; - if (dn->dn_nlevels > 1) + if (dn->dn_nlevels > 1) { + rw_enter(&dn->dn_struct_rwlock, RW_WRITER); dnode_dirty_l1(dn, 0, tx); + rw_exit(&dn->dn_struct_rwlock); + } goto done; } else if (off >= blksz) { /* Freeing past end-of-data */ - goto out; + return; } else { /* Freeing part of the block. */ head = blksz - off; @@ -2062,19 +2064,26 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) } /* zero out any partial block data at the start of the range */ if (head) { + int res; ASSERT3U(blkoff + head, ==, blksz); if (len < head) head = len; - if (dbuf_hold_impl(dn, 0, dbuf_whichblock(dn, 0, off), - TRUE, FALSE, FTAG, &db) == 0) { + rw_enter(&dn->dn_struct_rwlock, RW_READER); + res = dbuf_hold_impl(dn, 0, dbuf_whichblock(dn, 0, off), + TRUE, FALSE, FTAG, &db); + rw_exit(&dn->dn_struct_rwlock); + if (res == 0) { caddr_t data; + boolean_t dirty; + db_lock_type_t dblt = dmu_buf_lock_parent(db, RW_READER, + FTAG); /* don't dirty if it isn't on disk and isn't dirty */ - if (db->db_last_dirty || - (db->db_blkptr && !BP_IS_HOLE(db->db_blkptr))) { - rw_exit(&dn->dn_struct_rwlock); + dirty = db->db_last_dirty || + (db->db_blkptr && !BP_IS_HOLE(db->db_blkptr)); + dmu_buf_unlock_parent(db, dblt, FTAG); + if (dirty) { dmu_buf_will_dirty(&db->db, tx); - rw_enter(&dn->dn_struct_rwlock, RW_WRITER); data = db->db.db_data; bzero(data + blkoff, head); } @@ -2086,11 +2095,11 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) /* If the range was less than one block, we're done */ if (len == 0) - goto out; + return; /* If the remaining range is past end of file, we're done */ if ((off >> blkshift) > dn->dn_maxblkid) - goto out; + return; ASSERT(ISP2(blksz)); if (trunc) @@ -2101,16 +2110,23 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) ASSERT0(P2PHASE(off, blksz)); /* zero out any partial block data at the end of the range */ if (tail) { + int res; if (len < tail) tail = len; - if (dbuf_hold_impl(dn, 0, dbuf_whichblock(dn, 0, off+len), - TRUE, FALSE, FTAG, &db) == 0) { + rw_enter(&dn->dn_struct_rwlock, RW_READER); + res = dbuf_hold_impl(dn, 0, dbuf_whichblock(dn, 0, off+len), + TRUE, FALSE, FTAG, &db); + rw_exit(&dn->dn_struct_rwlock); + if (res == 0) { + boolean_t dirty; /* don't dirty if not on disk and not dirty */ - if (db->db_last_dirty || - (db->db_blkptr && !BP_IS_HOLE(db->db_blkptr))) { - rw_exit(&dn->dn_struct_rwlock); + db_lock_type_t type = dmu_buf_lock_parent(db, RW_READER, + FTAG); + dirty = db->db_last_dirty || + (db->db_blkptr && !BP_IS_HOLE(db->db_blkptr)); + dmu_buf_unlock_parent(db, type, FTAG); + if (dirty) { dmu_buf_will_dirty(&db->db, tx); - rw_enter(&dn->dn_struct_rwlock, RW_WRITER); bzero(db->db.db_data, tail); } dbuf_rele(db, FTAG); @@ -2120,7 +2136,7 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) /* If the range did not include a full block, we are done */ if (len == 0) - goto out; + return; ASSERT(IS_P2ALIGNED(off, blksz)); ASSERT(trunc || IS_P2ALIGNED(len, blksz)); @@ -2150,6 +2166,7 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) * amount of space if we copy the freed BPs into deadlists. */ if (dn->dn_nlevels > 1) { + rw_enter(&dn->dn_struct_rwlock, RW_WRITER); uint64_t first, last; first = blkid >> epbs; @@ -2194,6 +2211,7 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) dnode_dirty_l1(dn, i, tx); } + rw_exit(&dn->dn_struct_rwlock); } done: @@ -2215,9 +2233,6 @@ done: dbuf_free_range(dn, blkid, blkid + nblks - 1, tx); dnode_setdirty(dn, tx); -out: - - rw_exit(&dn->dn_struct_rwlock); } static boolean_t @@ -2329,6 +2344,8 @@ dnode_next_offset_level(dnode_t *dn, int flags, uint64_t *offset, dprintf("probing object %llu offset %llx level %d of %u\n", dn->dn_object, *offset, lvl, dn->dn_phys->dn_nlevels); + ASSERT(RW_LOCK_HELD(&dn->dn_struct_rwlock)); + hole = ((flags & DNODE_FIND_HOLE) != 0); inc = (flags & DNODE_FIND_BACKWARDS) ? -1 : 1; ASSERT(txg == 0 || !hole); @@ -2361,9 +2378,9 @@ dnode_next_offset_level(dnode_t *dn, int flags, uint64_t *offset, return (error); } data = db->db.db_data; + rw_enter(&db->db_rwlock, RW_READER); } - if (db != NULL && txg != 0 && (db->db_blkptr == NULL || db->db_blkptr->blk_birth <= txg || BP_IS_HOLE(db->db_blkptr))) { @@ -2423,8 +2440,10 @@ dnode_next_offset_level(dnode_t *dn, int flags, uint64_t *offset, error = SET_ERROR(ESRCH); } - if (db) + if (db != NULL) { + rw_exit(&db->db_rwlock); dbuf_rele(db, FTAG); + } return (error); } diff --git a/usr/src/uts/common/fs/zfs/dnode_sync.c b/usr/src/uts/common/fs/zfs/dnode_sync.c index 4a060403da..396d58da17 100644 --- a/usr/src/uts/common/fs/zfs/dnode_sync.c +++ b/usr/src/uts/common/fs/zfs/dnode_sync.c @@ -52,7 +52,6 @@ dnode_increase_indirection(dnode_t *dn, dmu_tx_t *tx) /* this dnode can't be paged out because it's dirty */ ASSERT(dn->dn_phys->dn_type != DMU_OT_NONE); - ASSERT(RW_WRITE_HELD(&dn->dn_struct_rwlock)); ASSERT(new_level > 1 && dn->dn_phys->dn_nlevels > 0); db = dbuf_hold_level(dn, dn->dn_phys->dn_nlevels, 0, FTAG); @@ -62,8 +61,24 @@ dnode_increase_indirection(dnode_t *dn, dmu_tx_t *tx) dprintf("os=%p obj=%llu, increase to %d\n", dn->dn_objset, dn->dn_object, dn->dn_phys->dn_nlevels); + /* + * Lock ordering requires that we hold the children's db_mutexes (by + * calling dbuf_find()) before holding the parent's db_rwlock. The lock + * order is imposed by dbuf_read's steps of "grab the lock to protect + * db_parent, get db_parent, hold db_parent's db_rwlock". + */ + dmu_buf_impl_t *children[DN_MAX_NBLKPTR]; + ASSERT3U(nblkptr, <=, DN_MAX_NBLKPTR); + for (i = 0; i < nblkptr; i++) { + children[i] = + dbuf_find(dn->dn_objset, dn->dn_object, old_toplvl, i); + } + /* transfer dnode's block pointers to new indirect block */ (void) dbuf_read(db, NULL, DB_RF_MUST_SUCCEED|DB_RF_HAVESTRUCT); + if (dn->dn_dbuf != NULL) + rw_enter(&dn->dn_dbuf->db_rwlock, RW_WRITER); + rw_enter(&db->db_rwlock, RW_WRITER); ASSERT(db->db.db_data); ASSERT(arc_released(db->db_buf)); ASSERT3U(sizeof (blkptr_t) * nblkptr, <=, db->db.db_size); @@ -73,8 +88,7 @@ dnode_increase_indirection(dnode_t *dn, dmu_tx_t *tx) /* set dbuf's parent pointers to new indirect buf */ for (i = 0; i < nblkptr; i++) { - dmu_buf_impl_t *child = - dbuf_find(dn->dn_objset, dn->dn_object, old_toplvl, i); + dmu_buf_impl_t *child = children[i]; if (child == NULL) continue; @@ -107,6 +121,10 @@ dnode_increase_indirection(dnode_t *dn, dmu_tx_t *tx) bzero(dn->dn_phys->dn_blkptr, sizeof (blkptr_t) * nblkptr); + rw_exit(&db->db_rwlock); + if (dn->dn_dbuf != NULL) + rw_exit(&dn->dn_dbuf->db_rwlock); + dbuf_rele(db, FTAG); rw_exit(&dn->dn_struct_rwlock); @@ -183,7 +201,7 @@ free_verify(dmu_buf_impl_t *db, uint64_t start, uint64_t end, dmu_tx_t *tx) ASSERT(db->db_level == 1); rw_enter(&dn->dn_struct_rwlock, RW_READER); - err = dbuf_hold_impl(dn, db->db_level-1, + err = dbuf_hold_impl(dn, db->db_level - 1, (db->db_blkid << epbs) + i, TRUE, FALSE, FTAG, &child); rw_exit(&dn->dn_struct_rwlock); if (err == ENOENT) @@ -281,7 +299,9 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, * ancestor of the first or last block to be freed. The first and * last L1 indirect blocks are always dirtied by dnode_free_range(). */ + db_lock_type_t dblt = dmu_buf_lock_parent(db, RW_READER, FTAG); VERIFY(BP_GET_FILL(db->db_blkptr) == 0 || db->db_dirtycnt > 0); + dmu_buf_unlock_parent(db, dblt, FTAG); dbuf_release_bp(db); bp = db->db.db_data; @@ -307,7 +327,9 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, if (db->db_level == 1) { FREE_VERIFY(db, start, end, tx); - free_blocks(dn, bp, end-start+1, tx); + rw_enter(&db->db_rwlock, RW_WRITER); + free_blocks(dn, bp, end - start + 1, tx); + rw_exit(&db->db_rwlock); } else { for (uint64_t id = start; id <= end; id++, bp++) { if (BP_IS_HOLE(bp)) @@ -324,10 +346,12 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, } if (free_indirects) { + rw_enter(&db->db_rwlock, RW_WRITER); for (i = 0, bp = db->db.db_data; i < 1 << epbs; i++, bp++) ASSERT(BP_IS_HOLE(bp)); bzero(db->db.db_data, db->db.db_size); free_blocks(dn, db->db_blkptr, 1, tx); + rw_exit(&db->db_rwlock); } DB_DNODE_EXIT(db); @@ -379,7 +403,6 @@ dnode_sync_free_range_impl(dnode_t *dn, uint64_t blkid, uint64_t nblks, VERIFY0(dbuf_hold_impl(dn, dnlevel - 1, i, TRUE, FALSE, FTAG, &db)); rw_exit(&dn->dn_struct_rwlock); - free_children(db, blkid, nblks, free_indirects, tx); dbuf_rele(db, FTAG); } diff --git a/usr/src/uts/common/fs/zfs/sys/dbuf.h b/usr/src/uts/common/fs/zfs/sys/dbuf.h index 271232c61c..7482006eb1 100644 --- a/usr/src/uts/common/fs/zfs/sys/dbuf.h +++ b/usr/src/uts/common/fs/zfs/sys/dbuf.h @@ -108,6 +108,12 @@ typedef enum override_states { DR_OVERRIDDEN } override_states_t; +typedef enum db_lock_type { + DLT_NONE, + DLT_PARENT, + DLT_OBJSET +} db_lock_type_t; + typedef struct dbuf_dirty_record { /* link on our parents dirty list */ list_node_t dr_dirty_node; @@ -217,6 +223,22 @@ typedef struct dmu_buf_impl { */ uint8_t db_level; + /* + * Protects db_buf's contents if they contain an indirect block or data + * block of the meta-dnode. We use this lock to protect the structure of + * the block tree. This means that when modifying this dbuf's data, we + * grab its rwlock. When modifying its parent's data (including the + * blkptr to this dbuf), we grab the parent's rwlock. The lock ordering + * for this lock is: + * 1) dn_struct_rwlock + * 2) db_rwlock + * We don't currently grab multiple dbufs' db_rwlocks at once. + */ + krwlock_t db_rwlock; + + /* buffer holding our data */ + arc_buf_t *db_buf; + /* db_mtx protects the members below */ kmutex_t db_mtx; @@ -232,9 +254,6 @@ typedef struct dmu_buf_impl { */ zfs_refcount_t db_holds; - /* buffer holding our data */ - arc_buf_t *db_buf; - kcondvar_t db_changed; dbuf_dirty_record_t *db_data_pending; @@ -336,6 +355,8 @@ void dbuf_setdirty(dmu_buf_impl_t *db, dmu_tx_t *tx); void dbuf_unoverride(dbuf_dirty_record_t *dr); void dbuf_sync_list(list_t *list, int level, dmu_tx_t *tx); void dbuf_release_bp(dmu_buf_impl_t *db); +db_lock_type_t dmu_buf_lock_parent(dmu_buf_impl_t *db, krw_t rw, void *tag); +void dmu_buf_unlock_parent(dmu_buf_impl_t *db, db_lock_type_t type, void *tag); boolean_t dbuf_can_remap(const dmu_buf_impl_t *buf); diff --git a/usr/src/uts/common/fs/zfs/sys/dmu_zfetch.h b/usr/src/uts/common/fs/zfs/sys/dmu_zfetch.h index 21a3ff3a20..d426cc282b 100644 --- a/usr/src/uts/common/fs/zfs/sys/dmu_zfetch.h +++ b/usr/src/uts/common/fs/zfs/sys/dmu_zfetch.h @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2014 by Delphix. All rights reserved. + * Copyright (c) 2014, 2017 by Delphix. All rights reserved. */ #ifndef _DMU_ZFETCH_H @@ -66,7 +66,8 @@ void zfetch_fini(void); void dmu_zfetch_init(zfetch_t *, struct dnode *); void dmu_zfetch_fini(zfetch_t *); -void dmu_zfetch(zfetch_t *, uint64_t, uint64_t, boolean_t); +void dmu_zfetch(zfetch_t *, uint64_t, uint64_t, boolean_t, + boolean_t); #ifdef __cplusplus diff --git a/usr/src/uts/common/fs/zfs/sys/dsl_dataset.h b/usr/src/uts/common/fs/zfs/sys/dsl_dataset.h index 189376eefc..0fd7e1a7e2 100644 --- a/usr/src/uts/common/fs/zfs/sys/dsl_dataset.h +++ b/usr/src/uts/common/fs/zfs/sys/dsl_dataset.h @@ -306,6 +306,7 @@ typedef struct dsl_dataset_snapshot_arg { /* flags for holding the dataset */ typedef enum ds_hold_flags { + DS_HOLD_FLAG_NONE = 0 << 0, DS_HOLD_FLAG_DECRYPT = 1 << 0 /* needs access to encrypted data */ } ds_hold_flags_t; diff --git a/usr/src/uts/i86pc/cpu/generic_cpu/gcpu_mca.c b/usr/src/uts/i86pc/cpu/generic_cpu/gcpu_mca.c index a7ea684f9c..2f71105178 100644 --- a/usr/src/uts/i86pc/cpu/generic_cpu/gcpu_mca.c +++ b/usr/src/uts/i86pc/cpu/generic_cpu/gcpu_mca.c @@ -1366,7 +1366,8 @@ gcpu_mca_init(cmi_hdl_t hdl) */ if (!gcpu_suppress_log_on_init && ((vendor == X86_VENDOR_Intel && family >= 0xf) || - vendor == X86_VENDOR_AMD)) + vendor == X86_VENDOR_AMD || + vendor == X86_VENDOR_HYGON)) gcpu_mca_logout(hdl, NULL, -1ULL, NULL, B_FALSE, GCPU_MPT_WHAT_POKE_ERR); diff --git a/usr/src/uts/i86pc/os/cmi_hw.c b/usr/src/uts/i86pc/os/cmi_hw.c index aa549569b0..fb59826431 100644 --- a/usr/src/uts/i86pc/os/cmi_hw.c +++ b/usr/src/uts/i86pc/os/cmi_hw.c @@ -1272,6 +1272,7 @@ cmi_hdl_create(enum cmi_hdl_class class, uint_t chipid, uint_t coreid, switch (vendor) { case X86_VENDOR_Intel: case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: if (cmi_ext_topo_check == 0) { cpuid_get_ext_topo((cpu_t *)priv, &cmi_core_nbits, &cmi_strand_nbits); diff --git a/usr/src/uts/i86pc/os/cpuid.c b/usr/src/uts/i86pc/os/cpuid.c index 6f54dee7f9..c40173d4c8 100644 --- a/usr/src/uts/i86pc/os/cpuid.c +++ b/usr/src/uts/i86pc/os/cpuid.c @@ -1817,6 +1817,7 @@ platform_cpuid_mangle(uint_t vendor, uint32_t eax, struct cpuid_regs *cp) } break; case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: switch (eax) { case 0x80000001: @@ -2077,7 +2078,8 @@ cpuid_gather_apicid(struct cpuid_info *cpi) } } - if (cpi->cpi_vendor == X86_VENDOR_AMD && + if ((cpi->cpi_vendor == X86_VENDOR_AMD || + cpi->cpi_vendor == X86_VENDOR_HYGON) && is_x86_feature(x86_featureset, X86FSET_TOPOEXT) && cpi->cpi_xmaxeax >= CPUID_LEAF_EXT_1e) { return (cpi->cpi_extd[0x1e].cp_eax); @@ -2742,7 +2744,8 @@ cpuid_use_amd_retpoline(struct cpuid_info *cpi) uint64_t val; on_trap_data_t otd; - if (cpi->cpi_vendor != X86_VENDOR_AMD) + if (cpi->cpi_vendor != X86_VENDOR_AMD && + cpi->cpi_vendor != X86_VENDOR_HYGON) return (B_FALSE); /* @@ -2881,7 +2884,8 @@ cpuid_scan_security(cpu_t *cpu, uchar_t *featureset) struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi; x86_spectrev2_mitigation_t v2mit; - if (cpi->cpi_vendor == X86_VENDOR_AMD && + if ((cpi->cpi_vendor == X86_VENDOR_AMD || + cpi->cpi_vendor == X86_VENDOR_HYGON) && cpi->cpi_xmaxeax >= CPUID_LEAF_EXT_8) { if (cpi->cpi_extd[8].cp_ebx & CPUID_AMD_EBX_IBPB) add_x86_feature(featureset, X86FSET_IBPB); @@ -3092,7 +3096,8 @@ cpuid_pass1_topology(cpu_t *cpu, uchar_t *featureset) cpi = cpu->cpu_m.mcpu_cpi; - if (cpi->cpi_vendor == X86_VENDOR_AMD) { + if (cpi->cpi_vendor == X86_VENDOR_AMD || + cpi->cpi_vendor == X86_VENDOR_HYGON) { cpuid_gather_amd_topology_leaves(cpu); } @@ -3108,6 +3113,7 @@ cpuid_pass1_topology(cpu_t *cpu, uchar_t *featureset) &cpi->cpi_ncore_per_chip); break; case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: cpuid_amd_ncores(cpi, &cpi->cpi_ncpu_per_chip, &cpi->cpi_ncore_per_chip); break; @@ -3157,7 +3163,8 @@ cpuid_pass1_topology(cpu_t *cpu, uchar_t *featureset) cpi->cpi_clogid = 0; cpi->cpi_coreid = cpu->cpu_id; cpi->cpi_pkgcoreid = 0; - if (cpi->cpi_vendor == X86_VENDOR_AMD) { + if (cpi->cpi_vendor == X86_VENDOR_AMD || + cpi->cpi_vendor == X86_VENDOR_HYGON) { cpi->cpi_procnodeid = BITX(cpi->cpi_apicid, 3, 0); } else { cpi->cpi_procnodeid = cpi->cpi_chipid; @@ -3168,6 +3175,7 @@ cpuid_pass1_topology(cpu_t *cpu, uchar_t *featureset) cpuid_intel_getids(cpu, featureset); break; case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: cpuid_amd_getids(cpu, featureset); break; default: @@ -3358,6 +3366,9 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) if (CPI_FAMILY(cpi) == 0xf) cpi->cpi_model += CPI_MODEL_XTD(cpi) << 4; break; + case X86_VENDOR_HYGON: + cpi->cpi_model += CPI_MODEL_XTD(cpi) << 4; + break; default: if (cpi->cpi_model == 0xf) cpi->cpi_model += CPI_MODEL_XTD(cpi) << 4; @@ -3471,6 +3482,10 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) #endif break; + case X86_VENDOR_HYGON: + /* Enable all for Hygon Dhyana CPU */ + mask_ecx = 0xffffffff; + break; case X86_VENDOR_TM: /* * workaround the NT workaround in CMS 4.1 @@ -3934,6 +3949,7 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) x86_type == X86_TYPE_CYRIX_GXm) xcpuid++; break; + case X86_VENDOR_HYGON: case X86_VENDOR_Centaur: case X86_VENDOR_TM: default: @@ -3955,6 +3971,7 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) switch (cpi->cpi_vendor) { case X86_VENDOR_Intel: case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: if (cpi->cpi_xmaxeax < 0x80000001) break; cp = &cpi->cpi_extd[1]; @@ -3998,7 +4015,8 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) add_x86_feature(featureset, X86FSET_1GPG); } - if ((cpi->cpi_vendor == X86_VENDOR_AMD) && + if ((cpi->cpi_vendor == X86_VENDOR_AMD || + cpi->cpi_vendor == X86_VENDOR_HYGON) && (cpi->cpi_std[1].cp_edx & CPUID_INTC_EDX_FXSR) && (cp->cp_ecx & CPUID_AMD_ECX_SSE4A)) { add_x86_feature(featureset, X86FSET_SSE4A); @@ -4019,7 +4037,8 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) * that AMD processors don't support sysenter * in long mode at all, so don't try to program them. */ - if (x86_vendor == X86_VENDOR_AMD) { + if (x86_vendor == X86_VENDOR_AMD || + x86_vendor == X86_VENDOR_HYGON) { remove_x86_feature(featureset, X86FSET_SEP); } @@ -4073,6 +4092,7 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) } /*FALLTHROUGH*/ case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: if (cpi->cpi_xmaxeax < CPUID_LEAF_EXT_8) break; cp = &cpi->cpi_extd[8]; @@ -4084,7 +4104,8 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) /* * AMD uses ebx for some extended functions. */ - if (cpi->cpi_vendor == X86_VENDOR_AMD) { + if (cpi->cpi_vendor == X86_VENDOR_AMD || + cpi->cpi_vendor == X86_VENDOR_HYGON) { /* * While we're here, check for the AMD "Error * Pointer Zero/Restore" feature. This can be @@ -4120,6 +4141,7 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) switch (cpi->cpi_vendor) { case X86_VENDOR_Intel: case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: if (cpi->cpi_maxeax >= 7) { cp = &cpi->cpi_extd[7]; cp->cp_eax = 0x80000007; @@ -4152,7 +4174,8 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) cpi->cpi_socket = _cpuid_skt(cpi->cpi_vendor, cpi->cpi_family, cpi->cpi_model, cpi->cpi_step); - if (cpi->cpi_vendor == X86_VENDOR_AMD) { + if (cpi->cpi_vendor == X86_VENDOR_AMD || + cpi->cpi_vendor == X86_VENDOR_HYGON) { if (cpi->cpi_xmaxeax >= CPUID_LEAF_EXT_8 && cpi->cpi_extd[8].cp_ebx & CPUID_AMD_EBX_ERR_PTR_ZERO) { /* Special handling for AMD FP not necessary. */ @@ -5032,7 +5055,8 @@ cpuid_pass3(cpu_t *cpu) cpi->cpi_last_lvl_cacheid = cpu->cpu_id; if ((cpi->cpi_maxeax >= 4 && cpi->cpi_vendor == X86_VENDOR_Intel) || - (cpi->cpi_vendor == X86_VENDOR_AMD && + ((cpi->cpi_vendor == X86_VENDOR_AMD || + cpi->cpi_vendor == X86_VENDOR_HYGON) && cpi->cpi_xmaxeax >= CPUID_LEAF_EXT_1d && is_x86_feature(x86_featureset, X86FSET_TOPOEXT))) { uint32_t leaf; @@ -5401,6 +5425,7 @@ cpuid_pass4(cpu_t *cpu, uint_t *hwcap_out) /*FALLTHROUGH*/ case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: edx = &cpi->cpi_support[AMD_EDX_FEATURES]; ecx = &cpi->cpi_support[AMD_ECX_FEATURES]; @@ -5417,6 +5442,7 @@ cpuid_pass4(cpu_t *cpu, uint_t *hwcap_out) break; case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: if (!is_x86_feature(x86_featureset, X86FSET_TSCP)) *edx &= ~CPUID_AMD_EDX_TSCP; if (!is_x86_feature(x86_featureset, X86FSET_SSE4A)) @@ -5459,6 +5485,7 @@ cpuid_pass4(cpu_t *cpu, uint_t *hwcap_out) switch (cpi->cpi_vendor) { case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: if (*edx & CPUID_AMD_EDX_TSCP) hwcap_flags |= AV_386_TSCP; if (*ecx & CPUID_AMD_ECX_AHF64) @@ -5603,7 +5630,8 @@ cpuid_syscall32_insn(cpu_t *cpu) { struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi; - if (cpi->cpi_vendor == X86_VENDOR_AMD && + if ((cpi->cpi_vendor == X86_VENDOR_AMD || + cpi->cpi_vendor == X86_VENDOR_HYGON) && cpi->cpi_xmaxeax >= 0x80000001 && (CPI_FEATURES_XTD_EDX(cpi) & CPUID_AMD_EDX_SYSC)) return (1); @@ -5821,7 +5849,9 @@ cpuid_have_cr8access(cpu_t *cpu) ASSERT(cpu != NULL); cpi = cpu->cpu_m.mcpu_cpi; - if (cpi->cpi_vendor == X86_VENDOR_AMD && cpi->cpi_maxeax >= 1 && + if ((cpi->cpi_vendor == X86_VENDOR_AMD || + cpi->cpi_vendor == X86_VENDOR_HYGON) && + cpi->cpi_maxeax >= 1 && (CPI_FEATURES_XTD_ECX(cpi) & CPUID_AMD_ECX_CR8D) != 0) return (1); return (0); @@ -6789,6 +6819,8 @@ x86_which_cacheinfo(struct cpuid_info *cpi) (cpi->cpi_family == 5 && cpi->cpi_model >= 1)) return (X86_VENDOR_AMD); break; + case X86_VENDOR_HYGON: + return (X86_VENDOR_AMD); case X86_VENDOR_TM: if (cpi->cpi_family >= 5) return (X86_VENDOR_AMD); @@ -6885,6 +6917,9 @@ cpuid_set_cpu_properties(void *dip, processorid_t cpu_id, case X86_VENDOR_AMD: create = cpi->cpi_family >= 0xf; break; + case X86_VENDOR_HYGON: + create = 1; + break; default: create = 0; break; @@ -6901,6 +6936,9 @@ cpuid_set_cpu_properties(void *dip, processorid_t cpu_id, case X86_VENDOR_AMD: create = CPI_FAMILY(cpi) == 0xf; break; + case X86_VENDOR_HYGON: + create = 1; + break; default: create = 0; break; @@ -6912,6 +6950,7 @@ cpuid_set_cpu_properties(void *dip, processorid_t cpu_id, /* generation */ switch (cpi->cpi_vendor) { case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: /* * AMD K5 model 1 was the first part to support this */ @@ -6938,6 +6977,9 @@ cpuid_set_cpu_properties(void *dip, processorid_t cpu_id, case X86_VENDOR_AMD: create = cpi->cpi_family >= 0xf; break; + case X86_VENDOR_HYGON: + create = 1; + break; default: create = 0; break; @@ -6958,6 +7000,9 @@ cpuid_set_cpu_properties(void *dip, processorid_t cpu_id, case X86_VENDOR_AMD: create = cpi->cpi_family >= 0xf; break; + case X86_VENDOR_HYGON: + create = 1; + break; default: create = 0; break; @@ -6988,6 +7033,9 @@ cpuid_set_cpu_properties(void *dip, processorid_t cpu_id, case X86_VENDOR_AMD: create = cpi->cpi_family >= 0xf; break; + case X86_VENDOR_HYGON: + create = 1; + break; default: create = 0; break; @@ -7000,6 +7048,7 @@ cpuid_set_cpu_properties(void *dip, processorid_t cpu_id, switch (cpi->cpi_vendor) { case X86_VENDOR_Intel: case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: case X86_VENDOR_Cyrix: case X86_VENDOR_TM: case X86_VENDOR_Centaur: @@ -7513,7 +7562,8 @@ cpuid_pass_ucode(cpu_t *cpu, uchar_t *fset) cp.cp_ecx = 0; (void) __cpuid_insn(&cp); cpi->cpi_std[7] = cp; - } else if (cpi->cpi_vendor == X86_VENDOR_AMD) { + } else if (cpi->cpi_vendor == X86_VENDOR_AMD || + cpi->cpi_vendor == X86_VENDOR_HYGON) { /* No xcpuid support */ if (cpi->cpi_family < 5 || (cpi->cpi_family == 5 && cpi->cpi_model < 1)) diff --git a/usr/src/uts/i86pc/os/cpuid_subr.c b/usr/src/uts/i86pc/os/cpuid_subr.c index faa3e75b03..934b5d547d 100644 --- a/usr/src/uts/i86pc/os/cpuid_subr.c +++ b/usr/src/uts/i86pc/os/cpuid_subr.c @@ -88,12 +88,13 @@ * 15 for family 0x17, models 30 - 3f * 16 for family 0x17, models 60 - 6f * 17 for family 0x17, models 70 - 7f - * 18 for family 0x19, models 00 - 0f - * 19 for family 0x19, models 20 - 2f + * 18 for family 0x18, models 00 - 0f + * 19 for family 0x19, models 00 - 0f + * 20 for family 0x19, models 20 - 2f * Second index by (model & 0x3) for family 0fh, * CPUID pkg bits (Fn8000_0001_EBX[31:28]) for later families. */ -static uint32_t amd_skts[20][8] = { +static uint32_t amd_skts[21][8] = { /* * Family 0xf revisions B through E */ @@ -365,7 +366,7 @@ static uint32_t amd_skts[20][8] = { }, /* - * Family 0x19 models 00-0f (Zen 3 - Milan) + * Family 0x18 models 00-0f (Dhyana) */ #define A_SKTS_18 18 { @@ -373,6 +374,21 @@ static uint32_t amd_skts[20][8] = { X86_SOCKET_UNKNOWN, /* 0b001 */ X86_SOCKET_UNKNOWN, /* 0b010 */ X86_SOCKET_UNKNOWN, /* 0b011 */ + X86_SOCKET_SL1, /* 0b100 */ + X86_SOCKET_UNKNOWN, /* 0b101 */ + X86_SOCKET_DM1, /* 0b110 */ + X86_SOCKET_SL1R2 /* 0b111 */ + }, + + /* + * Family 0x19 models 00-0f (Zen 3 - Milan) + */ +#define A_SKTS_19 19 + { + X86_SOCKET_UNKNOWN, /* 0b000 */ + X86_SOCKET_UNKNOWN, /* 0b001 */ + X86_SOCKET_UNKNOWN, /* 0b010 */ + X86_SOCKET_UNKNOWN, /* 0b011 */ X86_SOCKET_SP3, /* 0b100 */ X86_SOCKET_UNKNOWN, /* 0b101 */ X86_SOCKET_UNKNOWN, /* 0b110 */ @@ -382,7 +398,7 @@ static uint32_t amd_skts[20][8] = { /* * Family 0x19 models 20-2f (Zen 3 - Vermeer) */ -#define A_SKTS_19 19 +#define A_SKTS_20 20 { X86_SOCKET_UNKNOWN, /* 0b000 */ X86_SOCKET_UNKNOWN, /* 0b001 */ @@ -399,7 +415,7 @@ struct amd_sktmap_s { uint32_t skt_code; char sktstr[16]; }; -static struct amd_sktmap_s amd_sktmap_strs[X86_NUM_SOCKETS_AMD + 1] = { +static struct amd_sktmap_s amd_sktmap_strs[X86_NUM_SOCKETS + 1] = { { X86_SOCKET_754, "754" }, { X86_SOCKET_939, "939" }, { X86_SOCKET_940, "940" }, @@ -434,6 +450,9 @@ static struct amd_sktmap_s amd_sktmap_strs[X86_NUM_SOCKETS_AMD + 1] = { { X86_SOCKET_FP5, "FP5" }, { X86_SOCKET_FP6, "FP6" }, { X86_SOCKET_STRX4, "sTRX4" }, + { X86_SOCKET_SL1, "SL1" }, + { X86_SOCKET_SL1R2, "SL1R2" }, + { X86_SOCKET_DM1, "DM1" }, { X86_SOCKET_UNKNOWN, "Unknown" } }; @@ -459,8 +478,9 @@ static const struct amd_skt_mapent { { 0x17, 0x30, 0x3f, A_SKTS_15 }, { 0x17, 0x60, 0x6f, A_SKTS_16 }, { 0x17, 0x70, 0x7f, A_SKTS_17 }, - { 0x19, 0x00, 0x0f, A_SKTS_18 }, - { 0x19, 0x20, 0x2f, A_SKTS_19 } + { 0x18, 0x00, 0x0f, A_SKTS_18 }, + { 0x19, 0x00, 0x0f, A_SKTS_19 }, + { 0x19, 0x20, 0x2f, A_SKTS_20 } }; /* @@ -629,7 +649,13 @@ static const struct amd_rev_mapent { A_SKTS_15 }, { 0x17, 0x71, 0x71, 0x0, 0x0, X86_CHIPREV_AMD_17_MTS_B0, "MTS-B0", - A_SKTS_17 } + A_SKTS_17 }, + + /* + * =============== HygonGenuine Family 0x18 =============== + */ + { 0x18, 0x00, 0x00, 0x1, 0x1, X86_CHIPREV_HYGON_18_DN_A1, "DN_A1", + A_SKTS_18 }, }; /* @@ -759,6 +785,7 @@ _cpuid_skt(uint_t vendor, uint_t family, uint_t model, uint_t step) switch (vendor) { case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: synth_amd_info(family, model, step, &skt, NULL, NULL); break; @@ -779,6 +806,7 @@ _cpuid_sktstr(uint_t vendor, uint_t family, uint_t model, uint_t step) switch (vendor) { case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: synth_amd_info(family, model, step, &skt, NULL, NULL); sktmapp = amd_sktmap_strs; @@ -805,6 +833,7 @@ _cpuid_chiprev(uint_t vendor, uint_t family, uint_t model, uint_t step) switch (vendor) { case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: synth_amd_info(family, model, step, NULL, &chiprev, NULL); break; @@ -823,6 +852,7 @@ _cpuid_chiprevstr(uint_t vendor, uint_t family, uint_t model, uint_t step) switch (vendor) { case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: synth_amd_info(family, model, step, NULL, NULL, &revstr); break; @@ -851,6 +881,8 @@ _cpuid_vendorstr_to_vendorcode(char *vendorstr) return (X86_VENDOR_Intel); else if (strcmp(vendorstr, X86_VENDORSTR_AMD) == 0) return (X86_VENDOR_AMD); + else if (strcmp(vendorstr, X86_VENDORSTR_HYGON) == 0) + return (X86_VENDOR_HYGON); else if (strcmp(vendorstr, X86_VENDORSTR_TM) == 0) return (X86_VENDOR_TM); else if (strcmp(vendorstr, CyrixInstead) == 0) diff --git a/usr/src/uts/i86pc/os/cpupm/cpupm_amd.c b/usr/src/uts/i86pc/os/cpupm/cpupm_amd.c index 086d9a8fe6..c99c191c40 100644 --- a/usr/src/uts/i86pc/os/cpupm/cpupm_amd.c +++ b/usr/src/uts/i86pc/os/cpupm/cpupm_amd.c @@ -37,8 +37,9 @@ cpupm_amd_init(cpu_t *cp) cpupm_mach_state_t *mach_state = (cpupm_mach_state_t *)(cp->cpu_m.mcpu_pm_mach_state); - /* AMD? */ - if (x86_vendor != X86_VENDOR_AMD) + /* AMD or Hygon? */ + if (x86_vendor != X86_VENDOR_AMD && + x86_vendor != X86_VENDOR_HYGON) return (B_FALSE); /* diff --git a/usr/src/uts/i86pc/os/hma.c b/usr/src/uts/i86pc/os/hma.c index 0e84030ac1..a53c797e4b 100644 --- a/usr/src/uts/i86pc/os/hma.c +++ b/usr/src/uts/i86pc/os/hma.c @@ -101,6 +101,7 @@ hma_init(void) (void) hma_vmx_init(); break; case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: (void) hma_svm_init(); break; default: @@ -121,6 +122,7 @@ hma_register_backend(const char *name) is_ready = hma_vmx_ready; break; case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: is_ready = hma_svm_ready; break; default: diff --git a/usr/src/uts/i86pc/os/startup.c b/usr/src/uts/i86pc/os/startup.c index dd2b5d703b..ac0ff1716a 100644 --- a/usr/src/uts/i86pc/os/startup.c +++ b/usr/src/uts/i86pc/os/startup.c @@ -3212,6 +3212,7 @@ setx86isalist(void) switch (x86_vendor) { case X86_VENDOR_Intel: case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: case X86_VENDOR_TM: if (is_x86_feature(x86_featureset, X86FSET_CMOV)) { /* diff --git a/usr/src/uts/intel/ia32/os/cpc_subr.c b/usr/src/uts/intel/ia32/os/cpc_subr.c index f7b86fd602..a74dfd77bc 100644 --- a/usr/src/uts/intel/ia32/os/cpc_subr.c +++ b/usr/src/uts/intel/ia32/os/cpc_subr.c @@ -140,7 +140,8 @@ kcpc_hw_init(cpu_t *cp) strands_perfmon_shared = 1; } } - } else if (cpuid_getvendor(cpu[0]) == X86_VENDOR_AMD) { + } else if (cpuid_getvendor(cpu[0]) == X86_VENDOR_AMD || + cpuid_getvendor(cpu[0]) == X86_VENDOR_HYGON) { /* * On AMD systems with HT, all of the performance * monitors exist on a per-logical CPU basis. diff --git a/usr/src/uts/intel/io/amdzen/amdzen.c b/usr/src/uts/intel/io/amdzen/amdzen.c index ac6ce9c94f..bd023a2edf 100644 --- a/usr/src/uts/intel/io/amdzen/amdzen.c +++ b/usr/src/uts/intel/io/amdzen/amdzen.c @@ -624,7 +624,7 @@ amdzen_stub_scan_cb(dev_info_t *dip, void *arg) return (DDI_WALK_CONTINUE); } - if (vid != AMDZEN_PCI_VID_AMD) { + if (vid != AMDZEN_PCI_VID_AMD && vid != AMDZEN_PCI_VID_HYGON) { return (DDI_WALK_CONTINUE); } @@ -737,9 +737,10 @@ amdzen_attach_stub(dev_info_t *dip, ddi_attach_cmd_t cmd) return (DDI_FAILURE); } - if (vid != AMDZEN_PCI_VID_AMD) { - dev_err(dip, CE_WARN, "expected AMD vendor ID (0x%x), found " - "0x%x", AMDZEN_PCI_VID_AMD, vid); + if (vid != AMDZEN_PCI_VID_AMD && vid != AMDZEN_PCI_VID_HYGON) { + dev_err(dip, CE_WARN, "expected vendor ID (0x%x), found 0x%x", + cpuid_getvendor(CPU) == X86_VENDOR_HYGON ? + AMDZEN_PCI_VID_HYGON : AMDZEN_PCI_VID_AMD, vid); return (DDI_FAILURE); } @@ -996,7 +997,8 @@ _init(void) { int ret; - if (cpuid_getvendor(CPU) != X86_VENDOR_AMD) { + if (cpuid_getvendor(CPU) != X86_VENDOR_AMD && + cpuid_getvendor(CPU) != X86_VENDOR_HYGON) { return (ENOTSUP); } diff --git a/usr/src/uts/intel/io/amdzen/amdzen.h b/usr/src/uts/intel/io/amdzen/amdzen.h index 8150495911..6ba5266bd3 100644 --- a/usr/src/uts/intel/io/amdzen/amdzen.h +++ b/usr/src/uts/intel/io/amdzen/amdzen.h @@ -200,6 +200,11 @@ typedef enum { */ #define AMDZEN_PCI_VID_AMD 0x1022 +/* + * Hygon PCI ID for reference + */ +#define AMDZEN_PCI_VID_HYGON 0x1d94 + typedef enum { AMDZEN_STUB_TYPE_DF, AMDZEN_STUB_TYPE_NB diff --git a/usr/src/uts/intel/pcbe/opteron_pcbe.c b/usr/src/uts/intel/pcbe/opteron_pcbe.c index c4496bf8ca..8d567daa64 100644 --- a/usr/src/uts/intel/pcbe/opteron_pcbe.c +++ b/usr/src/uts/intel/pcbe/opteron_pcbe.c @@ -547,7 +547,8 @@ opt_pcbe_init(void) * loads this module based on its name in the module directory, but it * could have been renamed. */ - if (cpuid_getvendor(CPU) != X86_VENDOR_AMD || amd_family < 0xf) + if ((cpuid_getvendor(CPU) != X86_VENDOR_AMD || amd_family < 0xf) && + cpuid_getvendor(CPU) != X86_VENDOR_HYGON) return (-1); if (amd_family == 0xf) { @@ -556,7 +557,9 @@ opt_pcbe_init(void) "AMD Opteron & Athlon64"); } else { (void) snprintf(amd_pcbe_impl_name, sizeof (amd_pcbe_impl_name), - "AMD Family %02xh", amd_family); + "%s Family %02xh", + cpuid_getvendor(CPU) == X86_VENDOR_HYGON ? "Hygon" : "AMD", + amd_family); } /* @@ -598,7 +601,8 @@ opt_pcbe_init(void) amd_pcbe_cpuref = amd_fam_11h_bkdg; amd_events = family_11h_events; amd_generic_events = opt_generic_events; - } else if (amd_family == 0x17 && amd_model <= 0x2f) { + } else if ((amd_family == 0x17 && amd_model <= 0x2f) || + amd_family == 0x18) { amd_pcbe_cpuref = amd_fam_17h_zen1_reg; amd_events = opteron_pcbe_f17h_zen1_events; amd_generic_events = family_17h_zen1_papi_events; diff --git a/usr/src/uts/intel/sys/x86_archext.h b/usr/src/uts/intel/sys/x86_archext.h index b75ab18f5e..2ec543677b 100644 --- a/usr/src/uts/intel/sys/x86_archext.h +++ b/usr/src/uts/intel/sys/x86_archext.h @@ -804,6 +804,9 @@ extern "C" { #define X86_VENDOR_NSC 10 #define X86_VENDORSTR_NSC "Geode by NSC" +#define X86_VENDOR_HYGON 11 +#define X86_VENDORSTR_HYGON "HygonGenuine" + /* * Vendor string max len + \0 */ @@ -968,6 +971,12 @@ extern "C" { _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x17, 0x0009) /* + * Definitions for Hygon Family 0x18 + */ +#define X86_CHIPREV_HYGON_18_DN_A1 \ + _X86_CHIPREV_MKREV(X86_VENDOR_HYGON, 0x18, 0x0001) + +/* * Various socket/package types, extended as the need to distinguish * a new type arises. The top 8 byte identfies the vendor and the * remaining 24 bits describe 24 socket types. @@ -1026,6 +1035,15 @@ extern "C" { #define X86_SOCKET_STRX4 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x23) #define X86_NUM_SOCKETS_AMD 0x24 +/* + * Hygon socket types + */ +#define X86_SOCKET_SL1 _X86_SOCKET_MKVAL(X86_VENDOR_HYGON, 0x01) +#define X86_SOCKET_SL1R2 _X86_SOCKET_MKVAL(X86_VENDOR_HYGON, 0x02) +#define X86_SOCKET_DM1 _X86_SOCKET_MKVAL(X86_VENDOR_HYGON, 0x03) +#define X86_NUM_SOCKETS_HYGON 0x04 + +#define X86_NUM_SOCKETS (X86_NUM_SOCKETS_AMD + X86_NUM_SOCKETS_HYGON) /* * Definitions for Intel processor models. These are all for Family 6 diff --git a/usr/src/uts/sun4u/cpu/us3_common.c b/usr/src/uts/sun4u/cpu/us3_common.c index 38a06c2731..14a2096e25 100644 --- a/usr/src/uts/sun4u/cpu/us3_common.c +++ b/usr/src/uts/sun4u/cpu/us3_common.c @@ -3331,7 +3331,7 @@ ce_scrub_xdiag_recirc(struct async_flt *aflt, errorq_t *eqp, case CE_ACT_DONE: break; - case CE_ACT(CE_DISP_BAD): + case CE_DISP_BAD: default: #ifdef DEBUG cmn_err(CE_PANIC, "ce_scrub_post: Bad action '%d'", action); diff --git a/usr/src/uts/sun4u/io/px/px_hlib.c b/usr/src/uts/sun4u/io/px/px_hlib.c index 11c529dfa7..a6ae488a76 100644 --- a/usr/src/uts/sun4u/io/px/px_hlib.c +++ b/usr/src/uts/sun4u/io/px/px_hlib.c @@ -161,9 +161,9 @@ static uint64_t msiq_config_other_regs[] = { #define MSIQ_MAPPING_SIZE (MSI_MAPPING_ENTRIES * sizeof (uint64_t)) /* OPL tuning variables for link unstable issue */ -int wait_perst = 5000000; /* step 9, default: 5s */ +int wait_perst = 5000000; /* step 9, default: 5s */ int wait_enable_port = 30000; /* step 11, default: 30ms */ -int link_retry_count = 2; /* step 11, default: 2 */ +int link_retry_count = 2; /* step 11, default: 2 */ int link_status_check = 400000; /* step 11, default: 400ms */ static uint64_t msiq_suspend(devhandle_t dev_hdl, pxu_t *pxu_p); @@ -2108,7 +2108,7 @@ uint64_t hvio_intr_getstate(devhandle_t dev_hdl, sysino_t sysino, intr_state_t *intr_state) { - intr_state_t state; + uint64_t state; state = CSRA_FR((caddr_t)dev_hdl, INTERRUPT_CLEAR, SYSINO_TO_DEVINO(sysino), ENTRIES_INT_STATE); diff --git a/usr/src/uts/sun4u/sunfire/io/fhc_bd.c b/usr/src/uts/sun4u/sunfire/io/fhc_bd.c index 5bc3b2fc0b..0a1936086b 100644 --- a/usr/src/uts/sun4u/sunfire/io/fhc_bd.c +++ b/usr/src/uts/sun4u/sunfire/io/fhc_bd.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/conf.h> #include <sys/ddi.h> @@ -768,7 +766,7 @@ fhc_bdlist_prime(int first, int count, int incr) type = jtag_get_board_type(jtm->jtag_cmd, sc); switch (type) { - case -1: + case EMPTY_BOARD: fhc_bd_sc_evt(sc, SYSC_EVT_BD_EMPTY); continue; case DISK_BOARD: diff --git a/usr/src/uts/sun4u/sunfire/io/jtag.c b/usr/src/uts/sun4u/sunfire/io/jtag.c index 7dc2a74dd7..71396af2ed 100644 --- a/usr/src/uts/sun4u/sunfire/io/jtag.c +++ b/usr/src/uts/sun4u/sunfire/io/jtag.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/param.h> #include <sys/ddi.h> @@ -1165,7 +1163,7 @@ jtag_check_plus_board( /* * Returns (positive) board type if something detected, including * UNKNOWN_BOARD. - * Returns -1 if nothing there. + * Returns EMPTY_BOARD if nothing there. */ enum board_type jtag_get_board_type(volatile u_int *jreg, sysc_cfga_stat_t *sc) @@ -1261,7 +1259,7 @@ jtag_get_board_type(volatile u_int *jreg, sysc_cfga_stat_t *sc) break; case RING_BROKEN: - result = -1; + result = EMPTY_BOARD; break; default: diff --git a/usr/src/uts/sun4u/sunfire/sys/fhc.h b/usr/src/uts/sun4u/sunfire/sys/fhc.h index f66a5003cd..a76231e781 100644 --- a/usr/src/uts/sun4u/sunfire/sys/fhc.h +++ b/usr/src/uts/sun4u/sunfire/sys/fhc.h @@ -27,8 +27,6 @@ #ifndef _SYS_FHC_H #define _SYS_FHC_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -486,6 +484,7 @@ struct ft_link_list { * boards. It is used by both the kernel and user programs. */ enum board_type { + EMPTY_BOARD = -1, UNINIT_BOARD = 0, /* Uninitialized board type */ UNKNOWN_BOARD, /* Unknown board type */ CPU_BOARD, /* System board CPU(s) */ |