linux-mips-fnet
[Top] [All Lists]

Can't run thread!!

To: "LinuxEmbeddedMailList" <linux-embedded@waste.org>, "LinuxKernelMailList" <linux-kernel@vger.kernel.org>, "MipsMailList" <linux-mips@fnet.fr>
Subject: Can't run thread!!
From: "Greeen-III" <greeen@iii.org.tw>
Date: Mon, 19 Mar 2001 16:06:14 +0800
Hi all,
 
I modified the /init/main.c to the following.
I skipped executing the "init" program.
But the program will stop after print "First Kernel thread".
Why??
 
Should I run the init program first or I forget to initialize something?
I try to change the library version, and the error still exist.
 
P.S  I use Mips r39xx machine.
 
                                                                                                        Green
 
------------------------</init/main.c>----------------------------
static int FirstKernelThread(void)
{
 printk("First Kernel thread!!\n");
 execve("/bin/pthread",argv_init,envp_init);
 return 1;
}
 
static int init(void)
{
...
...
// execve("/sbin/init",argv_init,envp_init);
// execve("/etc/init",argv_init,envp_init);
// execve("/bin/init",argv_init,envp_init);
// execve("/sbin/sulogin",argv_init,envp_init);
// execve("/bin/bash",argv_init,envp_init);
 
/* create a kernel thread to run my program pthread */
 kernel_thread(FirstKernelThread, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
...
}
 
 
--------------------<testpthread.c>---------------------------
/*
 2001/03/14 Lin-Ming Wan(Green)
 */
 
#include <stdio.h>
#include <pthread.h>
 
int FirstThread(void)
{
 printf("test thread!!");
 return 1;
}
 
int main(void)
{
 pthread_t MyThread;
 
 /* Call Thread */
 printf("-------> FirstThread\n");
 pthread_create(    &MyThread,
       (pthread_attr_t *) NULL,
      (void*)FirstThread,
      NULL );
/*Wait for child process*/
 pthread_join( MyThread, NULL);
 return 1;
}
<Prev in Thread] Current Thread [Next in Thread>