summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordp <none@none>2006-03-09 01:36:44 -0800
committerdp <none@none>2006-03-09 01:36:44 -0800
commit6927f468b0af7710df000f6b16f6ee413e1e3007 (patch)
tree7402871f85c8bdc366c20b330ea94441180ff760
parentfea70b5430ad76f6dd4330a35518de5f17b52e96 (diff)
downloadillumos-gate-6927f468b0af7710df000f6b16f6ee413e1e3007.tar.gz
PSARC/2006/163 SMF_ZONENAME variable for smf_method(5)
6392792 calls to zonename(1) should be standardized, minimized
-rw-r--r--usr/src/cmd/auditd/svc-auditd10
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/slpd/slp11
-rw-r--r--usr/src/cmd/cron/svc-cron9
-rw-r--r--usr/src/cmd/fs.d/nfs/svc/nfs-server9
-rw-r--r--usr/src/cmd/initpkg/init.d/volmgt17
-rw-r--r--usr/src/cmd/initpkg/rc2.sh30
-rw-r--r--usr/src/cmd/initpkg/rc3.sh31
-rw-r--r--usr/src/cmd/initpkg/rcS.sh48
-rw-r--r--usr/src/cmd/kbd/keymap31
-rw-r--r--usr/src/cmd/pools/poold/svc-poold22
-rw-r--r--usr/src/cmd/pools/svc-pools18
-rw-r--r--usr/src/cmd/rpcsvc/nis/bin/nisclient.sh9
-rw-r--r--usr/src/cmd/rpcsvc/nis/bin/nisserver.sh9
-rw-r--r--usr/src/cmd/svc/milestone/boot-archive20
-rw-r--r--usr/src/cmd/svc/milestone/devices-local15
-rw-r--r--usr/src/cmd/svc/milestone/fs-root17
-rw-r--r--usr/src/cmd/svc/milestone/fs-usr9
-rw-r--r--usr/src/cmd/svc/milestone/identity-node12
-rw-r--r--usr/src/cmd/svc/milestone/net-init23
-rw-r--r--usr/src/cmd/svc/milestone/net-loopback13
-rw-r--r--usr/src/cmd/svc/milestone/net-physical17
-rw-r--r--usr/src/cmd/svc/milestone/net-svc14
-rw-r--r--usr/src/cmd/svc/shell/smf_include.sh37
-rw-r--r--usr/src/cmd/svc/startd/env.c27
-rw-r--r--usr/src/cmd/syseventd/svc-syseventd9
-rw-r--r--usr/src/cmd/syslogd/system-log10
-rw-r--r--usr/src/cmd/utmpd/svc-utmpd10
-rw-r--r--usr/src/cmd/volmgt/etc/svc-volfs2
-rw-r--r--usr/src/cmd/ypcmd/ypstart.sh9
29 files changed, 227 insertions, 271 deletions
diff --git a/usr/src/cmd/auditd/svc-auditd b/usr/src/cmd/auditd/svc-auditd
index cfeae6a5db..f5dc38abfc 100644
--- a/usr/src/cmd/auditd/svc-auditd
+++ b/usr/src/cmd/auditd/svc-auditd
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -34,7 +33,6 @@
. /lib/svc/share/smf_include.sh
AUDITCONFIG=/usr/sbin/auditconfig
-ZONE=`/sbin/zonename`
AUDITCOND=`$AUDITCONFIG -getcond 2> /dev/null`
@@ -47,7 +45,7 @@ fi
# In a non-global zone, auditd is started only if the "perzone"
# audit policy has been set.
-if [ "$ZONE" != "global" ]; then
+if smf_is_nonglobalzone; then
echo `$AUDITCONFIG -getpolicy` | grep perzone > /dev/null
if [ $? -eq 1 ]; then
diff --git a/usr/src/cmd/cmd-inet/usr.lib/slpd/slp b/usr/src/cmd/cmd-inet/usr.lib/slpd/slp
index 1fd7565897..9ae3027621 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/slpd/slp
+++ b/usr/src/cmd/cmd-inet/usr.lib/slpd/slp
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -51,7 +50,7 @@ case "$1" in
'stop')
# Kill the slpd proxy.
- /usr/bin/pkill -x -u 0 -P 1 -z `/sbin/zonename` $SLPD
+ /usr/bin/pkill -x -u 0 -P 1 -z `smf_zonename` $SLPD
# If a configuration file exists signal a shutdown to the real slpd.
[ -f $CONF ] && {
@@ -64,7 +63,7 @@ case "$1" in
sleep 5
# The pattern must not exceed 80 chars!
- /usr/bin/pkill -x -f -u 0 -P 1,$$ -z `/sbin/zonename` \
+ /usr/bin/pkill -x -f -u 0 -P 1,$$ -z `smf_zonename` \
"${JAVA_BIN}.*-classpath ${CLASSPATH} .*"
}
diff --git a/usr/src/cmd/cron/svc-cron b/usr/src/cmd/cron/svc-cron
index 6dfa01b806..4def6071b8 100644
--- a/usr/src/cmd/cron/svc-cron
+++ b/usr/src/cmd/cron/svc-cron
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -32,7 +31,7 @@
. /lib/svc/share/smf_include.sh
if [ -p /etc/cron.d/FIFO ]; then
- if /usr/bin/pgrep -x -u 0 -z `/sbin/zonename` cron >/dev/null 2>&1; then
+ if /usr/bin/pgrep -x -u 0 -z `smf_zonename` cron >/dev/null 2>&1; then
echo "$0: cron is already running"
exit $SMF_EXIT_ERR_NOSMF
fi
diff --git a/usr/src/cmd/fs.d/nfs/svc/nfs-server b/usr/src/cmd/fs.d/nfs/svc/nfs-server
index 7ce855b79f..82b48ced37 100644
--- a/usr/src/cmd/fs.d/nfs/svc/nfs-server
+++ b/usr/src/cmd/fs.d/nfs/svc/nfs-server
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -29,12 +28,12 @@
# Start/stop processes required for server NFS
. /lib/svc/share/smf_include.sh
-zone=${_INIT_ZONENAME:=`/sbin/zonename`}
+zone=`smf_zonename`
case "$1" in
'start')
# The NFS server is not supported in a local zone
- if [ $zone != "global" ] ; then
+ if smf_is_nonglobalzone; then
/usr/sbin/svcadm disable -t svc:/network/nfs/server
echo "The NFS server is not supported in a local zone"
sleep 5 &
diff --git a/usr/src/cmd/initpkg/init.d/volmgt b/usr/src/cmd/initpkg/init.d/volmgt
index 5d9d2ce4da..e7a155f89e 100644
--- a/usr/src/cmd/initpkg/init.d/volmgt
+++ b/usr/src/cmd/initpkg/init.d/volmgt
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,15 +20,21 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
+. /lib/svc/share/smf_include.sh
+
+if smf_is_nonglobalzone; then
+ echo "Volume management is not available in non-global zones."
+ exit 1
+fi
+
case "$1" in
'start')
- if [ -f /etc/vold.conf -a -f /usr/sbin/vold -a \
- "${_INIT_ZONENAME:=`/sbin/zonename`}" = "global" ]; then
+ if [ -f /etc/vold.conf -a -f /usr/sbin/vold ]; then
echo 'volume management starting.'
svcadm enable svc:/system/filesystem/volfs:default
fi
diff --git a/usr/src/cmd/initpkg/rc2.sh b/usr/src/cmd/initpkg/rc2.sh
index 979890592f..d9628c977f 100644
--- a/usr/src/cmd/initpkg/rc2.sh
+++ b/usr/src/cmd/initpkg/rc2.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -25,7 +24,7 @@
# All rights reserved.
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -41,6 +40,8 @@ if [ -z "$SMF_RESTARTER" ]; then
exit 1
fi
+. /lib/svc/share/smf_include.sh
+
action=$1
# Export boot parameters to rc scripts
@@ -65,23 +66,10 @@ export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
_INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
_INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
-_INIT_ZONENAME=`/sbin/zonename`
-
-export _INIT_ZONENAME
-
-if [ "$_INIT_ZONENAME" = "global" ]; then
- # Export net boot configuration strategy. _INIT_NET_IF is set to the
- # interface name of the netbooted interface if this is a net boot.
- # _INIT_NET_STRATEGY is set to the network configuration strategy.
- set -- `/sbin/netstrategy`
- if [ $? -eq 0 ]; then
- if [ "$1" = "nfs" -o "$1" = "cachefs" ]; then
- _INIT_NET_IF="$2"
- fi
- _INIT_NET_STRATEGY="$3"
- export _INIT_NET_IF _INIT_NET_STRATEGY
- fi
-fi
+#
+# Set _INIT_NET_STRATEGY and _INIT_NET_IF variables from /sbin/netstrategy
+#
+smf_netstrategy
case $action in
stop)
diff --git a/usr/src/cmd/initpkg/rc3.sh b/usr/src/cmd/initpkg/rc3.sh
index bdaa047e9f..fc9d743cb2 100644
--- a/usr/src/cmd/initpkg/rc3.sh
+++ b/usr/src/cmd/initpkg/rc3.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -25,7 +24,7 @@
# All rights reserved.
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -40,6 +39,8 @@ if [ -z "$SMF_RESTARTER" ]; then
exit 1
fi
+. /lib/svc/share/smf_include.sh
+
# Export boot parameters to rc scripts
set -- `/usr/bin/who -r`
@@ -62,23 +63,11 @@ export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
_INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
_INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
-_INIT_ZONENAME=`/sbin/zonename`
-
-export _INIT_ZONENAME
+#
+# Set _INIT_NET_STRATEGY and _INIT_NET_IF variables from /sbin/netstrategy
+#
+smf_netstrategy
-if [ "$_INIT_ZONENAME" = "global" ]; then
- # Export net boot configuration strategy. _INIT_NET_IF is set to the
- # interface name of the netbooted interface if this is a net boot.
- # _INIT_NET_STRATEGY is set to the network configuration strategy.
- set -- `/sbin/netstrategy`
- if [ $? -eq 0 ]; then
- if [ "$1" = "nfs" -o "$1" = "cachefs" ]; then
- _INIT_NET_IF="$2"
- fi
- _INIT_NET_STRATEGY="$3"
- export _INIT_NET_IF _INIT_NET_STRATEGY
- fi
-fi
if [ -d /etc/rc3.d ]; then
for f in /etc/rc3.d/K*; do
@@ -100,7 +89,7 @@ if [ -d /etc/rc3.d ]; then
done
fi
-if [ "$_INIT_ZONENAME" = "global" ]; then
+if smf_is_globalzone; then
# Unload all the loadable modules brought in during boot
# Delay a few seconds to allow dtlogin to open console first.
diff --git a/usr/src/cmd/initpkg/rcS.sh b/usr/src/cmd/initpkg/rcS.sh
index 962035549e..5e41614d7e 100644
--- a/usr/src/cmd/initpkg/rcS.sh
+++ b/usr/src/cmd/initpkg/rcS.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -102,47 +101,10 @@ export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
_INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
_INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
-_INIT_ZONENAME=`/sbin/zonename`
-
-export _INIT_ZONENAME
-
-if [ "$_INIT_ZONENAME" = "global" ]; then
- # Export net boot configuration strategy. _INIT_NET_IF is set to the
- # interface name of the netbooted interface if this is a net boot.
- # _INIT_NET_STRATEGY is set to the network configuration strategy.
- set -- `/sbin/netstrategy`
- if [ $? -eq 0 ]; then
- if [ "$1" = "nfs" -o "$1" = "cachefs" ]; then
- _INIT_NET_IF="$2"
- export _INIT_NET_IF
- fi
- _INIT_NET_STRATEGY="$3"
- fi
-else
- # Special case for zones since netstrategy needs /dev/ip which does
- # not exist in a non-global zone. Also, the _IF variable is only
- # consumed in the global zone.
- _INIT_NET_STRATEGY="none"
-fi
-export _INIT_NET_STRATEGY
-
-#
-# Useful shell functions:
-#
-
-#
-# shcat file
#
-# Simulates cat in sh so it doesn't need to be on the root filesystem.
+# Set _INIT_NET_STRATEGY and _INIT_NET_IF variables from /sbin/netstrategy
#
-shcat() {
- while [ $# -ge 1 ]; do
- while read i; do
- echo "$i"
- done < $1
- shift
- done
-}
+smf_netstrategy
. /lib/svc/share/fs_include.sh
diff --git a/usr/src/cmd/kbd/keymap b/usr/src/cmd/kbd/keymap
index f95d2c147e..85cc35e728 100644
--- a/usr/src/cmd/kbd/keymap
+++ b/usr/src/cmd/kbd/keymap
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -32,20 +31,20 @@
# This file loads keyboard mappings and initializes keyboard defaults
-# At least for now, skip everything if in a non-global zone
-if [ "${_INIT_ZONENAME:=`/sbin/zonename`}" = "global" ]; then
+. /lib/svc/share/smf_include.sh
- #
- # Systems with no hardware keyboard ID may provide an eeprom value,
- # or the value can be supplied in /etc/default/kbd. A value supplied
- # in /etc/default/kbd will override the value supplied in eeprom.
- #
- [ -x /usr/lib/set_keyboard_layout ] && /usr/lib/set_keyboard_layout
+smf_is_globalzone || exit $SMF_EXIT_OK
- # Initialize the keyboard defaults
+#
+# Systems with no hardware keyboard ID may provide an eeprom value,
+# or the value can be supplied in /etc/default/kbd. A value supplied
+# in /etc/default/kbd will override the value supplied in eeprom.
+#
+[ -x /usr/lib/set_keyboard_layout ] && /usr/lib/set_keyboard_layout
+
+# Initialize the keyboard defaults
- [ -h /dev/kbd -a -x /usr/bin/kbd ] && /usr/bin/kbd -i >/dev/null 2>&1
+[ -h /dev/kbd -a -x /usr/bin/kbd ] && /usr/bin/kbd -i >/dev/null 2>&1
- # Load the keymap for the attached keyboard.
- /usr/bin/loadkeys
-fi
+# Load the keymap for the attached keyboard.
+/usr/bin/loadkeys
diff --git a/usr/src/cmd/pools/poold/svc-poold b/usr/src/cmd/pools/poold/svc-poold
index 77b2e32773..98cf94393d 100644
--- a/usr/src/cmd/pools/poold/svc-poold
+++ b/usr/src/cmd/pools/poold/svc-poold
@@ -20,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -30,18 +30,22 @@
. /lib/svc/share/smf_include.sh
-check_requirements () {
- if [ ! -x /sbin/zonename ] || [ ! -x /usr/lib/pool/poold ] ||
- [ "${_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then
- exit $SMF_EXIT_ERR_FATAL
- fi
-}
+if [ ! -x /usr/lib/pool/poold ]; then
+ echo "/usr/lib/pool/poold not found or not executable"
+ exit $SMF_EXIT_ERR_FATAL
+fi
+
+if smf_is_nonglobalzone; then
+ echo "poold cannot be run in non-global zones"
+ exit $SMF_EXIT_ERR_FATAL
+fi
-check_requirements
case "$1" in
'start')
/usr/lib/pool/poold
- if [ $? -ne 0 ]; then
+ err=$?
+ if [ $err -ne 0 ]; then
+ echo "poold failed to start: error $err"
exit $SMF_EXIT_ERR_FATAL
fi
;;
diff --git a/usr/src/cmd/pools/svc-pools b/usr/src/cmd/pools/svc-pools
index 53858cd0fd..6652f2a80e 100644
--- a/usr/src/cmd/pools/svc-pools
+++ b/usr/src/cmd/pools/svc-pools
@@ -20,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -30,14 +30,16 @@
. /lib/svc/share/smf_include.sh
-check_requirements () {
- if [ ! -x /sbin/zonename ] || [ ! -x /usr/sbin/pooladm ] ||
- [ "${_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then
- exit $SMF_EXIT_ERR_FATAL
- fi
-}
+if [ ! -x /usr/sbin/pooladm ]; then
+ echo "/usr/sbin/pooladm not found or not executable"
+ exit $SMF_EXIT_ERR_FATAL
+fi
+
+if smf_is_nonglobalzone; then
+ echo "pools service is only available in the global zone"
+ exit $SMF_EXIT_ERR_FATAL
+fi
-check_requirements
case "$1" in
'start')
/usr/sbin/pooladm -e
diff --git a/usr/src/cmd/rpcsvc/nis/bin/nisclient.sh b/usr/src/cmd/rpcsvc/nis/bin/nisclient.sh
index 273e107b5e..9a768f1e61 100644
--- a/usr/src/cmd/rpcsvc/nis/bin/nisclient.sh
+++ b/usr/src/cmd/rpcsvc/nis/bin/nisclient.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -549,7 +548,7 @@ setup_server()
elif [ -z "$ADDR" ]
then
DEFADDR=""
- zone=`/usr/bin/zonename`
+ zone=`/sbin/zonename`
PROC=`/usr/bin/pgrep -z $zone ypbind`
if [ ! -z "$PROC" ]
then
diff --git a/usr/src/cmd/rpcsvc/nis/bin/nisserver.sh b/usr/src/cmd/rpcsvc/nis/bin/nisserver.sh
index 9c1cdf6225..4969586ab7 100644
--- a/usr/src/cmd/rpcsvc/nis/bin/nisserver.sh
+++ b/usr/src/cmd/rpcsvc/nis/bin/nisserver.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -1459,7 +1458,7 @@ nonroot_master()
if [ ! -z "$HOST" -a "`tolower $HOST`" = "$LOCALHOST" ]
then
# check to see if already running...
- zone=`/usr/bin/zonename`
+ zone=`/sbin/zonename`
PROC=`pgrep -z $zone rpc.nispasswdd`
if [ -z "$PROC" ]
then
diff --git a/usr/src/cmd/svc/milestone/boot-archive b/usr/src/cmd/svc/milestone/boot-archive
index ed7da420d8..2b34bce166 100644
--- a/usr/src/cmd/svc/milestone/boot-archive
+++ b/usr/src/cmd/svc/milestone/boot-archive
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,11 +20,16 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
+#
+# Check the boot archive content against root filesystem.
+# Return failure if they differ.
+#
+
. /lib/svc/share/smf_include.sh
. /lib/svc/share/fs_include.sh
@@ -36,13 +40,7 @@ if [ `uname -p` = "sparc" ]; then
exit $SMF_EXIT_OK
fi
-#
-# Check the boot archive content against root filesystem.
-# Return failure if they differ.
-#
-if [ "${_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then
- exit $SMF_EXIT_OK
-fi
+smf_is_globalzone || exit $SMF_EXIT_OK
#
# Make sure we return failure only once. If user choose to ignore
diff --git a/usr/src/cmd/svc/milestone/devices-local b/usr/src/cmd/svc/milestone/devices-local
index d58518c56c..767b8fa81f 100644
--- a/usr/src/cmd/svc/milestone/devices-local
+++ b/usr/src/cmd/svc/milestone/devices-local
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
@@ -34,12 +33,10 @@
# device links established so that we can successfully perform our
# remaining standard mounts.
-if [ `/sbin/zonename` != "global" ]; then
- exit 0
-fi
-
. /lib/svc/share/smf_include.sh
+smf_is_globalzone || exit $SMF_EXIT_OK
+
svcprop -q -p system/reconfigure system/svc/restarter:default
if [ $? -eq 0 ]; then
echo 'Configuring devices.' > /dev/msglog 2>&1
@@ -79,4 +76,4 @@ if [ -x /usr/sbin/zfs ]; then
/usr/sbin/zfs volinit || exit $SMF_EXIT_ERR_FATAL
fi
-exit 0
+exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/svc/milestone/fs-root b/usr/src/cmd/svc/milestone/fs-root
index 6ad59053ce..d9d6e2c851 100644
--- a/usr/src/cmd/svc/milestone/fs-root
+++ b/usr/src/cmd/svc/milestone/fs-root
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -128,19 +127,19 @@ sun4u_libc_psr_mount() {
fi
}
+. /lib/svc/share/smf_include.sh
+. /lib/svc/share/fs_include.sh
+
#
# Most of the operations in this script are only necessary in the global
# zone but due to the way initialization scripts like this are packaged,
# it needs to currently exist for all zones.
#
-if [ "${_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then
+if smf_is_nonglobalzone; then
libc_mount
- exit 0
+ exit $SMF_EXIT_OK
fi
-. /lib/svc/share/smf_include.sh
-. /lib/svc/share/fs_include.sh
-
#
# Root is already mounted (by the kernel), but still needs to be
# checked, possibly remounted and entered into mnttab. First
@@ -257,4 +256,4 @@ elif [ "$ARCH" = "sun4u" ]; then
sun4u_libc_psr_mount
fi
-exit 0
+exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/svc/milestone/fs-usr b/usr/src/cmd/svc/milestone/fs-usr
index b2c39bfed4..ef907dfad8 100644
--- a/usr/src/cmd/svc/milestone/fs-usr
+++ b/usr/src/cmd/svc/milestone/fs-usr
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
@@ -42,7 +41,7 @@
# Check and remount the / (root) file system.
# For NFS mounts, force the llock option on.
#
-if [ "${_INIT_ZONENAME:=`/sbin/zonename`}" = "global" ]; then
+if smf_is_globalzone; then
readvfstab / < $vfstab
checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL
checkopt "llock" $mntopts
diff --git a/usr/src/cmd/svc/milestone/identity-node b/usr/src/cmd/svc/milestone/identity-node
index 7f88286e57..c9b20ba669 100644
--- a/usr/src/cmd/svc/milestone/identity-node
+++ b/usr/src/cmd/svc/milestone/identity-node
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -25,7 +24,7 @@
# All rights reserved.
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -68,8 +67,7 @@ case "$_INIT_NET_STRATEGY" in
trap 2 3 ;;
"none") hostname="`shcat /etc/nodename 2>/dev/null`"
if [ -z "$hostname" ]; then
- if [ "${_INIT_ZONENAME:=`/sbin/zonename`}" = "global" ]
- then
+ if smf_is_globalzone; then
hostname=`/sbin/hostconfig -h -p bootparams`
else
hostname=`/sbin/uname -n`
@@ -94,3 +92,5 @@ echo "Hostname: `/sbin/uname -n`" > /dev/msglog
# Reset the library path now that we are past the critical stage
unset LD_LIBRARY_PATH
+
+exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/svc/milestone/net-init b/usr/src/cmd/svc/milestone/net-init
index 4d49484f18..7cbcb48089 100644
--- a/usr/src/cmd/svc/milestone/net-init
+++ b/usr/src/cmd/svc/milestone/net-init
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -46,15 +45,13 @@ case "$1" in
# it tries to do is irrelevant (and will actually lead to the service
# failing if we try to do it), so just bail out.
#
- if [ `/sbin/zonename` != "global" ]; then
- exit 0
- fi
+ smf_is_globalzone || exit $SMF_EXIT_OK
+
;; # Fall through -- rest of script is the initialization code
'stop')
- if [ `/sbin/zonename` != "global" ]; then
- exit 0
- fi
+ smf_is_globalzone || exit $SMF_EXIT_OK
+
#
# If we were routing dynamically, we will note this with
# the .dynamic_routing file, so that we can leave the routes
@@ -62,11 +59,11 @@ case "$1" in
# when we come back into states 2 or 3.
#
if /usr/bin/pgrep -x -u 0 'in.routed|in.rdisc' >/dev/null 2>&1; then
- /usr/bin/pkill -z `/sbin/zonename` -x -u 0 'in.routed|in.rdisc'
+ /usr/bin/pkill -z global -x -u 0 'in.routed|in.rdisc'
> /etc/.dynamic_routing
fi
- /usr/bin/pkill -z `/sbin/zonename` -x -u 0 'in.ndpd|in.ripngd'
- exit 0
+ /usr/bin/pkill -z global -x -u 0 'in.ndpd|in.ripngd'
+ exit $SMF_EXIT_OK
;;
*)
@@ -368,4 +365,4 @@ if [ -f /etc/inet/static_routes ]; then
fi
# Clear exit status.
-exit 0
+exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/svc/milestone/net-loopback b/usr/src/cmd/svc/milestone/net-loopback
index 15f2e038f8..6275b8ebdf 100644
--- a/usr/src/cmd/svc/milestone/net-loopback
+++ b/usr/src/cmd/svc/milestone/net-loopback
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -33,9 +32,7 @@
# it tries to do is irrelevant (and will actually lead to the service
# failing if we try to do it), so just bail out.
#
-if [ `/sbin/zonename` != "global" ]; then
- exit 0
-fi
+smf_is_globalzone || exit $SMF_EXIT_OK
#
# Cause ifconfig to not automatically start in.mpathd when IPMP groups are
@@ -83,5 +80,5 @@ fi
if [ -n "$inet6_list" ]; then
/sbin/ifconfig lo0 inet6 plumb ::1 up
else
- exit 0
+ exit $SMF_EXIT_OK
fi
diff --git a/usr/src/cmd/svc/milestone/net-physical b/usr/src/cmd/svc/milestone/net-physical
index ae728d074b..3e5291a854 100644
--- a/usr/src/cmd/svc/milestone/net-physical
+++ b/usr/src/cmd/svc/milestone/net-physical
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
@@ -30,17 +29,15 @@
#
# ident "%Z%%M% %I% %E% SMI"
+. /lib/svc/share/smf_include.sh
+. /lib/svc/share/net_include.sh
+
#
# In a zone we need this service to be up, but all of the work
# it tries to do is irrelevant (and will actually lead to the service
# failing if we try to do it), so just bail out.
#
-if [ `/sbin/zonename` != "global" ]; then
- exit 0
-fi
-
-. /lib/svc/share/smf_include.sh
-. /lib/svc/share/net_include.sh
+smf_is_globalzone || exit $SMF_EXIT_OK
# Print warnings to console
warn_failed_ifs() {
diff --git a/usr/src/cmd/svc/milestone/net-svc b/usr/src/cmd/svc/milestone/net-svc
index 82a6d14a72..3f9531b8fb 100644
--- a/usr/src/cmd/svc/milestone/net-svc
+++ b/usr/src/cmd/svc/milestone/net-svc
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -32,6 +31,8 @@
# depend on NIS/NIS+ maps.
#
+. /lib/svc/share/smf_include.sh
+
case "$1" in
'start')
#
@@ -39,9 +40,7 @@ case "$1" in
# it tries to do is irrelevant (and will actually lead to the service
# failing if we try to do it), so just bail out.
#
- if [ `/sbin/zonename` != "global" ]; then
- exit 0
- fi
+ smf_is_globalzone || exit 0
;; # Fall through -- rest of script is the initialization code
'stop')
@@ -54,7 +53,6 @@ case "$1" in
;;
esac
-. /lib/svc/share/smf_include.sh
# If boot variables are not set, set variables we use
[ -z "$_INIT_UTS_NODENAME" ] && _INIT_UTS_NODENAME=`/usr/bin/uname -n`
diff --git a/usr/src/cmd/svc/shell/smf_include.sh b/usr/src/cmd/svc/shell/smf_include.sh
index a61bae426e..5376d381bf 100644
--- a/usr/src/cmd/svc/shell/smf_include.sh
+++ b/usr/src/cmd/svc/shell/smf_include.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -35,7 +34,8 @@ smf_clear_env () {
unset \
SMF_FMRI \
SMF_METHOD \
- SMF_RESTARTER
+ SMF_RESTARTER \
+ SMF_ZONENAME
}
# smf_console
@@ -48,7 +48,32 @@ smf_console () {
/usr/bin/tee ${SMF_MSGLOG_REDIRECT:-/dev/msglog}
}
+# smf_zonename
#
+# Prints the name of this zone.
+
+smf_zonename() {
+ echo "${SMF_ZONENAME:=`/sbin/zonename`}"
+}
+
+# smf_is_globalzone
+#
+# Returns zero (success) if this is the global zone. 1 otherwise.
+#
+smf_is_globalzone() {
+ [ "${SMF_ZONENAME:=`/sbin/zonename`}" = "global" ] && return 0
+ return 1
+}
+
+# smf_is_nonglobalzone
+#
+# Returns zero (success) if this is not the global zone. 1 otherwise.
+#
+smf_is_nonglobalzone() {
+ [ "${SMF_ZONENAME:=`/sbin/zonename`}" != "global" ] && return 0
+ return 1
+}
+
# smf_netstrategy
# -> (_INIT_NET_IF, _INIT_NET_STRATEGY)
#
@@ -60,7 +85,7 @@ smf_console () {
# The network boot strategy for a zone is always "none".
#
smf_netstrategy () {
- if [ "${_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then
+ if smf_is_nonglobalzone; then
_INIT_NET_STRATEGY="none" export _INIT_NET_STRATEGY
return 0
fi
diff --git a/usr/src/cmd/svc/startd/env.c b/usr/src/cmd/svc/startd/env.c
index a6612f209a..ec050dffda 100644
--- a/usr/src/cmd/svc/startd/env.c
+++ b/usr/src/cmd/svc/startd/env.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * 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.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -31,6 +30,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <zone.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -49,6 +49,8 @@ static char *ENVFILE = "/etc/default/init"; /* Default env. */
static char **glob_envp; /* Array of environment strings */
static int glob_env_n; /* Number of environment slots allocated. */
+static char zonename[ZONENAME_MAX];
+
/*
* init_env()
* A clone of the work init.c does to provide as much compatibility
@@ -166,6 +168,12 @@ init_env()
/* Append a null pointer to the environment array to mark its end. */
glob_envp[i] = NULL;
+
+ /*
+ * Get the zonename once; it is used to set SMF_ZONENAME for methods.
+ */
+ (void) getzonenamebyid(getzoneid(), zonename, sizeof (zonename));
+
}
static int
@@ -250,10 +258,10 @@ set_smf_env(char **env, size_t env_sz, const char *path,
size_t sz;
/*
- * Max. of glob_env, env, three SMF_ variables,
+ * Max. of glob_env, env, four SMF_ variables,
* path, and terminating NULL.
*/
- nenv_size = glob_env_n + env_sz + 3 + 1 + 1;
+ nenv_size = glob_env_n + env_sz + 4 + 1 + 1;
nenv = startd_zalloc(sizeof (char *) * nenv_size);
@@ -266,7 +274,6 @@ set_smf_env(char **env, size_t env_sz, const char *path,
np++;
}
-
if (inst) {
sz = sizeof ("SMF_FMRI=") + strlen(inst->ri_i.i_fmri);
*np = startd_alloc(sz);
@@ -289,6 +296,12 @@ set_smf_env(char **env, size_t env_sz, const char *path,
(void) strlcat(*np, SCF_SERVICE_STARTD, sz);
np++;
+ sz = sizeof ("SMF_ZONENAME=") + strlen(zonename);
+ *np = startd_alloc(sz);
+ (void) strlcpy(*np, "SMF_ZONENAME=", sz);
+ (void) strlcat(*np, zonename, sz);
+ np++;
+
for (p = glob_envp; *p != NULL; p++) {
if (valid_env_var(*p, inst, path)) {
sz = strlen(*p) + 1;
diff --git a/usr/src/cmd/syseventd/svc-syseventd b/usr/src/cmd/syseventd/svc-syseventd
index 8c54a045fe..db33bf2666 100644
--- a/usr/src/cmd/syseventd/svc-syseventd
+++ b/usr/src/cmd/syseventd/svc-syseventd
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -55,7 +54,7 @@ case "$1" in
dpid=`/usr/bin/pgrep devfsadm`
scpid=`/usr/bin/pgrep syseventconfd`
spid=`/usr/bin/pgrep syseventd`
- zone=`/sbin/zonename`
+ zone=`smf_zonename`
/usr/bin/pkill -x -u 0 -P 1 -z $zone rcm_daemon
/usr/bin/pkill -x -u 0 -P 1 -z $zone syseventd
/usr/bin/pkill -x -u 0 -P 1 -z $zone devfsadm
diff --git a/usr/src/cmd/syslogd/system-log b/usr/src/cmd/syslogd/system-log
index 967a59a63d..3290b5d47c 100644
--- a/usr/src/cmd/syslogd/system-log
+++ b/usr/src/cmd/syslogd/system-log
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -29,8 +28,7 @@
. /lib/svc/share/smf_include.sh
if [ -f /etc/syslog.conf -a -f /usr/sbin/syslogd ]; then
- echo 'syslog service starting.'
- if [ "${_INIT_ZONENAME:=`/sbin/zonename`}" = "global" ]; then
+ if smf_is_globalzone; then
#
# Before syslogd starts, save any messages from
# previous crash dumps so that messages appear
diff --git a/usr/src/cmd/utmpd/svc-utmpd b/usr/src/cmd/utmpd/svc-utmpd
index 852b7c6713..cb890eb338 100644
--- a/usr/src/cmd/utmpd/svc-utmpd
+++ b/usr/src/cmd/utmpd/svc-utmpd
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -34,8 +33,7 @@
# if the daemon is already running.
if [ -p /etc/utmppipe ]; then
- ZONENAME=`/sbin/zonename`
- if /usr/bin/pgrep -x -u 0 -z $ZONENAME utmpd >/dev/null 2>&1; 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
diff --git a/usr/src/cmd/volmgt/etc/svc-volfs b/usr/src/cmd/volmgt/etc/svc-volfs
index a17c0d75f2..31a3e5755d 100644
--- a/usr/src/cmd/volmgt/etc/svc-volfs
+++ b/usr/src/cmd/volmgt/etc/svc-volfs
@@ -57,7 +57,7 @@ fi
case "$1" in
'start')
# volume management is not supported in a local zone
- if [ `/sbin/zonename` != "global" ] ; then
+ if smf_is_nonglobalzone; then
/usr/sbin/svcadm disable -t svc:/system/filesystem/volfs
echo "Volume management is not supported in a local zone"
sleep 5 &
diff --git a/usr/src/cmd/ypcmd/ypstart.sh b/usr/src/cmd/ypcmd/ypstart.sh
index d9c7262f30..69630911eb 100644
--- a/usr/src/cmd/ypcmd/ypstart.sh
+++ b/usr/src/cmd/ypcmd/ypstart.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -47,7 +46,7 @@ fi
echo "starting NIS (YP server) services:\c"
-zone=`/usr/bin/zonename`
+zone=`/sbin/zonename`
if [ -d /var/yp/$domain ]; then
state=`/usr/bin/svcprop -p restarter/state network/nis/server:default`