* ps.cc (main): Eliminate use of PID_ZOMBIE.
* strace.cc (main): Recognize new option for displaying hex value of strace type. (handle_output_debug_string): Prepend output with hex value of strace message if -H is specified.
This commit is contained in:
parent
85b3fb9640
commit
459a956197
@ -1,3 +1,11 @@
|
|||||||
|
2005-01-16 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* ps.cc (main): Eliminate use of PID_ZOMBIE.
|
||||||
|
* strace.cc (main): Recognize new option for displaying hex value of
|
||||||
|
strace type.
|
||||||
|
(handle_output_debug_string): Prepend output with hex value of strace
|
||||||
|
message if -H is specified.
|
||||||
|
|
||||||
2005-01-11 Pierre Humblet <pierre.humblet@ieee.org>
|
2005-01-11 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
* mkpasswd.c (print_win_error): Transform into macro.
|
* mkpasswd.c (print_win_error): Transform into macro.
|
||||||
|
@ -345,7 +345,7 @@ main (int argc, char *argv[])
|
|||||||
status = 'O';
|
status = 'O';
|
||||||
|
|
||||||
char pname[MAX_PATH];
|
char pname[MAX_PATH];
|
||||||
if (p->process_state & (PID_ZOMBIE | PID_EXITED))
|
if (p->process_state & PID_EXITED || (p->exitcode & ~0xffff))
|
||||||
strcpy (pname, "<defunct>");
|
strcpy (pname, "<defunct>");
|
||||||
else if (p->ppid)
|
else if (p->ppid)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,7 @@ static int hhmmss = 0;
|
|||||||
static int bufsize = 0;
|
static int bufsize = 0;
|
||||||
static int new_window = 0;
|
static int new_window = 0;
|
||||||
static long flush_period = 0;
|
static long flush_period = 0;
|
||||||
|
static int include_hex = 0;
|
||||||
|
|
||||||
static BOOL close_handle (HANDLE h, DWORD ok);
|
static BOOL close_handle (HANDLE h, DWORD ok);
|
||||||
|
|
||||||
@ -426,7 +427,7 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *buf;
|
char *buf;
|
||||||
buf = (char *) alloca (len + 65) + 10;
|
buf = (char *) alloca (len + 85) + 20;
|
||||||
|
|
||||||
if (!ReadProcessMemory (hchild, ((char *) p) + INTROLEN, buf, len, &nbytes))
|
if (!ReadProcessMemory (hchild, ((char *) p) + INTROLEN, buf, len, &nbytes))
|
||||||
error (0, "couldn't get message from subprocess, windows error %d",
|
error (0, "couldn't get message from subprocess, windows error %d",
|
||||||
@ -558,6 +559,12 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile)
|
|||||||
memcpy ((s -= len), intbuf, len);
|
memcpy ((s -= len), intbuf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (include_hex)
|
||||||
|
{
|
||||||
|
s -= 8;
|
||||||
|
sprintf (s, "%p", n);
|
||||||
|
strchr (s, '\0')[0] = ' ';
|
||||||
|
}
|
||||||
child->last_usecs = usecs;
|
child->last_usecs = usecs;
|
||||||
if (numerror || !output_winerror (ofile, s))
|
if (numerror || !output_winerror (ofile, s))
|
||||||
fputs (s, ofile);
|
fputs (s, ofile);
|
||||||
@ -850,6 +857,7 @@ struct option longopts[] = {
|
|||||||
{"buffer-size", required_argument, NULL, 'b'},
|
{"buffer-size", required_argument, NULL, 'b'},
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
{"flush-period", required_argument, NULL, 'S'},
|
{"flush-period", required_argument, NULL, 'S'},
|
||||||
|
{"hex", no_argument, NULL, 'H'},
|
||||||
{"mask", required_argument, NULL, 'm'},
|
{"mask", required_argument, NULL, 'm'},
|
||||||
{"new-window", no_argument, NULL, 'w'},
|
{"new-window", no_argument, NULL, 'w'},
|
||||||
{"output", required_argument, NULL, 'o'},
|
{"output", required_argument, NULL, 'o'},
|
||||||
@ -864,7 +872,7 @@ struct option longopts[] = {
|
|||||||
{NULL, 0, NULL, 0}
|
{NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const opts = "+b:dhfm:no:p:S:tTuvw";
|
static const char *const opts = "+b:dhHfm:no:p:S:tTuvw";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_version ()
|
print_version ()
|
||||||
@ -919,6 +927,9 @@ main (int argc, char **argv)
|
|||||||
// Print help and exit
|
// Print help and exit
|
||||||
usage (stdout);
|
usage (stdout);
|
||||||
break;
|
break;
|
||||||
|
case 'H':
|
||||||
|
include_hex ^= 1;
|
||||||
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
{
|
{
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user