-----Original Message----- ********************** Legal Disclaimer **************************** "This email may contain confidential and privileged material for the sole use of the intended recipient. Any unauthorized review, use or distribution by others is strictly prohibited. If you have received the message in error, please advise the sender by reply email and delete the message. Thank you." ********************************************************************** From: Gaurav Dhiman [mailto:gaurav4lkg@xxxxxxxxx] Sent: Wednesday, April 27, 2005 6:42 PM To: B Srinivas Cc: kernelnewbies@xxxxxxxxxxxx Subject: Re: SMP kernel can you post your code on this list (if possible), so that we can see what exactly is being done. -gd On 4/27/05, B Srinivas <b.srinivas@xxxxxxxxxxxx> wrote: > > > > Hello there, > > I have written a module which registers a character device > . and in the open function I put it into a wait queue > (interruptible_sleep_on). > > I load one more module which also registers the character device and in its > open fuction I wake the first process in sleep. (wake_up). > > Here am successfully able to wake up only on a UP kernel and not on a SMP > kernel !!! whats are the fundaments am missing ? > > > > Thanks with regards > > Srinivas Bakki > > > Mod.h : int mod_open(struct inode * , struct file *); int mod_release(struct inode * , struct file *); wait_queue_head_t wait; struct file_operations file_ops={ open:mod_open, release:mod_release, }; Mod.c : #define __KERNEL__ #define MODULE #include<linux/kernel.h> #include<linux/module.h> #include<linux/init.h> #include<linux/fs.h> #include<asm/current.h> #include "mod.h" int mod_open(struct inode * in, struct file * fi) { init_waitqueue_head(&wait); printk("The process is goin to a sleep state \n"); interruptible_sleep_on(&wait); return 0; } int mod_release(struct inode * in, struct file * fi) { printk("This is the close thing \n"); return 0; } int load_module(void) { int res; res = register_chrdev(0,"mod",&file_ops); printk("char dev. registered %d \n",res); printk("The module is loaded \n"); return 0; } void unload_module(void) { printk("The module is unloaded \n"); } module_init(load_module); module_exit(unload_module); Mod1.c : #define __KERNEL__ #define MODULE #include<linux/kernel.h> #include<linux/module.h> #include<linux/init.h> #include<linux/fs.h> #include "mod.h" int mod_open(struct inode * in, struct file * fi) { printk("This is the open thing \n"); wake_up(&wait); return 0; } int mod_release(struct inode * in, struct file * fi) { printk("This is the close thing \n"); return 0; } int load_module(void) { int res; res = register_chrdev(0,"mod1",&file_ops); printk("char dev. registered %d \n",res); printk("The module is loaded \n"); return 0; } void unload_module(void) { printk("The module is unloaded \n"); } module_init(load_module); module_exit(unload_module); Thanks with regards Srinivas Bakki -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/