[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
RE: Readonly files
- From: "Steven Fullmer" <Steven_Fullmer tni com>
- To: <redhat-install-list redhat com>
- Subject: RE: Readonly files
- Date: Thu, 29 May 2003 15:15:34 -0600
>> Using chmod, chown and chgrp, a user can get permissions to modify files. Is there a way to 'lock' files in use as well? I know of a couple programs that create an entry into a .lock file where, when someone opens the same file, it is opened read-only. Is this a feature unique to this program, or is it a RH standard, so no two people can modify certain files? If there is, is there a command that is sent to lock and/or unlock the files/directories in question?
>The creation of a lock file is unique to certain programs, and it's normally used to prevent two programs from trying to fight over a device (such as a modem or printer).
> Record locking (where a program acquires a write lock on a file so that only it can modify it) is and has always been a part of Linux. The programs using it must both adhere to the standard (called "cooperative locking"). It's a part of the standard file I/O library and is accessed via the fcntl() system call (see "man fcntl", specifically the parts about "F_GETLK", "F_SETLK" and "F_SETLKW".
Meaning, then, that if a program I run doesn't support cooperative locking, it has the potential of accessing and modifying the file in question while another (which does support this standard) is in the middle of using it?
Steven Fullmer
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]