Changeset View
Changeset View
Standalone View
Standalone View
head/usr.bin/truss/setup.c
Show All 39 Lines | |||||
#include <sys/ptrace.h> | #include <sys/ptrace.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.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 <stdint.h> | #include <stdint.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <sysdecode.h> | #include <sysdecode.h> | ||||
#include <time.h> | #include <time.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
▲ Show 20 Lines • Show All 530 Lines • ▼ Show 20 Lines | report_new_child(struct trussinfo *info) | ||||
print_line_prefix(info); | print_line_prefix(info); | ||||
fprintf(info->outfile, "<new process>\n"); | fprintf(info->outfile, "<new process>\n"); | ||||
} | } | ||||
static void | static void | ||||
report_signal(struct trussinfo *info, siginfo_t *si) | report_signal(struct trussinfo *info, siginfo_t *si) | ||||
{ | { | ||||
struct threadinfo *t; | struct threadinfo *t; | ||||
char *signame; | const char *signame; | ||||
t = info->curthread; | t = info->curthread; | ||||
clock_gettime(CLOCK_REALTIME, &t->after); | clock_gettime(CLOCK_REALTIME, &t->after); | ||||
print_line_prefix(info); | print_line_prefix(info); | ||||
signame = strsig(si->si_status); | signame = sysdecode_signal(si->si_status); | ||||
fprintf(info->outfile, "SIGNAL %u (%s)\n", si->si_status, | if (signame == NULL) | ||||
signame == NULL ? "?" : signame); | signame = "?"; | ||||
fprintf(info->outfile, "SIGNAL %u (%s)\n", si->si_status, signame); | |||||
} | } | ||||
/* | /* | ||||
* Wait for events until all the processes have exited or truss has been | * Wait for events until all the processes have exited or truss has been | ||||
* asked to stop. | * asked to stop. | ||||
*/ | */ | ||||
void | void | ||||
eventloop(struct trussinfo *info) | eventloop(struct trussinfo *info) | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |