Question

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.

Was it helpful?

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top