Results 1 to 3 of 3
Hi everyone
I need to write a system call for the first time and it's proven to be pretty frustrating - I'm having trouble wrapping my head around it. But ...
- 09-15-2011 #1Just Joined!
- Join Date
- Sep 2011
- Posts
- 4
Writing a System Call
Hi everyone

I need to write a system call for the first time and it's proven to be pretty frustrating - I'm having trouble wrapping my head around it. But I figure I'll start off slow. Here is my declaration in sys.c:
The compiler returns:Code:SYSCALL_DEFINE1 (getprinfo, struct prinfo *info)
There are two arguments there. I can also see that info isn't being included in the compiler's output; it's saying that info is undeclared. Am I using SYSCALL_DEFINE1 incorrectly? Am I treating it too much like a user-space program?Code:/home/dtroberts/kernelSrc/kernel/sys.c:1816:1: error: macro "__SC_DECL1" requires 2 arguments, but only 1 given
Thank you.
- 09-16-2011 #2
Doing a quick trace through the /include/linux/syscalls.h file in the kernel source code implies to me that your arguments and their types should be separate:
Having never written a system call, I'm not entirely sure that this is accurate, but given that __SC_DECL1 is defined as:Code:SYSCALL_DEFINE1(getprinfo, struct prinfo *, info)
I suspect that this is true.Code:#define __SC_DECL1(t1, a1) t1 a1
DISTRO=Arch
Registered Linux User #388732
- 09-16-2011 #3Just Joined!
- Join Date
- Sep 2011
- Posts
- 4


Reply With Quote
