Re: [Need Help] About file lock in Debian Sarge
[please don't top-post] On Tue, Dec 22, 2009 at 02:31:16PM +0700, Muhammad H Hilman wrote: Wow, it's work but, must I change the code on my application that needed filelock? because, filelock code on that application stated as ubuntu command (just filelock) as far as I know debian command on filelock is (filelock-create) I've never heard of filelock-create, I'm afraid. A quick search doesn't show it in any Debian package. can you tel me what's the different between (filelock-create) command and lockf() and fcntl() actually, I am still newbie on using Debian This is probably off-topic for debian-devel. File locking is /ideally/ done using advisory byte-region locking, provided by the system calls fcntl(), lockf() and flock(). flock() is deprecated (doesn't work over NFS, where the others do, as well as not being SUS/POSIX). flock() and lockf() are equivalent. Both these calls will allow one to lock some (or all) of the data in a given open file. But, they do require the file to remain open while you want to prevent others modifying it. For uses such as shell scripts, where each command runs a separate process, byte-region locking doesn't always work due to the lock being lost when the command terminates. Here, we can use the atomic property of open(2) with O_CREAT|O_EXCL to obtain exclusive access to the file. Since it's a file, it's preserved between running each separate command. But, it has the disadvantages of · no automatic cleanup; the lock remains if the program terminates before it deletes the lock file · needs logic to detect and remove state lockfiles; this includes checking that the program that originally created the lock file is still running, which can be tricky · no differentiation between readers and writers (the others have separate read (shared) and write (exclusive) locks. This means you can't have multiple readers, which will cause more lock contention, and hence potentially lower performance liblockfile is a strange beast in some respects, being a C interface to creating lockfiles. However, a typical C program should in most cases be using byte-region locks; it appears mainly used by MTAs which also have an odd (unnecessary?) obsession with lock files. As a general rule: • If all your locking occurs in a single program and the locks don't need preserving when the program is not running, then byte-region locks are optimal • If you are wanting locking during the execution of a shell script where locks need preserving between the execution of individual commands, then lock files are the only choice As an example of how to do this totally wrong, see openoffice.org. It creates lockfiles, where it should be using byte-region locks. If it crashes while editing a file on one machine, or you copy a directory containing an open file, and you try and open it on another machine, it won't allow editing until you manually clean up the lock files. Totally stupid, and very user-unfriendly. Hope this makes some sense. If you have any other questions, then debian-mentors or private mail is probably the way to go. If you provide some real details of what you are trying to do, you'll get a more specific answer. Regards, Roger -- .''`. Roger Leigh : :' : Debian GNU/Linux http://people.debian.org/~rleigh/ `. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/ `-GPG Public Key: 0x25BFB848 Please GPG sign your mail. signature.asc Description: Digital signature
Re: [Need Help] About file lock in Debian Sarge
Wow, it's work but, must I change the code on my application that needed filelock? because, filelock code on that application stated as ubuntu command (just filelock) as far as I know debian command on filelock is (filelock-create) can you tel me what's the different between (filelock-create) command and lockf() and fcntl() actually, I am still newbie on using Debian Thanks, On Mon, Dec 21, 2009 at 6:52 AM, Roger Leigh rle...@codelibre.net wrote: On Thu, Dec 17, 2009 at 11:16:02PM +0100, Michelle Konzack wrote: maybe apt-get install liblockfile1 Possibly, but lockf() and fcntl() are usually better, and are present in libc. -- .''`. Roger Leigh : :' : Debian GNU/Linux http://people.debian.org/~rleigh/http://people.debian.org/%7Erleigh/ `. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/ `-GPG Public Key: 0x25BFB848 Please GPG sign your mail. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAksuuKUACgkQVcFcaSW/uEi66ACgjEUjXA5/CSWzcL+KiKxnb4lV sKUAoLri4DdIZTwNUdQEzizrLPVLW1mD =/6Md -END PGP SIGNATURE-
Re: [Need Help] About file lock in Debian Sarge
Hello, maybe apt-get install liblockfile1 Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # http://www.tamay-dogan.net/ Michelle Konzack http://www.can4linux.org/ Apt. 917 http://www.flexray4linux.org/ 50, rue de Soultz Jabber linux4miche...@jabber.ccc.de 67100 Strabourg/France IRC#Debian (irc.icq.com) Tel. DE: +49 177 9351947 ICQ#328449886 Tel. FR: +33 6 61925193 signature.pgp Description: Digital signature
Re: [Need Help] About file lock in Debian Sarge
On Thu, Dec 17, 2009 at 11:16:02PM +0100, Michelle Konzack wrote: maybe apt-get install liblockfile1 Possibly, but lockf() and fcntl() are usually better, and are present in libc. -- .''`. Roger Leigh : :' : Debian GNU/Linux http://people.debian.org/~rleigh/ `. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/ `-GPG Public Key: 0x25BFB848 Please GPG sign your mail. signature.asc Description: Digital signature
[Need Help] About file lock in Debian Sarge
Dear Debian developers I run DOVIS 2.0 (docking application) in cluster server using Debian Sarge Then I got *Can not get init lock!* notification here is the screenshoot [image: http://img710.imageshack.us/img710/7643/35869453.png] I already asked the developers about this problem They said I have to install file lock in my Operating System here is the screenshoot [image: http://img43.imageshack.us/img43/361/dovis.png] Actually, I don't really know how to install file lock in Debian Sarge, so do my system administrator Anybody knows how to install file lock in Debian Sarge?
Re: [Need Help] About file lock in Debian Sarge
[Please note that this question is more appropriate for debian-user, not debian-devel.] On Thu, Dec 17, 2009 at 10:51:39AM +0700, Muhammad H Hilman wrote: Dear Debian developers I run DOVIS 2.0 (docking application) in cluster server using Debian Sarge Then I got *Can not get init lock!* notification here is the screenshoot [image: http://img710.imageshack.us/img710/7643/35869453.png] I already asked the developers about this problem They said I have to install file lock in my Operating System here is the screenshoot [image: http://img43.imageshack.us/img43/361/dovis.png] Actually, I don't really know how to install file lock in Debian Sarge, so do my system administrator Anybody knows how to install file lock in Debian Sarge? file lock is not a proper name for a piece of software. I have no idea what this is supposed to mean; I think the developers of the software you're trying to run owe you a clearer explanation. -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. Ubuntu Developerhttp://www.debian.org/ slanga...@ubuntu.com vor...@debian.org signature.asc Description: Digital signature