Reputation:
I'm trying to make a system call in Ubuntu 12.04.1. I'm getting an error compiling my hello.c
file:
#include <linux/kernel.h>
asmlinkage long sys_hello(void) {
printk("hello world\n");
return 0;
}
It shows the error:
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘long’ asmlinkage long sys_hello(void)
Upvotes: 1
Views: 285
Reputation: 558
All the system calls must be compiled into the kernel. You need to do this within the kernel build system.you cannot use it outside the kernel or shared object.
Upvotes: 0
Reputation:
I'm trying to make a system call in Ubuntu 12.04.1.
Assuming you mean you're trying to create a system call: kernel modules cannot add system calls. All system calls must be compiled into the kernel.
Upvotes: 0
Reputation: 33717
I assume you are trying to build a kernel module. You need to do this within the kernel build system. You cannot compile it as a regular application or shared object. The easiest way probably is to patch the module into the Ubuntu kernel tree and build it using these instructions.
Upvotes: 0