summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/init/init.c28
-rw-r--r--usr/src/cmd/svc/startd/specials.c8
-rw-r--r--usr/src/cmd/utmpd/svc-utmpd6
-rw-r--r--usr/src/cmd/utmpd/utmpd.c6
-rw-r--r--usr/src/lib/fm/topo/modules/Makefile.plugin5
-rw-r--r--usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_hostbridge.c4
-rw-r--r--usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_ioboard.c6
-rw-r--r--usr/src/lib/fm/topo/modules/common/disk/disk.c20
-rw-r--r--usr/src/lib/fm/topo/modules/common/pcibus/pcibus.c9
-rw-r--r--usr/src/lib/fm/topo/modules/sun4/ioboard/ioboard.c3
-rw-r--r--usr/src/lib/fm/topo/modules/sun4v/hostbridge/hb_sun4v.c5
-rw-r--r--usr/src/lib/fm/topo/modules/sun4v/motherboard/motherboard.c10
-rw-r--r--usr/src/lib/libc/port/gen/getutx.c6
-rw-r--r--usr/src/lib/libipmi/common/ipmi_impl.h5
-rw-r--r--usr/src/lib/libipmi/common/ipmi_sdr.c25
-rw-r--r--usr/src/lib/libipmi/common/libipmi.c1
16 files changed, 94 insertions, 53 deletions
diff --git a/usr/src/cmd/init/init.c b/usr/src/cmd/init/init.c
index aeb494e74f..1449c6c2c0 100644
--- a/usr/src/cmd/init/init.c
+++ b/usr/src/cmd/init/init.c
@@ -457,8 +457,8 @@ struct init_state {
* Useful file and device names.
*/
static char *CONSOLE = "/dev/console"; /* Real system console */
-static char *INITPIPE_DIR = "/etc";
-static char *INITPIPE = "/etc/initpipe";
+static char *INITPIPE_DIR = "/var/run";
+static char *INITPIPE = "/var/run/initpipe";
#define INIT_STATE_DIR "/etc/svc/volatile"
static const char * const init_state_file = INIT_STATE_DIR "/init.state";
@@ -486,6 +486,7 @@ static char *SH = "/sbin/sh"; /* Standard shell */
static int prior_state;
static int prev_state; /* State "init" was in last time it woke */
static int new_state; /* State user wants "init" to go to. */
+static int lvlq_received; /* Explicit request to examine state */
static int op_modes = BOOT_MODES; /* Current state of "init" */
static int Gchild = 0; /* Flag to indicate "godchild" died, set in */
/* childeath() and cleared in cleanaux() */
@@ -725,12 +726,16 @@ main(int argc, char *argv[])
prev_state = prior_state = cur_state;
+ setup_pipe();
+
/*
* Here is the beginning of the main process loop.
*/
for (;;) {
- if (Pfd < 0)
+ if (lvlq_received) {
setup_pipe();
+ lvlq_received = B_FALSE;
+ }
/*
* Clean up any accounting records for dead "godchildren".
@@ -2174,8 +2179,8 @@ init_signals(void)
/*
* Set up pipe for "godchildren". If the file exists and is a pipe just open
* it. Else, if the file system is r/w create it. Otherwise, defer its
- * creation and open until after the sysinit functions have had a chance to
- * make the root read/write.
+ * creation and open until after /var/run has been mounted. This function is
+ * only called on startup and when explicitly requested via LVLQ.
*/
void
setup_pipe()
@@ -2184,6 +2189,13 @@ setup_pipe()
struct statvfs statvfs_buf;
struct sigaction act;
+ /*
+ * Always close the previous pipe descriptor as the mounted filesystems
+ * may have changed.
+ */
+ if (Pfd >= 0)
+ (void) close(Pfd);
+
if ((stat(INITPIPE, &stat_buf) == 0) &&
((stat_buf.st_mode & (S_IFMT|S_IRUSR)) == (S_IFIFO|S_IRUSR)))
Pfd = open(INITPIPE, O_RDWR | O_NDELAY);
@@ -2254,10 +2266,12 @@ siglvl(int sig, siginfo_t *sip, ucontext_t *ucp)
* signal is not a LVLQ, set the new level to the signal
* received.
*/
- if (sig == LVLQ)
+ if (sig == LVLQ) {
new_state = cur_state;
- else
+ lvlq_received = B_TRUE;
+ } else {
new_state = sig;
+ }
/*
* Clear all times and repeat counts in the process table
diff --git a/usr/src/cmd/svc/startd/specials.c b/usr/src/cmd/svc/startd/specials.c
index 012c707a37..9cc5273ef0 100644
--- a/usr/src/cmd/svc/startd/specials.c
+++ b/usr/src/cmd/svc/startd/specials.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -119,7 +119,7 @@ special_fsminimal_post_online()
case -1:
default:
log_error(LOG_WARNING, gettext("couldn't check status of "
- "root filesystem: %s\n"), strerror(errno));
+ "root filesystem: %s\n"), strerror(errno));
break;
}
@@ -130,7 +130,7 @@ special_fsminimal_post_online()
"read-only after system/filesystem/minimal\n");
if (fs_remount("/var"))
log_framework(LOG_WARNING, "/var "
- "filesystem remount failed\n");
+ "filesystem remount failed\n");
}
break;
case 0:
@@ -154,7 +154,7 @@ special_fsminimal_post_online()
log_init();
/*
- * Poke init so it will create /etc/initpipe.
+ * Poke init so it will create /var/run/initpipe.
*/
if (zone_getattr(getzoneid(), ZONE_ATTR_INITPID, &init_pid,
sizeof (init_pid)) != sizeof (init_pid)) {
diff --git a/usr/src/cmd/utmpd/svc-utmpd b/usr/src/cmd/utmpd/svc-utmpd
index cb890eb338..9f7c1ad520 100644
--- a/usr/src/cmd/utmpd/svc-utmpd
+++ b/usr/src/cmd/utmpd/svc-utmpd
@@ -20,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -32,12 +32,12 @@
# If a utmppipe exists, check for a utmpd process and exit
# if the daemon is already running.
-if [ -p /etc/utmppipe ]; then
+if [ -p /var/run/utmppipe ]; then
if /usr/bin/pgrep -x -u 0 -z `smf_zonename` utmpd >/dev/null 2>&1; then
echo "$0: utmpd is already running"
exit 1
fi
fi
-/usr/bin/rm -f /etc/utmppipe
+/usr/bin/rm -f /var/run/utmppipe
/usr/lib/utmpd &
diff --git a/usr/src/cmd/utmpd/utmpd.c b/usr/src/cmd/utmpd/utmpd.c
index 252a0eb940..8de0fbd6e8 100644
--- a/usr/src/cmd/utmpd/utmpd.c
+++ b/usr/src/cmd/utmpd/utmpd.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -134,8 +134,8 @@ static pollfd_t *fdtable = NULL;
static int pidcnt = 0; /* Number of procs being watched */
static char *prog_name; /* To save the invocation name away */
-static char *UTMPPIPE_DIR = "/etc";
-static char *UTMPPIPE = "/etc/utmppipe";
+static char *UTMPPIPE_DIR = "/var/run";
+static char *UTMPPIPE = "/var/run/utmppipe";
static int Pfd = -1; /* File descriptor of named pipe */
static int Poll_timeout = POLL_TIMEOUT;
static int WTMPXfd = -1; /* File descriptor of WTMPX_FILE */
diff --git a/usr/src/lib/fm/topo/modules/Makefile.plugin b/usr/src/lib/fm/topo/modules/Makefile.plugin
index 58692cc9b4..fd459b0bb5 100644
--- a/usr/src/lib/fm/topo/modules/Makefile.plugin
+++ b/usr/src/lib/fm/topo/modules/Makefile.plugin
@@ -55,7 +55,7 @@ arch_ROOTCONF = $(ROOT)/usr/platform/$(ARCH)/lib/fm/topo/plugins/$(CONF)
plat_ROOTCONF = $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/topo/plugins/$(CONF))
ROOTCONF = $($(CLASS)_ROOTCONF)
-LINTFLAGS += -mu
+LINTFLAGS = -msux
LINTFILES = $(SRCS:%.c=%.ln)
APIMAP = ../../../libtopo/common/topo_mod.map
@@ -67,7 +67,8 @@ CFLAGS += -G $(XREGSFLAG)
CPPFLAGS += -I.
CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT
LDFLAGS += $(ZIGNORE) -M$(APIMAP)
-LDLIBS += -L$(ROOTLIBDIR)/fm -R/usr/lib/fm -ltopo -lnvpair -lc
+LDLIBS += -L$(ROOTLIBDIR)/fm -ltopo -lnvpair -lc
+DYNFLAGS += -R/usr/lib/fm
all: $(PROG)
diff --git a/usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_hostbridge.c b/usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_hostbridge.c
index 875db20b08..2392dc136c 100644
--- a/usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_hostbridge.c
+++ b/usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_hostbridge.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -127,7 +127,7 @@ opl_rc_node_create(topo_mod_t *mp, tnode_t *parent, di_node_t dnode, int inst)
char fru_str[64];
nvlist_t *fru_fmri;
/* Add FRU fmri */
- snprintf(fru_str, sizeof (fru_str), "hc:///component=%s",
+ (void) snprintf(fru_str, sizeof (fru_str), "hc:///component=%s",
slot_name);
if (topo_mod_str2nvl(mp, fru_str, &fru_fmri) == 0) {
(void) topo_node_fru_set(rcn, fru_fmri, 0, &err);
diff --git a/usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_ioboard.c b/usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_ioboard.c
index 144d901900..e679dce9aa 100644
--- a/usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_ioboard.c
+++ b/usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_ioboard.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -182,13 +182,13 @@ opl_iob_node_create(topo_mod_t *mp, tnode_t *parent, int inst)
}
nvlist_free(fmri);
/* Create and add FRU fmri for this ioboard */
- snprintf(fmri_str, sizeof (fmri_str), IOBDFRU, inst);
+ (void) snprintf(fmri_str, sizeof (fmri_str), IOBDFRU, inst);
if (topo_mod_str2nvl(mp, fmri_str, &fmri) == 0) {
(void) topo_node_fru_set(ion, fmri, 0, &err);
nvlist_free(fmri);
}
/* Add label for this ioboard */
- snprintf(label, sizeof (label), LABEL, inst);
+ (void) snprintf(label, sizeof (label), LABEL, inst);
(void) topo_node_label_set(ion, label, &err);
/* Create range of hostbridges on this ioboard */
diff --git a/usr/src/lib/fm/topo/modules/common/disk/disk.c b/usr/src/lib/fm/topo/modules/common/disk/disk.c
index a992389aef..8253eabb9c 100644
--- a/usr/src/lib/fm/topo/modules/common/disk/disk.c
+++ b/usr/src/lib/fm/topo/modules/common/disk/disk.c
@@ -201,7 +201,7 @@ disk_set_proto_props(topo_mod_t *mod, tnode_t *dtn, int pinst)
}
nvlist_free(asru);
- snprintf(label, sizeof (label), "HD_ID_%d", pinst);
+ (void) snprintf(label, sizeof (label), "HD_ID_%d", pinst);
if (topo_node_label_set(dtn, label, &err) != 0) {
topo_mod_dprintf(mod, "%s: label error %s\n", func,
topo_strerror(err));
@@ -249,9 +249,6 @@ disk_set_props(tnode_t *dtn, tnode_t *parent, char *model, char *manuf,
int inst = topo_node_instance(parent);
disk_di_node_t *dnode;
- topo_prop_get_string(parent, TOPO_BINDING_PGROUP, TOPO_BINDING_OCCUPANT,
- &device, err);
-
dnode = topo_node_getspecific(dtn);
/* set the protocol group properties */
@@ -269,10 +266,14 @@ disk_set_props(tnode_t *dtn, tnode_t *parent, char *model, char *manuf,
/* create/set the devfs-path in the io group */
(void) topo_pgroup_create(dtn, &io_pgroup, err);
- (void) topo_prop_set_string(dtn, TOPO_PGROUP_IO,
- TOPO_IO_DEV_PATH, TOPO_PROP_IMMUTABLE, device, err);
- topo_mod_strfree(mod, device);
+ if (topo_prop_get_string(parent, TOPO_BINDING_PGROUP,
+ TOPO_BINDING_OCCUPANT, &device, err) == 0) {
+ (void) topo_prop_set_string(dtn, TOPO_PGROUP_IO,
+ TOPO_IO_DEV_PATH, TOPO_PROP_IMMUTABLE, device, err);
+
+ topo_mod_strfree(mod, device);
+ }
/* create the storage group */
(void) topo_pgroup_create(dtn, &storage_pgroup, err);
@@ -449,8 +450,9 @@ disk_enum(topo_mod_t *mod, tnode_t *rnode, const char *name,
return (-1);
}
- topo_prop_get_string(rnode, TOPO_BINDING_PGROUP, TOPO_BINDING_OCCUPANT,
- &device, &err);
+ if (topo_prop_get_string(rnode, TOPO_BINDING_PGROUP,
+ TOPO_BINDING_OCCUPANT, &device, &err) != 0)
+ return (-1);
if ((dnode = disk_di_node_match_device(device)) == NULL) {
topo_mod_dprintf(mod,
diff --git a/usr/src/lib/fm/topo/modules/common/pcibus/pcibus.c b/usr/src/lib/fm/topo/modules/common/pcibus/pcibus.c
index 88d10c8cee..468b363c4f 100644
--- a/usr/src/lib/fm/topo/modules/common/pcibus/pcibus.c
+++ b/usr/src/lib/fm/topo/modules/common/pcibus/pcibus.c
@@ -293,7 +293,11 @@ pcidev_declare(topo_mod_t *mod, tnode_t *parent, di_node_t dn,
* from our parent node's private data.
*/
- did_inherit(ppd, pd);
+ if (did_inherit(ppd, pd) != 0) {
+ topo_node_unbind(ntn);
+ return (NULL);
+ }
+
if (did_props_set(ntn, pd, Dev_common_props, Dev_propcnt) < 0) {
topo_node_unbind(ntn);
return (NULL);
@@ -507,7 +511,8 @@ pciexbus_enum(topo_mod_t *mp, tnode_t *ptn, char *pnm, topo_instance_t min,
"Unable to proceed with %s enumeration.\n", pnm, PCIEX_BUS);
return (0);
}
- did_hash_init(mp);
+ if (did_hash_init(mp) != 0)
+ return (-1);
if ((did_create(mp, pdn, 0, 0, rc, TRUST_BDF)) == NULL)
return (-1); /* errno already set */
diff --git a/usr/src/lib/fm/topo/modules/sun4/ioboard/ioboard.c b/usr/src/lib/fm/topo/modules/sun4/ioboard/ioboard.c
index 198e901440..6c268bde8b 100644
--- a/usr/src/lib/fm/topo/modules/sun4/ioboard/ioboard.c
+++ b/usr/src/lib/fm/topo/modules/sun4/ioboard/ioboard.c
@@ -133,7 +133,8 @@ iob_enum(topo_mod_t *mp, tnode_t *pn, const char *name, topo_instance_t imin,
return (-1);
}
- did_hash_init(mp);
+ if (did_hash_init(mp) != 0)
+ return (-1);
rv = platform_iob_enum(mp, pn, imin, imax);
diff --git a/usr/src/lib/fm/topo/modules/sun4v/hostbridge/hb_sun4v.c b/usr/src/lib/fm/topo/modules/sun4v/hostbridge/hb_sun4v.c
index 4daf1f6e73..54b0ccb09d 100644
--- a/usr/src/lib/fm/topo/modules/sun4v/hostbridge/hb_sun4v.c
+++ b/usr/src/lib/fm/topo/modules/sun4v/hostbridge/hb_sun4v.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -77,7 +77,8 @@ pci_hostbridges_find(topo_mod_t *mod, tnode_t *ptn)
}
pnode = di_drv_next_node(pnode);
}
- rcs_process(mod, rcs, ptn);
+ if (rcs_process(mod, rcs, ptn) != 0)
+ return (-1);
busorrc_free(mod, rcs);
return (0);
}
diff --git a/usr/src/lib/fm/topo/modules/sun4v/motherboard/motherboard.c b/usr/src/lib/fm/topo/modules/sun4v/motherboard/motherboard.c
index 18100982c0..c42c1f852a 100644
--- a/usr/src/lib/fm/topo/modules/sun4v/motherboard/motherboard.c
+++ b/usr/src/lib/fm/topo/modules/sun4v/motherboard/motherboard.c
@@ -274,8 +274,14 @@ mb_tnode_create(topo_mod_t *mod, tnode_t *parent,
(void) mb_get_pri_info(mod, &serial, &part, &csn);
if (nvlist_lookup_string(auth, FM_FMRI_AUTH_CHASSIS, &pstr) != 0 &&
- csn != NULL)
- nvlist_add_string(auth, FM_FMRI_AUTH_CHASSIS, csn);
+ csn != NULL) {
+ if (nvlist_add_string(auth, FM_FMRI_AUTH_CHASSIS, csn) != 0) {
+ topo_mod_dprintf(mod,
+ "failed to add chassis to auth");
+ nvlist_free(auth);
+ return (NULL);
+ }
+ }
fmri = topo_mod_hcfmri(mod, NULL, FM_HC_SCHEME_VERSION, name, i,
NULL, auth, part, NULL, serial);
diff --git a/usr/src/lib/libc/port/gen/getutx.c b/usr/src/lib/libc/port/gen/getutx.c
index 255282d406..3d8e69cf4e 100644
--- a/usr/src/lib/libc/port/gen/getutx.c
+++ b/usr/src/lib/libc/port/gen/getutx.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -91,8 +91,8 @@
#define MAXFILE 79 /* Maximum pathname length for "utmpx" file */
#define MAXVAL 255 /* max value for an id `character' */
-#define IPIPE "/etc/initpipe" /* FIFO to send pids to init */
-#define UPIPE "/etc/utmppipe" /* FIFO to send pids to utmpd */
+#define IPIPE "/var/run/initpipe" /* FIFO to send pids to init */
+#define UPIPE "/var/run/utmppipe" /* FIFO to send pids to utmpd */
#define VAR_UTMPX_FILE "/var/adm/utmpx" /* for sanity check only */
diff --git a/usr/src/lib/libipmi/common/ipmi_impl.h b/usr/src/lib/libipmi/common/ipmi_impl.h
index 619b048186..0a22c061d7 100644
--- a/usr/src/lib/libipmi/common/ipmi_impl.h
+++ b/usr/src/lib/libipmi/common/ipmi_impl.h
@@ -83,6 +83,11 @@ extern void *impi_realloc(ipmi_handle_t *, void *, size_t);
*/
extern ipmi_transport_t ipmi_transport_bmc;
+/*
+ * Miscellaneous routines
+ */
+extern void ipmi_sdr_clear(ipmi_handle_t *);
+
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/lib/libipmi/common/ipmi_sdr.c b/usr/src/lib/libipmi/common/ipmi_sdr.c
index 052bb2f89b..75aa33ab07 100644
--- a/usr/src/lib/libipmi/common/ipmi_sdr.c
+++ b/usr/src/lib/libipmi/common/ipmi_sdr.c
@@ -78,16 +78,7 @@ ipmi_sdr_refresh(ipmi_handle_t *ihp)
ipmi_sdr_generic_locator_t *gen_src, *gen_dst;
ipmi_sdr_fru_locator_t *fru_src, *fru_dst;
- /*
- * Free any existing SDRs.
- */
- while (ihp->ih_sdr_cache != NULL) {
- ent = ihp->ih_sdr_cache->isc_next;
- ipmi_free(ihp, ent->isc_generic);
- ipmi_free(ihp, ent->isc_fru);
- ipmi_free(ihp, ent);
- ihp->ih_sdr_cache = ent;
- }
+ ipmi_sdr_clear(ihp);
/*
* Iterate over all existing SDRs and add them to the cache.
@@ -147,6 +138,20 @@ ipmi_sdr_refresh(ipmi_handle_t *ihp)
return (0);
}
+void
+ipmi_sdr_clear(ipmi_handle_t *ihp)
+{
+ ipmi_sdr_cache_ent_t *ent, *next;
+
+ while ((ent = ihp->ih_sdr_cache) != NULL) {
+ next = ent->isc_next;
+ ipmi_free(ihp, ent->isc_generic);
+ ipmi_free(ihp, ent->isc_fru);
+ ipmi_free(ihp, ent);
+ ihp->ih_sdr_cache = next;
+ }
+}
+
ipmi_sdr_t *
ipmi_sdr_get(ipmi_handle_t *ihp, uint16_t id, uint16_t *next)
{
diff --git a/usr/src/lib/libipmi/common/libipmi.c b/usr/src/lib/libipmi/common/libipmi.c
index 84d5c51690..edc4609691 100644
--- a/usr/src/lib/libipmi/common/libipmi.c
+++ b/usr/src/lib/libipmi/common/libipmi.c
@@ -70,6 +70,7 @@ ipmi_close(ipmi_handle_t *ihp)
{
if (ihp->ih_transport && ihp->ih_tdata)
ihp->ih_transport->it_close(ihp->ih_tdata);
+ ipmi_sdr_clear(ihp);
free(ihp);
}