2017-10-21 75 views
2

我想在Ubuntu 12.04.1中进行系统调用。我试图在Ubuntu 12.04.1中进行系统调用。我遇到了一个错误编译我的hello.c文件

#include <linux/kernel.h> 
asmlinkage long sys_hello(void) { 
    printk("hello world\n"); 
    return 0; 
} 

它显示了错误:

error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘long’ asmlinkage long sys_hello(void)

+3

“问题”与问题描述有点相似... – fvu

+0

您有“问题”。你有什么问题?任何特定的错误消息?你的代码是否会唤起离开者的邪恶哀伤? –

+0

error:expected'=',',',';','asm'或'__attribute__'before'long' asmlinkage long sys_hello(void) ^ ~~~ @RobertColumbia –

回答

0

我假设你正在试图建立一个内核模块,我得到一个错误,我的编译文件hello.c。您需要在内核构建系统中执行此操作。您无法将其编译为常规应用程序或共享对象。最简单的方法可能是将模块修补到Ubuntu内核树中,并使用these instructions进行构建。

0

I'm trying to make a system call in Ubuntu 12.04.1.

假设你的意思是你想创建系统调用:内核模块不能添加系统调用。所有的系统调用都必须编译到内核中。

相关问题