Re: [PATCH v5 4/5] docs: counter: Document character device interface

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

 



Hi!

> +        int main(void)
> +        {
> +                struct pollfd pfd = { .events = POLLIN };
> +                struct counter_event event_data[2];
> +
> +                pfd.fd = open("/dev/counter0", O_RDWR);
> +
> +                ioctl(pfd.fd, COUNTER_SET_WATCH_IOCTL, watches);
> +                ioctl(pfd.fd, COUNTER_SET_WATCH_IOCTL, watches + 1);
> +                ioctl(pfd.fd, COUNTER_LOAD_WATCHES_IOCTL);
> +
> +                for (;;) {
> +                        poll(&pfd, 1, -1);

Why do poll, when you are doing blocking read?

> +                        read(pfd.fd, event_data,  sizeof(event_data));

Does your new chrdev always guarantee returning complete buffer?

If so, should it behave like that?

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux