Полезная информация Чай для похудения Изумрудный ящер, чай для похудения Изумрудный ящер wikizdorove.ru.

next up previous contents
Next: Linux Memory Management Up: How System Calls Work Previous: How Initializes the system

How to Add Your Own System Calls

  1. Create a directory under the /usr/src/linux/ directory to hold your code.
  2. Put any include files in /usr/include/sys/ and /usr/include/linux/.
  3. Add the relocatable module produced by the link of your new kernel code to the ARCHIVES and the subdirectory to the SUBDIRS lines of the top level Makefile. See fs/Makefile, target fs.o for an example.
  4. Add a #define __NR_xx to unistd.h to assign a call number for your system call, where xx, the index, is something descriptive relating to your system call. It will be used to set up the vector through sys_call_table to invoke you code.
  5. Add an entry point for your system call to the sys_call_table in sys.h. It should match the index (xx) that you assigned in the previous step. The NR_syscalls variable will be recalculated automatically.
  6. Modify any kernel code in kernel/fs/mm/, etc. to take into account the environment needed to support your new code.
  7. Run make from the top level to produce the new kernel incorporating your new code.

At this point, you will have to either add a syscall to your libraries, or use the proper _syscalln() macro in your user program for your programs to access the new system call.

The 386DX Microprocessor Programmer's Reference Manual is a helpful reference, as is James Turley's Advanced 80386 Programming Techniques. See the Annotated bibliography in Appendix gif.



Converted on:
Mon Apr 1 10:20:16 EST 1996