On Sun, 16 Apr 2006, Andreas Jellinghaus wrote: > Andreas Jellinghaus wrote: > > openct uses > > open(device, O_EXCL | O_RDWR); > > > > so, I would assume that only one process can open a device > > like this. unfortunatly this is not true: I have two processes > > that have the same device opened this way. > > > > note: I used /dev/bus/usb/*/* files, not the old usbfs. > > found it. for some reason I had one process on /dev/bus/usb/*/* > and one on /proc/bus/usb/*/*. Since that is inside the kernel the > same resource, wouldn't honoring O_EXCL be good? or is it tradition > that only the filename is important, not what is behind it?
The answer is somewhere inbetween. The filename doesn't matter, but the inode does. And the entries in /dev/bus/usb use different inodes from the entries in /proc/bus/usb: $ ls -l /dev/bus/usb/1 total 0 lrwxrwxrwx 1 root root 18 Apr 16 09:51 1 -> ../../../usbdev1.1 $ ls -l /dev/usbdev1.1 crw------- 1 root root 189, 0 Apr 16 09:51 /dev/usbdev1.1 $ $ ls -l /proc/bus/usb/001 total 0 -rw-r--r-- 1 root root 43 Apr 16 09:51 001 As you can see, /dev/bus/usb/1/1 is a (symbolic link to a) character device with major number 189 and minor number 0. On the other hand, /proc/bus/usb/001/001 is a regular file, not a device file, of length 43. The fact that the two inodes ultimately refer to the same resource doesn't matter because the VFS decides how to apply O_EXCL based only on the inode, not the underlying resource (which it doesn't even know about). Alan Stern ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
