Created attachment 145651 [details] code patch for ps(1) This patch adds a field (sstart) to ps(1) to print the time, in seconds since January 1st 1970, when a process started. On Solaris (and the same works on Linux I believe), you can stat(2) /proc/<pid> and inspect the mtime of the directory to determine this information, however on BSD (1) /proc doesn't set the mtime on these directories and (2) /proc is most-likely going to be removed in future releases. Examples: Simple example useful for scripting $ ./ps -p $$ -o sstart= 1407708424 All "started" fields currently available for the current process $ ./ps -p $$ -o start,lstart,sstart STARTED STARTED STARTED 10:07PM Sun Aug 10 22:07:04 2014 1407708424 `sstart` is the most convenient for scripting purposes.
I think that for scripting "etimes" is probably sufficient.
^Triage: - [tags] in issue Titles are deprecated - Does the patch still apply to current? @Piotr Is this a Close -> Not Accepted, or can the proposal be improved/changed?
(In reply to Kubilay Kocak from comment #2) My comment is meant as a "I would reject this but definitely not unilaterally".
^Triage: clear stale flags. To submitter: is this aging PR still relevant?
(In reply to Mark Linimon from comment #4) hello! happy 10 years since i wrote this patch - i had long since forgotten about this! I wrote this patch originally because of the company I was working for at the time - we were transitioning to FreeBSD and my job was largely to port our software and get it working on FreeBSD. We had some tooling that showed our services running (and their PIDs) and it was helpful to see how long ago a process was started and how long it was running. Like I mentioned originally, on other operating systems we could just stat(2) /proc/<pid> but that didn't work for us on FreeBSD. When I looked into it more I saw that it probably made more sense for this logic to be in the tooling (like `ps`) instead of the `/proc` filesystem - so this patch was born. Looking at the comments on this patch I looked up "etimes" with `ps` and I agree that it would be sufficient to accomplish what I originally wanted. I, personally, don't have much use for this patch anymore - but I will leave it up to others to see if this is something they want to include. Thanks! dave
Created attachment 258126 [details] code patch for ps(1) ^Triage: rebase patch.