[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: puzzle about open in kernel



madsys wrote:

>hi all,
>	
>	I have a puzzle about open() in kernel lately.
>
>	see below please:
>
>	init/main.c [init()]:
>	---snip---
>	if (open("/dev/console", O_RDWR, 0) < 0)
>		printk("Warning: unable to open an initial console.\n");
>	---snip---
>	
>    I know that open() is a wrapper of system call. But who can tell me why the kernel use system call "open" instead of the direct sys_open function in the kernel? Can we change it to the sys_open function here?
>	
>  
>
the init() function is a kernel thread. From what i understand you can
call system calls from inside a kernel thread, As the kernel thread, is
a process (with process id etc) running in kernel space.




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/