linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Riesch <christian.riesch@omicron.at>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Rodolfo Giometti <giometti@enneenne.com>
Subject: Re: [PATCH] pps: Add support for read operations and return a useful value in poll
Date: Wed, 1 Apr 2015 14:01:36 +0200	[thread overview]
Message-ID: <CABkLObqCWn3WZzs-eMYaBAOYuM6VKxL1Cg1j9Ft05JAjENJXnw@mail.gmail.com> (raw)
In-Reply-To: <20150401081133.GA4384@enneenne.com>

[sent again with Rodolfo in the list of recipients, something went
wrong, sorry!]

Hi Rodolfo,

Thanks for your reply!

On Wed, Apr 1, 2015 at 10:11 AM, Rodolfo Giometti <giometti@enneenne.com> wrote:
> On Tue, Mar 31, 2015 at 11:31:22PM +0200, Christian Riesch wrote:
>> The PPS_FETCH ioctl in drivers/pps/pps.c blocks until a new PPS event
>> occurs, then returns the time stamp data. While this is fine for
>> lots of applications, sometimes it would be nice if the poll system
>> call and a subsequent read could be used to obtain the pps data.
>
> Nak. The read syscall can't be forced to return fix amount of
> data.

I just copied/modified the behavior of ptp_read() in drivers/ptp/ptp_chardev.c:

if (cnt % sizeof(struct ptp_extts_event) != 0)
        return -EINVAL;

There the amount of data is forced to be a multiple of sizeof(struct
ptp_extts_event). But if you prefer an ioctl, I can change that of
course.

> Use a dedicated ioctl instead.

Is it ok to pair POLLIN | POLLRDNORM in the poll function with an
ioctl? Or should returning POLLIN | POLLRDNORM mean that a read() will
not block? Should I use POLLPRI instead or something else?

Regards, Christian

      parent reply	other threads:[~2015-04-01 12:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31 21:31 [PATCH] pps: Add support for read operations and return a useful value in poll Christian Riesch
2015-04-01  8:11 ` Rodolfo Giometti
2015-04-01 11:56   ` Christian Riesch
2015-04-01 12:01   ` Christian Riesch [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABkLObqCWn3WZzs-eMYaBAOYuM6VKxL1Cg1j9Ft05JAjENJXnw@mail.gmail.com \
    --to=christian.riesch@omicron.at \
    --cc=giometti@enneenne.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).