LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-15-2006, 05:45 AM   #1
sunpascal
Member
 
Registered: Jan 2005
Distribution: Debian
Posts: 104

Rep: Reputation: 15
file locking in linux?


Hi,
I have used Debian with KDE for a while now, after using Windows for a long time.
However, file locking is still a mystery to me. It seems files can be deleted even if an application still uses that file. And even more interesting, I can play a sound track after I deleted it. Is that normal?
On the other hand linux is very strict on umounting devices while files are still in use.
How does file locking work in linux anyways?

-Pascal
 
Old 03-15-2006, 09:16 AM   #2
Gogul
Member
 
Registered: Nov 2005
Posts: 112

Rep: Reputation: 15
that sounds a little funny to me

if you're referring to read/write access then you can easily change these by just loggin in as root (or whoever owns the r/w permissions) then going into the file properties.
 
Old 03-15-2006, 09:18 AM   #3
Gogul
Member
 
Registered: Nov 2005
Posts: 112

Rep: Reputation: 15
don't know if this will help

http://www.google.com/search?client=...UTF-8&oe=UTF-8
 
Old 03-15-2006, 09:35 AM   #4
sunpascal
Member
 
Registered: Jan 2005
Distribution: Debian
Posts: 104

Original Poster
Rep: Reputation: 15
sorry, I wasn't clear.
I don't have a problem at all. I am just wondering: In windows, a program automatically locks a file if it reads or writes to it. Most linux programs don't seem to do that, right?
 
Old 03-15-2006, 09:38 AM   #5
sunpascal
Member
 
Registered: Jan 2005
Distribution: Debian
Posts: 104

Original Poster
Rep: Reputation: 15
Also, how is it possible to listen to a sound track (with kaffeine) after you already deleted that file? It doesn't load it all into memory, does it?
 
Old 03-15-2006, 09:49 AM   #6
Flesym
Member
 
Registered: Aug 2005
Location: Germany
Distribution: Ubuntu, Debian
Posts: 189

Rep: Reputation: 31
Look here:
http://en.wikipedia.org/wiki/File_locking
 
Old 03-15-2006, 09:56 AM   #7
Gogul
Member
 
Registered: Nov 2005
Posts: 112

Rep: Reputation: 15
That should answer your question though I think when you do play a sound file all of it is left in memory (depending on the size imho) though once you close kaffeine or reboot your computer you should no longer be able to access it.

I can't say if it applys to most linux programs.

Though I'm guessing no, I've noticed that sound tracks do for some reason remain in memory while they're been played.

if you can still access a sound track after closing the application or rebooting your computer then I've no idea why you'd still be able to listen to it once you've deleted it.

http://linux.oneandoneis2.org/LNW.htm
 
Old 03-15-2006, 06:37 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
The unlink cmd (=delete) removes the inode entry, but if a prog currently has the file open, it will continue to exist until the prog closes it.
Handy for more secure (invisible) temp files; see articles on CGI uploads for example.
For full explanation:
http://hissa.nist.gov/rbac/titleissues/node26.html
 
Old 03-15-2006, 09:00 PM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 7,150

Rep: Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203
Ahh, one of the magic features of Linux.

In the Linux/Unix system, a file is an inode structure. (Don't ask me why it's called an "inode.") Physically speaking, that on-disk structure is the thing .. the only thing .. that actually represents a file.

Directory entries point to the inode. The original directory-entry always does, and additional hard-links can be defined to do so as well.

Anyhow... the file-locking philosophies of Unix vs. Windows are not quite the same. You can read considerably about it on the web.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
locking a file permanently sooraj_pathe Linux - General 1 03-11-2004 02:58 PM
locking a usage policy file/ftp file permissions gbow Linux - Newbie 0 02-16-2004 06:35 AM
Wine File Locking MurrayL Linux - Software 3 02-12-2004 04:27 AM
File locking over Samba rtaft Linux - Software 0 12-30-2003 12:02 PM
File locking in Linux xailer Programming 5 12-29-2003 03:00 PM


All times are GMT -5. The time now is 09:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration