Denys Vlasenko schrieb:
> On Friday 02 November 2007 19:59, Marc Blumentritt wrote:
>> Hi bb list,
>>
>> #!/bin/sh
>> # Copyright 2006-2007 Gentoo Foundation
>> # Distributed under the terms of the GNU General Public License v2
>>
>> # Ensure we are called by init
>> echo "PPID = $PPID"
>> #[ "$PPID" == "1" ] || exit 0
>>
>> I would expect a PPID of 1, bit I get something like 833! But if a check
>> with ps, init has PID of 1?! I cannot explain this. I also used sysvinit
>> instead of bb init and checked PPID in a similar way and got the same
>> result! The only idea I have, where this could come from is, that
>> /bin/sh is of course a link to /bin/busybox. Perhaps this breaks
>> checking PPID? Or this is some kind of bug? Or is this related with
>> running a system in rootfs of initramfs?
> 
> I think that your process gets started from a child if init, not
> an init itself. Do "ps -A" and send output to the list,
> and alsoo look up what process has PID 833.

This is ps -A from booted system:
[EMAIL PROTECTED] $ ps -A
PID   USER     COMMAND
    1 root     init
    2 root     [kthreadd]
    3 root     [migration/0]
    4 root     [ksoftirqd/0]
    5 root     [events/0]
    6 root     [khelper]
   34 root     [kblockd/0]
   35 root     [kacpid]
   36 root     [kacpi_notify]
  124 root     [ksuspend_usbd]
  127 root     [khubd]
  129 root     [kseriod]
  144 root     [pdflush]
  145 root     [pdflush]
  146 root     [kswapd0]
  147 root     [aio/0]
  148 root     [jfsIO]
  149 root     [jfsCommit]
  150 root     [jfsSync]
  151 root     [xfslogd/0]
  152 root     [xfsdatad/0]
  824 root     [kpsmoused]
 1222 root     syslogd
 1352 root     /usr/sbin/dropbear
 1359 root     /sbin/getty 38400 tty1
 1360 root     /sbin/getty 38400 tty2
 1362 root     /sbin/getty 38400 tty3
 1363 root     /sbin/getty 38400 tty4
 1364 root     /sbin/getty 38400 tty5
 1371 root     /sbin/getty 38400 tty6
 1375 root     /usr/sbin/dropbear
 1376 root     -sh
 1381 root     ps -A

I do not see PID 833.

I also added
ps -a > /ps_init_data to my init script and got this result(!):
[EMAIL PROTECTED] $ cat /ps_init_data
PID   USER     COMMAND

Empty list? At least init should be listed, shouldn't it?

I'm also checking the PPID of my shutdown script. It was 1384 , but I
think this depends upon how many commands I executed before (I did the
cat command and reboot). Could it be, that busybox init creates a child
process for every action it does?

Regards,
Marc

_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to