Messages in this thread | | | Date | Wed, 23 Mar 2005 10:51:07 +0530 (IST) | From | Payasam Manohar <> | Subject | segmentation fault while loading modules |
| |
hai,
I have a problem in loading a module ,it is giving segmentation fault, when I do the /sbin/lsmod signal4 944 (initializing)
here signal4 is my module name.I am using 2.4.20-8 kernel. And I am unable to remove this module also.
following is the code of my module
#include <bits/signum.h> /* signal number macros SIGHUP etc. */ #include <linux/kernel.h> /* printk level */ #include <linux/module.h> /* kernel version etc. */ #include <linux/sched.h> /* task_struct */
MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("Signal to a user-space app from a kernel module");
int pid=0; MODULE_PARM(pid,"i");
int ksignal(int pid,int signum) { struct task_struct x; struct task_struct *p; /* run through the task list of linux until we find our pid */ //for (p = &init_task ; (p = next_task(p)) != &init_task ; ){ for (p = &x ; (p = next_task(p)) != &x ; ){ if(p->pid == pid){ printk("sending signal %d for pid %d\n",signum,(int)p->pid); /* don't have a sig_info struct to send along - pass 0 */ return send_sig(signum,p,0); } } /* did not find the requested pid */ return -1; }
int init_module(void) { /* send pid a SIGKILL */ ksignal(2345,SIGKILL); return 0; }
void cleanup_module(void) { printk("out of here\n"); } ----------------------- my makefile is:
TARGET := signal4 WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes INCLUDE := -isystem /lib/modules/2.4.20-8feb9.1/build/include CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE} CC := gcc
${TARGET}.o: ${TARGET}.c
.PHONY: clean
Any suggestions are welcome.
Thanks&Regards, P.Manohar.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |