Re: Using system calls inside kernel

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

 



it is not commended to use system call in the kernel space. It has no
necessary to do so.
u can research the maillist for why.
i think the system call is the interface for user space applications to use.
u wanna write the sock in the kernel, plz use the function the kernel provide.
give u two articles for reference:
http://kernelnewbies.org/Simple_UDP_Server
http://kernelnewbies.org/FAQ/WhyWritingFilesFromKernelIsBad

IMO, the functions designed had their own scope for using.

BRs
Lin

2009/8/3 Methos <methos.oldest@xxxxxxxxx>:
> 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?

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[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