On Tue, 18 Apr 2006, Andreas Jellinghaus wrote:

> I tried once more, and this time with /dev/bus/usb only.
> 
> How can there be five processes with the same file opened?
> 
> [EMAIL PROTECTED]:~# lsof  |grep /dev/bus/
> ifdhandle 26749       root    3u      CHR            189,273              
> 51693 /dev/bus/usb/003/018
> ifdhandle 26761       root    3u      CHR            189,273              
> 51693 /dev/bus/usb/003/018
> ifdhandle 26765       root    3u      CHR            189,273              
> 51693 /dev/bus/usb/003/018
> ifdhandle 26775       root    3u      CHR            189,273              
> 51693 /dev/bus/usb/003/018
> ifdhandle 26819       root    3u      CHR            189,273              
> 51693 /dev/bus/usb/003/018
> [EMAIL PROTECTED]:~# 
> 
> all of them open it with O_EXCL?
> 
> does O_EXCL not work standalone? should I use flock or something like
> that instead to prevent several processes accessing the same file?
> Or are usb device file somehow special and those methods do not work?

Take a look at "man 2 open".  It says that O_EXCL doesn't do anything
unless you use it along with O_CREAT, in which case you get an error if
the file already exists.  So I guess you really don't want to use O_EXCL.

You should look at the man pages for flock, fcntl, and lockf.

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
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to