0

Can anybody please explain to me what kernel level operations are performed, when a file is edited? The thing i'm confused with is that is it the case that a new inode is created every time a file is edited. Please explain the steps, if possible. I have searched the internet, but no satisfactory answers there.

Thanks in advance.

Ebad Masood
  • 2,389
  • 28
  • 46
AniketGM
  • 901
  • 1
  • 9
  • 17
  • 1
    Many operations like polling laptop battery are performed. But actual operations performed by editor (_system calls_) may be captured with [`strace`](http://linux.die.net/man/1/strace) tool – myaut Apr 20 '15 at 06:53

1 Answers1

0

There's no single general answer, because this depends on what the application does when it's editing the file, what system it's running on, and what the file is stored on. It might be creating new temporary files, or clobbering and rewriting the original file, or using memory mapping, or using versioned filesystem features, or doing network file system operations, etc etc.

Instead of trying to answer this in the abstract, pick an open source editor you're interested in, and read through its source code and debug it to understand what it in particular is doing. Then if you have questions, you can read the API docs to figure out what kernel operations the functions it's calling map to or rely on.

Andrew Janke
  • 23,508
  • 5
  • 56
  • 85
  • I have used editor's like vim and gedit. They both use different inodes. Tracking the original file which is being edited becomes difficult. – AniketGM Apr 21 '15 at 06:56