Why does the named pipe keep getting modified

fifotimestamps

I have a named fifo created from a C program like this:

res = mkfifo("/home/myfolder/myfifo", 0666);

after that there are only reads and writes.

Now, from this answer : Does a named pipe change the filesystem I concluded that the system should practically never actually write in the actual file on the filesystem, and that everything is handled in RAM.

Whenever I restart my program, the "mkfifo" line returns a "File already exists" error, which is OK.
What bothers me is that when I "ls" the file, the "last modified date time" sometimes does change. If the system never actually writes into the file, shouldn't it remain constant?

Best Answer

The data passing through the pipe is not written or read to and from the filesystem. When creating the named pipe an inode is allocated so that it can be linked to from the directory you created it in; so that's a form of "modifying the filesystem".

Accessing the named pipe will update the inode's access time, writing to the named pipe will update the inode's modification time, so in that indirect way the filesystem is also being modified. That doesn't mean that the data is written to the filesystem; it's just how Linux handles writes to a named pipe.