linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Hotplug Driver Interface to User Level Programs: Some Questions.
@ 2004-08-19  4:51 Alexander N. Kozhushkin
  2004-08-19 15:32 ` [linux-usb-devel] Hotplug Driver Interface to User Level Programs: Alan Stern
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Alexander N. Kozhushkin @ 2004-08-19  4:51 UTC (permalink / raw)
  To: linux-hotplug

    My experience of using Linux  kernels 2.6 shows that there is some
problem  with hotplug  devices.  Namely,  it seems  that, there  is no
uniform approach of how an  application performing I/O operations on a
device must be handled, when that device is disconnected.

    The  following  consideration explains  the  problem.  Consider  a
process, which is  performing a system call with  a file descriptor as
an  argument.  The  file descriptor  corresponds to  a  device special
file,  and  the  device  was  disconnected after  the  descriptor  was
created.
There are three reasonable ways by which the process can be handled: 
1. If the  call involves an I/O  operation on the  device, the process
   hangs indefinitely until a signal  has terminated  the call  or the
   process.
2. If the call  involves an I/O operation on  the disconnected device,
   the  process  waits  for the  device.  As  soon  as the  device  is
   connected again,  an initialization  procedure will put  the device
   into  an  appropriate  state  and  will make  the  stopped  process
   continue.   If the  call does  not  involve I/O  operations on  the
   device,  it is  performed  without  waiting, as  if  the device  is
   presented.  In  any case the process  is able to  complete the call
   successfully.
3. The  call  completes without  waiting  for  the  device.  The  file
   descriptor has been unusable for I/O operations on the device since
   the disconnection, therefore the result of the call is not affected
   if the  device has  been connected again.   The result of  the call
   depends on  the kind of  the called function and  other conditions.
   However, the 'close' function closes the file, and there are system
   calls which produce a specific error code in such situations.

In addition  to the  above, in many  cases it  is useful to  deliver a
signal to  a selected  process at the  moment when the  device becomes
disconnected.

    The choice of the standard affects not only the kernel itself, but
also applications.  The third  approach looks like the most reasonable
one, it is proposed in the 'drivers/usb/usb-skeleton.c' file, however,
all of  the approaches above  are in use  now.

Which approach is the standard one or is supposed to be the standard?

What is  the standard behavior of the  'read()', 'write()', 'ioctl()',
'select()',  'fcntl()',   'close()',  ...  system  calls   in  such  a
situation?



-- 
*********************************************************
                Alexander N. Kozhushkin.
            ADDR: alex@grave.users.botik.ru
*********************************************************


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-09-14  6:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2004-09-14  6:58 ` Vojtech Pavlik

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).