Changeset View
Changeset View
Standalone View
Standalone View
head/usr.bin/truss/main.c
Show All 36 Lines | |||||
* files handle the bulk of the work. And, of course, the kernel has to | * files handle the bulk of the work. And, of course, the kernel has to | ||||
* do a lot of the work :). | * do a lot of the work :). | ||||
*/ | */ | ||||
#include <sys/ptrace.h> | #include <sys/ptrace.h> | ||||
#include <err.h> | #include <err.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
#include <stdbool.h> | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <sysdecode.h> | #include <sysdecode.h> | ||||
#include <time.h> | #include <time.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include "truss.h" | #include "truss.h" | ||||
#include "extern.h" | #include "extern.h" | ||||
#include "syscall.h" | #include "syscall.h" | ||||
static void | static void | ||||
usage(void) | usage(void) | ||||
{ | { | ||||
fprintf(stderr, "%s\n%s\n", | fprintf(stderr, "%s\n%s\n", | ||||
"usage: truss [-cfaedDS] [-o file] [-s strsize] -p pid", | "usage: truss [-cfaedDS] [-o file] [-s strsize] -p pid", | ||||
" truss [-cfaedDS] [-o file] [-s strsize] command [args]"); | " truss [-cfaedDS] [-o file] [-s strsize] command [args]"); | ||||
exit(1); | exit(1); | ||||
} | |||||
char * | |||||
strsig(int sig) | |||||
{ | |||||
static char tmp[64]; | |||||
if (sig > 0 && sig < NSIG) { | |||||
snprintf(tmp, sizeof(tmp), "SIG%s", sys_signame[sig]); | |||||
return (tmp); | |||||
} | |||||
return (NULL); | |||||
} | } | ||||
int | int | ||||
main(int ac, char **av) | main(int ac, char **av) | ||||
{ | { | ||||
struct sigaction sa; | struct sigaction sa; | ||||
struct trussinfo *trussinfo; | struct trussinfo *trussinfo; | ||||
char *fname; | char *fname; | ||||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |