About system calls question...

machael thailer dony.he at huawei.com
Mon Jul 23 16:32:36 EST 2001


I have a question about how to use system calls...
I notice that in init/main.c=>init() functions:

init(void * unused)
{
    ....
if (open("/dev/console", O_RDWR, 0) < 0)
  printk("Warning: unable to open an initial console.\n");

 (void) dup(0);
 (void) dup(0);

 /*
  * We try each of these until one succeeds.
  *
  * The Bourne shell can be used instead of init if we are
  * trying to recover a really broken machine.
  */

 if (execute_command)
  execve(execute_command,argv_init,envp_init);
 execve("/sbin/init",argv_init,envp_init);
......
}

My question is since "open" "dup" and "execve" are system calls, they should
be called  only in user process instead of in kernel space.

Why can they be used in this way here?
Thanks in advance!

machael thailer


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-embedded mailing list