static ssize_t mycdrv_write (struct file *file, const char __user * buf, size_t lbuf, loff_t * ppos) { int nbytes = mycdrv_generic_write (file, buf, lbuf, ppos); printk (KERN_INFO "process %i (%s) awakening the readers...\n", current->pid, current->comm); wake_up_interruptible (&wq); atomic_set (&data_ready, 1); return nbytes; }
static ssize_t mycdrv_write(struct file *file, const char __user * buf, size_t lbuf, loff_t * ppos) { static int len = 100; pr_info(" Entering the WRITE function\n"); pr_info(" my current task pid is %d\n", (int)current->pid); init_timer(&my_timer); /* intialize */ my_timer.function = my_timer_function; my_timer.expires = jiffies + HZ; /* one second delay */ my_timer.data = len; add_timer(&my_timer); pr_info("Adding timer at jiffies = %ld\n", jiffies); len += 100; return mycdrv_generic_write(file, buf, lbuf, ppos); }