lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201008080909.GA31561@amd>
Date:   Thu, 8 Oct 2020 10:09:09 +0200
From:   Pavel Machek <pavel@....cz>
To:     William Breathitt Gray <vilhelm.gray@...il.com>
Cc:     jic23@...nel.org, kamel.bouhara@...tlin.com, gwendal@...omium.org,
        alexandre.belloni@...tlin.com, david@...hnology.com,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-stm32@...md-mailman.stormreply.com,
        linux-arm-kernel@...ts.infradead.org, syednwaris@...il.com,
        patrick.havelange@...ensium.com, fabrice.gasnier@...com,
        mcoquelin.stm32@...il.com, alexandre.torgue@...com
Subject: Re: [PATCH v5 4/5] docs: counter: Document character device interface

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

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ