Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/truss/setup.c
Show All 35 Lines | |||||
/* | /* | ||||
* Various setup functions for truss. Not the cleanest-written code, | * Various setup functions for truss. Not the cleanest-written code, | ||||
* I'm afraid. | * I'm afraid. | ||||
*/ | */ | ||||
#include <sys/ptrace.h> | #include <sys/ptrace.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/time.h> | |||||
#include <sys/wait.h> | #include <sys/wait.h> | ||||
#include <assert.h> | #include <assert.h> | ||||
#include <err.h> | #include <err.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <stdint.h> | #include <stdint.h> | ||||
▲ Show 20 Lines • Show All 465 Lines • ▼ Show 20 Lines | if (info->flags & (FOLLOWFORKS | DISPLAYTIDS)) { | ||||
if ((info->flags & (FOLLOWFORKS | DISPLAYTIDS)) == | if ((info->flags & (FOLLOWFORKS | DISPLAYTIDS)) == | ||||
(FOLLOWFORKS | DISPLAYTIDS)) | (FOLLOWFORKS | DISPLAYTIDS)) | ||||
len += fprintf(info->outfile, " "); | len += fprintf(info->outfile, " "); | ||||
if (info->flags & DISPLAYTIDS) | if (info->flags & DISPLAYTIDS) | ||||
len += fprintf(info->outfile, "%6d", t->tid); | len += fprintf(info->outfile, "%6d", t->tid); | ||||
len += fprintf(info->outfile, ": "); | len += fprintf(info->outfile, ": "); | ||||
} | } | ||||
if (info->flags & ABSOLUTETIMESTAMPS) { | if (info->flags & ABSOLUTETIMESTAMPS) { | ||||
timespecsubt(&t->after, &info->start_time, &timediff); | timespecsub(&t->after, &info->start_time, &timediff); | ||||
len += fprintf(info->outfile, "%jd.%09ld ", | len += fprintf(info->outfile, "%jd.%09ld ", | ||||
(intmax_t)timediff.tv_sec, timediff.tv_nsec); | (intmax_t)timediff.tv_sec, timediff.tv_nsec); | ||||
} | } | ||||
if (info->flags & RELATIVETIMESTAMPS) { | if (info->flags & RELATIVETIMESTAMPS) { | ||||
timespecsubt(&t->after, &t->before, &timediff); | timespecsub(&t->after, &t->before, &timediff); | ||||
len += fprintf(info->outfile, "%jd.%09ld ", | len += fprintf(info->outfile, "%jd.%09ld ", | ||||
(intmax_t)timediff.tv_sec, timediff.tv_nsec); | (intmax_t)timediff.tv_sec, timediff.tv_nsec); | ||||
} | } | ||||
return (len); | return (len); | ||||
} | } | ||||
static void | static void | ||||
report_thread_death(struct trussinfo *info) | report_thread_death(struct trussinfo *info) | ||||
▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines |