![]() | |||||||||||||
Messages in this thread |
Hi, The buffer-cache is a kernel-internal datastructure that you do not have to worry about in applications. The 'buf' variable in your code is a local buffer, which is not anything special to the kernel but just another piece of memory. The next file-read will therefore come from the file, or from the kernel-internal buffercache which always represents the file on disk. If you write the new data to disk with the write() statement, the write will go thru the buffercache, and at some point in future the new buffercache-data will be written to the actual disk. To all applications, the fact that on-disk is not identical to buffer-cache is always invisible; the contents of the buffercache _is_ the contents of the file. There is no way to get round the kernel for reading this file :-) The buf[] variable in your code however, is not directly connected to the kernel's internal buffercache and any modifications that you make to this application-local piece of memory has no bearing on the file/buffercache whatsoever until you write() that data :-) Greetings, --Tim - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/ | ||||||||||||
| Last update: 2005-03-22 13:58 [from the cache] ©2003-2008 | |||||||||||||