在Linux中创建系统调用 [英] Creating a System Call in Linux

查看:73
本文介绍了在Linux中创建系统调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我们的操作系统"课程刚刚获得了一个期中项目,我们被要求实施系统调用(我想我认为我们必须编写一段代码来调用它).

We just got a midterm project today for my "operating systems" course, we are requested to implement a system call (and I guess I assume we'll have to write a piece of code to call it).

我知道我将需要更新系统调用的表(不记得名称,但是没什么大不了),以及创建该表将指向的内核模块,但这是否意味着我必须重新编译整个内核,这样内核才能知道我的模块?

I understand I'll need to update the table of the system calls (can't remember the name, but no biggie), as well as create a kernel module that the table will point to, but does this mean I'll have to recompile the whole kernel, so the kernel knows about my module?

我已经看到有可能劫持当前的系统调用,但是我怀疑如果这样做的话,我的功课不会功劳.

I have seen that it's possible to hijack a current system call, but I suspect that I won't get credit for my assignment if I do it that way.

只想感受一下我将要付出的努力.

Just wanted to get a feel for the size of the effort I'll be making.

更新: 好吧,这有点麻烦,他们从我相信2.6.32向前更改了一些内容,因此当我回到我发现的在线教程特有的先前内核版本时,确实很容易遵循.如果有人在线上学习并正在关注本教程,那么最初我建议您先在本教程中下载相同的内核,然后在了解自己的工作后再从那里继续前进.如果您真的很熟悉编译内核等问题,那么可能就没问题了,但这是我第一次编译内核,因此要进行2个小时的编译,然后发现有些问题是不可行的,并且必须重新做一遍,特别是当我不确定自己在做什么/没有做错错误时.

UPDATE: Well it kinda ended up being a hassle, they change some things from I believe 2.6.32 forward, so when I went back to a previous kernel version specific to the tutorials online I found, it was really easy to follow. If anyone catches this online and are following a tutorial, initially I would recommend downloading the same kernel in the tutorial initially, then move forward from there once you have an understanding of what you're doing. If you're really familiar with compiling kernels, etc, you might not have an issue, but this was my first time compiling a kernel, so it was a pain to compile for 2 hours and then find out something didn't work, and have to do it all over again, especially when I wasn't sure what I was/wasn't doing wrong.

推荐答案

但这是否意味着我必须重新编译整个内核,所以内核知道我的模块?

but does this mean I'll have to recompile the whole kernel, so the kernel knows about my module?

是的,您将需要重新编译内核.

Yes, you will need to recompile the kernel.

这篇关于在Linux中创建系统调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆