PERFORCE change 187053 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Sun Dec 19 11:55:56 UTC 2010


http://p4web.freebsd.org/@@187053?ac=10

Change 187053 by trasz at trasz_victim on 2010/12/19 11:55:55

	Fix rusage_proc_fork() failure handling.

Affected files ...

.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_fork.c#29 edit

Differences ...

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_fork.c#29 (text+ko) ====

@@ -772,6 +772,21 @@
 	knlist_init_mtx(&newproc->p_klist, &newproc->p_mtx);
 	STAILQ_INIT(&newproc->p_ktr);
 
+	/*
+	 * XXX: This is ugly; when we copy resource usage, we need to bump
+	 *      per-cred resource counters.
+	 */
+	newproc->p_ucred = p1->p_ucred;
+
+	/*
+	 * Initialize resource container for the child process.
+	 */
+	error = container_proc_fork(p1, newproc);
+	if (error != 0) {
+		error = EAGAIN;
+		goto fail1;
+	}
+
 	/* We have to lock the process tree while we look for a pid. */
 	sx_slock(&proctree_lock);
 
@@ -790,20 +805,6 @@
 	}
 
 	/*
-	 * XXX: This is ugly; when we copy resource usage, we need to bump
-	 *      per-cred resource counters.
-	 */
-	newproc->p_ucred = p1->p_ucred;
-
-	/*
-	 * Initialize resource container for the child process.
-	 */
-	error = container_proc_fork(p1, newproc);
-	if (error != 0) {
-		error = EAGAIN;
-		goto fail;
-	}
-	/*
 	 * After fork, there is exactly one thread running.
 	 */
 	error = rusage_set(newproc, RUSAGE_NTHR, 1);


More information about the p4-projects mailing list