changeset 10371:077c3911081b

6853894 syseventd is core dumping on snv_117 6860272 syseventd: [daemon.error] Fatal:attempting to dump core 4902139 syseventd lies about dumping core 6522182 syseventd doesn't work with both the options -r and -d
author Stephen Hanson <Stephen.Hanson@Sun.COM>
date Mon, 24 Aug 2009 13:00:47 -0700
parents dcd626b57c18
children 2a69958cda3f
files usr/src/cmd/syseventd/daemons/syseventd/syseventd.c usr/src/cmd/syseventd/modules/datalink_mod/datalink_mod.c
diffstat 2 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/syseventd/daemons/syseventd/syseventd.c	Mon Aug 24 12:26:07 2009 -0700
+++ b/usr/src/cmd/syseventd/daemons/syseventd/syseventd.c	Mon Aug 24 13:00:47 2009 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -225,9 +225,12 @@
 			(void) se_signal_unblockall();
 			syseventd_exit(1);
 			/*NOTREACHED*/
+		case SIGCLD:
+			/* No need to abort on a SIGCLD */
+			break;
 		default:
 			syseventd_err_print(FATAL_ERROR);
-			(void) fflush(0);
+			abort();
 
 	}
 }
@@ -309,7 +312,7 @@
 		prog++;
 	}
 
-	if ((c = getopt(argc, argv, "d:r:")) != EOF) {
+	while ((c = getopt(argc, argv, "d:r:")) != EOF) {
 		switch (c) {
 		case 'd':
 			debug_level = atoi(optarg);
@@ -691,6 +694,9 @@
 		while (eventq != NULL) {
 			d_pkg = eventq->d_pkg;
 			d_pkg->completion_state = SE_OUTSTANDING;
+			scp->eventq = eventq->next;
+			free(eventq);
+			eventq = scp->eventq;
 			(void) mutex_unlock(&scp->client_lock);
 
 
@@ -767,17 +773,6 @@
 			d_pkg->completion_status = error;
 			d_pkg->completion_state = SE_COMPLETE;
 			(void) sema_post(d_pkg->completion_sema);
-
-			/* Update eventq pointer */
-			if (scp->eventq != NULL) {
-				scp->eventq = eventq->next;
-				free(eventq);
-				eventq = scp->eventq;
-			} else {
-				free(eventq);
-				break;
-			}
-
 			syseventd_print(3, "Completed delivery with "
 			    "error %d\n", error);
 		}
--- a/usr/src/cmd/syseventd/modules/datalink_mod/datalink_mod.c	Mon Aug 24 12:26:07 2009 -0700
+++ b/usr/src/cmd/syseventd/modules/datalink_mod/datalink_mod.c	Mon Aug 24 13:00:47 2009 -0700
@@ -36,6 +36,7 @@
 #include <libnvpair.h>
 #include <librcm.h>
 #include <libsysevent.h>
+#include "sysevent_signal.h"
 
 extern void syseventd_err_print(char *, ...);
 
@@ -71,15 +72,26 @@
 		(void) mutex_unlock(&dl_mx);
 
 		while (tmp_events != NULL) {
+			struct sigaction cbuf, dfl;
+
+			/*
+			 * Ignore SIGCLD for the
+			 * duration of the rcm_notify_event call.
+			 */
+			(void) memset(&dfl, 0, sizeof (dfl));
+			dfl.sa_handler = SIG_IGN;
+			(void) sigaction(SIGCHLD, &dfl, &cbuf);
+
 			/*
 			 * Send the PHYSLINK_NEW event to network_rcm to update
 			 * the network devices cache accordingly.
 			 */
 			if (rcm_notify_event(rcm_hdl, RCM_RESOURCE_PHYSLINK_NEW,
 			    0, tmp_events->ev, NULL) != RCM_SUCCESS)
-				syseventd_err_print("datalink_mod: Can not"
+				syseventd_err_print("datalink_mod: Can not "
 				    "notify event: %s\n", strerror(errno));
 
+			(void) sigaction(SIGCHLD, &cbuf, NULL);
 			ep = tmp_events;
 			tmp_events = tmp_events->next;
 			nvlist_free(ep->ev);