linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: [linux-usb-devel] Hotplug Driver Interface to User Level Programs: A Driver Example
Date: Mon, 13 Sep 2004 20:25:13 +0000	[thread overview]
Message-ID: <200409132225.13674.oliver@neukum.org> (raw)
In-Reply-To: <412431DB.DCC65347@grave.users.botik.ru>

Am Montag, 13. September 2004 21:27 schrieb Linas Vepstas:
> Another alkternative to returning -ENODEV is to have a zero-length read.
> This is a traditional unix way of signifying that the remote end has
> disconnected; e.g. for tcp sockets.  That is, select() will tell you
> that there is something to read, and the read() call will suceed
> (without error), and return zero bytes read.  For tcp, this is
> understood to mean that the far side has closed its socket.
> 
> I'm not sure, but maybe this would also make sense for any USB device
> that can be read with open(), read() calls? 

Unfortunately that would violate POSIX. Quote:

When attempting to read a file (other than a pipe or FIFO) that supports non-blocking reads and has no data currently available:
*If O_NONBLOCK is set, read() shall return -1 and set errno to [EAGAIN].
*If O_NONBLOCK is clear, read() shall block the calling thread until some data becomes available.
*The use of the O_NONBLOCK flag has no effect if there is some data available.

If you need to modify applications, you can just as well return
a proper error.

	Regards
		Oliver



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2004-09-13 20:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-19  4:51 Hotplug Driver Interface to User Level Programs: Some Questions Alexander N. Kozhushkin
2004-08-19 15:32 ` [linux-usb-devel] Hotplug Driver Interface to User Level Programs: Alan Stern
2004-08-20 15:12 ` [linux-usb-devel] Hotplug Driver Interface to User Level Programs: Some Questions David Brownell
2004-09-12  0:33 ` [linux-usb-devel] Hotplug Driver Interface to User Level Programs: A Alexander N. Kozhushkin
2004-09-12  0:56 ` [linux-usb-devel] Hotplug Driver Interface to User Level Programs: Alexander N. Kozhushkin
2004-09-13 19:27 ` [linux-usb-devel] Hotplug Driver Interface to User Level Programs: A Driver Example Linas Vepstas
2004-09-13 20:25 ` Oliver Neukum [this message]
2004-09-14  6:58 ` Vojtech Pavlik

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=200409132225.13674.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=linux-hotplug@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).