Adding system calls to linux (and a question) SOLVED!
How do I search for files in the terminal? I want to search for a specific file or several files in a certain folder including all its sub folders.
What are the steps I need to do to add system calls to the linux interface?
I need to create a .c file with my syscalls inside the kernel, and then add it to the makefile?
The .o files are the compiled .c files?
Does the makefile compiles automatically all the .c files in the kernel folder?
because I didnt see any .c file specified in the makefile.
After doing that, I need to update the entry.s with the names of my syscalls?
Is there anything else I need to do apart from what I mentioned?
Thanks in advance.
[Edited by - The C modest god on November 19, 2005 7:59:02 AM]
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:
Original post by Toolmaker
Quote:
Original post by The C modest godHow is my improoved signature?It sucks, just like you.
You might want to gain some more familarity with linux before diving into the kernel. Maybe not though...
grep is the tool for searching (obscure Star Trek reference).
How you make a driver depends on which kernel you are making it for. The process it a little bit different for 2.6 than 2.4. There should be HOWTOs out there, or simple example drivers.
grep is the tool for searching (obscure Star Trek reference).
How you make a driver depends on which kernel you are making it for. The process it a little bit different for 2.6 than 2.4. There should be HOWTOs out there, or simple example drivers.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
It's not for the terminal, but RedHat SourceNavigator is a very useful tool for ... uhm ... navigating large amounts of source code.
STLport | Lua | Squirrel | Doxygen | NASM | bochs | osdev | Ruby | FreeBSD | Zend Framework 2 | YUI 3 | VP UML| ZFS | Linux Mint (Cinnamon)
I didnt find any related tutorial.
I was able to narrow my problem to this:
I have linux red hat8 installed.
I want to add a system call to the kernel and recompile the kernel.
What I did is I added My.c inside linux-2.4.18-14custom/kernel
The code for My.c is:
The problem I have as when I add #include <linux/sched.h> I get all sort of errors on sched.h when compiling with gcc -c My.c or gcc My.c -c
I also tried to compile user.c in the kernel, because it also has an include to sched.h, and I got about the same errors on sched.h
So how am I suppose to create My.o from My.c?
Is there something I am missing?
Thanks in advance.
I was able to narrow my problem to this:
I have linux red hat8 installed.
I want to add a system call to the kernel and recompile the kernel.
What I did is I added My.c inside linux-2.4.18-14custom/kernel
The code for My.c is:
#include <linux/kernel.h>#include <linux/sched.h>#include <errno.h>//#include <current.h>int sys_getpath (int pid, int * array, int size){ task_struct * pTask; printk ("This is get path V0P02\n"); // pTask = current; printk ("%d", pTask->pid); while (pTask->pid!=1) { pTask = pTask->p_pptr; printk ("%d", pTask->pid); } return 0;}
The problem I have as when I add #include <linux/sched.h> I get all sort of errors on sched.h when compiling with gcc -c My.c or gcc My.c -c
I also tried to compile user.c in the kernel, because it also has an include to sched.h, and I got about the same errors on sched.h
So how am I suppose to create My.o from My.c?
Is there something I am missing?
Thanks in advance.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:
Original post by Toolmaker
Quote:
Original post by The C modest godHow is my improoved signature?It sucks, just like you.
You're going to have to follow the normal procedure for compiling kernel drivers.
This means adding some parameters to gcc.
It must not read any of the standard include files in /usr/include, so you probably want a -nostdinc in there.
It must also have the kernel headers in the include path.
Why not consider creating a device special file instead of a system call? It may be easier (This is a guess).
Mark
This means adding some parameters to gcc.
It must not read any of the standard include files in /usr/include, so you probably want a -nostdinc in there.
It must also have the kernel headers in the include path.
Why not consider creating a device special file instead of a system call? It may be easier (This is a guess).
Mark
Use can use the find command to look for a file. You could also try locate, if the file is on your system at least a day.
Why do you want to add system calls to the Linux kernel?
If you use those in a program then, only users with patched kernels can run your program. I think you don't need this (unless you're just interested in kernel hacking, of course).
Why do you want to add system calls to the Linux kernel?
If you use those in a program then, only users with patched kernels can run your program. I think you don't need this (unless you're just interested in kernel hacking, of course).
The problem has been solved.
I didnt need to compile the MY.c into MY.o, when I did "make bzImage" it did it without me having to add anything. The only thing I needed to add was MY.o in the makefile INSIDE the kerenel library.
So the problem is solved, and now I have my own system call in linux.
Thanks for the help.
I didnt need to compile the MY.c into MY.o, when I did "make bzImage" it did it without me having to add anything. The only thing I needed to add was MY.o in the makefile INSIDE the kerenel library.
So the problem is solved, and now I have my own system call in linux.
Thanks for the help.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:
Original post by Toolmaker
Quote:
Original post by The C modest godHow is my improoved signature?It sucks, just like you.
Quote: Original post by Shannon Barber
grep is the tool for searching (obscure Star Trek reference).
Care to explain that reference? According to the jargon file:
Quote: from Jargon File: Grep
[from the qed/ed editor idiom g/re/p, where re stands for a regular expression, to Globally search for the Regular Expression and Print the lines containing matches to it, via Unix grep(1)] To rapidly scan a file or set of files looking for a particular string or pattern (when browsing through a large set of files, one may speak of grepping around). By extension, to look for something by pattern. “Grep the bulletin board for the system backup schedule, would you?” See also vgrep.
[It has been alleged that the source is from the title of a paper “A General Regular Expression Parser”, but dmr confirms the g/re/p etymology --ESR]
So what's the Star Trek reference?
John B
The best thing about the internet is the way people with no experience or qualifications can pretend to be completely superior to other people who have no experience or qualifications.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement