The HyperNews Linux KHG Discussion Pages

Note: code snip to make a sys_* call from a module

Forum: The Linux Kernel Hackers' Guide
Re: Question Can I make syscall from inside a kernel module? (Shawn Chang)
Keywords: syscall, module, lock physical page
Date: Thu, 08 Jan 1998 22:35:21 GMT
From: Pradeep Gore <[email protected]>

As an example, here is a code snip that make a sys_read call from a kernel module.

// module.c
#include <sys/syscall.h>
extern long sys_call_table[]; // arch/i386/kernel/entry.S

int (*sys_read)(unsigned int fd, char *buf, int count);
// pointer to sys_read. linux/fs/read_write.c

int init_module(void)
 sys_read = sys_call_table[SYS_read];
 //now you can use sys_read