80 lines
1.7 KiB
C
80 lines
1.7 KiB
C
#ident "$Header: /proj/irix6.5.7m/isms/irix/cmd/icrash_old/cmds/RCS/cmd_stat.c,v 1.1 1999/05/25 19:19:20 tjm Exp $"
|
|
#define _KERNEL 1
|
|
#include <sys/types.h>
|
|
#include <sys/param.h>
|
|
#include <stdio.h>
|
|
#include <errno.h>
|
|
#include <nlist.h>
|
|
#include <libelf.h>
|
|
#include <libdwarf.h>
|
|
#include <dwarf.h>
|
|
#include "icrash.h"
|
|
#include "extern.h"
|
|
#include "eval.h"
|
|
#include "dwarflib.h"
|
|
|
|
/*
|
|
* stat_cmd() -- Print out the putbuf / system information.
|
|
*/
|
|
int
|
|
stat_cmd(command_t cmd)
|
|
{
|
|
int lbolt;
|
|
|
|
print_utsname(cmd.ofp);
|
|
fprintf(cmd.ofp, " time of crash: ");
|
|
print_curtime(cmd.ofp);
|
|
|
|
kl_get_block(K, K_LBOLT(K), 4, &lbolt, "lbolt");
|
|
fprintf(cmd.ofp, " system age: %d day, %d hour, %d min.\n",
|
|
(((lbolt/100)/60)/60)/24,
|
|
(((lbolt/100)/60)/60)%24,
|
|
((lbolt/100)/60)%60);
|
|
|
|
fprintf(cmd.ofp, " putbuf:\n");
|
|
print_putbuf(cmd.ofp);
|
|
|
|
/* dump the error dumpbuf (IP19 systems only)
|
|
*/
|
|
if (K_ERROR_DUMPBUF(K)) {
|
|
fprintf(cmd.ofp, "\n\nERROR DUMPBUF:\n\n");
|
|
fprintf(cmd.ofp, "0x%llx = \"", K_ERROR_DUMPBUF(K));
|
|
dump_string(K_ERROR_DUMPBUF(K), cmd.flags, cmd.ofp);
|
|
fprintf(cmd.ofp, "\"\n");
|
|
}
|
|
fprintf(cmd.ofp, "\n");
|
|
return(0);
|
|
}
|
|
|
|
#define _STAT_USAGE "[-w outfile]"
|
|
|
|
/*
|
|
* stat_usage() -- Print the usage string for the 'stat' command.
|
|
*/
|
|
void
|
|
stat_usage(command_t cmd)
|
|
{
|
|
CMD_USAGE(cmd, _STAT_USAGE);
|
|
}
|
|
|
|
/*
|
|
* stat_help() -- Print the help information for the 'stat' command.
|
|
*/
|
|
void
|
|
stat_help(command_t cmd)
|
|
{
|
|
CMD_HELP(cmd, _STAT_USAGE,
|
|
"Display system statistics and the putbuf array, which contains "
|
|
"the latest messages printed via the kernel printf/cmn_err "
|
|
"routines.");
|
|
}
|
|
|
|
/*
|
|
* stat_parse() -- Parse the command line arguments for 'stat'.
|
|
*/
|
|
int
|
|
stat_parse(command_t cmd)
|
|
{
|
|
return (C_FALSE|C_WRITE);
|
|
}
|