summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraf <none@none>2007-02-27 05:23:54 -0800
committeraf <none@none>2007-02-27 05:23:54 -0800
commite1c679fa4b0ab8c4bcaa6263974ca0c46e5b027f (patch)
tree3ab961ccad0bcf7766e5abc16158bb13e53de15d
parentd612f30addc721b15c3a58bcd359a267daeec31b (diff)
downloadillumos-gate-e1c679fa4b0ab8c4bcaa6263974ca0c46e5b027f.tar.gz
PSARC 2007/101 FMA libfmd_msg
6510717 syslog and snmp agents can both use setlocale() at the same time
-rw-r--r--usr/src/cmd/fm/modules/common/snmp-trapgen/Makefile7
-rw-r--r--usr/src/cmd/fm/modules/common/snmp-trapgen/snmp.c63
-rw-r--r--usr/src/cmd/fm/modules/common/syslog-msgs/Makefile11
-rw-r--r--usr/src/cmd/fm/modules/common/syslog-msgs/syslog.c68
-rw-r--r--usr/src/lib/fm/Makefile3
-rw-r--r--usr/src/lib/fm/libfmd_msg/Makefile59
-rw-r--r--usr/src/lib/fm/libfmd_msg/Makefile.com61
-rw-r--r--usr/src/lib/fm/libfmd_msg/amd64/Makefile31
-rw-r--r--usr/src/lib/fm/libfmd_msg/common/fmd_msg.c60
-rw-r--r--usr/src/lib/fm/libfmd_msg/common/fmd_msg.h52
-rw-r--r--usr/src/lib/fm/libfmd_msg/common/llib-lfmd_msg29
-rw-r--r--usr/src/lib/fm/libfmd_msg/common/mapfile-vers34
-rw-r--r--usr/src/lib/fm/libfmd_msg/i386/Makefile30
-rw-r--r--usr/src/lib/fm/libfmd_msg/sparc/Makefile30
-rw-r--r--usr/src/lib/fm/libfmd_msg/sparcv9/Makefile31
-rw-r--r--usr/src/pkgdefs/SUNWfmd/prototype_com7
-rw-r--r--usr/src/pkgdefs/SUNWfmd/prototype_i3865
-rw-r--r--usr/src/pkgdefs/SUNWfmd/prototype_sparc5
18 files changed, 544 insertions, 42 deletions
diff --git a/usr/src/cmd/fm/modules/common/snmp-trapgen/Makefile b/usr/src/cmd/fm/modules/common/snmp-trapgen/Makefile
index c877711d92..71cec7e0b5 100644
--- a/usr/src/cmd/fm/modules/common/snmp-trapgen/Makefile
+++ b/usr/src/cmd/fm/modules/common/snmp-trapgen/Makefile
@@ -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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -40,8 +40,9 @@ SNMPLIBS = -lnetsnmp -lnetsnmpagent
lint := SNMPLIBS =
CPPFLAGS += -I/usr/sfw/include
-LDFLAGS += -L/usr/sfw/lib -R/usr/sfw/lib
-LDLIBS += $(SNMPLIBS)
+LDFLAGS += -L/usr/sfw/lib -L$(ROOT)/usr/lib/fm -R/usr/sfw/lib:/usr/lib/fm
+LINTFLAGS += -L$(ROOT)/usr/lib/fm
+LDLIBS += $(SNMPLIBS) -lfmd_msg
$(ROOTSMASNMPCONFS) := FILEMODE = 0600
diff --git a/usr/src/cmd/fm/modules/common/snmp-trapgen/snmp.c b/usr/src/cmd/fm/modules/common/snmp-trapgen/snmp.c
index 2acdfe37b5..aaa22759f0 100644
--- a/usr/src/cmd/fm/modules/common/snmp-trapgen/snmp.c
+++ b/usr/src/cmd/fm/modules/common/snmp-trapgen/snmp.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.
*/
@@ -29,6 +29,7 @@
#include <sys/fm/protocol.h>
#include <fm/fmd_api.h>
#include <fm/fmd_snmp.h>
+#include <fm/fmd_msg.h>
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
@@ -166,11 +167,12 @@ send_trap(fmd_hdl_t *hdl, const char *uuid, const char *code, const char *url)
static void
snmp_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
{
- char *uuid, *code, *dict, *url, *urlcode, *p;
+ char *uuid, *code, *dict, *url, *urlcode, *locdir, *p;
boolean_t domsg;
uint8_t version;
char *olang = NULL;
+ int locale_c = 0;
size_t len;
if (nvlist_lookup_uint8(nvl, FM_VERSION, &version) != 0 ||
@@ -204,8 +206,10 @@ snmp_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
(void) strncpy(dict, code, (size_t)(p - code));
dict[(size_t)(p - code)] = '\0';
+ fmd_msg_lock();
+
if (snmp_locdir != NULL)
- (void) bindtextdomain(dict, snmp_locdir);
+ locdir = bindtextdomain(dict, snmp_locdir);
if ((url = dgettext(dict, SNMP_URL)) == SNMP_URL) {
/*
@@ -213,8 +217,11 @@ snmp_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
* current language. Fall back to C and try again.
*/
olang = setlocale(LC_MESSAGES, NULL);
- fmd_hdl_debug(hdl, "dgettext(%s, %s) in %s failed; trying C\n",
- dict, SNMP_URL, olang);
+ if (olang) {
+ p = alloca(strlen(olang) + 1);
+ olang = strcpy(p, olang);
+ }
+ locale_c = 1;
(void) setlocale(LC_MESSAGES, "C");
if ((url = dgettext(dict, SNMP_URL)) == SNMP_URL)
url = snmp_url;
@@ -243,6 +250,19 @@ snmp_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
*/
if (olang != NULL)
(void) setlocale(LC_MESSAGES, olang);
+
+ if (snmp_locdir != NULL)
+ (void) bindtextdomain(dict, locdir);
+
+ fmd_msg_unlock();
+
+ if (locale_c) {
+ fmd_hdl_debug(hdl,
+ url == snmp_url ?
+ "dgettext(%s, %s) in %s and C failed\n" :
+ "dgettext(%s, %s) in %s failed; C used\n",
+ dict, SNMP_URL, olang ? olang : "<null>");
+ }
}
static int
@@ -310,7 +330,7 @@ static const fmd_hdl_info_t fmd_info = {
void
_fmd_init(fmd_hdl_t *hdl)
{
- char *rootdir, *locdir;
+ char *rootdir, *locdir, *locale, *p;
if (fmd_hdl_register(hdl, FMD_API_VERSION, &fmd_info) != 0)
return; /* invalid data in configuration file */
@@ -334,8 +354,17 @@ _fmd_init(fmd_hdl_t *hdl)
"NLSPATH=/usr/lib/fm/fmd/fmd.cat", FMD_SLEEP)) != 0)
fmd_hdl_abort(hdl, "snmp-trapgen failed to set NLSPATH");
+ fmd_msg_lock();
(void) setlocale(LC_MESSAGES, "");
- fmd_hdl_debug(hdl, "locale=%s\n", setlocale(LC_MESSAGES, NULL));
+ locale = setlocale(LC_MESSAGES, NULL);
+ if (locale) {
+ p = alloca(strlen(locale) + 1);
+ locale = strcpy(p, locale);
+ } else {
+ locale = "<null>";
+ }
+ fmd_msg_unlock();
+ fmd_hdl_debug(hdl, "locale=%s\n", locale);
/*
* Cache any properties we use every time we receive an event and
@@ -352,13 +381,19 @@ _fmd_init(fmd_hdl_t *hdl)
*/
rootdir = fmd_prop_get_string(hdl, "fmd.rootdir");
- if (*rootdir != '\0' && strcmp(rootdir, "/") != 0 &&
- (locdir = bindtextdomain(SNMP_DOMAIN, NULL)) != NULL) {
- size_t len = strlen(rootdir) + strlen(locdir) + 1;
- snmp_locdir = fmd_hdl_alloc(hdl, len, FMD_SLEEP);
- (void) snprintf(snmp_locdir, len, "%s%s", rootdir, locdir);
- (void) bindtextdomain(SNMP_DOMAIN, snmp_locdir);
- fmd_hdl_debug(hdl, "binding textdomain to %s\n", snmp_locdir);
+ if (*rootdir != '\0' && strcmp(rootdir, "/") != 0) {
+ fmd_msg_lock();
+ locdir = bindtextdomain(SNMP_DOMAIN, NULL);
+ fmd_msg_unlock();
+ if (locdir != NULL) {
+ size_t len = strlen(rootdir) + strlen(locdir) + 1;
+ snmp_locdir = fmd_hdl_alloc(hdl, len, FMD_SLEEP);
+ (void) snprintf(snmp_locdir, len, "%s%s", rootdir,
+ locdir);
+ fmd_hdl_debug(hdl,
+ "binding textdomain to %s for snmp\n",
+ snmp_locdir);
+ }
}
fmd_prop_free_string(hdl, rootdir);
diff --git a/usr/src/cmd/fm/modules/common/syslog-msgs/Makefile b/usr/src/cmd/fm/modules/common/syslog-msgs/Makefile
index 645d1db465..80276353b0 100644
--- a/usr/src/cmd/fm/modules/common/syslog-msgs/Makefile
+++ b/usr/src/cmd/fm/modules/common/syslog-msgs/Makefile
@@ -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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -30,3 +29,7 @@ CLASS = common
SRCS = syslog.c
include ../../Makefile.plugin
+
+LDFLAGS += -L $(ROOT)/usr/lib/fm -R/usr/lib/fm
+LINTFLAGS += -L$(ROOT)/usr/lib/fm
+LDLIBS += -lfmd_msg
diff --git a/usr/src/cmd/fm/modules/common/syslog-msgs/syslog.c b/usr/src/cmd/fm/modules/common/syslog-msgs/syslog.c
index 5c62b8cd92..a654e0d9a3 100644
--- a/usr/src/cmd/fm/modules/common/syslog-msgs/syslog.c
+++ b/usr/src/cmd/fm/modules/common/syslog-msgs/syslog.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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -29,6 +28,7 @@
#include <sys/fm/protocol.h>
#include <sys/strlog.h>
#include <fm/fmd_api.h>
+#include <fm/fmd_msg.h>
#include <stropts.h>
#include <syslog.h>
@@ -193,7 +193,7 @@ syslog_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
{
char *uuid, *code, *dict, *url, *urlcode, *template, *p;
char *src_name, *src_vers, *platform, *chassis, *server;
- char *typ, *sev, *fmt, *trfmt, *rsp, *imp, *act;
+ char *typ, *sev, *fmt, *trfmt, *rsp, *imp, *act, *locdir;
char msg[1024], desc[1024], date[64];
boolean_t domsg;
@@ -204,6 +204,7 @@ syslog_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
time_t sec;
uint_t tn = 0;
char *olang = NULL;
+ int locale_c = 0;
size_t len;
if (nvlist_lookup_uint8(nvl, FM_VERSION, &version) != 0 ||
@@ -281,8 +282,10 @@ syslog_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
act = imp + snprintf(imp, INT_MAX, "%s.impact", code) + 1;
(void) snprintf(act, INT_MAX, "%s.action", code);
+ fmd_msg_lock();
+
if (syslog_locdir != NULL)
- (void) bindtextdomain(dict, syslog_locdir);
+ locdir = bindtextdomain(dict, syslog_locdir);
if ((trfmt = dgettext(dict, fmt)) == fmt) {
/*
@@ -292,8 +295,11 @@ syslog_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
* message. Fall back to C and try again.
*/
olang = setlocale(LC_MESSAGES, NULL);
- fmd_hdl_debug(hdl, "dgettext(%s, %s) in %s failed; trying C\n",
- dict, fmt, olang);
+ if (olang) {
+ p = alloca(strlen(olang) + 1);
+ olang = strcpy(p, olang);
+ }
+ locale_c = 1;
(void) setlocale(LC_MESSAGES, "C");
trfmt = dgettext(dict, fmt);
}
@@ -349,6 +355,19 @@ syslog_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
*/
if (olang != NULL)
(void) setlocale(LC_MESSAGES, olang);
+
+ if (syslog_locdir != NULL)
+ (void) bindtextdomain(dict, locdir);
+
+ fmd_msg_unlock();
+
+ if (locale_c) {
+ fmd_hdl_debug(hdl,
+ trfmt == fmt ?
+ "dgettext(%s, %s) in %s and C failed\n" :
+ "dgettext(%s, %s) in %s failed; C used\n",
+ dict, fmt, olang ? olang : "<null>");
+ }
}
static const fmd_prop_t fmd_props[] = {
@@ -377,7 +396,7 @@ void
_fmd_init(fmd_hdl_t *hdl)
{
const struct facility *fp;
- char *facname, *tz, *rootdir, *locdir;
+ char *facname, *tz, *rootdir, *locdir, *locale, *p;
if (fmd_hdl_register(hdl, FMD_API_VERSION, &fmd_info) != 0)
return; /* invalid data in configuration file */
@@ -404,8 +423,17 @@ _fmd_init(fmd_hdl_t *hdl)
"NLSPATH=/usr/lib/fm/fmd/fmd.cat", FMD_SLEEP)) != 0)
fmd_hdl_abort(hdl, "syslog-msgs failed to set NLSPATH");
+ fmd_msg_lock();
(void) setlocale(LC_MESSAGES, "");
- fmd_hdl_debug(hdl, "locale=%s\n", setlocale(LC_MESSAGES, NULL));
+ locale = setlocale(LC_MESSAGES, NULL);
+ if (locale) {
+ p = alloca(strlen(locale) + 1);
+ locale = strcpy(p, locale);
+ } else {
+ locale = "<null>";
+ }
+ fmd_msg_unlock();
+ fmd_hdl_debug(hdl, "locale=%s\n", locale);
/*
* If the "gmt" property is set to true, force our EVENT-TIME to be
@@ -454,13 +482,19 @@ _fmd_init(fmd_hdl_t *hdl)
*/
rootdir = fmd_prop_get_string(hdl, "fmd.rootdir");
- if (*rootdir != '\0' && strcmp(rootdir, "/") != 0 &&
- (locdir = bindtextdomain(SYSLOG_DOMAIN, NULL)) != NULL) {
- size_t len = strlen(rootdir) + strlen(locdir) + 1;
- syslog_locdir = fmd_hdl_alloc(hdl, len, FMD_SLEEP);
- (void) snprintf(syslog_locdir, len, "%s%s", rootdir, locdir);
- (void) bindtextdomain(SYSLOG_DOMAIN, syslog_locdir);
- fmd_hdl_debug(hdl, "binding textdomain to %s\n", syslog_locdir);
+ if (*rootdir != '\0' && strcmp(rootdir, "/") != 0) {
+ fmd_msg_lock();
+ locdir = bindtextdomain(SYSLOG_DOMAIN, NULL);
+ fmd_msg_unlock();
+ if (locdir != NULL) {
+ size_t len = strlen(rootdir) + strlen(locdir) + 1;
+ syslog_locdir = fmd_hdl_alloc(hdl, len, FMD_SLEEP);
+ (void) snprintf(syslog_locdir, len, "%s%s", rootdir,
+ locdir);
+ fmd_hdl_debug(hdl,
+ "binding textdomain to %s for syslog\n",
+ syslog_locdir);
+ }
}
fmd_prop_free_string(hdl, rootdir);
diff --git a/usr/src/lib/fm/Makefile b/usr/src/lib/fm/Makefile
index 4da0e6d11f..6f84280eb9 100644
--- a/usr/src/lib/fm/Makefile
+++ b/usr/src/lib/fm/Makefile
@@ -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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -38,6 +38,7 @@ SUBDIRS = \
libdiagcode \
libfmd_adm \
libfmd_log \
+ libfmd_msg \
libfmd_snmp \
$($(MACH)_SUBDIRS) \
topo
diff --git a/usr/src/lib/fm/libfmd_msg/Makefile b/usr/src/lib/fm/libfmd_msg/Makefile
new file mode 100644
index 0000000000..efe5f75257
--- /dev/null
+++ b/usr/src/lib/fm/libfmd_msg/Makefile
@@ -0,0 +1,59 @@
+#
+# 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 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../../Makefile.lib
+include ../Makefile.lib
+
+FMHDRS = fmd_msg.h
+HDRDIR = common
+
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET = all
+clean := TARGET = clean
+clobber := TARGET = clobber
+install := TARGET = install
+lint := TARGET = lint
+
+.KEEP_STATE:
+
+all clean clobber lint: $(SUBDIRS)
+
+install: install_h .WAIT $(SUBDIRS)
+
+install_h: $(ROOTFMHDRS)
+
+check: $(CHECKHDRS)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../../Makefile.targ
+include ../Makefile.targ
diff --git a/usr/src/lib/fm/libfmd_msg/Makefile.com b/usr/src/lib/fm/libfmd_msg/Makefile.com
new file mode 100644
index 0000000000..70d82c62b4
--- /dev/null
+++ b/usr/src/lib/fm/libfmd_msg/Makefile.com
@@ -0,0 +1,61 @@
+#
+# 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 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+LIBRARY = libfmd_msg.a
+VERS = .1
+
+LIBSRCS = fmd_msg.c
+OBJECTS = $(LIBSRCS:%.c=%.o)
+
+include ../../../Makefile.lib
+include ../../Makefile.lib
+
+SRCS = $(LIBSRCS:%.c=../common/%.c)
+LIBS = $(DYNLIB) $(LINTLIB)
+
+SRCDIR = ../common
+
+CPPFLAGS += -I../common -I.
+CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
+CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
+LDLIBS += -lnvpair -lgen -lc
+
+LINTFLAGS = -msux
+LINTFLAGS64 = -msux -Xarch=$(MACH64:sparcv9=v9)
+
+$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
+$(LINTLIB) := LINTFLAGS = -nsvx
+$(LINTLIB) := LINTFLAGS64 = -nsvx -Xarch=$(MACH64:sparcv9=v9)
+
+.KEEP_STATE:
+
+all: $(LIBS)
+
+lint: $(LINTLIB) lintcheck
+
+include ../../../Makefile.targ
+include ../../Makefile.targ
diff --git a/usr/src/lib/fm/libfmd_msg/amd64/Makefile b/usr/src/lib/fm/libfmd_msg/amd64/Makefile
new file mode 100644
index 0000000000..a2f97019c8
--- /dev/null
+++ b/usr/src/lib/fm/libfmd_msg/amd64/Makefile
@@ -0,0 +1,31 @@
+#
+# 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 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.com
+include ../../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64)
diff --git a/usr/src/lib/fm/libfmd_msg/common/fmd_msg.c b/usr/src/lib/fm/libfmd_msg/common/fmd_msg.c
new file mode 100644
index 0000000000..4f7631b27f
--- /dev/null
+++ b/usr/src/lib/fm/libfmd_msg/common/fmd_msg.c
@@ -0,0 +1,60 @@
+/*
+ * 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 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <synch.h>
+
+static rwlock_t fmd_msg_rwlock;
+
+#pragma init(fmd_msg_init)
+static void
+fmd_msg_init(void)
+{
+ (void) rwlock_init(&fmd_msg_rwlock, USYNC_THREAD, NULL);
+}
+
+#pragma fini(fmd_msg_fini)
+static void
+fmd_msg_fini(void)
+{
+ (void) rwlock_destroy(&fmd_msg_rwlock);
+}
+
+void
+fmd_msg_lock(void)
+{
+ if (rw_wrlock(&fmd_msg_rwlock) != 0)
+ abort();
+}
+
+void
+fmd_msg_unlock(void)
+{
+ if (rw_unlock(&fmd_msg_rwlock) != 0)
+ abort();
+}
diff --git a/usr/src/lib/fm/libfmd_msg/common/fmd_msg.h b/usr/src/lib/fm/libfmd_msg/common/fmd_msg.h
new file mode 100644
index 0000000000..5e6ebb093a
--- /dev/null
+++ b/usr/src/lib/fm/libfmd_msg/common/fmd_msg.h
@@ -0,0 +1,52 @@
+/*
+ * 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 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _FMD_MSG_H
+#define _FMD_MSG_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Fault Management Daemon msg File Interfaces
+ *
+ * Note: The contents of this file are private to the implementation of the
+ * Solaris system and FMD subsystem and are subject to change at any time
+ * without notice. Applications and drivers using these interfaces will fail
+ * to run on future releases. These interfaces should not be used for any
+ * purpose until they are publicly documented for use outside of Sun.
+ */
+
+extern void fmd_msg_lock(void);
+extern void fmd_msg_unlock(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FMD_MSG_H */
diff --git a/usr/src/lib/fm/libfmd_msg/common/llib-lfmd_msg b/usr/src/lib/fm/libfmd_msg/common/llib-lfmd_msg
new file mode 100644
index 0000000000..c7609ca9f7
--- /dev/null
+++ b/usr/src/lib/fm/libfmd_msg/common/llib-lfmd_msg
@@ -0,0 +1,29 @@
+/*
+ * 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 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*LINTLIBRARY*/
+/*PROTOLIB1*/
diff --git a/usr/src/lib/fm/libfmd_msg/common/mapfile-vers b/usr/src/lib/fm/libfmd_msg/common/mapfile-vers
new file mode 100644
index 0000000000..f2b08e9c50
--- /dev/null
+++ b/usr/src/lib/fm/libfmd_msg/common/mapfile-vers
@@ -0,0 +1,34 @@
+#
+# 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 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+SUNWprivate {
+ global:
+ fmd_msg_lock;
+ fmd_msg_unlock;
+ local:
+ *;
+};
diff --git a/usr/src/lib/fm/libfmd_msg/i386/Makefile b/usr/src/lib/fm/libfmd_msg/i386/Makefile
new file mode 100644
index 0000000000..f91f0270e9
--- /dev/null
+++ b/usr/src/lib/fm/libfmd_msg/i386/Makefile
@@ -0,0 +1,30 @@
+#
+# 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 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/fm/libfmd_msg/sparc/Makefile b/usr/src/lib/fm/libfmd_msg/sparc/Makefile
new file mode 100644
index 0000000000..f91f0270e9
--- /dev/null
+++ b/usr/src/lib/fm/libfmd_msg/sparc/Makefile
@@ -0,0 +1,30 @@
+#
+# 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 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/fm/libfmd_msg/sparcv9/Makefile b/usr/src/lib/fm/libfmd_msg/sparcv9/Makefile
new file mode 100644
index 0000000000..a2f97019c8
--- /dev/null
+++ b/usr/src/lib/fm/libfmd_msg/sparcv9/Makefile
@@ -0,0 +1,31 @@
+#
+# 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 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.com
+include ../../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64)
diff --git a/usr/src/pkgdefs/SUNWfmd/prototype_com b/usr/src/pkgdefs/SUNWfmd/prototype_com
index 761458c0c8..807deee1b8 100644
--- a/usr/src/pkgdefs/SUNWfmd/prototype_com
+++ b/usr/src/pkgdefs/SUNWfmd/prototype_com
@@ -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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -38,6 +38,7 @@ f none usr/include/fm/fmd_adm.h 644 root bin
f none usr/include/fm/fmd_api.h 644 root bin
f none usr/include/fm/fmd_fmri.h 644 root bin
f none usr/include/fm/fmd_log.h 644 root bin
+f none usr/include/fm/fmd_msg.h 644 root bin
f none usr/include/fm/fmd_snmp.h 644 root bin
f none usr/include/fm/libtopo.h 644 root bin
f none usr/include/fm/topo_mod.h 644 root bin
@@ -98,6 +99,10 @@ f none usr/lib/fm/libfmd_log.so.1 755 root bin
s none usr/lib/fm/libfmd_log.so=libfmd_log.so.1
f none usr/lib/fm/llib-lfmd_log 644 root bin
f none usr/lib/fm/llib-lfmd_log.ln 644 root bin
+f none usr/lib/fm/libfmd_msg.so.1 755 root bin
+s none usr/lib/fm/libfmd_msg.so=libfmd_msg.so.1
+f none usr/lib/fm/llib-lfmd_msg 644 root bin
+f none usr/lib/fm/llib-lfmd_msg.ln 644 root bin
f none usr/lib/fm/libfmd_snmp.so.1 755 root bin
s none usr/lib/fm/libfmd_snmp.so=libfmd_snmp.so.1
f none usr/lib/fm/llib-lfmd_snmp 644 root bin
diff --git a/usr/src/pkgdefs/SUNWfmd/prototype_i386 b/usr/src/pkgdefs/SUNWfmd/prototype_i386
index 34d8cc9545..ab9372b801 100644
--- a/usr/src/pkgdefs/SUNWfmd/prototype_i386
+++ b/usr/src/pkgdefs/SUNWfmd/prototype_i386
@@ -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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -35,6 +35,8 @@ f none usr/lib/fm/amd64/libfmd_adm.so.1 755 root bin
s none usr/lib/fm/amd64/libfmd_adm.so=./libfmd_adm.so.1
f none usr/lib/fm/amd64/libfmd_log.so.1 755 root bin
s none usr/lib/fm/amd64/libfmd_log.so=./libfmd_log.so.1
+f none usr/lib/fm/amd64/libfmd_msg.so.1 755 root bin
+s none usr/lib/fm/amd64/libfmd_msg.so=./libfmd_msg.so.1
f none usr/lib/fm/amd64/libfmd_snmp.so.1 755 root bin
s none usr/lib/fm/amd64/libfmd_snmp.so=./libfmd_snmp.so.1
f none usr/lib/fm/amd64/libtopo.so.1 755 root bin
@@ -42,6 +44,7 @@ s none usr/lib/fm/amd64/libtopo.so=libtopo.so.1
f none usr/lib/fm/amd64/llib-ldiagcode.ln 644 root bin
f none usr/lib/fm/amd64/llib-lfmd_adm.ln 644 root bin
f none usr/lib/fm/amd64/llib-lfmd_log.ln 644 root bin
+f none usr/lib/fm/amd64/llib-lfmd_msg.ln 644 root bin
f none usr/lib/fm/amd64/llib-lfmd_snmp.ln 644 root bin
f none usr/lib/fm/amd64/llib-ltopo.ln 644 root bin
d none usr/lib/fm/fmd/schemes/amd64 755 root bin
diff --git a/usr/src/pkgdefs/SUNWfmd/prototype_sparc b/usr/src/pkgdefs/SUNWfmd/prototype_sparc
index 757b08f7ca..888e5561d6 100644
--- a/usr/src/pkgdefs/SUNWfmd/prototype_sparc
+++ b/usr/src/pkgdefs/SUNWfmd/prototype_sparc
@@ -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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -59,6 +59,9 @@ f none usr/lib/fm/sparcv9/llib-lfmd_adm.ln 644 root bin
f none usr/lib/fm/sparcv9/libfmd_log.so.1 755 root bin
s none usr/lib/fm/sparcv9/libfmd_log.so=libfmd_log.so.1
f none usr/lib/fm/sparcv9/llib-lfmd_log.ln 644 root bin
+f none usr/lib/fm/sparcv9/libfmd_msg.so.1 755 root bin
+s none usr/lib/fm/sparcv9/libfmd_msg.so=libfmd_msg.so.1
+f none usr/lib/fm/sparcv9/llib-lfmd_msg.ln 644 root bin
f none usr/lib/fm/sparcv9/libmdesc.so.1 755 root bin
s none usr/lib/fm/sparcv9/libmdesc.so=libmdesc.so.1 755 root bin
f none usr/lib/fm/sparcv9/llib-lmdesc.ln 644 root bin