Using system calls inside kernel

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

 



hi,
I want to write a simple network client server inside kernel(2.6.22). I know that this should not be done in kernel, however, this is a research project and I just wanted to compare a few things. I was using sock_create() to create a socket. This call returns an allocated struct socket upon successful completion. However, now I want to use sys_poll() to poll the socket to check if the data is available. Since I need fd for this, I was thinking about recompiling kernel with exported sock_map_fd() (and sock_poll()) and using that to get an fd.
My questions:
1. I assume that usually when a socket is created from user level process, sock_map_fd() will allocate an fd from table that is associated with that user level process. However, in this case, my kernel thread is not associated with any process. Would it be still safe to call sock_map_fd(), get an fd and call sys_poll() on it?
2. In the latest kernel (2.6.30), I see that most of the system calls are defined using SYSCALL_DEFINEN() macro. What is the reason in doing so? Can one still use system calls defined in this way inside the kernel?
In general, why system calls are hidden from kernel processes?

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux