Sponsored Content
Operating Systems Linux Red Hat Adding our system call Fedora 18 -new syscall Post 302796901 by fpmurphy on Sunday 21st of April 2013 07:33:11 AM
Old 04-21-2013
Download the source of the kernel version to which you want to add the system cal.

Add your new syscall to arch/x86/syscalls (assuming you are using a kernel > 3.3.4). To add your system call move to the end of the file and add an entry at the end with the syntax same as previous lines. Next edit arch/x86/include/asm/unistd_32.h and add an appropriate #define for the your system call at the end of the file. Lets assume you wish to name your syscall "demo"
Code:
#define __NR_demo <your syscall number>

Then add the following code to kernel/sys.c
Code:
int SYSCALL_DEFINE0(demo) { 
printk(KERN_INFO "Demo system call"); 
return 0;                                
}

SYSCALL_DEFINE0 signifies that demo is a system call with zero arguments.

Compile and install your new kernel. Your new syscall is then ready for testing.
 

6 More Discussions You Might Find Interesting

1. Red Hat

Fedora - A confiusing operating system!!

I don't know why all these complicated stuff?! I have Fedora Core 3 installed on my Laptop. It has the apache 2.0 + php 4.3.0 installed on it. But for some reasons I need to remove them and install everything by myself. However, I don't see any way to remove a software from this silly oprating... (9 Replies)
Discussion started by: HSN
9 Replies

2. Shell Programming and Scripting

solaris and fedora core in one system

How can I keep Solaris 10 GA with Fedora core 3 in the same system.I have got IBM Netvista system with 40 gb hdd ,128mb ram,pentium 4 1.66 gb processor.Pls tell me in detail,otherwise provide me good Url. :) :eek: :confused: (1 Reply)
Discussion started by: xinubhaskar
1 Replies

3. UNIX for Advanced & Expert Users

solaris and fedora core in one system

How can I keep Solaris 10 GA and Fedora Core 3 In the same machine.I have got IBM netvista machine,with 40 gb hdd and 128 mb ram and 1.6 gzh pentium processor.Give me the step in detail.How do I pertition?How can I boot up both? :( :eek: :confused: (2 Replies)
Discussion started by: xinubhaskar
2 Replies

4. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

5. Programming

Adding custom ("Hello") system call: help

I'm trying to add a custom ("Hello world" :o) system call. In /usr/src/linux/hello/ I put simple hello.c ...#include "linux/linkage.h" // for linking a system call #include "linux/kernel.h" // for "printk" asmlinkage int sys_hello() { printk(KERN_ALERT "Hello!"); return 1; }... and in... (5 Replies)
Discussion started by: courteous
5 Replies

6. Emergency UNIX and Linux Support

Bad Address when adding system call

Hi guys. I have downloaded kernel 2.6.38-5 to add a system call. I did the following steps: 1. I have added my system call to system call table <src folder>/arc/x86/kernel/syscall_table_32.S .long sys_mycall 2. i have added the system cal number in <src... (5 Replies)
Discussion started by: majid.merkava
5 Replies
syscall(3UCB)					     SunOS/BSD Compatibility Library Functions					     syscall(3UCB)

NAME
syscall - indirect system call SYNOPSIS
/usr/ucb/cc [ flag ... ] file ... #include <sys/syscall.h> int syscall(number, arg, ...); DESCRIPTION
syscall() performs the function whose assembly language interface has the specified number, and arguments arg .... Symbolic constants for functions can be found in the header <sys/syscall.h>. RETURN VALUES
On error syscall() returns -1 and sets the external variable errno (see intro(2)). FILES
<sys/syscall.h> SEE ALSO
intro(2), pipe(2) NOTES
Use of these interfaces should be restricted to only applications written on BSD platforms. Use of these interfaces with any of the system libraries or in multi-thread applications is unsupported. WARNINGS
There is no way to use syscall() to call functions such as pipe(2) which return values that do not fit into one hardware register. Since many system calls are implemented as library wrappers around traps to the kernel, these calls may not behave as documented when called from syscall(), which bypasses these wrappers. For these reasons, using syscall() is not recommended. SunOS 5.10 22 Jan 1993 syscall(3UCB)
All times are GMT -4. The time now is 01:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy