Re: Char device. poll() function question.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I want to use poll() functionality (to properly handle select()
> and poll() syscalls) in my char-device driver. The code for my 
> kernel-side poll() function is (a little bit simplified):
> 
> unsigned int my_poll(struct file *filp, struct poll_table_struct 
> *wait)
> {
>        unsigned int mask=0;
>        unsigned long flags;
>
>        poll_wait(filp, my_wait_queue, wait);
>
>        if ( any_data_available > 0)
>                mask |= POLLIN | POLLRDNORM;
>
>        return mask;
>}

You have to make sure your process is sleeping on my_wait_queue. Linux kernel will wake up processes sleeping on my_wait_queue.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux