diff options
| -rw-r--r-- | usr/src/boot/Makefile.version | 2 | ||||
| -rw-r--r-- | usr/src/boot/lib/libstand/cd9660.c | 8 | ||||
| -rw-r--r-- | usr/src/boot/lib/libstand/zfs/zfsimpl.c | 294 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/i386/isoboot/cd9660read.c | 4 | ||||
| -rw-r--r-- | usr/src/cmd/svc/milestone/global.xml | 3 | ||||
| -rw-r--r-- | usr/src/cmd/svc/milestone/network-physical.xml | 5 | ||||
| -rw-r--r-- | usr/src/cmd/svc/svccfg/svccfg_libscf.c | 6 | ||||
| -rw-r--r-- | usr/src/cmd/svc/svccfg/svccfg_xml.c | 8 | ||||
| -rw-r--r-- | usr/src/lib/libc_db/common/thread_db.c | 3 | ||||
| -rw-r--r-- | usr/src/lib/libnsl/rpc/xdr_sizeof.c | 31 | ||||
| -rw-r--r-- | usr/src/lib/libsocket/socket/weaks.c | 36 | ||||
| -rw-r--r-- | usr/src/lib/libsysevent/libsysevent.c | 13 | ||||
| -rw-r--r-- | usr/src/man/man1/svcprop.1 | 12 | ||||
| -rw-r--r-- | usr/src/man/man1m/svc.startd.1m | 31 | ||||
| -rw-r--r-- | usr/src/man/man3c_db/td_sync_get_info.3c_db | 24 | ||||
| -rw-r--r-- | usr/src/man/man5/smf_restarter.5 | 14 |
16 files changed, 252 insertions, 242 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index 284339de4d..21a55e3451 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,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)-2019.12.05.1 +BOOT_VERSION = $(LOADER_VERSION)-2019.12.16.2 diff --git a/usr/src/boot/lib/libstand/cd9660.c b/usr/src/boot/lib/libstand/cd9660.c index 487b994408..a17146fce5 100644 --- a/usr/src/boot/lib/libstand/cd9660.c +++ b/usr/src/boot/lib/libstand/cd9660.c @@ -286,7 +286,7 @@ cd9660_open(const char *path, struct open_file *f) struct file *fp = NULL; void *buf; struct iso_primary_descriptor *vd; - size_t buf_size, read, dsize, off; + size_t read, dsize, off; daddr_t bno, boff; struct iso_directory_record rec; struct iso_directory_record *dp = NULL; @@ -294,7 +294,8 @@ cd9660_open(const char *path, struct open_file *f) bool isdir = false; /* First find the volume descriptor */ - buf = malloc(buf_size = ISO_DEFAULT_BLOCK_SIZE); + buf = malloc(MAX(ISO_DEFAULT_BLOCK_SIZE, + sizeof (struct iso_primary_descriptor))); vd = buf; for (bno = 16; ; bno++) { twiddle(1); @@ -438,8 +439,7 @@ cd9660_open(const char *path, struct open_file *f) return (0); out: - if (fp) - free(fp); + free(fp); free(buf); return (rc); diff --git a/usr/src/boot/lib/libstand/zfs/zfsimpl.c b/usr/src/boot/lib/libstand/zfs/zfsimpl.c index 7d0d79b922..a85f6f5721 100644 --- a/usr/src/boot/lib/libstand/zfs/zfsimpl.c +++ b/usr/src/boot/lib/libstand/zfs/zfsimpl.c @@ -103,7 +103,7 @@ typedef struct indirect_vsd { */ static vdev_list_t zfs_vdevs; - /* +/* * List of ZFS features supported for read */ static const char *features_for_read[] = { @@ -140,7 +140,7 @@ static char *dnode_cache_buf; static char *zap_scratch; static char *zfs_temp_buf, *zfs_temp_end, *zfs_temp_ptr; -#define TEMP_SIZE (1024 * 1024) +#define TEMP_SIZE (1024 * 1024) static int zio_read(const spa_t *spa, const blkptr_t *bp, void *buf); static int zfs_get_root(const spa_t *spa, uint64_t *objid); @@ -205,7 +205,7 @@ xdr_int(const unsigned char **xdr, int *ip) } static int -xdr_u_int(const unsigned char **xdr, u_int *ip) +xdr_u_int(const unsigned char **xdr, uint_t *ip) { *ip = be32dec(*xdr); (*xdr) += 4; @@ -215,17 +215,17 @@ xdr_u_int(const unsigned char **xdr, u_int *ip) static int xdr_uint64_t(const unsigned char **xdr, uint64_t *lp) { - u_int hi, lo; + uint_t hi, lo; xdr_u_int(xdr, &hi); xdr_u_int(xdr, &lo); - *lp = (((uint64_t) hi) << 32) | lo; + *lp = (((uint64_t)hi) << 32) | lo; return (0); } static int nvlist_find(const unsigned char *nvlist, const char *name, int type, - int *elementsp, void *valuep) + int *elementsp, void *valuep) { const unsigned char *p, *pair; int junk; @@ -243,33 +243,34 @@ nvlist_find(const unsigned char *nvlist, const char *name, int type, const char *pairname; xdr_int(&p, &namelen); - pairname = (const char*) p; + pairname = (const char *)p; p += roundup(namelen, 4); xdr_int(&p, &pairtype); - if (!memcmp(name, pairname, namelen) && type == pairtype) { + if (memcmp(name, pairname, namelen) == 0 && type == pairtype) { xdr_int(&p, &elements); if (elementsp) *elementsp = elements; if (type == DATA_TYPE_UINT64) { - xdr_uint64_t(&p, (uint64_t *) valuep); + xdr_uint64_t(&p, (uint64_t *)valuep); return (0); } else if (type == DATA_TYPE_STRING) { int len; xdr_int(&p, &len); - (*(const char**) valuep) = (const char*) p; + (*(const char **)valuep) = (const char *)p; return (0); - } else if (type == DATA_TYPE_NVLIST - || type == DATA_TYPE_NVLIST_ARRAY) { - (*(const unsigned char**) valuep) = - (const unsigned char*) p; + } else if (type == DATA_TYPE_NVLIST || + type == DATA_TYPE_NVLIST_ARRAY) { + (*(const unsigned char **)valuep) = + (const unsigned char *)p; return (0); } else { return (EIO); } } else { /* - * Not the pair we are looking for, skip to the next one. + * Not the pair we are looking for, skip to the + * next one. */ p = pair + encoded_size; } @@ -307,12 +308,13 @@ nvlist_check_features_for_read(const unsigned char *nvlist) found = 0; xdr_int(&p, &namelen); - pairname = (const char*) p; + pairname = (const char *)p; p += roundup(namelen, 4); xdr_int(&p, &pairtype); for (i = 0; features_for_read[i] != NULL; i++) { - if (!memcmp(pairname, features_for_read[i], namelen)) { + if (memcmp(pairname, features_for_read[i], + namelen) == 0) { found = 1; break; } @@ -358,7 +360,7 @@ nvlist_next(const unsigned char *nvlist) xdr_int(&p, &decoded_size); } - return p; + return (p); } #ifdef TEST @@ -366,7 +368,7 @@ nvlist_next(const unsigned char *nvlist) static const unsigned char * nvlist_print(const unsigned char *nvlist, unsigned int indent) { - static const char* typenames[] = { + static const char *typenames[] = { "DATA_TYPE_UNKNOWN", "DATA_TYPE_BOOLEAN", "DATA_TYPE_BYTE", @@ -413,7 +415,7 @@ nvlist_print(const unsigned char *nvlist, unsigned int indent) const char *pairname; xdr_int(&p, &namelen); - pairname = (const char*) p; + pairname = (const char *)p; p += roundup(namelen, 4); xdr_int(&p, &pairtype); @@ -449,7 +451,8 @@ nvlist_print(const unsigned char *nvlist, unsigned int indent) if (j != elements - 1) { for (i = 0; i < indent; i++) printf(" "); - printf("%s %s", typenames[pairtype], pairname); + printf("%s %s", typenames[pairtype], + pairname); } } break; @@ -465,7 +468,7 @@ nvlist_print(const unsigned char *nvlist, unsigned int indent) xdr_int(&p, &decoded_size); } - return p; + return (p); } #endif @@ -486,7 +489,6 @@ vdev_read_phys(vdev_t *vdev, const blkptr_t *bp, void *buf, psize = size; } - /*printf("ZFS: reading %zu bytes at 0x%jx to %p\n", psize, (uintmax_t)offset, buf);*/ rc = vdev->v_phys_read(vdev, vdev->v_read_priv, offset, buf, psize); if (rc) return (rc); @@ -848,7 +850,7 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint64_t asize, void *arg) printf("vdev_indirect_remap: out of memory.\n"); zio->io_error = ENOMEM; } - for ( ; rs != NULL; rs = list_remove_head(&stack)) { + for (; rs != NULL; rs = list_remove_head(&stack)) { vdev_t *v = rs->rs_vd; uint64_t num_entries = 0; /* vdev_indirect_mapping_t *vim = v->v_mapping; */ @@ -1018,7 +1020,7 @@ vdev_disk_read(vdev_t *vdev, const blkptr_t *bp, void *buf, { return (vdev_read_phys(vdev, bp, buf, - offset + VDEV_LABEL_START_SIZE, bytes)); + offset + VDEV_LABEL_START_SIZE, bytes)); } @@ -1080,8 +1082,8 @@ vdev_create(uint64_t guid, vdev_read_t *vdev_read) vdev_t *vdev; vdev_indirect_config_t *vic; - vdev = malloc(sizeof(vdev_t)); - memset(vdev, 0, sizeof(vdev_t)); + vdev = malloc(sizeof (vdev_t)); + memset(vdev, 0, sizeof (vdev_t)); STAILQ_INIT(&vdev->v_children); vdev->v_guid = guid; vdev->v_state = VDEV_STATE_OFFLINE; @@ -1117,15 +1119,16 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t *pvdev, return (ENOENT); } - if (strcmp(type, VDEV_TYPE_MIRROR) - && strcmp(type, VDEV_TYPE_DISK) + if (strcmp(type, VDEV_TYPE_MIRROR) != 0 && + strcmp(type, VDEV_TYPE_DISK) != 0 && #ifdef ZFS_TEST - && strcmp(type, VDEV_TYPE_FILE) + strcmp(type, VDEV_TYPE_FILE) != 0 && #endif - && strcmp(type, VDEV_TYPE_RAIDZ) - && strcmp(type, VDEV_TYPE_INDIRECT) - && strcmp(type, VDEV_TYPE_REPLACING)) { - printf("ZFS: can only boot from disk, mirror, raidz1, raidz2 and raidz3 vdevs\n"); + strcmp(type, VDEV_TYPE_RAIDZ) != 0 && + strcmp(type, VDEV_TYPE_INDIRECT) != 0 && + strcmp(type, VDEV_TYPE_REPLACING) != 0) { + printf("ZFS: can only boot from disk, mirror, raidz1, " + "raidz2 and raidz3 vdevs\n"); return (EIO); } @@ -1149,13 +1152,13 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t *pvdev, if (!vdev) { is_new = 1; - if (!strcmp(type, VDEV_TYPE_MIRROR)) + if (strcmp(type, VDEV_TYPE_MIRROR) == 0) vdev = vdev_create(guid, vdev_mirror_read); - else if (!strcmp(type, VDEV_TYPE_RAIDZ)) + else if (strcmp(type, VDEV_TYPE_RAIDZ) == 0) vdev = vdev_create(guid, vdev_raidz_read); - else if (!strcmp(type, VDEV_TYPE_REPLACING)) + else if (strcmp(type, VDEV_TYPE_REPLACING) == 0) vdev = vdev_create(guid, vdev_replacing_read); - else if (!strcmp(type, VDEV_TYPE_INDIRECT)) { + else if (strcmp(type, VDEV_TYPE_INDIRECT) == 0) { vdev_indirect_config_t *vic; vdev = vdev_create(guid, vdev_indirect_read); @@ -1213,7 +1216,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t *pvdev, } else { char *name; - if (!strcmp(type, "raidz")) { + if (strcmp(type, "raidz") == 0) { if (vdev->v_nparity < 1 || vdev->v_nparity > 3) { printf("ZFS: can only boot from disk, " @@ -1221,12 +1224,12 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t *pvdev, "vdevs\n"); return (EIO); } - asprintf(&name, "%s%d-%" PRIu64, type, + rc = asprintf(&name, "%s%d-%" PRIu64, type, vdev->v_nparity, id); } else { - asprintf(&name, "%s-%" PRIu64, type, id); + rc = asprintf(&name, "%s-%" PRIu64, type, id); } - if (name == NULL) + if (rc < 0) return (ENOMEM); vdev->v_name = name; } @@ -1266,7 +1269,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t *pvdev, return (rc); if (is_new) STAILQ_INSERT_TAIL(&vdev->v_children, kid, - v_childlink); + v_childlink); kids = nvlist_next(kids); } } else { @@ -1328,7 +1331,7 @@ spa_find_by_guid(uint64_t guid) if (spa->spa_guid == guid) return (spa); - return (0); + return (NULL); } static spa_t * @@ -1337,10 +1340,10 @@ spa_find_by_name(const char *name) spa_t *spa; STAILQ_FOREACH(spa, &zfs_pools, spa_link) - if (!strcmp(spa->spa_name, name)) + if (strcmp(spa->spa_name, name) == 0) return (spa); - return (0); + return (NULL); } spa_t * @@ -1363,7 +1366,7 @@ spa_get_primary_vdev(const spa_t *spa) if (vdev == NULL) return (NULL); for (kid = STAILQ_FIRST(&vdev->v_children); kid != NULL; - kid = STAILQ_FIRST(&vdev->v_children)) + kid = STAILQ_FIRST(&vdev->v_children)) vdev = kid; return (vdev); } @@ -1389,7 +1392,7 @@ spa_create(uint64_t guid, const char *name) static const char * state_name(vdev_state_t state) { - static const char* names[] = { + static const char *names[] = { "UNKNOWN", "CLOSED", "OFFLINE", @@ -1399,7 +1402,7 @@ state_name(vdev_state_t state) "DEGRADED", "ONLINE" }; - return names[state]; + return (names[state]); } static int @@ -1414,7 +1417,7 @@ pager_printf(const char *fmt, ...) return (pager_output(line)); } -#define STATUS_FORMAT " %s %s\n" +#define STATUS_FORMAT " %s %s\n" static int print_state(int indent, const char *name, vdev_state_t state) @@ -1436,7 +1439,7 @@ vdev_status(vdev_t *vdev, int indent) int ret; if (vdev->v_islog) { - (void)pager_output(" logs\n"); + (void) pager_output(" logs\n"); indent++; } @@ -1731,7 +1734,7 @@ vdev_probe(vdev_phys_read_t *phys_read, void *read_priv, spa_t **spap) if (!SPA_VERSION_IS_SUPPORTED(val)) { printf("ZFS: unsupported ZFS version %u (should be %u)\n", - (unsigned) val, (unsigned) SPA_VERSION); + (unsigned)val, (unsigned)SPA_VERSION); free(nvlist); return (EIO); } @@ -1876,8 +1879,8 @@ ilog2(int n) for (v = 0; v < 32; v++) if (n == (1 << v)) - return v; - return -1; + return (v); + return (-1); } static int @@ -1948,8 +1951,8 @@ zio_read(const spa_t *spa, const blkptr_t *bp, void *buf) zfs_free(pbuf, size); } if (error != 0) - printf("ZFS: i/o error - unable to decompress block pointer data, error %d\n", - error); + printf("ZFS: i/o error - unable to decompress " + "block pointer data, error %d\n", error); return (error); } @@ -2006,7 +2009,8 @@ zio_read(const spa_t *spa, const blkptr_t *bp, void *buf) } static int -dnode_read(const spa_t *spa, const dnode_phys_t *dnode, off_t offset, void *buf, size_t buflen) +dnode_read(const spa_t *spa, const dnode_phys_t *dnode, off_t offset, + void *buf, size_t buflen) { int ibshift = dnode->dn_indblkshift - SPA_BLKPTRSHIFT; int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT; @@ -2073,7 +2077,7 @@ dnode_read(const spa_t *spa, const dnode_phys_t *dnode, off_t offset, void *buf, i = bsize - boff; if (i > buflen) i = buflen; memcpy(buf, &dnode_cache_buf[boff], i); - buf = ((char*) buf) + i; + buf = ((char *)buf) + i; offset += i; buflen -= i; } @@ -2104,7 +2108,7 @@ mzap_lookup(const dnode_phys_t *dnode, const char *name, uint64_t *value) for (i = 0; i < chunks; i++) { mze = &mz->mz_chunk[i]; - if (!strcmp(mze->mze_name, name)) { + if (strcmp(mze->mze_name, name) == 0) { *value = mze->mze_value; return (0); } @@ -2118,7 +2122,8 @@ mzap_lookup(const dnode_phys_t *dnode, const char *name, uint64_t *value) * matches. */ static int -fzap_name_equal(const zap_leaf_t *zl, const zap_leaf_chunk_t *zc, const char *name) +fzap_name_equal(const zap_leaf_t *zl, const zap_leaf_chunk_t *zc, + const char *name) { size_t namelen; const zap_leaf_chunk_t *nc; @@ -2130,6 +2135,7 @@ fzap_name_equal(const zap_leaf_t *zl, const zap_leaf_chunk_t *zc, const char *na p = name; while (namelen > 0) { size_t len; + len = namelen; if (len > ZAP_LEAF_ARRAY_BYTES) len = ZAP_LEAF_ARRAY_BYTES; @@ -2140,7 +2146,7 @@ fzap_name_equal(const zap_leaf_t *zl, const zap_leaf_chunk_t *zc, const char *na nc = &ZAP_LEAF_CHUNK(zl, nc->l_array.la_next); } - return 1; + return (1); } /* @@ -2159,7 +2165,7 @@ fzap_leaf_value(const zap_leaf_t *zl, const zap_leaf_chunk_t *zc) value = (value << 8) | p[i]; } - return value; + return (value); } static void @@ -2251,7 +2257,7 @@ fzap_lookup(const spa_t *spa, const dnode_phys_t *dnode, const char *name, uint64_t integer_size, uint64_t num_integers, void *value) { int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT; - zap_phys_t zh = *(zap_phys_t *) zap_scratch; + zap_phys_t zh = *(zap_phys_t *)zap_scratch; fat_zap_t z; uint64_t *ptrtbl; uint64_t hash; @@ -2264,17 +2270,17 @@ fzap_lookup(const spa_t *spa, const dnode_phys_t *dnode, const char *name, return (rc); z.zap_block_shift = ilog2(bsize); - z.zap_phys = (zap_phys_t *) zap_scratch; + z.zap_phys = (zap_phys_t *)zap_scratch; /* * Figure out where the pointer table is and read it in if necessary. */ if (zh.zap_ptrtbl.zt_blk) { rc = dnode_read(spa, dnode, zh.zap_ptrtbl.zt_blk * bsize, - zap_scratch, bsize); + zap_scratch, bsize); if (rc) return (rc); - ptrtbl = (uint64_t *) zap_scratch; + ptrtbl = (uint64_t *)zap_scratch; } else { ptrtbl = &ZAP_EMBEDDED_PTRTBL_ENT(&z, 0); } @@ -2291,20 +2297,21 @@ fzap_lookup(const spa_t *spa, const dnode_phys_t *dnode, const char *name, if (rc) return (rc); - zl.l_phys = (zap_leaf_phys_t *) zap_scratch; + zl.l_phys = (zap_leaf_phys_t *)zap_scratch; /* * Make sure this chunk matches our hash. */ - if (zl.l_phys->l_hdr.lh_prefix_len > 0 - && zl.l_phys->l_hdr.lh_prefix - != hash >> (64 - zl.l_phys->l_hdr.lh_prefix_len)) + if (zl.l_phys->l_hdr.lh_prefix_len > 0 && + zl.l_phys->l_hdr.lh_prefix != + hash >> (64 - zl.l_phys->l_hdr.lh_prefix_len)) return (ENOENT); /* * Hash within the chunk to find our entry. */ - int shift = (64 - ZAP_LEAF_HASH_SHIFT(&zl) - zl.l_phys->l_hdr.lh_prefix_len); + int shift = (64 - ZAP_LEAF_HASH_SHIFT(&zl) - + zl.l_phys->l_hdr.lh_prefix_len); int h = (hash >> shift) & ((1 << ZAP_LEAF_HASH_SHIFT(&zl)) - 1); h = zl.l_phys->l_hash[h]; if (h == 0xffff) @@ -2343,12 +2350,12 @@ zap_lookup(const spa_t *spa, const dnode_phys_t *dnode, const char *name, if (rc) return (rc); - zap_type = *(uint64_t *) zap_scratch; + zap_type = *(uint64_t *)zap_scratch; if (zap_type == ZBT_MICRO) - return mzap_lookup(dnode, name, value); + return (mzap_lookup(dnode, name, value)); else if (zap_type == ZBT_HEADER) { - return fzap_lookup(spa, dnode, name, integer_size, - num_integers, value); + return (fzap_lookup(spa, dnode, name, integer_size, + num_integers, value)); } printf("ZFS: invalid zap_type=%d\n", (int)zap_type); return (EIO); @@ -2391,10 +2398,11 @@ mzap_list(const dnode_phys_t *dnode, int (*callback)(const char *, uint64_t)) * the directory header. */ static int -fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const char *, uint64_t)) +fzap_list(const spa_t *spa, const dnode_phys_t *dnode, + int (*callback)(const char *, uint64_t)) { int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT; - zap_phys_t zh = *(zap_phys_t *) zap_scratch; + zap_phys_t zh = *(zap_phys_t *)zap_scratch; fat_zap_t z; int i, j, rc; @@ -2402,7 +2410,7 @@ fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const cha return (EIO); z.zap_block_shift = ilog2(bsize); - z.zap_phys = (zap_phys_t *) zap_scratch; + z.zap_phys = (zap_phys_t *)zap_scratch; /* * This assumes that the leaf blocks start at block 1. The @@ -2418,7 +2426,7 @@ fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const cha if (dnode_read(spa, dnode, off, zap_scratch, bsize)) return (EIO); - zl.l_phys = (zap_leaf_phys_t *) zap_scratch; + zl.l_phys = (zap_leaf_phys_t *)zap_scratch; for (j = 0; j < ZAP_LEAF_NUMCHUNKS(&zl); j++) { zap_leaf_chunk_t *zc, *nc; @@ -2428,8 +2436,8 @@ fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const cha if (zc->l_entry.le_type != ZAP_CHUNK_ENTRY) continue; namelen = zc->l_entry.le_name_numints; - if (namelen > sizeof(name)) - namelen = sizeof(name); + if (namelen > sizeof (name)) + namelen = sizeof (name); /* * Paste the name back together. @@ -2453,7 +2461,7 @@ fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const cha */ value = fzap_leaf_value(&zl, zc); - //printf("%s 0x%jx\n", name, (uintmax_t)value); + /* printf("%s 0x%jx\n", name, (uintmax_t)value); */ rc = callback((const char *)name, value); if (rc != 0) return (rc); @@ -2483,21 +2491,22 @@ zap_list(const spa_t *spa, const dnode_phys_t *dnode) if (dnode_read(spa, dnode, 0, zap_scratch, size)) return (EIO); - zap_type = *(uint64_t *) zap_scratch; + zap_type = *(uint64_t *)zap_scratch; if (zap_type == ZBT_MICRO) - return mzap_list(dnode, zfs_printf); + return (mzap_list(dnode, zfs_printf)); else - return fzap_list(spa, dnode, zfs_printf); + return (fzap_list(spa, dnode, zfs_printf)); } static int -objset_get_dnode(const spa_t *spa, const objset_phys_t *os, uint64_t objnum, dnode_phys_t *dnode) +objset_get_dnode(const spa_t *spa, const objset_phys_t *os, uint64_t objnum, + dnode_phys_t *dnode) { off_t offset; - offset = objnum * sizeof(dnode_phys_t); - return dnode_read(spa, &os->os_meta_dnode, offset, - dnode, sizeof(dnode_phys_t)); + offset = objnum * sizeof (dnode_phys_t); + return (dnode_read(spa, &os->os_meta_dnode, offset, + dnode, sizeof (dnode_phys_t))); } static int @@ -2515,7 +2524,7 @@ mzap_rlookup(const spa_t *spa __unused, const dnode_phys_t *dnode, char *name, */ size = dnode->dn_datablkszsec * 512; - mz = (const mzap_phys_t *) zap_scratch; + mz = (const mzap_phys_t *)zap_scratch; chunks = size / MZAP_ENT_LEN - 1; for (i = 0; i < chunks; i++) { @@ -2555,10 +2564,11 @@ fzap_name_copy(const zap_leaf_t *zl, const zap_leaf_chunk_t *zc, char *name) } static int -fzap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t value) +fzap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, + uint64_t value) { int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT; - zap_phys_t zh = *(zap_phys_t *) zap_scratch; + zap_phys_t zh = *(zap_phys_t *)zap_scratch; fat_zap_t z; int i, j; @@ -2566,7 +2576,7 @@ fzap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t v return (EIO); z.zap_block_shift = ilog2(bsize); - z.zap_phys = (zap_phys_t *) zap_scratch; + z.zap_phys = (zap_phys_t *)zap_scratch; /* * This assumes that the leaf blocks start at block 1. The @@ -2580,7 +2590,7 @@ fzap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t v if (dnode_read(spa, dnode, off, zap_scratch, bsize)) return (EIO); - zl.l_phys = (zap_leaf_phys_t *) zap_scratch; + zl.l_phys = (zap_leaf_phys_t *)zap_scratch; for (j = 0; j < ZAP_LEAF_NUMCHUNKS(&zl); j++) { zap_leaf_chunk_t *zc; @@ -2603,7 +2613,8 @@ fzap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t v } static int -zap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t value) +zap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, + uint64_t value) { int rc; uint64_t zap_type; @@ -2613,11 +2624,11 @@ zap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t va if (rc) return (rc); - zap_type = *(uint64_t *) zap_scratch; + zap_type = *(uint64_t *)zap_scratch; if (zap_type == ZBT_MICRO) - return mzap_rlookup(spa, dnode, name, value); + return (mzap_rlookup(spa, dnode, name, value)); else - return fzap_rlookup(spa, dnode, name, value); + return (fzap_rlookup(spa, dnode, name, value)); } static int @@ -2632,7 +2643,7 @@ zfs_rlookup(const spa_t *spa, uint64_t objnum, char *result) char *p; int len; - p = &name[sizeof(name) - 1]; + p = &name[sizeof (name) - 1]; *p = '\0'; if (objset_get_dnode(spa, &spa->spa_mos, objnum, &dataset)) { @@ -2648,15 +2659,17 @@ zfs_rlookup(const spa_t *spa, uint64_t objnum, char *result) dd = (dsl_dir_phys_t *)&dir.dn_bonus; /* Actual loop condition. */ - parent_obj = dd->dd_parent_obj; + parent_obj = dd->dd_parent_obj; if (parent_obj == 0) break; - if (objset_get_dnode(spa, &spa->spa_mos, parent_obj, &parent) != 0) + if (objset_get_dnode(spa, &spa->spa_mos, parent_obj, + &parent) != 0) return (EIO); dd = (dsl_dir_phys_t *)&parent.dn_bonus; child_dir_zapobj = dd->dd_child_dir_zapobj; - if (objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, &child_dir_zap) != 0) + if (objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, + &child_dir_zap) != 0) return (EIO); if (zap_rlookup(spa, &child_dir_zap, component, dir_obj) != 0) return (EIO); @@ -2687,7 +2700,8 @@ zfs_lookup_dataset(const spa_t *spa, const char *name, uint64_t *objnum) dsl_dir_phys_t *dd; const char *p, *q; - if (objset_get_dnode(spa, &spa->spa_mos, DMU_POOL_DIRECTORY_OBJECT, &dir)) + if (objset_get_dnode(spa, &spa->spa_mos, + DMU_POOL_DIRECTORY_OBJECT, &dir)) return (EIO); if (zap_lookup(spa, &dir, DMU_POOL_ROOT_DATASET, sizeof (dir_obj), 1, &dir_obj)) @@ -2716,7 +2730,8 @@ zfs_lookup_dataset(const spa_t *spa, const char *name, uint64_t *objnum) } child_dir_zapobj = dd->dd_child_dir_zapobj; - if (objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, &child_dir_zap) != 0) + if (objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, + &child_dir_zap) != 0) return (EIO); /* Actual loop condition #2. */ @@ -2731,7 +2746,7 @@ zfs_lookup_dataset(const spa_t *spa, const char *name, uint64_t *objnum) #pragma GCC diagnostic ignored "-Wstrict-aliasing" static int -zfs_list_dataset(const spa_t *spa, uint64_t objnum/*, int pos, char *entry*/) +zfs_list_dataset(const spa_t *spa, uint64_t objnum) { uint64_t dir_obj, child_dir_zapobj; dnode_phys_t child_dir_zap, dir, dataset; @@ -2742,7 +2757,7 @@ zfs_list_dataset(const spa_t *spa, uint64_t objnum/*, int pos, char *entry*/) printf("ZFS: can't find dataset %ju\n", (uintmax_t)objnum); return (EIO); } - ds = (dsl_dataset_phys_t *) &dataset.dn_bonus; + ds = (dsl_dataset_phys_t *)&dataset.dn_bonus; dir_obj = ds->ds_dir_obj; if (objset_get_dnode(spa, &spa->spa_mos, dir_obj, &dir)) { @@ -2752,7 +2767,8 @@ zfs_list_dataset(const spa_t *spa, uint64_t objnum/*, int pos, char *entry*/) dd = (dsl_dir_phys_t *)&dir.dn_bonus; child_dir_zapobj = dd->dd_child_dir_zapobj; - if (objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, &child_dir_zap) != 0) { + if (objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, + &child_dir_zap) != 0) { printf("ZFS: can't find child zap %ju\n", (uintmax_t)dir_obj); return (EIO); } @@ -2761,7 +2777,8 @@ zfs_list_dataset(const spa_t *spa, uint64_t objnum/*, int pos, char *entry*/) } int -zfs_callback_dataset(const spa_t *spa, uint64_t objnum, int (*callback)(const char *, uint64_t)) +zfs_callback_dataset(const spa_t *spa, uint64_t objnum, + int (*callback)(const char *, uint64_t)) { uint64_t dir_obj, child_dir_zapobj, zap_type; dnode_phys_t child_dir_zap, dir, dataset; @@ -2774,7 +2791,7 @@ zfs_callback_dataset(const spa_t *spa, uint64_t objnum, int (*callback)(const ch printf("ZFS: can't find dataset %ju\n", (uintmax_t)objnum); return (err); } - ds = (dsl_dataset_phys_t *) &dataset.dn_bonus; + ds = (dsl_dataset_phys_t *)&dataset.dn_bonus; dir_obj = ds->ds_dir_obj; err = objset_get_dnode(spa, &spa->spa_mos, dir_obj, &dir); @@ -2785,21 +2802,23 @@ zfs_callback_dataset(const spa_t *spa, uint64_t objnum, int (*callback)(const ch dd = (dsl_dir_phys_t *)&dir.dn_bonus; child_dir_zapobj = dd->dd_child_dir_zapobj; - err = objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, &child_dir_zap); + err = objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, + &child_dir_zap); if (err != 0) { printf("ZFS: can't find child zap %ju\n", (uintmax_t)dir_obj); return (err); } - err = dnode_read(spa, &child_dir_zap, 0, zap_scratch, child_dir_zap.dn_datablkszsec * 512); + err = dnode_read(spa, &child_dir_zap, 0, zap_scratch, + child_dir_zap.dn_datablkszsec * 512); if (err != 0) return (err); - zap_type = *(uint64_t *) zap_scratch; + zap_type = *(uint64_t *)zap_scratch; if (zap_type == ZBT_MICRO) - return mzap_list(&child_dir_zap, callback); + return (mzap_list(&child_dir_zap, callback)); else - return fzap_list(spa, &child_dir_zap, callback); + return (fzap_list(spa, &child_dir_zap, callback)); } /* @@ -2817,7 +2836,7 @@ zfs_mount_dataset(const spa_t *spa, uint64_t objnum, objset_phys_t *objset) return (EIO); } - ds = (dsl_dataset_phys_t *) &dataset.dn_bonus; + ds = (dsl_dataset_phys_t *)&dataset.dn_bonus; if (zio_read(spa, &ds->ds_bp, objset)) { printf("ZFS: can't read object set for dataset %ju\n", (uintmax_t)objnum); @@ -2842,7 +2861,8 @@ zfs_get_root(const spa_t *spa, uint64_t *objid) /* * Start with the MOS directory object. */ - if (objset_get_dnode(spa, &spa->spa_mos, DMU_POOL_DIRECTORY_OBJECT, &dir)) { + if (objset_get_dnode(spa, &spa->spa_mos, + DMU_POOL_DIRECTORY_OBJECT, &dir)) { printf("ZFS: can't read MOS object directory\n"); return (EIO); } @@ -2850,19 +2870,20 @@ zfs_get_root(const spa_t *spa, uint64_t *objid) /* * Lookup the pool_props and see if we can find a bootfs. */ - if (zap_lookup(spa, &dir, DMU_POOL_PROPS, sizeof (props), 1, &props) == 0 - && objset_get_dnode(spa, &spa->spa_mos, props, &propdir) == 0 - && zap_lookup(spa, &propdir, "bootfs", sizeof (bootfs), 1, &bootfs) == 0 - && bootfs != 0) - { + if (zap_lookup(spa, &dir, DMU_POOL_PROPS, + sizeof (props), 1, &props) == 0 && + objset_get_dnode(spa, &spa->spa_mos, props, &propdir) == 0 && + zap_lookup(spa, &propdir, "bootfs", + sizeof (bootfs), 1, &bootfs) == 0 && bootfs != 0) { *objid = bootfs; return (0); } /* * Lookup the root dataset directory */ - if (zap_lookup(spa, &dir, DMU_POOL_ROOT_DATASET, sizeof (root), 1, &root) - || objset_get_dnode(spa, &spa->spa_mos, root, &dir)) { + if (zap_lookup(spa, &dir, DMU_POOL_ROOT_DATASET, + sizeof (root), 1, &root) || + objset_get_dnode(spa, &spa->spa_mos, root, &dir)) { printf("ZFS: can't find root dsl_dir\n"); return (EIO); } @@ -2871,7 +2892,7 @@ zfs_get_root(const spa_t *spa, uint64_t *objid) * Use the information from the dataset directory's bonus buffer * to find the dataset object and from that the object set itself. */ - dsl_dir_phys_t *dd = (dsl_dir_phys_t *) &dir.dn_bonus; + dsl_dir_phys_t *dd = (dsl_dir_phys_t *)&dir.dn_bonus; *objid = dd->dd_head_dataset_obj; return (0); } @@ -2956,7 +2977,7 @@ check_mos_features(const spa_t *spa) if (dnode_read(spa, &dir, 0, zap_scratch, size)) return (EIO); - zap_type = *(uint64_t *) zap_scratch; + zap_type = *(uint64_t *)zap_scratch; if (zap_type == ZBT_MICRO) rc = mzap_list(&dir, check_feature); else @@ -3052,8 +3073,7 @@ zfs_spa_init(spa_t *spa) goto done; } - if (nvlist_find(nv, ZPOOL_CONFIG_TYPE, DATA_TYPE_STRING, - NULL, &type)) { + if (nvlist_find(nv, ZPOOL_CONFIG_TYPE, DATA_TYPE_STRING, NULL, &type)) { printf("ZFS: can't find vdev details\n"); rc = ENOENT; goto done; @@ -3064,7 +3084,7 @@ zfs_spa_init(spa_t *spa) } rc = nvlist_find(nv, ZPOOL_CONFIG_CHILDREN, DATA_TYPE_NVLIST_ARRAY, - &nkids, &nv); + &nkids, &nv); if (rc != 0) goto done; @@ -3199,9 +3219,9 @@ zfs_dnode_readlink(const spa_t *spa, dnode_phys_t *dn, char *path, size_t psize) * Second test is purely to silence bogus compiler * warning about accessing past the end of dn_bonus. */ - if (psize + sizeof(znode_phys_t) <= dn->dn_bonuslen && - sizeof(znode_phys_t) <= sizeof(dn->dn_bonus)) { - memcpy(path, &dn->dn_bonus[sizeof(znode_phys_t)], psize); + if (psize + sizeof (znode_phys_t) <= dn->dn_bonuslen && + sizeof (znode_phys_t) <= sizeof (dn->dn_bonus)) { + memcpy(path, &dn->dn_bonus[sizeof (znode_phys_t)], psize); } else { rc = dnode_read(spa, dn, 0, path, psize); } @@ -3238,7 +3258,7 @@ zfs_lookup(const struct zfsmount *mnt, const char *upath, dnode_phys_t *dnode) return (EIO); } - if ((entry = malloc(sizeof(struct obj_list))) == NULL) + if ((entry = malloc(sizeof (struct obj_list))) == NULL) return (ENOMEM); /* @@ -3250,7 +3270,7 @@ zfs_lookup(const struct zfsmount *mnt, const char *upath, dnode_phys_t *dnode) return (rc); } - rc = zap_lookup(spa, &dn, ZFS_ROOT_OBJ, sizeof(objnum), 1, &objnum); + rc = zap_lookup(spa, &dn, ZFS_ROOT_OBJ, sizeof (objnum), 1, &objnum); if (rc) { free(entry); return (rc); @@ -3295,7 +3315,7 @@ zfs_lookup(const struct zfsmount *mnt, const char *upath, dnode_phys_t *dnode) objnum = (STAILQ_FIRST(&on_cache))->objnum; continue; } - if (q - p + 1 > sizeof(element)) { + if (q - p + 1 > sizeof (element)) { rc = ENAMETOOLONG; goto done; } @@ -3310,12 +3330,12 @@ zfs_lookup(const struct zfsmount *mnt, const char *upath, dnode_phys_t *dnode) goto done; } - rc = zap_lookup(spa, &dn, element, sizeof(objnum), 1, &objnum); + rc = zap_lookup(spa, &dn, element, sizeof (objnum), 1, &objnum); if (rc) goto done; objnum = ZFS_DIRENT_OBJ(objnum); - if ((entry = malloc(sizeof(struct obj_list))) == NULL) { + if ((entry = malloc(sizeof (struct obj_list))) == NULL) { rc = ENOMEM; goto done; } @@ -3342,7 +3362,7 @@ zfs_lookup(const struct zfsmount *mnt, const char *upath, dnode_phys_t *dnode) * Read the link value and copy the tail of our * current path onto the end. */ - if (sb.st_size + strlen(p) + 1 > sizeof(path)) { + if (sb.st_size + strlen(p) + 1 > sizeof (path)) { rc = ENAMETOOLONG; goto done; } diff --git a/usr/src/boot/sys/boot/i386/isoboot/cd9660read.c b/usr/src/boot/sys/boot/i386/isoboot/cd9660read.c index f1e43d7a74..5a4113421e 100644 --- a/usr/src/boot/sys/boot/i386/isoboot/cd9660read.c +++ b/usr/src/boot/sys/boot/i386/isoboot/cd9660read.c @@ -33,6 +33,7 @@ /* $NetBSD: cd9660.c,v 1.5 1997/06/26 19:11:33 drochner Exp $ */ #include <sys/cdefs.h> +#include <sys/param.h> #include <fs/cd9660/iso.h> #include <fs/cd9660/cd9660_rrip.h> @@ -222,7 +223,8 @@ dirmatch(const char *path, struct iso_directory_record *dp, int use_rrip, static uint64_t cd9660_lookup(const char *path) { - static char blkbuf[ISO_DEFAULT_BLOCK_SIZE]; + static char blkbuf[MAX(ISO_DEFAULT_BLOCK_SIZE, + sizeof (struct iso_primary_descriptor))]; struct iso_primary_descriptor *vd; struct iso_directory_record rec; struct iso_directory_record *dp = NULL; diff --git a/usr/src/cmd/svc/milestone/global.xml b/usr/src/cmd/svc/milestone/global.xml index 0441e6ed97..4ebc6ddaf0 100644 --- a/usr/src/cmd/svc/milestone/global.xml +++ b/usr/src/cmd/svc/milestone/global.xml @@ -3,6 +3,7 @@ <!-- Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> + Copyright 2019 Joyent, Inc. CDDL HEADER START @@ -102,7 +103,7 @@ The restarter responsible for managing this service instance. If the property i required='false'> <description> <loctext xml:lang='C'> -Only one instance of this service may be run. This property is currently unenforced, but will be at some point in the future. +Only one instance of this service may be run. This behavior is unimplemented, and obsolete. </loctext> </description> <cardinality min='1' max='1'/> diff --git a/usr/src/cmd/svc/milestone/network-physical.xml b/usr/src/cmd/svc/milestone/network-physical.xml index 62b89bbccc..f26c9647a1 100644 --- a/usr/src/cmd/svc/milestone/network-physical.xml +++ b/usr/src/cmd/svc/milestone/network-physical.xml @@ -55,6 +55,11 @@ <service_fmri value='svc:/system/filesystem/smartdc' /> </dependency> + <!-- + physical:default and physical:nwam are mutually exclusive. + Use a one-way dependency for now since two-way exclude_all + does not work. + --> <dependency name='mdata-fetch' grouping='optional_all' diff --git a/usr/src/cmd/svc/svccfg/svccfg_libscf.c b/usr/src/cmd/svc/svccfg/svccfg_libscf.c index 36d77df6c8..9fec777bd3 100644 --- a/usr/src/cmd/svc/svccfg/svccfg_libscf.c +++ b/usr/src/cmd/svc/svccfg/svccfg_libscf.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2015 Joyent, Inc. + * Copyright 2019 Joyent, Inc. * Copyright 2012 Milan Jurik. All rights reserved. * Copyright 2017 RackTop Systems. * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. @@ -9743,6 +9743,10 @@ export_svc_general(scf_propertygroup_t *pg, struct entity_elts *selts) scfdie(); if (strcmp(exp_str, SCF_PROPERTY_SINGLE_INSTANCE) == 0) { + /* + * Unimplemented and obsolete, but we still process it + * for compatibility purposes. + */ if (prop_check_type(exp_prop, SCF_TYPE_BOOLEAN) == 0 && prop_get_val(exp_prop, exp_val) == 0) { uint8_t b; diff --git a/usr/src/cmd/svc/svccfg/svccfg_xml.c b/usr/src/cmd/svc/svccfg/svccfg_xml.c index 2cee741477..13c7a90d12 100644 --- a/usr/src/cmd/svc/svccfg/svccfg_xml.c +++ b/usr/src/cmd/svc/svccfg/svccfg_xml.c @@ -23,6 +23,7 @@ */ /* * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2019 Joyent, Inc. */ @@ -3317,9 +3318,12 @@ lxml_get_instance(entity_t *service, xmlNodePtr inst, bundle_type_t bt, return (0); } -/* ARGSUSED1 */ +/* + * Unimplemented and obsolete, but we still process it for compatibility + * purposes. + */ static int -lxml_get_single_instance(entity_t *entity, xmlNodePtr si) +lxml_get_single_instance(entity_t *entity, xmlNodePtr si __unused) { pgroup_t *pg; property_t *p; diff --git a/usr/src/lib/libc_db/common/thread_db.c b/usr/src/lib/libc_db/common/thread_db.c index a592ba0125..53e1f6b1c7 100644 --- a/usr/src/lib/libc_db/common/thread_db.c +++ b/usr/src/lib/libc_db/common/thread_db.c @@ -2893,14 +2893,13 @@ out: */ #pragma weak td_sync_setstate = __td_sync_setstate td_err_e -__td_sync_setstate(const td_synchandle_t *sh_p, long lvalue) +__td_sync_setstate(const td_synchandle_t *sh_p, int value) { struct ps_prochandle *ph_p; int trunc = 0; td_err_e return_val; td_so_un_t generic_so; uint32_t *rwstate; - int value = (int)lvalue; if ((ph_p = ph_lock_sh(sh_p, &return_val)) == NULL) return (return_val); diff --git a/usr/src/lib/libnsl/rpc/xdr_sizeof.c b/usr/src/lib/libnsl/rpc/xdr_sizeof.c index ca22f6ed99..2810d6a523 100644 --- a/usr/src/lib/libnsl/rpc/xdr_sizeof.c +++ b/usr/src/lib/libnsl/rpc/xdr_sizeof.c @@ -101,12 +101,26 @@ x_inline(XDR *xdrs, int len) return ((rpc_inline_t *)xdrs->x_private); } -static int -harmless(void) +static bool_t +harmless_getlong(XDR *xdr __unused, long *l __unused) { /* Always return FALSE/NULL, as the case may be */ - return (0); + return (FALSE); +} + +static bool_t +harmless_getbytes(XDR *xdr __unused, caddr_t p __unused, int i __unused) +{ + return (FALSE); +} + +#if defined(_LP64) +static bool_t +harmless_getint32(XDR *xdr __unused, int32_t *p __unused) +{ + return (FALSE); } +#endif static void x_destroy(XDR *xdrs) @@ -126,26 +140,21 @@ xdr_sizeof(xdrproc_t func, void *data) struct xdr_ops ops; bool_t stat; /* to stop ANSI-C compiler from complaining */ - typedef bool_t (* dummyfunc1)(XDR *, long *); - typedef bool_t (* dummyfunc2)(XDR *, caddr_t, int); -#if defined(_LP64) - typedef bool_t (* dummyfunc3)(XDR *, int32_t *); -#endif ops.x_putlong = x_putlong; - ops.x_getlong = (dummyfunc1) harmless; + ops.x_getlong = harmless_getlong; ops.x_putbytes = x_putbytes; ops.x_inline = x_inline; ops.x_getpostn = x_getpostn; ops.x_setpostn = x_setpostn; ops.x_destroy = x_destroy; #if defined(_LP64) - ops.x_getint32 = (dummyfunc3) harmless; + ops.x_getint32 = harmless_getint32; ops.x_putint32 = x_putint32_t; #endif /* the other harmless ones */ - ops.x_getbytes = (dummyfunc2) harmless; + ops.x_getbytes = harmless_getbytes; x.x_op = XDR_ENCODE; x.x_ops = &ops; diff --git a/usr/src/lib/libsocket/socket/weaks.c b/usr/src/lib/libsocket/socket/weaks.c index 51e8d13e06..63f8d2c044 100644 --- a/usr/src/lib/libsocket/socket/weaks.c +++ b/usr/src/lib/libsocket/socket/weaks.c @@ -79,7 +79,7 @@ extern int _so_getsockname(); * already bound socket. */ int -_bind(int sock, struct sockaddr *addr, int addrlen) +_bind(int sock, struct sockaddr *addr, socklen_t addrlen) { return (_so_bind(sock, addr, addrlen, SOV_SOCKBSD)); } @@ -103,7 +103,7 @@ _accept4(int sock, struct sockaddr *addr, int *addrlen, int flags) } int -_connect(int sock, struct sockaddr *addr, int addrlen) +_connect(int sock, struct sockaddr *addr, socklen_t addrlen) { return (_so_connect(sock, addr, addrlen, SOV_DEFAULT)); } @@ -114,41 +114,41 @@ _shutdown(int sock, int how) return (_so_shutdown(sock, how, SOV_DEFAULT)); } -int -_recv(int sock, char *buf, int len, int flags) +ssize_t +_recv(int sock, void *buf, size_t len, int flags) { return (_so_recv(sock, buf, len, flags & ~MSG_XPG4_2)); } -int -_recvfrom(int sock, char *buf, int len, int flags, - struct sockaddr *addr, int *addrlen) +ssize_t +_recvfrom(int sock, void *_RESTRICT_KYWD buf, size_t len, int flags, + struct sockaddr *_RESTRICT_KYWD addr, void *addrlen) { return (_so_recvfrom(sock, buf, len, flags & ~MSG_XPG4_2, addr, addrlen)); } -int +ssize_t _recvmsg(int sock, struct msghdr *msg, int flags) { return (_so_recvmsg(sock, msg, flags & ~MSG_XPG4_2)); } -int -_send(int sock, char *buf, int len, int flags) +ssize_t +_send(int sock, const void *buf, size_t len, int flags) { return (_so_send(sock, buf, len, flags & ~MSG_XPG4_2)); } -int -_sendmsg(int sock, struct msghdr *msg, int flags) +ssize_t +_sendmsg(int sock, const struct msghdr *msg, int flags) { return (_so_sendmsg(sock, msg, flags & ~MSG_XPG4_2)); } -int -_sendto(int sock, char *buf, int len, int flags, - struct sockaddr *addr, int *addrlen) +ssize_t +_sendto(int sock, const void *buf, size_t len, int flags, + const struct sockaddr *addr, socklen_t addrlen) { return (_so_sendto(sock, buf, len, flags & ~MSG_XPG4_2, addr, addrlen)); @@ -211,7 +211,7 @@ _getsockopt(int sock, int level, int optname, char *optval, int *optlen) } int -_setsockopt(int sock, int level, int optname, char *optval, int optlen) +_setsockopt(int sock, int level, int optname, char *optval, socklen_t optlen) { return (_so_setsockopt(sock, level, optname, optval, optlen, SOV_DEFAULT)); @@ -250,7 +250,7 @@ __xnet_sendmsg(int sock, const struct msghdr *msg, int flags) int __xnet_sendto(int sock, const void *buf, size_t len, int flags, - const struct sockaddr *addr, socklen_t addrlen) + const struct sockaddr *addr, socklen_t addrlen) { return (_so_sendto(sock, buf, len, flags | MSG_XPG4_2, addr, addrlen)); @@ -258,7 +258,7 @@ __xnet_sendto(int sock, const void *buf, size_t len, int flags, int __xnet_getsockopt(int sock, int level, int option_name, - void *option_value, socklen_t *option_lenp) + void *option_value, socklen_t *option_lenp) { if (level == IPPROTO_SCTP) { return (_getsockopt(sock, level, option_name, option_value, diff --git a/usr/src/lib/libsysevent/libsysevent.c b/usr/src/lib/libsysevent/libsysevent.c index 928020233f..9aa2178301 100644 --- a/usr/src/lib/libsysevent/libsysevent.c +++ b/usr/src/lib/libsysevent/libsysevent.c @@ -755,9 +755,10 @@ se_print(FILE *fp, sysevent_t *ev) * It is created as a seperate thread in each subscriber * process per subscription. */ -static void -subscriber_event_handler(sysevent_handle_t *shp) +static void * +subscriber_event_handler(void *arg) { + sysevent_handle_t *shp = arg; subscriber_priv_t *sub_info; sysevent_queue_t *evqp; @@ -784,7 +785,7 @@ subscriber_event_handler(sysevent_handle_t *shp) } if (!SH_BOUND(shp)) { (void) mutex_unlock(&sub_info->sp_qlock); - return; + return (NULL); } } @@ -2219,8 +2220,7 @@ sysevent_bind_subscriber_cmn(sysevent_handle_t *shp, /* Create an event handler thread */ if (xsa == NULL || xsa->xs_thrcreate == NULL) { - created = thr_create(NULL, 0, - (void *(*)(void *))subscriber_event_handler, + created = thr_create(NULL, 0, subscriber_event_handler, shp, THR_BOUND, &sub_info->sp_handler_tid) == 0; } else { /* @@ -2238,8 +2238,7 @@ sysevent_bind_subscriber_cmn(sysevent_handle_t *shp, * thread start function to stash it. */ - created = xsa->xs_thrcreate(NULL, - (void *(*)(void *))subscriber_event_handler, + created = xsa->xs_thrcreate(NULL, subscriber_event_handler, shp, xsa->xs_thrcreate_cookie) == 1; } diff --git a/usr/src/man/man1/svcprop.1 b/usr/src/man/man1/svcprop.1 index e4eaba64a2..fa86788ab9 100644 --- a/usr/src/man/man1/svcprop.1 +++ b/usr/src/man/man1/svcprop.1 @@ -1,13 +1,13 @@ '\" te .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved +.\" Copyright 2019 Joyent, Inc. .\" 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 SVCPROP 1 "April 9, 2016" +.TH SVCPROP 1 "Dec 11, 2019" .SH NAME svcprop \- retrieve values of service configuration properties .SH SYNOPSIS -.LP .nf \fBsvcprop\fR [\fB-fqtv\fR] [\fB-C\fR | \fB-c\fR | \fB-s\fR \fIsnapshot\fR] [\fB-z\fR \fIzone\fR] [\fB-p\fR [\fIname\fR/]\fIname\fR]... @@ -20,7 +20,6 @@ svcprop \- retrieve values of service configuration properties .fi .SH DESCRIPTION -.LP The \fBsvcprop\fR utility prints values of properties in the service configuration repository. Properties are selected by \fB-p\fR options and the operands. @@ -35,7 +34,6 @@ instance's directly attached properties. See \fBsmf\fR(5) for an explanation of property composition. If the \fBrunning\fR snapshot does not exist then the instance's directly attached properties are used instead. .SS "Output Format" -.LP By default, when a single property is selected, the values for each are printed on separate lines. Empty \fBASCII\fR string values are represented by a pair of double quotes (\fB""\fR). Bourne shell metacharacters ('\fB;\fR', '\fB&\fR\&', @@ -62,7 +60,6 @@ due to access controls, an error results. .LP Error messages are printed to the standard error stream. .SH OPTIONS -.LP The following options are supported: .sp .ne 2 @@ -174,7 +171,6 @@ Uses properties from the service or instance in the specified \fIzone\fR. This option is only applicable from the global zone, see \fBzones\fR(5). .SH OPERANDS -.LP The following operands are supported: .sp .ne 2 @@ -236,7 +232,6 @@ instances, \fBsvcprop\fR acts on each service or instance. .RE .SH EXAMPLES -.LP \fBExample 1 \fRDisplaying the Value of a Single Property .sp .LP @@ -284,7 +279,6 @@ example% svcprop -p general ntp general/package astring SUNWntpr general/enabled boolean true general/entity_stability astring Unstable -general/single_instance boolean true .fi .in -2 .sp @@ -367,7 +361,6 @@ svcprop -p $1 $2 | ( .sp .SH EXIT STATUS -.LP The following exit values are returned: .sp .ne 2 @@ -397,7 +390,6 @@ Invalid command line options were specified. .RE .SH SEE ALSO -.LP \fBsvcs\fR(1), \fBinetd\fR(1M), \fBsvcadm\fR(1M), \fBsvccfg\fR(1M), \fBsvc.startd\fR(1M), \fBservice_bundle\fR(4), \fBattributes\fR(5), \fBfnmatch\fR(5), \fBsmf\fR(5), \fBsmf_method\fR(5), \fBsmf_security\fR(5), diff --git a/usr/src/man/man1m/svc.startd.1m b/usr/src/man/man1m/svc.startd.1m index 103c6b5fec..69b223d225 100644 --- a/usr/src/man/man1m/svc.startd.1m +++ b/usr/src/man/man1m/svc.startd.1m @@ -1,14 +1,13 @@ '\" te .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. -.\" Copyright 2012, Joyent, Inc. All Rights Reserved. +.\" Copyright 2019 Joyent, Inc. .\" 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 SVC.STARTD 1M "Aug 23, 2012" +.TH SVC.STARTD 1M "Dec 11, 2019" .SH NAME svc.startd \- Service Management Facility master restarter .SH SYNOPSIS -.LP .nf \fB/lib/svc/bin/svc.startd\fR .fi @@ -19,8 +18,6 @@ svc.startd \- Service Management Facility master restarter .fi .SH DESCRIPTION -.sp -.LP \fBsvc.startd\fR is the master restarter daemon for Service Management Facility (SMF) and the default restarter for all services. \fBsvc.startd\fR starts, stops, and restarts services based on administrative requests, system failures, @@ -44,8 +41,6 @@ to all restarters. Configuration Facility. \fBsvcadm\fR(1M) allows manipulation of service instances with respect to the service's restarter. .SS "Environment Variables" -.sp -.LP Environment variables with the "SMF_" prefix are reserved and may be overwritten. .sp @@ -59,8 +54,6 @@ default. By default, all other environment variables supplied to Duplicate entries are reduced to a single entry. The value used is undefined. Environment entries that are not prefixed with "<\fIname\fR>=" are ignored. .SS "Restarter Options" -.sp -.LP \fBsvc.startd\fR is not configured by command line options. Instead, configuration is read from the service configuration repository. You can use \fBsvccfg\fR(1M) to set all options and properties. @@ -159,13 +152,9 @@ administrator. Configuration errors, such as disabling \fBsvc.startd\fR are logged by \fBsyslog\fR, but ignored. .SS "SERVICE STATES" -.sp -.LP Services managed by \fBsvc.startd\fR can appear in any of the states described in \fBsmf\fR(5). The state definitions are unmodified by this restarter. .SS "SERVICE REPORTING" -.sp -.LP In addition to any logging done by the managed service, \fBsvc.startd\fR provides a common set of service reporting and logging mechanisms. .sp @@ -249,8 +238,6 @@ descriptors to \fB/var/svc/log/\fIservice\fR:\fIinstance\fR.log\fR. The level of logging to system global locations like \fB/var/svc/log/svc.startd.log\fR and \fBsyslog\fR is controlled by the \fBoptions/logging\fR property. .SS "SERVICE DEFINITION" -.sp -.LP When developing or configuring a service managed by \fBsvc.startd\fR, a common set of properties are used to affect the interaction between the service instance and the restarter. @@ -351,8 +338,10 @@ available) for managing the service. .ad .sp .6 .RS 4n -If \fBsingle_instance\fR is set to true, \fBsvc.startd\fR only allows one -instance of this service to transition to online or degraded at any time. +This was originally supposed to ensure that only one service instance could be +in online or degraded state at once; however, it was never implemented, and is +often incorrectly specified in multi-instance manifests. As such, it should be +considered obsolete and not specified in new manifests. .RE .sp @@ -429,8 +418,6 @@ create a \fButmpx\fR entry. .RE .SS "SERVICE FAILURE" -.sp -.LP \fBsvc.startd\fR assumes that a method has failed if it returns a non-zero exit code or if fails to complete before the timeout specified expires. If \fB$SMF_EXIT_ERR_CONFIG\fR or \fB$SMF_EXIT_ERR_FATAL\fR is returned, @@ -495,8 +482,6 @@ transition to maintenance state. However, a wait service which is repeatedly exiting with an error that exceeds the default rate (5 failures/second) will be throttled back so that the service only restarts once per second. .SS "LEGACY SERVICES" -.sp -.LP \fBsvc.startd\fR continues to provide support for services invoked during the startup run level transitions. Each \fB/etc/rc?.d\fR directory is processed after all managed services which constitute the equivalent run level milestone @@ -545,7 +530,6 @@ in the \fBLEGACY-RUN\fR state, cannot be modified, and can not be specified as dependencies of other services. The initial start time of the legacy service is captured as a convenience for the administrator. .SH FILES -.sp .ne 2 .na \fB\fB/var/svc/log\fR\fR @@ -565,7 +549,6 @@ before \fB/var\fR is mounted read-write. .RE .SH EXAMPLE -.LP \fBExample 1 \fRTurning on Verbose Logging .sp .LP @@ -588,8 +571,6 @@ svc:/system/svc/restarter:default> exit This request will take effect on the next restart of \fBsvc.startd\fR. .SH SEE ALSO -.sp -.LP \fBsvcs\fR(1), \fBsvcprop\fR(1), \fBkernel\fR(1M), \fBinit\fR(1M), \fBsvcadm\fR(1M), \fBsvccfg\fR(1M), \fBsvc.configd\fR(1M), \fBsetsid\fR(2), \fBsyslog\fR(3C), \fBlibscf\fR(3LIB), \fBscf_value_is_type\fR(3SCF), diff --git a/usr/src/man/man3c_db/td_sync_get_info.3c_db b/usr/src/man/man3c_db/td_sync_get_info.3c_db index 0eeac0e1cd..4a616ccdb0 100644 --- a/usr/src/man/man3c_db/td_sync_get_info.3c_db +++ b/usr/src/man/man3c_db/td_sync_get_info.3c_db @@ -3,7 +3,7 @@ .\" 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 TD_SYNC_GET_INFO 3C_DB "Jun 5, 2007" +.TH TD_SYNC_GET_INFO 3C_DB "Nov 22, 2018" .SH NAME td_sync_get_info, td_ta_sync_tracking_enable, td_sync_get_stats, td_sync_setstate, td_sync_waiters \- operations on a synchronization object in @@ -30,7 +30,7 @@ cc [ \fIflag\fR... ] \fIfile\fR... -lc_db [ \fIlibrary\fR... ] .LP .nf -\fBtd_err_e\fR \fBtd_sync_setstate\fR(\fBconst td_synchandle_t *\fR\fIsh_p\fR); +\fBtd_err_e\fR \fBtd_sync_setstate\fR(\fBconst td_synchandle_t *\fR\fIsh_p\fR, \fBint\fR \fIvalue\fR); .fi .LP @@ -243,16 +243,16 @@ structure, depending on the type of the synchronization object. .LP The \fBtd_sync_setstate\fR function modifies the state of synchronization object \fIsi_p\fR, depending on the synchronization object type. For mutexes, -\fBtd_sync_setstate\fR is unlocked if the value is \fB0\fR. Otherwise it is -locked. For semaphores, the semaphore's count is set to the value. For -reader-writer locks, the reader count set to the value if value is \fB>0\fR. -The count is set to write-locked if value is \fB-1\fR\&. It is set to unlocked -if the value is \fB0\fR. Setting the state of a synchronization object from a -\fBlibc_db\fR interface may cause the synchronization object's semantics to be -violated from the point of view of the threads in the target process. For -example, if a thread holds a mutex, and \fBtd_sync_setstate\fR is used to set -the mutex to unlocked, then a different thread will also be able to -subsequently acquire the same mutex. +\fBtd_sync_setstate\fR is unlocked if the \fIvalue\fR is \fB0\fR. Otherwise it +is locked. For semaphores, the semaphore's count is set to the \fIvalue\fR. For +reader-writer locks, the reader count set to the \fIvalue\fR if \fIvalue\fR is +\fB>0\fR. The count is set to write-locked if \fIvalue\fR is \fB-1\fR\&. +It is set to unlocked if the \fIvalue\fR is \fB0\fR. Setting the state of a +synchronization object from a \fBlibc_db\fR interface may cause the +synchronization object's semantics to be violated from the point of view of +the threads in the target process. For example, if a thread holds a mutex, +and \fBtd_sync_setstate\fR is used to set the mutex to unlocked, then a +different thread will also be able to subsequently acquire the same mutex. .sp .LP The \fBtd_sync_waiters\fR function iterates over the set of thread handles of diff --git a/usr/src/man/man5/smf_restarter.5 b/usr/src/man/man5/smf_restarter.5 index 4f17933450..5ca1b5b729 100644 --- a/usr/src/man/man5/smf_restarter.5 +++ b/usr/src/man/man5/smf_restarter.5 @@ -1,14 +1,13 @@ '\" te .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. +.\" Copyright 2019 Joyent, Inc. .\" 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 SMF_RESTARTER 5 "May 23, 2008" +.TH SMF_RESTARTER 5 "Dec 11, 2019" .SH NAME smf_restarter \- service management facility conventions for restarters .SH DESCRIPTION -.sp -.LP All service instances in the service management facility must be managed by a restarter. This manual page describes configuration, functionality, and reporting characteristics that are common to all restarters in the framework. @@ -21,8 +20,6 @@ service instance to determine configuration. The restarter manages a set of property groups to communicate the current disposition of a service with display tools such as \fBsvcs\fR(1). .SS "Service Configuration" -.sp -.LP The common restarter configuration for all services is captured in the \fBgeneral\fR property group. This group includes the following required and optional property settings. @@ -54,12 +51,11 @@ absent, the restarter defaults to \fBsvc.startd\fR(1M). .ad .RS 19n This is an optional property. When set, only one instance of the service is -allowed to transition to an online or degraded status at any time. +allowed to transition to an online or degraded status at any time. Note that no +known implementation honours this setting, and it should be considered obsolete. .RE .SS "Service Reporting" -.sp -.LP All restarters report status using the \fBrestarter\fR property group, which includes the following properties: .sp @@ -106,7 +102,5 @@ executing. .RE .SH SEE ALSO -.sp -.LP \fBsvcs\fR(1), \fBsvc.startd\fR(1M), \fBservice_bundle\fR(4), \fBsmf\fR(5), \fBsmf_method\fR(5) |
