Re: Why isn't init PID 1?

Igmar Palsenberg (maillist@chello.nl)
Thu, 1 Feb 2001 00:58:47 +0100 (CET)


On Wed, 31 Jan 2001, Paul Powell wrote:

> Hello,
>
> I have a bootable linux CD that runs a custom init.
> Under most versions of linux init runs as process ID
> one. Under my bootable CD, it runs as process ID 15.
> I need it to run as PID 1 so that I can execute a
> kill(-1,15) without killing init.
>
> The boot CD uses and initrd image to load drivers.
> The linuxrc file looks like:
>
> #!/bin/sash
>
> aliasall
>
> echo "Loading aic7xxx module"
> insmod /lib/aic7xxx.o
> echo "Loading ips module"
> insmod /lib/ips.o ips=ioctlsize:512000
> echo "Loading sg module"
> insmod /lib/sg.o
> echo "Loading FAT modules"
> insmod /lib/fat.o
> insmod /lib/vfat.o
>
> echo "Mounting /proc"
> mount -t proc /proc /proc
> init
> umount /proc
>
> Does it run as PID 15 because I execute insmod and
> mount before running init?

Yes. First program to run get PID 1.

Solution : fork() in init and load the modules in the child.

Igmar

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/