[launchd-changes] [22873] trunk/launchd/src/launchd_core_logic.c

source_changes at macosforge.org source_changes at macosforge.org
Sat Sep 23 13:17:01 PDT 2006


Revision: 22873
          http://trac.macosforge.org/projects/launchd/changeset/22873
Author:   zarzycki at apple.com
Date:     2006-09-23 13:17:01 -0700 (Sat, 23 Sep 2006)

Log Message:
-----------
Structural and semantic reorganization:

Give all jobs a dedicated Mach port to represent those objects outside of launchd (a.k.a. "vproc_t").

Modified Paths:
--------------
    trunk/launchd/src/launchd_core_logic.c

Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c	2006-09-23 20:00:16 UTC (rev 22872)
+++ trunk/launchd/src/launchd_core_logic.c	2006-09-23 20:17:01 UTC (rev 22873)
@@ -627,9 +627,6 @@
 	j->legacy_mach_job = true;
 	j->priv_port_has_senders = true; /* the IPC that called us will make-send on this port */
 
-	if (!job_setup_machport(j))
-		goto out_bad;
-
 	if (!job_assumes(j, launchd_mport_notify_req(j->bs_port, MACH_NOTIFY_NO_SENDERS) == KERN_SUCCESS)) {
 		job_assumes(j, launchd_mport_close_recv(j->bs_port) == KERN_SUCCESS);
 		goto out_bad;
@@ -679,11 +676,6 @@
 	jr->stall_before_exec = w4d;
 	jr->force_ppc = fppc;
 
-	if (!job_setup_machport(jr)) {
-		job_remove(jr);
-		return NULL;
-	}
-
 	if (workingdir)
 		jr->workingdir = strdup(workingdir);
 
@@ -723,8 +715,9 @@
 
 	j = calloc(1, sizeof(struct job_s) + strlen(label) + 1);
 
-	if (!job_assumes(p, j != NULL))
-		goto out_bad;
+	if (!job_assumes(p, j != NULL)) {
+		return NULL;
+	}
 
 	strcpy(j->label, label);
 	j->kqjob_callback = job_callback;
@@ -735,6 +728,10 @@
 	j->checkedin = true;
 	j->firstborn = (strcmp(label, FIRSTBORN_LABEL) == 0);
 
+	if (!job_setup_machport(j)) {
+		goto out_bad;
+	}
+
 	if (reqport != MACH_PORT_NULL) {
 		j->req_port = reqport;
 		if (!job_assumes(j, launchd_mport_notify_req(reqport, MACH_NOTIFY_DEAD_NAME) == KERN_SUCCESS))
@@ -783,13 +780,12 @@
 	return j;
 
 out_bad:
-	if (j) {
-		if (j->prog)
-			free(j->prog);
-		if (j->stdinpath)
-			free(j->stdinpath);
-		free(j);
-	}
+	if (j->prog)
+		free(j->prog);
+	if (j->stdinpath)
+		free(j->stdinpath);
+	free(j);
+
 	return NULL;
 }
 
@@ -1079,8 +1075,6 @@
 	case 'M':
 		if (strcasecmp(key, LAUNCH_JOBKEY_MACHSERVICES) == 0) {
 			launch_data_dict_iterate(value, machservice_setup, j);
-			if (!SLIST_EMPTY(&j->machservices))
-				job_setup_machport(j);
 		}
 		break;
 	default:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20060923/2c46e158/attachment.html


More information about the launchd-changes mailing list