I agree with Lars that the objective here isn't very well defined, but
if the goal is to get netatalk to generate some sort of message on the
server end, here are some ideas.
The FPOpenFork AFP command has a DenyWrite access mode that should
deny a file open if the file's already opened that way. I'm not sure,
but I'd guess that Mac OS already handles the situation where the open
fails because of the multiple writers. To do this, the application
would have to enable the DenyWrite access mode and your client be able
to handle the return code properly. You could use ethereal/wireshark
to see if the FPOpenFork is being called correctly.
If your application isn't setting DenyWrite correctly and you have no
ability to modify it, I guess you could hack in different behaviour in
etc/afpd/fork.c's openfork() function to never allow more than one
simultaneous open() on any given file.
It all sounds like a hack, though.
On 1/29/07, Lars O. Grobe <grobe@...> wrote:
> > i am planning to set up a netatalk-fileserver and was asked to implement
> > a function that informs the user, if a file he wants to open is already
> > in use by another user. can anyone give me a hint how to do this, or
> > where this might be already documented?
> do you need file locking (which is made to ensure that data integrity is
> preserved in a technical meaning) or something that is working on a more
> general layer, giving you a dialog box saying "the file UVW is in use by
> user XYZ"? The first is the applications responsibility as far as I
> understand and should be supported on netatalks side. The second would
> need some coding I guess. Interesting idea, though, some kind of what
> cvs does with an appleshare frontend.
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> Netatalk-admins mailing list