changeset 13718:eff5ad995241

Backed out changeset 33bb96bf701a (missing bugid)
author Garrett D'Amore <garrett@damore.org>
date Sat, 09 Jun 2012 17:38:51 -0700
parents 33bb96bf701a
children da056fdd2d14
files usr/src/cmd/svc/configd/configd.c usr/src/cmd/svc/startd/restarter.c usr/src/cmd/svc/startd/startd.c usr/src/lib/librestart/common/librestart.c
diffstat 4 files changed, 10 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/svc/configd/configd.c	Sat Jun 09 17:31:14 2012 -0700
+++ b/usr/src/cmd/svc/configd/configd.c	Sat Jun 09 17:38:51 2012 -0700
@@ -23,9 +23,7 @@
  * Use is subject to license terms.
  */
 
-/*
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
- */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <assert.h>
 #include <door.h>
@@ -111,18 +109,6 @@
 
 #define	CONFIGD_MAX_FDS		262144
 
-const char *
-_umem_options_init(void)
-{
-	/*
-	 * Like svc.startd, we set our UMEM_OPTIONS to indicate that we do not
-	 * wish to have per-CPU magazines to reduce our memory footprint.  And
-	 * as with svc.startd, if svc.configd is so MT-hot that this becomes a
-	 * scalability problem, there are deeper issues...
-	 */
-	return ("nomagazines");		/* UMEM_OPTIONS setting */
-}
-
 /*
  * Thanks, Mike
  */
--- a/usr/src/cmd/svc/startd/restarter.c	Sat Jun 09 17:31:14 2012 -0700
+++ b/usr/src/cmd/svc/startd/restarter.c	Sat Jun 09 17:38:51 2012 -0700
@@ -373,11 +373,9 @@
 	if (inst->ri_logstem != NULL)
 		startd_free(inst->ri_logstem, PATH_MAX);
 	if (inst->ri_common_name != NULL)
-		startd_free(inst->ri_common_name,
-		    strlen(inst->ri_common_name) + 1);
+		startd_free(inst->ri_common_name, max_scf_value_size);
 	if (inst->ri_C_common_name != NULL)
-		startd_free(inst->ri_C_common_name,
-		    strlen(inst->ri_C_common_name) + 1);
+		startd_free(inst->ri_C_common_name, max_scf_value_size);
 	snap = NULL;
 	inst->ri_logstem = NULL;
 	inst->ri_common_name = NULL;
@@ -531,25 +529,8 @@
 		abort();
 	}
 
-	r = libscf_get_template_values(scf_inst, snap,
-	    &inst->ri_common_name, &inst->ri_C_common_name);
-
-	/*
-	 * Copy our names to smaller buffers to reduce our memory footprint.
-	 */
-	if (inst->ri_common_name != NULL) {
-		char *tmp = safe_strdup(inst->ri_common_name);
-		startd_free(inst->ri_common_name, max_scf_value_size);
-		inst->ri_common_name = tmp;
-	}
-
-	if (inst->ri_C_common_name != NULL) {
-		char *tmp = safe_strdup(inst->ri_C_common_name);
-		startd_free(inst->ri_C_common_name, max_scf_value_size);
-		inst->ri_C_common_name = tmp;
-	}
-
-	switch (r) {
+	switch (libscf_get_template_values(scf_inst, snap,
+	    &inst->ri_common_name, &inst->ri_C_common_name)) {
 	case 0:
 		break;
 
@@ -697,11 +678,9 @@
 	if (inst->ri_logstem != NULL)
 		startd_free(inst->ri_logstem, PATH_MAX);
 	if (inst->ri_common_name != NULL)
-		startd_free(inst->ri_common_name,
-		    strlen(inst->ri_common_name) + 1);
+		startd_free(inst->ri_common_name, max_scf_value_size);
 	if (inst->ri_C_common_name != NULL)
-		startd_free(inst->ri_C_common_name,
-		    strlen(inst->ri_C_common_name) + 1);
+		startd_free(inst->ri_C_common_name, max_scf_value_size);
 	startd_free(inst->ri_utmpx_prefix, max_scf_value_size);
 	startd_free(inst, sizeof (restarter_inst_t));
 	return (ENOENT);
@@ -761,11 +740,9 @@
 	startd_free((void *)ri->ri_i.i_fmri, strlen(ri->ri_i.i_fmri) + 1);
 	startd_free(ri->ri_logstem, PATH_MAX);
 	if (ri->ri_common_name != NULL)
-		startd_free(ri->ri_common_name,
-		    strlen(ri->ri_common_name) + 1);
+		startd_free(ri->ri_common_name, max_scf_value_size);
 	if (ri->ri_C_common_name != NULL)
-		startd_free(ri->ri_C_common_name,
-		    strlen(ri->ri_C_common_name) + 1);
+		startd_free(ri->ri_C_common_name, max_scf_value_size);
 	startd_free(ri->ri_utmpx_prefix, max_scf_value_size);
 	(void) pthread_mutex_destroy(&ri->ri_lock);
 	(void) pthread_mutex_destroy(&ri->ri_queue_lock);
@@ -1864,7 +1841,6 @@
 
 	rip->ri_queue_thread = 0;
 	MUTEX_UNLOCK(&rip->ri_queue_lock);
-
 out:
 	(void) scf_handle_unbind(h);
 	scf_handle_destroy(h);
--- a/usr/src/cmd/svc/startd/startd.c	Sat Jun 09 17:31:14 2012 -0700
+++ b/usr/src/cmd/svc/startd/startd.c	Sat Jun 09 17:38:51 2012 -0700
@@ -21,7 +21,6 @@
 
 /*
  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  */
 
 /*
@@ -144,7 +143,6 @@
 
 pthread_mutexattr_t mutex_attrs;
 
-#ifdef DEBUG
 const char *
 _umem_debug_init(void)
 {
@@ -156,19 +154,6 @@
 {
 	return ("fail,contents");	/* UMEM_LOGGING setting */
 }
-#endif
-
-const char *
-_umem_options_init(void)
-{
-	/*
-	 * To reduce our memory footprint, we set our UMEM_OPTIONS to indicate
-	 * that we do not wish to have per-CPU magazines -- if svc.startd is so
-	 * hot on CPU such that this becomes a scalability problem, there are
-	 * likely deeper things amiss...
-	 */
-	return ("nomagazines");		/* UMEM_OPTIONS setting */
-}
 
 /*
  * startd_alloc_retry()
--- a/usr/src/lib/librestart/common/librestart.c	Sat Jun 09 17:31:14 2012 -0700
+++ b/usr/src/lib/librestart/common/librestart.c	Sat Jun 09 17:38:51 2012 -0700
@@ -21,7 +21,6 @@
 
 /*
  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  */
 
 #include <libintl.h>
@@ -3334,10 +3333,6 @@
 	 * defaults that provide historic init behavior.
 	 */
 	if (mc_used == 0) {
-		free(cip->pwbuf);
-		free(cip->vbuf);
-		free(cip->working_dir);
-
 		(void) memset(cip, 0, sizeof (*cip));
 		cip->uid = 0;
 		cip->gid = 0;
@@ -3353,11 +3348,8 @@
 	scf_pg_destroy(instpg);
 	scf_pg_destroy(methpg);
 
-	if (cip->pwbuf != NULL) {
+	if (cip->pwbuf != NULL)
 		free(cip->pwbuf);
-		cip->pwbuf = NULL;
-	}
-
 	free(cip->vbuf);
 
 	if (err->type != 0) {