-   Linux - Kernel (
-   -   How to call system call from usb driver's code (

Mr.J 09-27-2008 09:52 AM

How to call system call from usb driver's code

I need to call one system call inside linux- .
I just included <linux/syscalls.h>
and called the api like (sys_getpid())...
but when I compiled the code, I got error ..undefined refence to sys_getpid....

If anybody has any idea on how to call system call within drivers code..
plz advise..


ashok449 09-29-2008 01:15 AM

I'm not sure but let me guess...

EXPORT_SYMBOL for the API you wanna use, and u can access in driver code

getpid() in kernel space ? you need to use process descriptor (struct task_struct) I guess ...

-- Ashok

krishna_123 09-29-2008 01:17 AM

sys_getpid is not exported since there is no EXPORT_SYMBOL(sys_getpid) defined in the kernel source tree.

krishna_123 09-29-2008 01:20 AM

u can get the pid of a process using the current pointer which is defined in linux/sched.h. current->pid will prints the pid of the user space program that invoked the driver

Mr.J 09-29-2008 04:47 AM

After exporting symbol, it worked.... Thanks for your help.

All times are GMT -5. The time now is 12:39 AM.