kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: mohit89mlnc@gmail.com (mohit verma)
To: kernelnewbies@lists.kernelnewbies.org
Subject: adding a system call
Date: Tue, 22 Feb 2011 20:44:39 +0530	[thread overview]
Message-ID: <AANLkTi=1wH+uVCPEGhXB7_UnAQp61ayKO6vee5Lg7GaD@mail.gmail.com> (raw)

hi all ,
i followed the link and tried to add a system call in kernel-version 2.6.37
here is the code :


#include<linux/linkage.h>
#include<linux/kernel.h>
#include<linux/fs.h>  //for getname
#include<linux/err.h> //for PTR_ERR
asmlinkage int sys_hariohm(const char __user *filename)
{
    char *tmp = getname(filename);
     int fd=PTR_ERR(tmp);
        if (!IS_ERR(tmp))
        {
        printk("filename %s \n",tmp);
        putname(tmp);
        return fd;
        }
        else
        {
        return 2;
        }
}


the compilation process was silent (without any error).
 but when i try to boot into the kernel having this system call , i get the
errors like :

do_exit() ,do_group_exit() , syscall_init() error lines with some addresses.

can someone help me understand what is wrong with this code?

thanks in advance :)

-- 
........................
*MOHIT VERMA*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110222/7eff007d/attachment.html 

             reply	other threads:[~2011-02-22 15:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-22 15:14 mohit verma [this message]
2011-02-22 15:18 ` adding a system call mohit verma
2011-02-22 17:50   ` Mulyadi Santosa
2011-02-22 18:01     ` mohit verma
2011-02-22 18:10       ` Mulyadi Santosa
2011-02-22 18:19         ` mohit verma
2011-02-22 18:39           ` Mulyadi Santosa
2011-02-22 18:44             ` mohit verma
2011-02-22 21:21               ` Anuz Pratap Singh Tomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=1wH+uVCPEGhXB7_UnAQp61ayKO6vee5Lg7GaD@mail.gmail.com' \
    --to=mohit89mlnc@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).