This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Linux and users  RSS feed

Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a web application (java) running on a websphere server on a linux machine.
This application writes pdf files on a windows2000 machine, thanks to samba.
but the problem is:
when a user A has opened the pdf file, and another user B want to open it, the application must display a message telling the user B that user A has already opened the file.
Before my application ran on a server in windows2000, so the application uses netapi32.dll (thanks to coroutine API for java) to determine which user open the file.
But now, how can I do? Is there a linux way to see which windows user has opened the file in the samba share? Is ther a way to use netapi32.dll in linux? (wine?)
thanks for your help
[ June 23, 2003: Message edited by: Michael Ernest ]
Tim Holloway
Posts: 18705
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A little more info, please.
Windows locks files based on their names. It has a fairly unfriendly way of doing so, which is why you have to reboot whenever certain executables/DLLs are updated. Linux/Unix looks at files based on inodes, which allows you to actually delete a file while someone else it writing to it without disaster (though it's not a habit I encourage).
Normally, PDF's are read and would be sharable. Only if you're talking about a user updating the PDF would I normally consider locking it. MS-WORD docs are different. A WORD doc can be opened read-only, but it requires a deliberate effort.
Anyway, I haven't looked at that kind of problem, so I can't give a definite solution. I recommend that you check the Samba docs, since it's Samba's job to emulate the networked Windows filesystem, and I think I may recall seeing something about such issues there.
Unix often uses the concept of a lockfile. This is simply a zero-length file whose mere presence is enough to indicate that a resource is locked. It's possible that Samba might even use this as part of whatever file-locking scheme they might be using. Unfortunately, lockfiles have to be explicitly created and destroyed, so if Samba intercepted an SMB file open/close operation, it could take that action as part of its network support functions, but a simple Unix/Linux file open/close can't.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!