LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-21-2013, 03:21 AM   #1
Binu
LQ Newbie
 
Registered: Apr 2013
Posts: 8

Rep: Reputation: Disabled
How to handle kernel signals


Hi,
Am writing a kernel module.By default the kernel stack is not executable, so while executing this stack section, the kernel throws a signal i.e SIGSEGV, SO my question is how to handle or capture this signal in kernel module ?
 
Old 04-22-2013, 04:27 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,590

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
SIGSEGV is a segmentation fault, meaning you are trying to read memory that is not allocated usually. What do you mean by "handle" or "capture" the sig11?

Heres some sig11 info.

http://www.bitwizard.nl/sig11/
 
2 members found this post helpful.
Old 05-24-2013, 11:06 AM   #3
Binu
LQ Newbie
 
Registered: Apr 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
Smile error: too few arguments to function `d_path'

Hi All,

Though am providing the correct argument to the function `d_path`, still it shows the error :
module/rt.c:23: error: too few arguments to function `d_path'

<snippet>
#include <linux/init.h>
#include <linux/module.h>
#include<linux/sched.h>
#include <linux/rcupdate.h>
#include <linux/fdtable.h>
#include <linux/fs.h>
#include <linux/fs_struct.h>
#include <linux/dcache.h>


MODULE_LICENSE("Dual BSD/GPL");

static int current_init(void)
{

char *cwd;
struct path pwd, root;
pwd = current->fs->pwd;
path_get(&pwd);
root= current->fs->root;
path_get(&root);
char *buf = (char *)kmalloc(GFP_KERNEL,100*sizeof(char));
cwd = d_path(&pwd,buf,100*sizeof(char));
printk(KERN_ALERT "Hello,the current working directory is \n %s",cwd);

return 0;
}

static void current_exit(void)
{

printk(KERN_ALERT "Goodbye cruel world");
}

module_init(current_init);
module_exit(current_exit);

<snippet>

Could any one help, how to solve this error ? Thanks in advance - Binu
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Sending Signals in kernel sindhu4sind Linux - Newbie 1 05-09-2012 11:18 AM
Can we handle the signals for Services like httpd ,mysql vass Programming 3 08-20-2004 06:43 PM
Capturing the signals from UNIX kernel Micha Agovic Programming 3 01-30-2002 08:11 AM


All times are GMT -5. The time now is 07:47 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration