diff options
Diffstat (limited to 'usr')
-rw-r--r-- | usr/src/cmd/rcm_daemon/Makefile.com | 15 | ||||
-rwxr-xr-x | usr/src/cmd/rcm_daemon/common/SUNW,vdevices.pl | 138 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWldomu.v/Makefile | 4 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWldomu.v/depend | 3 | ||||
-rwxr-xr-x | usr/src/pkgdefs/SUNWldomu.v/postinstall | 36 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWldomu.v/prototype_com | 3 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWldomu.v/prototype_sparc | 5 |
7 files changed, 198 insertions, 6 deletions
diff --git a/usr/src/cmd/rcm_daemon/Makefile.com b/usr/src/cmd/rcm_daemon/Makefile.com index 00a36402f8..a7293e76f1 100644 --- a/usr/src/cmd/rcm_daemon/Makefile.com +++ b/usr/src/cmd/rcm_daemon/Makefile.com @@ -61,6 +61,10 @@ COMMON_MOD_SRC = \ sparc_MOD_SRC = $(COMMON)/ttymux_rcm.c +COMMON_PERL_SCRIPT_SRC = + +sparc_PERL_SCRIPT_SRC = SUNW,vdevices.pl + COMMON_MOD_OBJ = \ filesys_rcm.o \ dump_rcm.o \ @@ -128,6 +132,9 @@ SRCS = $(RCM_SRC) $(COMMON_MOD_SRC) POFILES = $(SRCS:.c=.po) POFILE = prcm_daemon.po +PERL_SCRIPTS = $(COMMON_PERL_SRC) $($(MACH)_PERL_SCRIPT_SRC) +RCM_SCRIPTS = $(PERL_SCRIPTS) + # install specifics ROOTLIB_RCM = $(ROOTLIB)/$(RCM_DIR) @@ -136,6 +143,7 @@ ROOTLIB_RCM_DAEMON = $(RCM_DAEMON:%=$(ROOTLIB_RCM)/%) ROOTLIB_RCM_MODULES = $(COMMON_RCM_MODS:%=$(ROOTLIB_RCM_MOD)/%) \ $($(MACH)_RCM_MODS:%=$(ROOTLIB_RCM_MOD)/%) ROOTLIB_RCM_SCRIPT = $(ROOTLIB_RCM)/$(SCRIPT_DIR) +ROOTLIB_RCM_SCRIPTS = $(RCM_SCRIPTS:%=$(ROOTLIB_RCM_SCRIPT)/%) ROOTETC_RCM = $(ROOTETC)/$(RCM_DIR) ROOTETC_RCM_SCRIPT = $(ROOTETC_RCM)/$(SCRIPT_DIR) @@ -147,6 +155,7 @@ lint := TARGET= lint $(ROOTETC_RCM) := GROUP = sys $(ROOTETC_RCM_SCRIPT) := GROUP = sys +$(ROOTLIB_RCM_SCRIPTS) := FILEMODE = 555 .KEEP_STATE: @@ -159,7 +168,8 @@ install: all \ $(ROOTLIB_RCM_MODULES) \ $(ROOTLIB_RCM_SCRIPT) \ $(ROOTETC_RCM) \ - $(ROOTETC_RCM_SCRIPT) + $(ROOTETC_RCM_SCRIPT) \ + $(ROOTLIB_RCM_SCRIPTS) clean: $(RM) $(RCM_OBJ) $(COMMON_MOD_OBJ) $($(MACH)_MOD_OBJ) $(POFILES) @@ -209,3 +219,6 @@ $(ROOTETC_RCM): $(ROOTETC_RCM_SCRIPT): $(INS.dir) + +$(ROOTLIB_RCM_SCRIPT)/%: $(COMMON)/% + $(INS.file) diff --git a/usr/src/cmd/rcm_daemon/common/SUNW,vdevices.pl b/usr/src/cmd/rcm_daemon/common/SUNW,vdevices.pl new file mode 100755 index 0000000000..0c5d4d9ca7 --- /dev/null +++ b/usr/src/cmd/rcm_daemon/common/SUNW,vdevices.pl @@ -0,0 +1,138 @@ +#!/usr/bin/perl -w +# +# 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. +# +#pragma ident "%Z%%M% %I% %E% SMI" +# + +# +# RCM script to allow/deny removal of miscellaneous virtual devices +# from an LDoms domain. +# +# Currently, the only device in this category is vcc +# (virtual-console-concentrator). +# + +use strict; + +my $vcc_path_prefix = "/devices/virtual-devices\@100/channel-devices\@200/"; +my $vcc_leaf_node = "virtual-console-concentrator"; + +my $cmd; +my %dispatch; + + +sub do_scriptinfo +{ + print "rcm_log_debug=do_scriptinfo\n"; + + print "rcm_script_version=1\n"; + print "rcm_script_func_info=VIO DR (VCC)\n"; + + exit (0); +} + +sub do_resourceinfo +{ + print "rcm_log_debug=do_resourceinfo\n"; + print "rcm_resource_usage_info=" . + "in use by virtual console service (vntsd)\n"; + + exit (0); +} + +sub do_register +{ + print "rcm_log_debug=do_register\n"; + + # + # Identify any vcc devices in the system. Vntsd always keeps the + # ":ctl" node open as a way to create or remove console ports, so + # use that as a proxy for the entire device. + # + my $path = $vcc_path_prefix . $vcc_leaf_node . "\*ctl"; + my @devs = glob $path; + my $consdev; + + # + # Tell the RCM framework to notify us if there is a request to + # remove a vcc device. + # + printf "rcm_log_debug=do_register: %d devices\n", scalar(@devs); + foreach $consdev(@devs) { + print "rcm_resource_name=$consdev\n"; + } + + exit (0); +} + +sub do_queryremove +{ + my $rsrc = shift(@ARGV); + + print "rcm_log_debug=do_queryremove: '$rsrc'\n"; + + # + # fuser(1M) sends to stdout the pids of any processes using the + # device. Some other information always appears on stderr and + # must be discarded to avoid invalidating the test. + # + my $str = `/usr/sbin/fuser $rsrc 2>/dev/null`; + + if ($? != 0) { + printf "rcm_log_err=do_queryremove: " . + "fuser failed (status %d)\n", $?; + print "rcm_failure_reason=helper command (fuser) failed\n"; + exit (1); + } + + my @words = split(/ /, $str); + + # Allow the operation if device not opened by any processes. + if (scalar(@words) != 0) { + print "rcm_log_debug=BLOCKED\n"; + print "rcm_failure_reason=device " . + "in use by virtual console service (vntsd)\n"; + exit (3); + } + + exit (0); +} + +$cmd = shift(@ARGV); + +# dispatch table for RCM commands +%dispatch = ( + "scriptinfo" => \&do_scriptinfo, + "resourceinfo" => \&do_resourceinfo, + "register" => \&do_register, + "queryremove" => \&do_queryremove +); + +if (defined($dispatch{$cmd})) { + &{$dispatch{$cmd}}; +} else { + exit (2); +} diff --git a/usr/src/pkgdefs/SUNWldomu.v/Makefile b/usr/src/pkgdefs/SUNWldomu.v/Makefile index 9bbd4420a8..f3fa8a2414 100644 --- a/usr/src/pkgdefs/SUNWldomu.v/Makefile +++ b/usr/src/pkgdefs/SUNWldomu.v/Makefile @@ -20,7 +20,7 @@ # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -30,7 +30,7 @@ include ../Makefile.com .KEEP_STATE: -all: $(FILES) +all: $(FILES) postinstall install: all pkg diff --git a/usr/src/pkgdefs/SUNWldomu.v/depend b/usr/src/pkgdefs/SUNWldomu.v/depend index e7ae45116d..1ff9f1df5b 100644 --- a/usr/src/pkgdefs/SUNWldomu.v/depend +++ b/usr/src/pkgdefs/SUNWldomu.v/depend @@ -20,7 +20,7 @@ # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -54,3 +54,4 @@ P SUNWcsu Core Solaris, (Usr) P SUNWcsd Core Solaris Devices P SUNWcsl Core Solaris Libraries P SUNWldomr Solaris Logical Domains (Root) +P SUNWperl584core Perl 5.8.4 (core) diff --git a/usr/src/pkgdefs/SUNWldomu.v/postinstall b/usr/src/pkgdefs/SUNWldomu.v/postinstall new file mode 100755 index 0000000000..f882662475 --- /dev/null +++ b/usr/src/pkgdefs/SUNWldomu.v/postinstall @@ -0,0 +1,36 @@ +#!/bin/sh +# +# 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 +# + +# +# ident "%Z%%M% %I% %E% SMI" +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# After installation of a new script into /usr/lib/rcm/scripts, we must +# force rcm_daemon to reinitialize, which makes it aware of the new script. +# +/usr/bin/pkill -HUP -x -u root rcm_daemon + +exit 0 diff --git a/usr/src/pkgdefs/SUNWldomu.v/prototype_com b/usr/src/pkgdefs/SUNWldomu.v/prototype_com index a493d36d3f..1efcb6586b 100644 --- a/usr/src/pkgdefs/SUNWldomu.v/prototype_com +++ b/usr/src/pkgdefs/SUNWldomu.v/prototype_com @@ -20,7 +20,7 @@ # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -40,6 +40,7 @@ i pkginfo i copyright i depend +i postinstall # # source locations relative to the prototype file diff --git a/usr/src/pkgdefs/SUNWldomu.v/prototype_sparc b/usr/src/pkgdefs/SUNWldomu.v/prototype_sparc index 8f1e401c4b..5b7dd635bb 100644 --- a/usr/src/pkgdefs/SUNWldomu.v/prototype_sparc +++ b/usr/src/pkgdefs/SUNWldomu.v/prototype_sparc @@ -20,7 +20,7 @@ # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -54,5 +54,8 @@ d none usr/lib/ldoms 755 root bin f none usr/lib/ldoms/drd 555 root bin f none usr/lib/ldoms/vntsd 555 root bin f none usr/lib/libpri.so.1 755 root bin +d none usr/lib/rcm 755 root bin +d none usr/lib/rcm/scripts 755 root bin +f none usr/lib/rcm/scripts/SUNW,vdevices.pl 555 root bin d none usr/lib/sparcv9 755 root bin f none usr/lib/sparcv9/libpri.so.1 755 root bin |