LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 03-14-2014, 01:21 AM   #1
vviivveekkk
LQ Newbie
 
Registered: Jan 2014
Posts: 6

Rep: Reputation: Disabled
Confusion in system call implementation and strace


I am on Centos 6.5 and implemented a new demo system call on linux kernel 3.13.2.
For this I changed the
  1. syscall_32.tbl
    Appended this in the end
    Code:
    351	i386 	helloworld 	sys_helloworld
  2. sys.c
    Defined my function in this file
    Code:
    asmlinkage long sys_helloworld(int fd) 
       {
        printk(KERN_EMERG "Hello, world! from Vivek\n");
        return fd+1;
       }
  3. syscalls.h
    Added this before last #endif
    Code:
    asmlinkage long sys_helloworld(int fd);

Then compiled and installed the new kernel. Everything is fine and working.
To test my system call, I used this program
Code:
#include <stdio.h>
    #include <linux/kernel.h>
    #include <sys/syscall.h>
    #include <unistd.h>
 
    int main()
    {
    int fd;
    fd = syscall(351, 5);
    printf("\n%d", fd);
    return 0;
    }
Now when I trace the test program in strace it shows the output like this
Click image for larger version

Name:	Screenshot.jpg
Views:	28
Size:	93.5 KB
ID:	14961

the last call SYS_351 is my new system call.
I want to know why the name of my system call is not shown like others above in this picture?? Is there any other changes required to do that.??
 
Old 03-16-2014, 12:11 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Why not use the provided SYSCALL_DEFINE macros?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
new system call implementation help Rhasz Linux - Newbie 1 06-26-2012 09:37 PM
intercepting system call / alternative to strace mrshanim Linux - Kernel 2 10-24-2009 09:07 PM
Strace Linux System Call Peter_APIIT Programming 2 05-25-2009 12:12 AM
System Call Implementation GodSendDeath *BSD 3 04-11-2005 05:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration