The HyperNews Linux KHG Discussion Pages

## Can I make syscall from inside a kernel module?

  Forum: The Linux Kernel Hackers' Guide
  Keywords: syscall, module, lock physical page
  Date: Tue, 18 Nov 1997 21:48:35 GMT
  From: Shawn Chang <shawnc@cs.berkeley.edu>

I have a silly question about syscalls. I wrote a kernel module for user controlled page allocation, which needs to call some kernel function to lock some physical pages allocated, so they won't get swapped out. After searching in the kernel source, I only found sys_mlock() in mm/mlock.c seem to be a good function for my purpose. But sys_mlock() is not a directly exported kernel symbol, so my module can't call it directly. Then I found that one of the pre-defined syscalls is actually mlock, so I was thinking if I could make a syscall from inside my kernel module. Is it possible to do that? Otherwise, how do I export sys_mlock() so my kernel module will be able to call it? Another related question. My kernel module is accessed by user application through syscall(164,...). Suppose I want to access some functions in the kernel module from some original kernel functions, such as do_page_faults() in fault.c. What should I do? Thanks in advance for any answers. Shawn