struct timeval wtv;
struct timeval *tv = &wtv;
struct call_counts *cc;
- unsigned long scno = tcp->scno;
- if (!SCNO_IN_RANGE(scno))
+ if (!scno_in_range(tcp->scno))
return;
- if (!counts) {
- counts = calloc(nsyscalls, sizeof(*counts));
- if (!counts)
- die_out_of_memory();
- }
- cc = &counts[scno];
+ if (!counts)
+ counts = xcalloc(nsyscalls, sizeof(*counts));
+ cc = &counts[tcp->scno];
cc->calls++;
- if (tcp->u_error)
+ if (syserror(tcp))
cc->errors++;
/* tv = wall clock time spent while in syscall */
static int
syscall_cmp(void *a, void *b)
{
- return strcmp(sysent[*((int *) a)].sys_name,
- sysent[*((int *) b)].sys_name);
+ const char *a_name = sysent[*((int *) a)].sys_name;
+ const char *b_name = sysent[*((int *) b)].sys_name;
+ return strcmp(a_name ? a_name : "", b_name ? b_name : "");
}
static int
else if (strcmp(sortby, "nothing") == 0)
sortfun = NULL;
else {
- error_msg_and_die("invalid sortby: '%s'", sortby);
+ error_msg_and_help("invalid sortby: '%s'", sortby);
}
}
static void
call_summary_pers(FILE *outf)
{
- int i;
+ unsigned int i;
int call_cum, error_cum;
struct timeval tv_cum, dtv;
double float_tv_cum;
fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n",
dashes, dashes, dashes, dashes, dashes, dashes);
- sorted_count = calloc(sizeof(int), nsyscalls);
- if (!sorted_count)
- die_out_of_memory();
+ sorted_count = xcalloc(sizeof(int), nsyscalls);
call_cum = error_cum = tv_cum.tv_sec = tv_cum.tv_usec = 0;
if (overhead.tv_sec == -1) {
tv_mul(&overhead, &shortest, 8);
void
call_summary(FILE *outf)
{
- int i, old_pers = current_personality;
+ unsigned int i, old_pers = current_personality;
for (i = 0; i < SUPPORTED_PERSONALITIES; ++i) {
if (!countv[i])