* linuxrc thread doesn't terminate
@ 2001-12-03 20:52 Heather Peterson
0 siblings, 0 replies; only message in thread
From: Heather Peterson @ 2001-12-03 20:52 UTC (permalink / raw)
To: linuxppc-embedded
Hi,
I'm relatively new to linux. I hope this isn't a repeat
question, but I tried searching through the old postings
and couldn't find an answer.
I'm using an 860P custom board running the 2.2.14 kernel
from HardHat. I got it working using both NFS and with an
initial ramdisk. However, now I want to start up with a
small initrd and then mount the real root filesystem off a
compact flash card.
My system is configured with CONFIG_BLK_DEV_INITRD and
my boot argument is root=/dev/cfda2 (my compact flash
device). My initrd has a linuxrc file that loads the
drivers neccessary to access the compact flash device.
I put print statements in init/main.c
pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD);
printk("My printk: launched thread to call linuxrc,
pid = %d\n", pid);
if (pid>0)
while (pid != wait(&i));
printk("\nMy printk: Thread terminated\n");
Here is my linuxrc file:
#!/bin/sh
echo 'Loading compact flash drivers.'
insmod ports.o
insmod i2c.o
insmod cfd.o
echo 'End of linuxrc.'
When it runs I see the first print statement, I see the
output from my linuxrc script, but I never see the second
print statement. Is the thread not terminating properly?
How can I tell?
I also tried adding a counter to the loop and using waitpid
instead of wait:
pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD);
printk("My printk: launched thread to call linuxrc,
pid = %d\n", pid);
rc = 0;
loopCount = 0;
if (pid>0)
{
printk("My printk: waiting:\n");
while ((pid != rc) && (loopCount++ < 80000))
{
current->policy |= SCHED_YIELD;
schedule();
rc = waitpid(pid, &i, WNOHANG);
}
}
if (rc == pid)
printk("\nMy printk: Thread terminated\n");
else
printk("\nMy printk: continuing without
termination of linuxrc thread\n");
This seems to work. My drivers load from the linuxrc
script and then I see the print statement "continuing
without termination of linux rc thread", and it goes on
to call change_root(). Any ideas why wait and waitpid
never return with the pid of the linuxrc thread? What
am I doing wrong?
Any help would be greatly appreciated.
Thanks,
Heather
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-12-03 20:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-03 20:52 linuxrc thread doesn't terminate Heather Peterson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).