Search code examples
clinuxunixproc

When does a dir in /proc/ modified date changes?


I'm attempting to get the date of a creation of a process, but since POSIX only supports Accessed, Modified, and Changed dates i can't seem to "stat" any file. so maybe i can use the "modified" date of the process directory? like "/proc/2206" and take the modified date from the output struct?

thats why i want to know when does the folder's "modified" date changes? note: I'm Programming and not using any tools like "ps"

thank you.


Solution

  • You can use the stat(2) system call on /proc/2206/stat file -for process of pid 2206- (or on /proc/self/stat from inside the process). Read more about the Linux proc(5) pseudo-file system.

    It seems that all the access, modify, change times of that /proc/*/stat file are the start time of the considered process.

    Remember that files under /proc/ are pseudo-files provided by the linux kernel, which are read quickly and do not involve any disk activity.