Module Name: src Committed By: kamil Date: Sun Jun 3 13:41:30 UTC 2018
Modified Files: src/usr.bin/ktruss: dump.c Log Message: ktruss: Remove symbol clash with libc Rename local function wprintf() to xwprintf(). This is needed for installing interceptors in sanitizers. Sponsored by <The NetBSD Foundation> To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.bin/ktruss/dump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/ktruss/dump.c diff -u src/usr.bin/ktruss/dump.c:1.42 src/usr.bin/ktruss/dump.c:1.43 --- src/usr.bin/ktruss/dump.c:1.42 Tue Jul 17 14:39:08 2012 +++ src/usr.bin/ktruss/dump.c Sun Jun 3 13:41:30 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: dump.c,v 1.42 2012/07/17 14:39:08 njoly Exp $ */ +/* $NetBSD: dump.c,v 1.43 2018/06/03 13:41:30 kamil Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95"; #endif -__RCSID("$NetBSD: dump.c,v 1.42 2012/07/17 14:39:08 njoly Exp $"); +__RCSID("$NetBSD: dump.c,v 1.43 2018/06/03 13:41:30 kamil Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -112,11 +112,11 @@ void putpendq(struct ktr_entry *); void syscallnameprint(int); void syscallprint(struct ktr_header *); void sysretprint(struct ktr_header *); -int wprintf(const char *, ...) __printflike(1, 2); +int xwprintf(const char *, ...) __printflike(1, 2); void *xrealloc(void *, size_t *, size_t); int -wprintf(const char *fmt, ...) +xwprintf(const char *fmt, ...) { va_list ap; int w; @@ -146,7 +146,7 @@ indent(int col) { while (width < col) - if (wprintf(" ") < 0) + if (xwprintf(" ") < 0) break; } @@ -350,10 +350,10 @@ dumpheader(struct ktr_header *kth) union timeholder temp; temp.tv.tv_sec = temp.tv.tv_usec = 0; - wprintf("%6d ", kth->ktr_pid); + xwprintf("%6d ", kth->ktr_pid); if (kth->ktr_version > KTRFAC_VERSION(KTRFACv0)) - wprintf("%6d ", kth->ktr_lid); - wprintf("%-8.*s ", MAXCOMLEN, kth->ktr_comm); + xwprintf("%6d ", kth->ktr_lid); + xwprintf("%-8.*s ", MAXCOMLEN, kth->ktr_comm); if (timestamp) { if (timestamp == 2) { switch (kth->ktr_version) { @@ -404,10 +404,10 @@ dumpheader(struct ktr_header *kth) } } if (kth->ktr_version == KTRFAC_VERSION(KTRFACv0)) - wprintf("%lld.%06ld ", + xwprintf("%lld.%06ld ", (long long)temp.tv.tv_sec, (long)temp.tv.tv_usec); else - wprintf("%lld.%09ld ", + xwprintf("%lld.%09ld ", (long long)temp.ts.tv_sec, (long)temp.ts.tv_nsec); } } @@ -423,13 +423,13 @@ ioctldecode(u_long cmd) *dir++ = 'R'; *dir = '\0'; - wprintf(decimal ? ", _IO%s('%c',%ld" : ", _IO%s('%c',%#lx", + xwprintf(decimal ? ", _IO%s('%c',%ld" : ", _IO%s('%c',%#lx", dirbuf, (int) ((cmd >> 8) & 0xff), cmd & 0xff); if ((cmd & IOC_VOID) == 0) - wprintf(decimal ? ",%ld)" : ",%#lx)", + xwprintf(decimal ? ",%ld)" : ",%#lx)", (cmd >> 16) & 0xff); else - wprintf(")"); + xwprintf(")"); } void @@ -447,7 +447,7 @@ nameiargprint(const char *prefix, struct if (kte == NULL) argprint(prefix, ap, argsize); else { - wprintf("%s", prefix); + xwprintf("%s", prefix); nameiprint(&kte->kte_kth); free(kte); (*ap)++; @@ -460,9 +460,9 @@ syscallnameprint(int code) { if (code >= cur_emul->nsysnames || code < 0) - wprintf("[%d]", code); + xwprintf("[%d]", code); else - wprintf("%s", cur_emul->sysnames[code]); + xwprintf("%s", cur_emul->sysnames[code]); } void @@ -470,9 +470,9 @@ argprint(const char *prefix, register_t { if (decimal) - wprintf("%s%ld", prefix, (long)**ap); + xwprintf("%s%ld", prefix, (long)**ap); else - wprintf("%s%#lx", prefix, (long)**ap); + xwprintf("%s%#lx", prefix, (long)**ap); (*ap)++; *argsize -= sizeof(register_t); } @@ -492,7 +492,7 @@ syscallprint(struct ktr_header *kth) */ argsize = ktr->ktr_argsize; if (argsize == 0) { - wprintf("("); + xwprintf("("); goto noargument; } @@ -558,7 +558,7 @@ syscallprint(struct ktr_header *kth) break; case SYS_compat_16___sigaction14 : - wprintf("(%s", signals[(int)*ap].name); + xwprintf("(%s", signals[(int)*ap].name); ap++; argsize -= sizeof(register_t); break; @@ -566,7 +566,7 @@ syscallprint(struct ktr_header *kth) case SYS_ioctl : argprint("(", &ap, &argsize); if ((s = ioctlname(*ap)) != NULL) - wprintf(", %s", s); + xwprintf(", %s", s); else ioctldecode(*ap); ap++; @@ -576,9 +576,9 @@ syscallprint(struct ktr_header *kth) case SYS_ptrace : if ((long)*ap >= 0 && *ap < (register_t)(sizeof(ptrace_ops) / sizeof(ptrace_ops[0]))) - wprintf("(%s", ptrace_ops[*ap]); + xwprintf("(%s", ptrace_ops[*ap]); else - wprintf("(%ld", (long)*ap); + xwprintf("(%ld", (long)*ap); ap++; argsize -= sizeof(register_t); break; @@ -594,7 +594,7 @@ print_first: argprint(", ", &ap, &argsize); noargument: - wprintf(")"); + xwprintf(")"); } void @@ -625,24 +625,24 @@ sysretprint(struct ktr_header *kth) indent(50); if (error == EJUSTRETURN) - wprintf(" JUSTRETURN"); + xwprintf(" JUSTRETURN"); else if (error == ERESTART) - wprintf(" RESTART"); + xwprintf(" RESTART"); else if (error) { - wprintf(" Err#%d", error); + xwprintf(" Err#%d", error); if (error < MAXERRNOS && error >= -2) - wprintf(" %s", errnos[error].name); + xwprintf(" %s", errnos[error].name); } else switch (ktr->ktr_code) { case SYS_mremap: case SYS_mmap: - wprintf(" = %p", (void *)(intptr_t)ret); + xwprintf(" = %p", (void *)(intptr_t)ret); break; default: - wprintf(" = %ld", (long)ret); + xwprintf(" = %ld", (long)ret); if (kth->ktr_len > (int)offsetof(struct ktr_sysret, ktr_retval_1) && ktr->ktr_retval_1 != 0) - wprintf(", %ld", (long)ktr->ktr_retval_1); + xwprintf(", %ld", (long)ktr->ktr_retval_1); break; } } @@ -694,7 +694,7 @@ void nameiprint(struct ktr_header *kth) { - wprintf("\"%.*s\"", kth->ktr_len, (char *)(kth + 1)); + xwprintf("\"%.*s\"", kth->ktr_len, (char *)(kth + 1)); } #ifdef notused @@ -704,9 +704,9 @@ ktrnamei(struct ktr_entry *kte) struct ktr_header *kth = &kte->kte_kth; dumpheader(kth); - wprintf("namei("); + xwprintf("namei("); nameiprint(kth); - wprintf(")"); + xwprintf(")"); free(kte); } @@ -719,7 +719,7 @@ ktremul(struct ktr_entry *kte) char *emul = (char *)(kth + 1); dumpheader(kth); - wprintf("emul(%s)", emul); + xwprintf("emul(%s)", emul); setemul(emul, kth->ktr_pid, 1); free(kte); @@ -752,7 +752,7 @@ genioprint(struct ktr_header *kth) if (maxdata && datalen > maxdata) datalen = maxdata; newline(); - wprintf(" \""); + xwprintf(" \""); for (; datalen > 0; datalen--, dp++) { (void) vis(visbuf, *dp, VIS_NL|VIS_TAB|VIS_CSTYLE, /* We put NUL at the end of buffer when reading */ @@ -761,11 +761,11 @@ genioprint(struct ktr_header *kth) w = strlen(visbuf); if (width + w + 2 >= screenwidth) break; - wprintf("%s", visbuf); + xwprintf("%s", visbuf); if (width + 2 >= screenwidth) break; } - wprintf("\""); + xwprintf("\""); } #ifdef notused @@ -776,7 +776,7 @@ ktrgenio(struct ktr_entry *kte) struct ktr_genio *ktr = (struct ktr_genio *)(kth + 1); dumpheader(kth); - wprintf("genio fd %d %s", + xwprintf("genio fd %d %s", ktr->ktr_fd, ktr->ktr_rw ? "write" : "read"); genioprint(kth); @@ -791,11 +791,11 @@ ktrpsig(struct ktr_entry *kte) struct ktr_psig *psig = (struct ktr_psig *)(kth + 1); dumpheader(kth); - wprintf("SIG%s ", sys_signame[psig->signo]); + xwprintf("SIG%s ", sys_signame[psig->signo]); if (psig->action == SIG_DFL) - wprintf("SIG_DFL"); + xwprintf("SIG_DFL"); else { - wprintf("caught handler=0x%lx mask=0x%lx code=0x%x", + xwprintf("caught handler=0x%lx mask=0x%lx code=0x%x", (u_long)psig->action, (unsigned long)psig->mask.__bits[0], psig->code); } @@ -810,7 +810,7 @@ ktrcsw(struct ktr_entry *kte) struct ktr_csw *cs = (struct ktr_csw *)(kth + 1); dumpheader(kth); - wprintf("%s %s", cs->out ? "stop" : "resume", + xwprintf("%s %s", cs->out ? "stop" : "resume", cs->user ? "user" : "kernel"); free(kte);