static struct timeval overhead = { -1, -1 };
void
-set_sortby(char *sortby)
+set_sortby(const char *sortby)
{
if (strcmp(sortby, "time") == 0)
sortfun = time_cmp;
int call_cum, error_cum;
struct timeval tv_cum, dtv;
double percent;
- char *dashes = "-------------------------";
+ const char *dashes = "-------------------------";
char error_str[16];
int *sorted_count = calloc(sizeof(int), nsyscalls);
struct xlat {
int val;
- char *str;
+ const char *str;
};
extern const struct xlat open_mode_flags[];
#define alloctcb(pid) alloc_tcb((pid), 1)
-extern void set_sortby(char *);
+extern void set_sortby(const char *);
extern void set_overhead(int);
-extern void qualify(char *);
+extern void qualify(const char *);
extern int get_scno(struct tcb *);
extern long known_scno(struct tcb *);
extern long do_ptrace(int request, struct tcb *tcp, void *addr, void *data);
extern void dumpiov(struct tcb *, int, long);
extern void dumpstr(struct tcb *, long, int);
extern void printstr(struct tcb *, long, int);
-extern void printnum(struct tcb *, long, char *);
-extern void printnum_int(struct tcb *, long, char *);
+extern void printnum(struct tcb *, long, const char *);
+extern void printnum_int(struct tcb *, long, const char *);
extern void printpath(struct tcb *, long);
extern void printpathn(struct tcb *, long, int);
extern void printtv_bitness(struct tcb *, long, enum bitness_t, int);
& -sizeof(long));
fd_set *fds;
static char outstr[1024];
- char *sep;
+ const char *sep;
long arg;
if (entering(tcp)) {
else
{
unsigned int cumlen = 0;
- char *sep = "";
+ const char *sep = "";
if (syserror(tcp))
return 0;
#endif
struct ioctlent {
- char *doth;
- char *symbol;
+ const char *doth;
+ const char *symbol;
unsigned long code;
};
}
int
-main(argc, argv)
-int argc;
-char *argv[];
+main(int argc, const char *argv[])
{
int i;
static void
-printargv(tcp, addr)
-struct tcb *tcp;
-long addr;
+printargv(struct tcb *tcp, long addr)
{
union {
unsigned int p32;
unsigned long p64;
char data[sizeof(long)];
} cp;
- char *sep;
+ const char *sep;
int n = 0;
cp.p64 = 1;
}
static void
-printargc(fmt, tcp, addr)
-char *fmt;
-struct tcb *tcp;
-long addr;
+printargc(const char *fmt, struct tcb *tcp, long addr)
{
int count;
char *cp;
{
int i, nsigs;
int maxsigs;
- char *format, *s;
+ const char *format;
+ char *s;
static char outstr[8 * sizeof(sigset_t) * 8];
strcpy(outstr, str);
#ifdef LINUX
static void
-parse_sigset_t (const char *str, sigset_t *set)
+parse_sigset_t(const char *str, sigset_t *set)
{
const char *p;
unsigned int digit;
int sfd;
char sname[32];
char buf[2048];
- char *s;
+ const char *s;
int i;
sigset_t ignored, caught;
#endif
static int curcol;
struct tcb **tcbtab;
unsigned int nprocs, tcbtabsize;
-char *progname;
+const char *progname;
extern char **environ;
static int detach(struct tcb *tcp, int sig);
strcpy(pathname, filename);
#endif /* USE_DEBUGGING_EXEC */
else {
- char *path;
+ const char *path;
int m, n, len;
for (path = getenv("PATH"); path && *path; path += m) {
struct strbuf {
int maxlen; /* no. of bytes in buffer */
int len; /* no. of bytes returned */
- char *buf; /* pointer to data */
+ const char *buf; /* pointer to data */
};
#define MORECTL 1
#define MOREDATA 2
static const struct qual_options {
int bitflag;
- char *option_name;
- int (*qualify)();
- char *argument_name;
+ const char *option_name;
+ int (*qualify)(const char *, const struct qual_options *, int);
+ const char *argument_name;
} qual_options[] = {
{ QUAL_TRACE, "trace", qual_syscall, "system call" },
{ QUAL_TRACE, "t", qual_syscall, "system call" },
}
static int
-qual_syscall(s, opt, not)
- char *s;
- const struct qual_options *opt;
- int not;
+qual_syscall(const char *s, const struct qual_options *opt, int not)
{
int i;
int rc = -1;
}
static int
-qual_signal(s, opt, not)
- char *s;
- const struct qual_options *opt;
- int not;
+qual_signal(const char *s, const struct qual_options *opt, int not)
{
int i;
char buf[32];
return -1;
strcpy(buf, s);
s = buf;
- for (i = 0; s[i]; i++)
- s[i] = toupper((unsigned char)(s[i]));
- if (strncmp(s, "SIG", 3) == 0)
+ if (strncasecmp(s, "SIG", 3) == 0)
s += 3;
for (i = 0; i <= NSIG; i++)
- if (strcmp(s, signame(i) + 3) == 0) {
+ if (strcasecmp(s, signame(i) + 3) == 0) {
qualify_one(i, opt, not, -1);
return 0;
}
}
static int
-qual_fault(s, opt, not)
- char *s;
- const struct qual_options *opt;
- int not;
+qual_fault(const char *s, const struct qual_options *opt, int not)
{
return -1;
}
static int
-qual_desc(s, opt, not)
- char *s;
- const struct qual_options *opt;
- int not;
+qual_desc(const char *s, const struct qual_options *opt, int not)
{
if (isdigit((unsigned char)*s)) {
int desc = atoi(s);
}
static int
-lookup_class(s)
- char *s;
+lookup_class(const char *s)
{
if (strcmp(s, "file") == 0)
return TRACE_FILE;
}
void
-qualify(s)
-char *s;
+qualify(const char *s)
{
const struct qual_options *opt;
int not;
- char *p;
+ char *copy;
+ const char *p;
int i, n;
opt = &qual_options[0];
for (i = 0; i < MAX_QUALS; i++) {
qualify_one(i, opt, !not, -1);
}
- for (p = strtok(s, ","); p; p = strtok(NULL, ",")) {
+ if (!strchr(s, ','))
+ return;
+ if (!(copy = strdup(s))) {
+ fprintf(stderr, "out of memory\n");
+ exit(1);
+ }
+ for (p = strtok(copy, ","); p; p = strtok(NULL, ",")) {
if (opt->bitflag == QUAL_TRACE && (n = lookup_class(p)) > 0) {
for (i = 0; i < nsyscalls0; i++)
if (sysent0[i].sys_flags & n)
exit(1);
}
}
+ free(copy);
return;
}
}
int
-printflags(xlat, flags, dflt)
-const struct xlat *xlat;
-int flags;
-const char *dflt;
+printflags(const struct xlat *xlat, int flags, const char *dflt)
{
int n;
- char *sep;
+ const char *sep;
if (flags == 0 && xlat->val == 0) {
tprintf("%s", xlat->str);
}
void
-printnum(tcp, addr, fmt)
-struct tcb *tcp;
-long addr;
-char *fmt;
+printnum(struct tcb *tcp, long addr, const char *fmt)
{
long num;
}
void
-printnum_int(tcp, addr, fmt)
-struct tcb *tcp;
-long addr;
-char *fmt;
+printnum_int(struct tcb *tcp, long addr, const char *fmt)
{
int num;