Mail Archives: cygwin/2007/04/30/19:02:28
--------------000902040704050809040004
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Dave Korn wrote:
> On 30 April 2007 19:23, Matthew Woehlke wrote:
>
>> Dave Korn wrote:
>>> On 30 April 2007 18:48, Matthew Woehlke wrote:
>>>
>>>> um... and since Cygwin has this information, doesn't this mean that 'ps'
>>>> is missing a feature that is standard to pretty much every other *nix
>>>> implementation of 'ps'? (I don't have a POSIX standard handy
>>> Yes you do: open browser, google "posix opengroup". Vol.2, "Shell and
>>> utilities", part 4: Utilities: takes us to
>> ...and am too lazy to look. :-) Anyway, since the information is
>> available, and most other *nix's 'ps' provides it, any reason Cygwin's
>> 'ps' shouldn't do the same?
>
> I believe you can probably guess the answer to this one... particularly if I
> tell you it starts with "P" and ends with "TC" :)
Ok... Here is a P for you to TD* (* D="Decline") :-)
--
Matthew
If you believe you received this e-mail in error, you are probably sadly
mistaken, but if not, aren't you lucky?
--------------000902040704050809040004
Content-Type: text/x-patch;
name="ps.cc.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="ps.cc.diff"
--- ps.cc.orig 2007-04-30 17:33:46.245634000 -0500
+++ ps.cc 2007-04-30 17:57:22.907472200 -0500
@@ -18,6 +18,7 @@
#include <sys/cygwin.h>
#include <tlhelp32.h>
#include <psapi.h>
+#include <sys/stat.h>
static const char version[] = "$Revision: 1.11 $";
static char *prog_name;
@@ -253,7 +254,7 @@
const char *ftitle = " UID PID PPID TTY STIME COMMAND\n";
const char *ffmt = "%8.8s%8d%8d%4s%10s %s\n";
const char *ltitle = " PID PPID PGID WINPID TTY UID STIME COMMAND\n";
- const char *lfmt = "%c %7d %7d %7d %10u %4s %4u %8s %s\n";
+ const char *lfmt = "%c %7d %7d %7d %10u %4s %4u %8s %s";
char ch;
aflag = lflag = fflag = sflag = 0;
@@ -405,11 +406,27 @@
printf (ffmt, uname, p->pid, p->ppid, ttynam (p->ctty), start_time (p),
pname);
else if (lflag)
- printf (lfmt, status, p->pid, p->ppid, p->pgid,
- p->dwProcessId, ttynam (p->ctty),
- p->version >= EXTERNAL_PINFO_VERSION_32_BIT ? p->uid32 : p->uid,
- start_time (p), pname);
-
+ {
+ printf (lfmt, status, p->pid, p->ppid, p->pgid,
+ p->dwProcessId, ttynam (p->ctty),
+ p->version >= EXTERNAL_PINFO_VERSION_32_BIT ? p->uid32 : p->uid,
+ start_time (p), pname);
+ if (p->ppid)
+ {
+ char procpath[MAX_PATH];
+ FILE *f;
+ snprintf(procpath, MAX_PATH, "/proc/%u/cmdline", p->pid);
+ f = fopen(procpath, "rb");
+ if (f)
+ {
+ int c = 1;
+ while (c != 0 && c != EOF) c = fgetc(f);
+ for (;c != EOF; c = fgetc(f)) printf("%c", c?c:' ');
+ fclose(f);
+ }
+ }
+ printf("\n");
+ }
}
(void) cygwin_internal (CW_UNLOCK_PINFO);
--------------000902040704050809040004
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
--------------000902040704050809040004--
- Raw text -