I am Taniya Das and working in Linux Kernel internals, i just want to know " when i write to an open file(e.g abc.c) in Linux how does the Linux kernel interpret that write ".
Thanks
Taniya

Interpreted?

write() calls are deferred to some future time by the kernel. However, any read() to that file after a write is guaranteed to be able to read the data written. This means that if the kernel panics just when a deferred write() call retruns, the data will be lost - i.e., not physically written to disk.

If a write cannot complete, it returns -1, and sets errno. If errno is set to EINTR, then the write can be re-tried. Most other errors indicate some kind of fatal condition. Always check the return code from a write.

If you need to guarantee that data is physically written to disk, there are the aio calls. Depending on your kernel release, these calls may not be implemented fully. With 2.6 I bleive they are now fully POSIX compliant. Try info aio or man aio_write

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.