Upstart 0.5.0, /proc, and telinit

Garrett Cooper yanegomi at
Tue Feb 24 02:49:45 GMT 2009

On Mon, Feb 23, 2009 at 2:14 PM, Adam Sampson <ats at> wrote:
> Scott James Remnant <scott at> writes:
>> Nobody has supplied a patch.
> Well, here's what I'm using happily, but I suspect a little more finesse
> would be useful. ;)

Uh, that will almost certainly fail if it can't allocate a shell
because system(3) calls execve(2) and allocates a shell.

Using mount(2), like so, would be better:

#include <string.h>          /* For strerror(3). */
#include <errno.h>
#include <sys/mount.h>
#include <linux/kernel.h> /* For panic(2). */

/* ... */

if (mount("none", "/proc", "proc", 0, NULL) < 0) {
    /* Change to OOM support not available, etc for this instead of a panic? */
    panic ("Failed to mount /proc: %s\n", strerror(errno));

    You'll potentially need to do similar for /dev and /dev/console
(we currently do that, but I'm not sure if /dev/console is needed...).
Combined with proper calls to fstab(5) with getent, this should be
solved properly in less than 30 lines.

More information about the upstart-devel mailing list