Upstart trunk code needs /proc to be mounted

Sandeep Puddupakkam (spuddupa) spuddupa at cisco.com
Thu Jul 24 18:59:24 BST 2008


Hi,
I am trying to compile and use upstart from trunk. I was trying to start
a job (first job) and I ran into some error that was causing upstart to
restart a few time and then core dump.
Upon investigation, I found that the code inside job_process.c function
job_process_spawn() was trying to access /proc which is not mounted at
this time.

/* Adjust the process OOM killer priority.
	 */
	snprintf (filename, sizeof (filename), "/proc/%d/oom_adj",
getpid ());
	fd = fopen (filename, "w");
	if (! fd) {
		nih_error_raise_system ();
		job_process_error_abort (fds[1],
JOB_PROCESS_ERROR_OOM_ADJ, 0);
	}
	fprintf (fd, "%d\n", class->oom_adj);
	if (fclose (fd)) {
		nih_error_raise_system ();
		job_process_error_abort (fds[1],
JOB_PROCESS_ERROR_OOM_ADJ, 0);
	}

The /proc directory gets mounted as part of executing rc.sysinit on our
system.
The workaround that I used was to mount the /proc directory within the
upstart code in main().
Is it required that /proc be present when upstart is started?
What would happen if the above code is commented? Is/will the oom_adj
file read and used later on?

Thanks,
Sandeep



More information about the upstart-devel mailing list