How to write system call and new API's for Linux kernel

如何写系统调用和新的API是Linux内核

Tags: linux-kernel
标签: linux-kernel

问题 (Question)

I have got frustrated by asking this question on Linux kernel forums but no one replied so m finally posting my question here on Stack Overflow ....i hope some one will show me a way...

I was reading one of "HOWTO" article Implementing a System Call on Linux 2.6 for i386

I am a B.Tech computer science student and new to Linux kernel. I am following a book "Understanding Linux kernel 3rd edition " by Bovet and Cesati. As time is much much important for all of us so i am writing the purpose of posting this question in points :

  1. I want to understand and implement process basics , how system calls works , inter process communication , adding new system calls and interfaces in API , adding new functions to "libc and call these interfaces and system calls from user program" etc.

  2. The method above link told does not add anything to API or libc , i want to implement system call through API or glibc , so that there will be no need of creating "testmycall.h" (header file ) while writing a test file to test newly created system call.

  3. How the Linux kernel interact with the hardware (i want to go in such a detail so that i can make such a customizable Linux kernel so that i can use that kernel to open my home door , its a example only , i want to understand and use it to perform my experiments)

Can any one tell me the direction where i should move, any book to understand these basics especially adding system call using api/libc, any link you have and any forum where i can post questions.

Thank you so much for your kind help.

我有沮丧,问这个问题,对Linux内核的论坛,但没有人回答我的问题,我最后张贴在堆栈溢出的…我希望有人会告诉我的方式…

我在读一篇文章“如何做”执行一个系统调用在i386 Linux 2.6

我是一个科技学士计算机科学专业的学生和新的Linux内核。我下面的一本书“理解Linux内核第三版”博韦和cesati。:我想理解和实施过程的基础上,系统调用,进程间通信,API中添加新的系统调用接口,添加新的功能“libc和调用这些接口和系统调用用户程序”等。上面的链接告诉方法不到API或libc添加任何东西,我想通过API或glibc实现系统调用,这样就没有必要创造“testmycall。H”(头文件)在写一个测试文件来测试新创建的系统调用。

  1. 如何在Linux内核与硬件(我想在这样的细节,以便我能做这样一个可定制的Linux内核,这样我可以使用内核打开我的家门口,它的例子,我想了解和使用它来完成我的实验)

  2. 任何人可以告诉我,我应该走的方向,任何一本书来了解这些基础知识尤其是添加系统使用API调用libc库的任何链接/,你有任何的论坛,我可以张贴问题。

  3. 非常感谢你的帮助。

非常感谢你的帮助。

如果你想学习

最佳答案 (Best Answer)

If you want to learn Linux kernel programming then first you should understand the Linux Device Driver. Drivers is nothing but you kernel modules and you can interact with driver using application program.

Various kinds of drivers:

Character driver, PCI Driver, Block Driver, Network Driver

To learn device Driver u can follow this link "http://free-electrons.com/doc/books/ldd3.pdf" LDD by Jonathan Corbet, Alessandro Rubini.

You can learn ioctl Advanced Character Driver to interact with hardware but before that You should have some knowledge in character driver Modules.

To understand Process basics you can follow any one of the UNIX book. Which also deals with System Calls, IPC Concepts, Semaphore, Thread, Shared Memory

You may use this link http://www.di.uevora.pt/~lmr/syscalls.html to understand all system calls with Examples.

那么你首先应该了解Linux kernel programmingLinux Device Driver司机只不过是你的内核模块,你可以使用应用程序的驱动作用。各种驱动程序:

各种驱动程序:

字符驱动程序PCI驱动程序块设备驱动程序网络驱动程序

学习的设备驱动程序,你可以点击这个链接”http://free-electrons.com/doc/books/ldd3.pdf“LDD乔纳森Corbet,亚历山德罗Rubini。

你可以学习ioctl Advanced Character Driver与硬件但之前,你应该在字符驱动程序模块有一定的了解。

了解工艺基础您可以按照任何一个UNIX的书。它还处理System Calls, IPC Concepts, Semaphore, Thread, Shared Memory

你可以使用这个连接HTTP:/ / www.di。uevora Pt/~ LMR / syscalls.html。要了解所有的系统调用的例子。

本文翻译自StackoverFlow,英语好的童鞋可直接参考原文:http://stackoverflow.com/questions/23444014