diff options
author | John Sonnenschein <johns@joyent.com> | 2012-09-10 18:56:23 +0000 |
---|---|---|
committer | John Sonnenschein <johns@joyent.com> | 2012-09-10 18:56:23 +0000 |
commit | afbdbc48afac5b7bf58802c53226754c256215d1 (patch) | |
tree | 6fc5e9a77019ae61b4ce07fd9b41f04827c356f5 /usr/src/lib | |
parent | 4effda7fc5d948821a09a60e6385149d48c7e9dd (diff) | |
parent | 70f56fa69343b013f47e010537cff8ef3a7a40a5 (diff) | |
download | illumos-joyent-afbdbc48afac5b7bf58802c53226754c256215d1.tar.gz |
illumos sync
Diffstat (limited to 'usr/src/lib')
20 files changed, 457 insertions, 257 deletions
diff --git a/usr/src/lib/cfgadm_plugins/fp/common/cfga_fp.c b/usr/src/lib/cfgadm_plugins/fp/common/cfga_fp.c index d24104c900..6bb74889e7 100644 --- a/usr/src/lib/cfgadm_plugins/fp/common/cfga_fp.c +++ b/usr/src/lib/cfgadm_plugins/fp/common/cfga_fp.c @@ -23,9 +23,6 @@ * Use is subject to license terms. */ - - - #include "cfga_fp.h" /* @@ -70,11 +67,11 @@ cfga_change_state( /* Only configure and unconfigure operations are supported */ if (state_change_cmd != CFGA_CMD_CONFIGURE && - state_change_cmd != CFGA_CMD_UNCONFIGURE) { + state_change_cmd != CFGA_CMD_UNCONFIGURE) { return (CFGA_OPNOTSUPP); } - if ((ret = apidt_create(ap_id, &apidt, errstring)) != CFGA_OK) { + if ((ret = apidt_create(ap_id, &apidt, errstring)) != FPCFGA_OK) { return (err_cvt(ret)); } @@ -84,7 +81,8 @@ cfga_change_state( hw_option_p = hw_option; /* Use getsubopt() if more options get added */ while (*hw_option_p != '\0') { - switch (getsubopt(&hw_option_p, fp_cs_hw_opts, &value)) { + switch (getsubopt(&hw_option_p, fp_cs_hw_opts, + &value)) { case OPT_DISABLE_RCM : apidt.flags |= FLAG_DISABLE_RCM; break; @@ -98,7 +96,7 @@ cfga_change_state( case OPT_REMOVE_UNUSABLE_SCSI_LUN: if (state_change_cmd != CFGA_CMD_UNCONFIGURE) { cfga_err(errstring, 0, ERRARG_OPT_INVAL, - options, 0); + options, 0); S_FREE(hw_option); apidt_free(&apidt); return (CFGA_ERROR); @@ -108,11 +106,11 @@ cfga_change_state( default : /* process unknonw option. */ cfga_err(errstring, 0, ERRARG_OPT_INVAL, - options, 0); + options, 0); S_FREE(hw_option); apidt_free(&apidt); return (CFGA_ERROR); - } + } } S_FREE(hw_option); } @@ -138,15 +136,15 @@ cfga_change_state( if ((ret = findMatchingAdapterPort(apidt.xport_phys, &handle, &portIndex, &portAttrs, errstring)) == FPCFGA_OK) { - ret = dev_change_state(state_change_cmd, &apidt, &pwwn, - flags, errstring, handle, portAttrs); - HBA_CloseAdapter(handle); - HBA_FreeLibrary(); + ret = dev_change_state(state_change_cmd, &apidt, &pwwn, + flags, errstring, handle, portAttrs); + HBA_CloseAdapter(handle); + HBA_FreeLibrary(); } } else { /* Change state of all devices on FCA and the FCA itself */ ret = fca_change_state(state_change_cmd, &apidt, - flags, errstring); + flags, errstring); } apidt_free(&apidt); @@ -241,7 +239,8 @@ cfga_list_ext( hw_option_p = hw_option; /* Use getsubopt() if more options get added */ while (*hw_option_p != '\0') { - switch (getsubopt(&hw_option_p, fp_list_hw_opts, &value)) { + switch (getsubopt(&hw_option_p, fp_list_hw_opts, + &value)) { case OPT_DEVINFO_FORCE : fp_flags |= FLAG_DEVINFO_FORCE; break; @@ -252,17 +251,17 @@ cfga_list_ext( default : /* process unknonw option. */ cfga_err(errstring, 0, ERRARG_OPT_INVAL, - options, 0); + options, 0); S_FREE(hw_option); return (CFGA_ERROR); - } + } } S_FREE(hw_option); } /* if force_devinfo is specified check uid = 0 or not. */ if (((fp_flags & FLAG_DEVINFO_FORCE) == FLAG_DEVINFO_FORCE) && - (geteuid() != 0)) { + (geteuid() != 0)) { return (CFGA_PRIV); } @@ -294,14 +293,14 @@ cfga_list_ext( if ((fp_flags & FLAG_FCP_DEV) == FLAG_FCP_DEV) { ret = do_list_FCP_dev(ap_id, fp_flags, cmd, &ldatalistp, &nelem, - errstring); + errstring); if (ret != FPCFGA_OK) { list_free(&ldatalistp); return (err_cvt(ret)); } } else { if ((ret = apidt_create(ap_id, &apidt, errstring)) - != FPCFGA_OK) { + != FPCFGA_OK) { return (err_cvt(ret)); } @@ -371,10 +370,10 @@ cfga_ap_id_cmp(const char *ap_id1, const char *ap_id2) i++; if ((ap_id1[i] == '\0') && - !(strncmp(&ap_id2[i], LUN_COMP_SEP, strlen(LUN_COMP_SEP)))) { + !(strncmp(&ap_id2[i], LUN_COMP_SEP, strlen(LUN_COMP_SEP)))) { return (0); } else if ((ap_id2[i] == '\0') && - !(strncmp(&ap_id1[i], LUN_COMP_SEP, strlen(LUN_COMP_SEP)))) { + !(strncmp(&ap_id1[i], LUN_COMP_SEP, strlen(LUN_COMP_SEP)))) { return (0); } @@ -388,7 +387,7 @@ cfga_ap_id_cmp(const char *ap_id1, const char *ap_id2) if (isxdigit(ap_id1[i]) && isxdigit(ap_id2[i])) { ret = (strtoll((ap_id1 + i), NULL, 16)) - - (strtoll((ap_id2 + i), NULL, 16)); + (strtoll((ap_id2 + i), NULL, 16)); if (ret > 0) { return (1); } else if (ret < 0) { diff --git a/usr/src/lib/cfgadm_plugins/ib/common/cfga_ib.c b/usr/src/lib/cfgadm_plugins/ib/common/cfga_ib.c index 6dc2c8cf2e..b5689ccf35 100644 --- a/usr/src/lib/cfgadm_plugins/ib/common/cfga_ib.c +++ b/usr/src/lib/cfgadm_plugins/ib/common/cfga_ib.c @@ -1557,7 +1557,7 @@ ib_fill_static_apids(char *ap_id, cfga_list_data_t *clp) /* Get /dev/cfg path to corresponding to the physical ap_id */ /* Remember ap_id_log must be freed */ - if ((cfga_ib_ret_t)ib_physpath_to_devlink(ap_id, &ap_id_log, + if (ib_physpath_to_devlink(ap_id, &ap_id_log, &l_err) != ICFGA_OK) { DPRINTF("ib_fill_static_apids: " "ib_physpath_to_devlink failed\n"); diff --git a/usr/src/lib/cfgadm_plugins/sata/common/cfga_sata.c b/usr/src/lib/cfgadm_plugins/sata/common/cfga_sata.c index 10d85ace37..29f059b2db 100644 --- a/usr/src/lib/cfgadm_plugins/sata/common/cfga_sata.c +++ b/usr/src/lib/cfgadm_plugins/sata/common/cfga_sata.c @@ -1695,7 +1695,7 @@ cfga_list_ext( } else { /* This is an empty port */ - if (get_port_num(ap_id, &port) != SATA_CFGA_OK) { + if (get_port_num(ap_id, &port) != CFGA_SATA_OK) { goto bailout; } diff --git a/usr/src/lib/krb5/plugins/preauth/pkinit/pkinit_srv.c b/usr/src/lib/krb5/plugins/preauth/pkinit/pkinit_srv.c index 04f45828e5..17ee00992c 100644 --- a/usr/src/lib/krb5/plugins/preauth/pkinit/pkinit_srv.c +++ b/usr/src/lib/krb5/plugins/preauth/pkinit/pkinit_srv.c @@ -789,8 +789,9 @@ pkinit_server_return_padata(krb5_context context, } /* if this DH, then process finish computing DH key */ - if (rep != NULL && (rep->choice == choice_pa_pk_as_rep_dhInfo || - rep->choice == choice_pa_pk_as_rep_draft9_dhSignedData)) { + if (((rep != NULL) && (rep->choice == choice_pa_pk_as_rep_dhInfo)) || + ((rep9 != NULL) && rep9->choice == + choice_pa_pk_as_rep_draft9_dhSignedData)) { pkiDebug("received DH key delivery AS REQ\n"); retval = server_process_dh(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, subjectPublicKey, diff --git a/usr/src/lib/libc/port/threads/assfail.c b/usr/src/lib/libc/port/threads/assfail.c index 7cf0ea98e6..7a98884f4b 100644 --- a/usr/src/lib/libc/port/threads/assfail.c +++ b/usr/src/lib/libc/port/threads/assfail.c @@ -452,11 +452,11 @@ assfail3(const char *assertion, uintmax_t lv, const char *op, uintmax_t rv, { char buf[1000]; (void) strcpy(buf, assertion); - (void) strcat(buf, " (0x"); + (void) strcat(buf, " ("); ultos((uint64_t)lv, 16, buf + strlen(buf)); (void) strcat(buf, " "); (void) strcat(buf, op); - (void) strcat(buf, " 0x"); + (void) strcat(buf, " "); ultos((uint64_t)rv, 16, buf + strlen(buf)); (void) strcat(buf, ")"); __assfail(buf, filename, line_num); diff --git a/usr/src/lib/libdtrace/Makefile.com b/usr/src/lib/libdtrace/Makefile.com index 48b2001e62..085f5c5e28 100644 --- a/usr/src/lib/libdtrace/Makefile.com +++ b/usr/src/lib/libdtrace/Makefile.com @@ -70,8 +70,15 @@ LIBISASRCS = \ OBJECTS = dt_lex.o dt_grammar.o $(MACHOBJS) $(LIBSRCS:%.c=%.o) $(LIBISASRCS:%.c=%.o) -DRTISRC = drti.c -DRTIOBJ = $(DRTISRC:%.c=%.o) +DRTISRCS = dlink_init.c dlink_common.c +DRTIOBJS = $(DRTISRCS:%.c=pics/%.o) +DRTIOBJ = drti.o + +LIBDAUDITSRCS = dlink_audit.c dlink_common.c +LIBDAUDITOBJS = $(LIBDAUDITSRCS:%.c=pics/%.o) +LIBDAUDIT = libdtrace_forceload.so + +DLINKSRCS = dlink_common.c dlink_init.c dlink_audit.c DLIBSRCS += \ errno.d \ @@ -131,17 +138,23 @@ ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64 ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%) -ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ) -ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ) +ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ) $(ROOTDLIBDIR)/$(LIBDAUDIT) +ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ) $(ROOTDLIBDIR64)/$(LIBDAUDIT) + +$(ROOTDLIBDIR)/%.d := FILEMODE=444 +$(ROOTDLIBDIR)/%.o := FILEMODE=444 +$(ROOTDLIBDIR64)/%.o := FILEMODE=444 +$(ROOTDLIBDIR)/%.so := FILEMODE=555 +$(ROOTDLIBDIR64)/%.so := FILEMODE=555 .KEEP_STATE: -all: $(LIBS) $(DRTIOBJ) +all: $(LIBS) $(DRTIOBJ) $(LIBDAUDIT) -lint: lintdrti lintcheck +lint: lintdlink lintcheck -lintdrti: ../common/$(DRTISRC) - $(LINT.c) ../common/$(DRTISRC) $(DRTILDLIBS) +lintdlink: $(DLINKSRCS:%.c=../common/%.c) + $(LINT.c) $(DLINKSRCS:%.c=../common/%.c) $(DRTILDLIBS) dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h $(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@ @@ -202,10 +215,16 @@ pics/%.o: ../$(MACH)/%.s $(COMPILE.s) -o $@ $< $(POST_PROCESS_O) -%.o: ../common/%.c - $(COMPILE.c) -o $@ $< +$(DRTIOBJ): $(DRTIOBJS) + $(LD) -o $@ -r -Blocal -Breduce $(DRTIOBJS) $(POST_PROCESS_O) +$(LIBDAUDIT): $(LIBDAUDITOBJS) + $(LINK.c) -o $@ $(GSHARED) -h$(LIBDAUDIT) $(ZTEXT) $(ZDEFS) $(BDIRECT) \ + $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%) $(LIBDAUDITOBJS) \ + -lmapmalloc -lc -lproc + $(POST_PROCESS_SO) + $(ROOTDLIBDIR): $(INS.dir) @@ -227,6 +246,12 @@ $(ROOTDLIBDIR)/%.o: %.o $(ROOTDLIBDIR64)/%.o: %.o $(INS.file) +$(ROOTDLIBDIR)/%.so: %.so + $(INS.file) + +$(ROOTDLIBDIR64)/%.so: %.so + $(INS.file) + $(ROOTDLIBS): $(ROOTDLIBDIR) $(ROOTDOBJS): $(ROOTDLIBDIR) diff --git a/usr/src/lib/libdtrace/common/dlink.h b/usr/src/lib/libdtrace/common/dlink.h new file mode 100644 index 0000000000..16f0bd892d --- /dev/null +++ b/usr/src/lib/libdtrace/common/dlink.h @@ -0,0 +1,40 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +#ifndef _DLINK_H +#define _DLINK_H + +#include <link.h> +#include <sys/dtrace.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern const char *devname; + +extern void dprintf(int, const char *, ...); +extern void dtrace_link_init(void); +extern void dtrace_link_dof(dof_hdr_t *, Lmid_t, const char *, uintptr_t); + +#ifdef __cplusplus +} +#endif + +#endif /* _DLINK_H */ diff --git a/usr/src/lib/libdtrace/common/dlink_audit.c b/usr/src/lib/libdtrace/common/dlink_audit.c new file mode 100644 index 0000000000..57ca8d7fb7 --- /dev/null +++ b/usr/src/lib/libdtrace/common/dlink_audit.c @@ -0,0 +1,128 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +/* + * This file implements an audit library that can be used to force the loading + * of helper providers. The default disposition for a helper provider -- USDT + * and ustack helpers -- is to load itself from it's containing object's .init + * section. In cases where startup time is deemed critical, USDT authors can + * use the -xlazyload option to dtrace(1M) to disable automatic loading (it's + * difficult to make the case for the utility of this feature for anything + * other than libc which, indeed, was the sole motivation). If a binary has + * been compiled with automatic loading disabled, this audit library may be + * used to force automatic loading: + * + * LD_AUDIT_32=/usr/lib/dtrace/libdaudit.so + * LD_AUDIT_64=/usr/lib/dtrace/64/libdaudit.so + */ + +#include <link.h> +#include <stdio.h> +#include <libproc.h> +#include <strings.h> + +#include <dlink.h> + +typedef struct obj_list { + struct obj_list *ol_next; + char *ol_name; + uintptr_t ol_addr; + Lmid_t ol_lmid; +} obj_list_t; + +static obj_list_t *list; + +#pragma init(dtrace_daudit_init) +static void +dtrace_daudit_init(void) +{ + dtrace_link_init(); +} + +/*ARGSUSED*/ +uint_t +la_version(uint_t version) +{ + return (LAV_CURRENT); +} + +/* + * Record objects into our linked list as they're loaded. + */ +/*ARGSUSED*/ +uint_t +la_objopen(Link_map *lmp, Lmid_t lmid, uintptr_t *cookie) +{ + obj_list_t *node; + + /* + * If we can't allocate the next node in our list, we'll try to emit a + * message, but it's possible that might fail as well. + */ + if ((node = malloc(sizeof (obj_list_t))) == NULL) { + dprintf(0, "libdaudit: failed to allocate"); + return (0); + } + node->ol_next = list; + node->ol_name = strdup(lmp->l_name); + node->ol_addr = lmp->l_addr; + node->ol_lmid = lmid; + list = node; + + return (0); +} + +/* + * Once the link maps have reached a consistent state, process the list of + * objects that were loaded. We need to use libproc to search for the + * ___SUNW_dof symbol rather than dlsym(3C) since the symbol is not in the + * dynamic (run-time) symbol table (though it is, of course, in the symtab). + * Once we find it, we ioctl(2) it to the kernel just as we would have from + * the .init section if automatic loading were enabled. + */ +/*ARGSUSED*/ +void +la_activity(uintptr_t *cookie, uint_t flags) +{ + struct ps_prochandle *P; + int err, ret; + GElf_Sym sym; + + if (flags != LA_ACT_CONSISTENT) + return; + + while (list != NULL) { + obj_list_t *node = list; + char *name = node->ol_name; + + list = node->ol_next; + + P = Pgrab(getpid(), PGRAB_RDONLY, &err); + ret = Plookup_by_name(P, name, "___SUNW_dof", &sym); + Prelease(P, 0); + + if (ret == 0) { + dtrace_link_dof((void *)(uintptr_t)sym.st_value, + node->ol_lmid, node->ol_name, node->ol_addr); + } + + free(node->ol_name); + free(node); + } +} diff --git a/usr/src/lib/libdtrace/common/drti.c b/usr/src/lib/libdtrace/common/dlink_common.c index 3b5f0cbbdf..c47ec273ab 100644 --- a/usr/src/lib/libdtrace/common/drti.c +++ b/usr/src/lib/libdtrace/common/dlink_common.c @@ -18,22 +18,30 @@ * * CDDL HEADER END */ + /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#include <unistd.h> -#include <fcntl.h> -#include <dlfcn.h> -#include <link.h> -#include <sys/dtrace.h> +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +/* + * Common functions for helper provider loading both compiled into the + * executable via drti.o and dtrace(1M) -G, and the libdaudit.so library. + */ +#include <errno.h> +#include <fcntl.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <errno.h> +#include <unistd.h> + +#include <dlink.h> /* * In Solaris 10 GA, the only mechanism for communicating helper information @@ -43,24 +51,13 @@ * the /dev and having this initialization code use that /dev link. If the * /dev link doesn't exist it falls back to looking for the /devices node * as this code may be embedded in a binary which runs on Solaris 10 GA. - * - * Users may set the following environment variable to affect the way - * helper initialization takes place: - * - * DTRACE_DOF_INIT_DEBUG enable debugging output - * DTRACE_DOF_INIT_DISABLE disable helper loading - * DTRACE_DOF_INIT_DEVNAME set the path to the helper node */ - -static const char *devname = "/dev/dtrace/helper"; +const char *devname = "/dev/dtrace/helper"; static const char *olddevname = "/devices/pseudo/dtrace@0:helper"; -static const char *modname; /* Name of this load object */ -static int gen; /* DOF helper generation */ -extern dof_hdr_t __SUNW_dof; /* DOF defined in the .SUNW_dof section */ -static boolean_t dof_init_debug = B_FALSE; /* From DTRACE_DOF_INIT_DEBUG */ +static boolean_t dof_init_debug = B_FALSE; -static void +void dprintf(int debug, const char *fmt, ...) { va_list ap; @@ -70,10 +67,7 @@ dprintf(int debug, const char *fmt, ...) va_start(ap, fmt); - if (modname == NULL) - (void) fprintf(stderr, "dtrace DOF: "); - else - (void) fprintf(stderr, "dtrace DOF %s: ", modname); + (void) fprintf(stderr, "dtrace DOF: "); (void) vfprintf(stderr, fmt, ap); @@ -83,40 +77,39 @@ dprintf(int debug, const char *fmt, ...) va_end(ap); } -#pragma init(dtrace_dof_init) -static void -dtrace_dof_init(void) +/* + * Users may set the following environment variable to affect the way + * helper initialization takes place: + * + * DTRACE_DOF_INIT_DEBUG enable debugging output + * DTRACE_DOF_INIT_DISABLE disable helper loading + * DTRACE_DOF_INIT_DEVNAME set the path to the helper node + */ +void +dtrace_link_init(void) { - dof_hdr_t *dof = &__SUNW_dof; + if (getenv("DTRACE_DOF_INIT_DEBUG") != NULL) + dof_init_debug = B_TRUE; +} + +void +dtrace_link_dof(dof_hdr_t *dof, Lmid_t lmid, const char *name, uintptr_t addr) +{ + const char *modname; + const char *p; #ifdef _LP64 Elf64_Ehdr *elf; #else Elf32_Ehdr *elf; #endif dof_helper_t dh; - Link_map *lmp; - Lmid_t lmid; int fd; - const char *p; if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL) return; - if (getenv("DTRACE_DOF_INIT_DEBUG") != NULL) - dof_init_debug = B_TRUE; - - if (dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &lmp) == -1 || lmp == NULL) { - dprintf(1, "couldn't discover module name or address\n"); - return; - } - - if (dlinfo(RTLD_SELF, RTLD_DI_LMID, &lmid) == -1) { - dprintf(1, "couldn't discover link map ID\n"); - return; - } - - if ((modname = strrchr(lmp->l_name, '/')) == NULL) - modname = lmp->l_name; + if ((modname = strrchr(name, '/')) == NULL) + modname = name; else modname++; @@ -124,16 +117,16 @@ dtrace_dof_init(void) dof->dofh_ident[DOF_ID_MAG1] != DOF_MAG_MAG1 || dof->dofh_ident[DOF_ID_MAG2] != DOF_MAG_MAG2 || dof->dofh_ident[DOF_ID_MAG3] != DOF_MAG_MAG3) { - dprintf(0, ".SUNW_dof section corrupt\n"); + dprintf(0, ".SUNW_dof section corrupt for %s\n", modname); return; } - elf = (void *)lmp->l_addr; + elf = (void *)addr; dh.dofhp_dof = (uintptr_t)dof; - dh.dofhp_addr = elf->e_type == ET_DYN ? lmp->l_addr : 0; + dh.dofhp_addr = elf->e_type == ET_DYN ? addr : 0; - if (lmid == 0) { + if (lmid == LM_ID_BASE) { (void) snprintf(dh.dofhp_mod, sizeof (dh.dofhp_mod), "%s", modname); } else { @@ -162,29 +155,12 @@ dtrace_dof_init(void) } } - if ((gen = ioctl(fd, DTRACEHIOC_ADDDOF, &dh)) == -1) - dprintf(1, "DTrace ioctl failed for DOF at %p", dof); - else - dprintf(1, "DTrace ioctl succeeded for DOF at %p\n", dof); - - (void) close(fd); -} - -#pragma fini(dtrace_dof_fini) -static void -dtrace_dof_fini(void) -{ - int fd; - - if ((fd = open64(devname, O_RDWR)) < 0) { - dprintf(1, "failed to open helper device %s", devname); - return; + if (ioctl(fd, DTRACEHIOC_ADDDOF, &dh) == -1) { + dprintf(1, "DTrace ioctl failed for DOF at %p in %s", dof, + name); + } else { + dprintf(1, "DTrace ioctl succeeded for DOF at %p in %s\n", dof, + name); } - - if ((gen = ioctl(fd, DTRACEHIOC_REMOVE, gen)) == -1) - dprintf(1, "DTrace ioctl failed to remove DOF (%d)\n", gen); - else - dprintf(1, "DTrace ioctl removed DOF (%d)\n", gen); - (void) close(fd); } diff --git a/usr/src/lib/libdtrace/common/dlink_init.c b/usr/src/lib/libdtrace/common/dlink_init.c new file mode 100644 index 0000000000..7c00a49c21 --- /dev/null +++ b/usr/src/lib/libdtrace/common/dlink_init.c @@ -0,0 +1,85 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +/* + * This is the basis for drti.o which dt_link.c links into the object file + * generated by dtrace(1M) -G by default (note that -xlazyload disables this). + */ + +#include <dlfcn.h> +#include <stdlib.h> +#include <fcntl.h> +#include <unistd.h> + +#include <dlink.h> + +static int gen; /* DOF helper generation */ +extern dof_hdr_t __SUNW_dof; /* DOF defined in the .SUNW_dof section */ + +#pragma init(dtrace_drti_init) +static void +dtrace_drti_init(void) +{ + Link_map *lmp; + Lmid_t lmid; + + dtrace_link_init(); + + if (dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &lmp) == -1 || lmp == NULL) { + dprintf(1, "couldn't discover module name or address\n"); + return; + } + + if (dlinfo(RTLD_SELF, RTLD_DI_LMID, &lmid) == -1) { + dprintf(1, "couldn't discover link map ID\n"); + return; + } + + dtrace_link_dof(&__SUNW_dof, lmid, lmp->l_name, lmp->l_addr); +} + +#pragma fini(dtrace_drti_fini) +static void +dtrace_drti_fini(void) +{ + int fd; + + if ((fd = open64(devname, O_RDWR)) < 0) { + dprintf(1, "failed to open helper device %s", devname); + return; + } + + if ((gen = ioctl(fd, DTRACEHIOC_REMOVE, gen)) == -1) + dprintf(1, "DTrace ioctl failed to remove DOF (%d)\n", gen); + else + dprintf(1, "DTrace ioctl removed DOF (%d)\n", gen); + + (void) close(fd); +} diff --git a/usr/src/lib/libdtrace/common/dt_consume.c b/usr/src/lib/libdtrace/common/dt_consume.c index f12a39991a..b1e8d2daa4 100644 --- a/usr/src/lib/libdtrace/common/dt_consume.c +++ b/usr/src/lib/libdtrace/common/dt_consume.c @@ -2463,6 +2463,7 @@ dt_buf_oldest(void *elem, void *arg) while (offs < buf->dtbd_size) { dtrace_rechdr_t *dtrh = + /* LINTED - alignment */ (dtrace_rechdr_t *)(buf->dtbd_data + offs); if (dtrh->dtrh_epid == DTRACE_EPIDNONE) { offs += sizeof (dtrace_epid_t); diff --git a/usr/src/lib/libshare/nfs/libshare_nfs.c b/usr/src/lib/libshare/nfs/libshare_nfs.c index 67dc968bad..ef3f9cab0b 100644 --- a/usr/src/lib/libshare/nfs/libshare_nfs.c +++ b/usr/src/lib/libshare/nfs/libshare_nfs.c @@ -23,6 +23,9 @@ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ +/* + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. + */ /* * NFS specific functions @@ -253,7 +256,7 @@ findopt(char *name) if (name != NULL) { for (i = 0; optdefs[i].tag != NULL; i++) { if (strcmp(optdefs[i].tag, name) == 0) - return (i); + return (optdefs[i].index); } if (findcharset(name)) return (OPT_CHARSET_MAP); diff --git a/usr/src/lib/libsun_ima/common/ima.c b/usr/src/lib/libsun_ima/common/ima.c index b479cf4f95..0a8787756a 100644 --- a/usr/src/lib/libsun_ima/common/ima.c +++ b/usr/src/lib/libsun_ima/common/ima.c @@ -2714,7 +2714,7 @@ getAuthMethods( } i = 0; - if (auth.a_auth_method == IMA_AUTHMETHOD_NONE) { + if (auth.a_auth_method == authMethodNone) { pMethodList[i++] = IMA_AUTHMETHOD_NONE; } else if (auth.a_auth_method & authMethodCHAP) { pMethodList[i++] = IMA_AUTHMETHOD_CHAP; diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c index 53e012078e..2d444dcb4b 100644 --- a/usr/src/lib/libzfs/common/libzfs_dataset.c +++ b/usr/src/lib/libzfs/common/libzfs_dataset.c @@ -21,10 +21,10 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2010 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved. + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. */ #include <ctype.h> @@ -3532,7 +3532,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, boolean_t force) zhp->zfs_type == ZFS_TYPE_VOLUME); /* - * Destroy all recent snapshots and its dependends. + * Destroy all recent snapshots and their dependents. */ cb.cb_force = force; cb.cb_target = snap->zfs_name; @@ -4044,35 +4044,40 @@ zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type, zfs_userspace_cb_t func, void *arg) { zfs_cmd_t zc = { 0 }; - int error; zfs_useracct_t buf[100]; + libzfs_handle_t *hdl = zhp->zfs_hdl; + int ret; (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name)); zc.zc_objset_type = type; zc.zc_nvlist_dst = (uintptr_t)buf; - /* CONSTCOND */ - while (1) { + for (;;) { zfs_useracct_t *zua = buf; zc.zc_nvlist_dst_size = sizeof (buf); - error = ioctl(zhp->zfs_hdl->libzfs_fd, - ZFS_IOC_USERSPACE_MANY, &zc); - if (error || zc.zc_nvlist_dst_size == 0) + if (zfs_ioctl(hdl, ZFS_IOC_USERSPACE_MANY, &zc) != 0) { + char errbuf[ZFS_MAXNAMELEN + 32]; + + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot get used/quota for %s"), zc.zc_name); + return (zfs_standard_error_fmt(hdl, errno, errbuf)); + } + if (zc.zc_nvlist_dst_size == 0) break; while (zc.zc_nvlist_dst_size > 0) { - error = func(arg, zua->zu_domain, zua->zu_rid, - zua->zu_space); - if (error != 0) - return (error); + if ((ret = func(arg, zua->zu_domain, zua->zu_rid, + zua->zu_space)) != 0) + return (ret); zua++; zc.zc_nvlist_dst_size -= sizeof (zfs_useracct_t); } } - return (error); + return (0); } int diff --git a/usr/src/lib/libzfs/common/libzfs_import.c b/usr/src/lib/libzfs/common/libzfs_import.c index 414aa2f747..36d7420c3b 100644 --- a/usr/src/lib/libzfs/common/libzfs_import.c +++ b/usr/src/lib/libzfs/common/libzfs_import.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) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* @@ -439,8 +439,8 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok) uint_t i, nspares, nl2cache; boolean_t config_seen; uint64_t best_txg; - char *name, *hostname, *comment; - uint64_t version, guid; + char *name, *hostname; + uint64_t guid; uint_t children = 0; nvlist_t **child = NULL; uint_t holes; @@ -526,61 +526,54 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok) * configuration: * * version - * pool guid - * name + * pool guid + * name + * pool txg (if available) * comment (if available) - * pool state + * pool state * hostid (if available) * hostname (if available) */ - uint64_t state; + uint64_t state, version, pool_txg; + char *comment = NULL; + + version = fnvlist_lookup_uint64(tmp, + ZPOOL_CONFIG_VERSION); + fnvlist_add_uint64(config, + ZPOOL_CONFIG_VERSION, version); + guid = fnvlist_lookup_uint64(tmp, + ZPOOL_CONFIG_POOL_GUID); + fnvlist_add_uint64(config, + ZPOOL_CONFIG_POOL_GUID, guid); + name = fnvlist_lookup_string(tmp, + ZPOOL_CONFIG_POOL_NAME); + fnvlist_add_string(config, + ZPOOL_CONFIG_POOL_NAME, name); - verify(nvlist_lookup_uint64(tmp, - ZPOOL_CONFIG_VERSION, &version) == 0); - if (nvlist_add_uint64(config, - ZPOOL_CONFIG_VERSION, version) != 0) - goto nomem; - verify(nvlist_lookup_uint64(tmp, - ZPOOL_CONFIG_POOL_GUID, &guid) == 0); - if (nvlist_add_uint64(config, - ZPOOL_CONFIG_POOL_GUID, guid) != 0) - goto nomem; - verify(nvlist_lookup_string(tmp, - ZPOOL_CONFIG_POOL_NAME, &name) == 0); - if (nvlist_add_string(config, - ZPOOL_CONFIG_POOL_NAME, name) != 0) - goto nomem; + if (nvlist_lookup_uint64(tmp, + ZPOOL_CONFIG_POOL_TXG, &pool_txg) == 0) + fnvlist_add_uint64(config, + ZPOOL_CONFIG_POOL_TXG, pool_txg); - /* - * COMMENT is optional, don't bail if it's not - * there, instead, set it to NULL. - */ if (nvlist_lookup_string(tmp, - ZPOOL_CONFIG_COMMENT, &comment) != 0) - comment = NULL; - else if (nvlist_add_string(config, - ZPOOL_CONFIG_COMMENT, comment) != 0) - goto nomem; + ZPOOL_CONFIG_COMMENT, &comment) == 0) + fnvlist_add_string(config, + ZPOOL_CONFIG_COMMENT, comment); - verify(nvlist_lookup_uint64(tmp, - ZPOOL_CONFIG_POOL_STATE, &state) == 0); - if (nvlist_add_uint64(config, - ZPOOL_CONFIG_POOL_STATE, state) != 0) - goto nomem; + state = fnvlist_lookup_uint64(tmp, + ZPOOL_CONFIG_POOL_STATE); + fnvlist_add_uint64(config, + ZPOOL_CONFIG_POOL_STATE, state); hostid = 0; if (nvlist_lookup_uint64(tmp, ZPOOL_CONFIG_HOSTID, &hostid) == 0) { - if (nvlist_add_uint64(config, - ZPOOL_CONFIG_HOSTID, hostid) != 0) - goto nomem; - verify(nvlist_lookup_string(tmp, - ZPOOL_CONFIG_HOSTNAME, - &hostname) == 0); - if (nvlist_add_string(config, - ZPOOL_CONFIG_HOSTNAME, - hostname) != 0) - goto nomem; + fnvlist_add_uint64(config, + ZPOOL_CONFIG_HOSTID, hostid); + hostname = fnvlist_lookup_string(tmp, + ZPOOL_CONFIG_HOSTNAME); + fnvlist_add_string(config, + ZPOOL_CONFIG_HOSTNAME, hostname); } config_seen = B_TRUE; diff --git a/usr/src/lib/libzpool/Makefile.com b/usr/src/lib/libzpool/Makefile.com index 571881a47e..2485f7350f 100644 --- a/usr/src/lib/libzpool/Makefile.com +++ b/usr/src/lib/libzpool/Makefile.com @@ -20,6 +20,7 @@ # # # Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012 by Delphix. All rights reserved. # LIBRARY= libzpool.a @@ -57,9 +58,9 @@ C99MODE= -xc99=%all C99LMODE= -Xc99=%all CFLAGS += -g $(CCVERBOSE) $(CNOGLOBAL) -CFLAGS64 += -g $(CCVERBOSE) $(CNOGLOBAL) +CFLAGS64 += -g $(CCVERBOSE) $(CNOGLOBAL) LDLIBS += -lcmdutils -lumem -lavl -lnvpair -lz -lc -lsysevent -lmd -CPPFLAGS += $(INCS) +CPPFLAGS += $(INCS) -DDEBUG .KEEP_STATE: diff --git a/usr/src/lib/libzpool/common/sys/zfs_context.h b/usr/src/lib/libzpool/common/sys/zfs_context.h index 39af927f71..9e6fd4455c 100644 --- a/usr/src/lib/libzpool/common/sys/zfs_context.h +++ b/usr/src/lib/libzpool/common/sys/zfs_context.h @@ -36,7 +36,6 @@ extern "C" { #define _SYS_RWLOCK_H #define _SYS_CONDVAR_H #define _SYS_SYSTM_H -#define _SYS_DEBUG_H #define _SYS_T_LOCK_H #define _SYS_VNODE_H #define _SYS_VFS_H @@ -61,6 +60,7 @@ extern "C" { #include <atomic.h> #include <dirent.h> #include <time.h> +#include <procfs.h> #include <libsysevent.h> #include <sys/note.h> #include <sys/types.h> @@ -78,6 +78,7 @@ extern "C" { #include <sys/sysevent/eventdefs.h> #include <sys/sysevent/dev.h> #include <sys/sunddi.h> +#include <sys/debug.h> /* * Debugging @@ -110,60 +111,6 @@ extern void vpanic(const char *, __va_list); extern int aok; -/* This definition is copied from assert.h. */ -#if defined(__STDC__) -#if __STDC_VERSION__ - 0 >= 199901L -#define zverify(EX) (void)((EX) || (aok) || \ - (__assert_c99(#EX, __FILE__, __LINE__, __func__), 0)) -#else -#define zverify(EX) (void)((EX) || (aok) || \ - (__assert(#EX, __FILE__, __LINE__), 0)) -#endif /* __STDC_VERSION__ - 0 >= 199901L */ -#else -#define zverify(EX) (void)((EX) || (aok) || \ - (_assert("EX", __FILE__, __LINE__), 0)) -#endif /* __STDC__ */ - - -#define VERIFY zverify -#define ASSERT zverify -#undef assert -#define assert zverify - -extern void __assert(const char *, const char *, int); - -#ifdef lint -#define VERIFY3_IMPL(x, y, z, t) if (x == z) ((void)0) -#else -/* BEGIN CSTYLED */ -#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \ - const TYPE __left = (TYPE)(LEFT); \ - const TYPE __right = (TYPE)(RIGHT); \ - if (!(__left OP __right) && (!aok)) { \ - char *__buf = alloca(256); \ - (void) snprintf(__buf, 256, "%s %s %s (0x%llx %s 0x%llx)", \ - #LEFT, #OP, #RIGHT, \ - (u_longlong_t)__left, #OP, (u_longlong_t)__right); \ - __assert(__buf, __FILE__, __LINE__); \ - } \ -_NOTE(CONSTCOND) } while (0) -/* END CSTYLED */ -#endif /* lint */ - -#define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t) -#define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t) -#define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t) - -#ifdef NDEBUG -#define ASSERT3S(x, y, z) ((void)0) -#define ASSERT3U(x, y, z) ((void)0) -#define ASSERT3P(x, y, z) ((void)0) -#else -#define ASSERT3S(x, y, z) VERIFY3S(x, y, z) -#define ASSERT3U(x, y, z) VERIFY3U(x, y, z) -#define ASSERT3P(x, y, z) VERIFY3P(x, y, z) -#endif - /* * DTrace SDT probes have different signatures in userland than they do in * kernel. If they're being used in kernel code, re-define them out of diff --git a/usr/src/lib/lvm/libmeta/common/meta_smf.c b/usr/src/lib/lvm/libmeta/common/meta_smf.c index cc0de9e9fa..eaa2198fe9 100644 --- a/usr/src/lib/lvm/libmeta/common/meta_smf.c +++ b/usr/src/lib/lvm/libmeta/common/meta_smf.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Service Management Facility (SMF) interfaces. */ @@ -184,7 +182,7 @@ meta_smf_getmask() if ((sp = metasetnosetname(i, ep)) == NULL) { if (!mdisok(ep) && !mdiserror(ep, MDE_NO_SET) && - !mdismddberror(ep, MDE_NOTENOUGH_DB) && + !mdiserror(ep, MDE_NOTENOUGH_DB) && !mdiserror(ep, MDE_SMF_NO_SERVICE) && ep->info.errclass != MDEC_RPC) { /* @@ -257,7 +255,7 @@ enabled(char *svc_name) int rval = 0; prop = scf_simple_prop_get(NULL, svc_name, SCF_PG_GENERAL, - SCF_PROPERTY_ENABLED); + SCF_PROPERTY_ENABLED); if (scf_simple_prop_numvalues(prop) == 1) { if (*scf_simple_prop_next_boolean(prop) != 0) diff --git a/usr/src/lib/lvm/libmeta/common/meta_trans.c b/usr/src/lib/lvm/libmeta/common/meta_trans.c index 240ac4b3c0..f01e6b9c08 100644 --- a/usr/src/lib/lvm/libmeta/common/meta_trans.c +++ b/usr/src/lib/lvm/libmeta/common/meta_trans.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Just in case we're not in a build environment, make sure that * TEXT_DOMAIN gets set to something. @@ -55,10 +53,8 @@ meta_trans_replace(mdsetname_t *sp, mdname_t *transnp, mdname_t *oldnp, mdname_t *newnp, mdcmdopts_t options, md_error_t *ep) { replace_params_t params; - md_dev64_t old_dev, - new_dev; - daddr_t new_start_blk, - new_end_blk; + md_dev64_t old_dev, new_dev; + daddr_t new_start_blk, new_end_blk; /* should have same set */ assert(sp != NULL); @@ -657,7 +653,7 @@ mt_l_error_to_action( is_mounted = (meta_check_inuse(sp, p->namep, MDCHK_MOUNTED, ep) != 0); - if (!mdisok(ep) && mdiserror(ep, MDE_IS_MOUNTED)) { + if (!mdisok(ep) && mdisuseerror(ep, MDE_IS_MOUNTED)) { goto out; } @@ -714,7 +710,7 @@ mt_l_error_to_action( is_mounted = (meta_check_inuse(sp, p->namep, MDCHK_MOUNTED, ep) != 0); - if (!mdisok(ep) && mdiserror(ep, MDE_IS_MOUNTED)) { + if (!mdisok(ep) && mdisuseerror(ep, MDE_IS_MOUNTED)) { goto out; } @@ -771,13 +767,13 @@ mt_l_error_to_action( } len = strlen(umnt_msg) + strlen(fsck_msg) + strlen(mnt_msg) + - (only_fsck? 1: 0) + 1; + (only_fsck? 1: 0) + 1; if (!(rmsg = Zalloc(len))) { len = 0; goto out; } rc = snprintf(rmsg, len, "%s%s%s%s", umnt_msg, fsck_msg, - !only_fsck? "\n": "", mnt_msg); + !only_fsck? "\n": "", mnt_msg); if (rc == EOF) { goto out; } @@ -982,22 +978,22 @@ trans_report( dgettext(TEXT_DOMAIN, "Master Device"), dgettext(TEXT_DOMAIN, "Start Block"), dgettext(TEXT_DOMAIN, "Dbase"), - dgettext(TEXT_DOMAIN, "Reloc")) == EOF) { + dgettext(TEXT_DOMAIN, "Reloc")) == EOF) { goto out; } /* populate the key in the name_p structure */ if ((didnp = metadevname(&sp, - transp->masternamep->dev, ep)) == NULL) { + transp->masternamep->dev, ep)) == NULL) { return (-1); } /* determine if devid does NOT exist */ if (options & PRINT_DEVID) - if ((dtp = meta_getdidbykey(sp->setno, getmyside(sp, ep), - didnp->key, ep)) == NULL) + if ((dtp = meta_getdidbykey(sp->setno, + getmyside(sp, ep), didnp->key, ep)) == NULL) { devid = dgettext(TEXT_DOMAIN, "No "); - else { + } else { devid = dgettext(TEXT_DOMAIN, "Yes"); free(dtp); } @@ -1338,7 +1334,7 @@ log_report( dgettext(TEXT_DOMAIN, "Logging Device"), dgettext(TEXT_DOMAIN, "Start Block"), dgettext(TEXT_DOMAIN, "Dbase"), - dgettext(TEXT_DOMAIN, "Reloc")) == EOF) { + dgettext(TEXT_DOMAIN, "Reloc")) == EOF) { goto out; } /* get info */ @@ -1361,10 +1357,10 @@ log_report( /* determine if devid does NOT exist */ if (options & PRINT_DEVID) - if ((dtp = meta_getdidbykey(sp->setno, getmyside(sp, ep), - didnp->key, ep)) == NULL) + if ((dtp = meta_getdidbykey(sp->setno, + getmyside(sp, ep), didnp->key, ep)) == NULL) { devid = dgettext(TEXT_DOMAIN, "No "); - else { + } else { devid = dgettext(TEXT_DOMAIN, "Yes"); free(dtp); } @@ -1504,7 +1500,7 @@ meta_lockfs_common(mdname_t *fs, void **cookie, int lockit) (void) fclose(m); switch (pid = fork()) { - case -1: + case -1: /* * We've got some major trouble here and shouldn't * continue. The user needs to clear up the problems @@ -1515,7 +1511,7 @@ meta_lockfs_common(mdname_t *fs, void **cookie, int lockit) *cookie = 0; return (1); - case 0: + case 0: (void) execl("/usr/sbin/lockfs", "lockfs", lockit ? "-w" : "-u", "-c", "Solaris Volume Manager detach lock", tab_match.mnt_mountp, 0); @@ -1527,7 +1523,7 @@ meta_lockfs_common(mdname_t *fs, void **cookie, int lockit) */ exit(1); - default: + default: if (waitpid(pid, &lock_exit, 0) != pid) { /* * We couldn't get status regarding the diff --git a/usr/src/lib/smbsrv/libmlsvc/common/smb_logon.c b/usr/src/lib/smbsrv/libmlsvc/common/smb_logon.c index 71b6f278d6..4b7a1cd178 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/smb_logon.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/smb_logon.c @@ -308,7 +308,9 @@ smb_token_create_privs(smb_token_t *token) smb_lgrp_iterclose(&gi); if (token->tkn_flags & SMB_ATF_ADMIN) { - rc = smb_lgrp_getbyname("Administrators", &grp); + char admgrp[] = "Administrators"; + + rc = smb_lgrp_getbyname(admgrp, &grp); if (rc == SMB_LGRP_SUCCESS) { smb_privset_merge(privs, grp.sg_privs); smb_lgrp_free(&grp); |