[uClinux-dev] Locking files
tom at cyberiansoftware.com
Fri Nov 23 23:32:46 EST 2001
Jimi Simpson wrote:
> Firstly to set the scene: I am working on a system that uses a number of
> uClinux/Linux machines each with a mapping to a shared Windows
> directory, each of which needs to have the ability to gain exclusive
> read/write access to a shared file.
> I have successfully setup a mount from each machine to the shared
> directory/file using smbmount and all the machines can access the file
> without problem. As a quick test I have tried simply reading a number
> from the file and then storing the number+1 back to the file. Obviously
> in order to perform this reliably I need to lock the file at certain
> points and I have tried this with some success using both fcntl and
> flock, however I am experiencing some problems.
> If I spawn two threads of client execution from a Linux PC, then all
> appears to be well, but when I include an M5272C3 evaluation board
> running the same client application under uClinux, then it all goes
> horribly wrong. If I use the F_RDLCK macro as part of an fcntl call and
> then display the results, then the Linux PC looks right, but the eval
> board sees a false picture of the lock condition.
> If anyone has any ideas as to the likely causes of this problem, then
> please feel free to share them. It may be that my understanding and
> expectations from linux/smbmount/flock etc. is incorrect. Every bit of
> constructive help that I can get will be most appreciated.
Just off the top of my head... Samba needs to also be configured to
support locking, did you check to see that the samba server is properly
setup to support locks?
Tom Walsh - WN3L - Embedded Systems Consultant
"Windows? No thanks, I have work to do..."
This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/
More information about the uClinux-dev