diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c index cde019a509d0..3f00c8d03411 100644 --- a/sys/kern/kern_ktr.c +++ b/sys/kern/kern_ktr.c @@ -108,11 +108,12 @@ SYSCTL_INT(_debug_ktr, OID_AUTO, verbose, CTLFLAG_RW, &ktr_verbose, 0, ""); #ifdef KTR #ifdef KTR_EXTEND void -ktr_tracepoint(u_int mask, char *filename, u_int line, char *format, ...) +ktr_tracepoint(u_int mask, const char *filename, u_int line, + const char *format, ...) #else void -ktr_tracepoint(u_int mask, char *format, u_long arg1, u_long arg2, u_long arg3, - u_long arg4, u_long arg5) +ktr_tracepoint(u_int mask, const char *format, u_long arg1, u_long arg2, + u_long arg3, u_long arg4, u_long arg5) #endif { struct ktr_entry *entry; @@ -147,8 +148,7 @@ ktr_tracepoint(u_int mask, char *format, u_long arg1, u_long arg2, u_long arg3, else nanotime(&entry->ktr_tv); #ifdef KTR_EXTEND - strncpy(entry->ktr_filename, filename, KTRFILENAMESIZE - 1); - entry->ktr_filename[KTRFILENAMESIZE - 1] = '\0'; + entry->ktr_filename = filename; entry->ktr_line = line; entry->ktr_cpu = KTR_CPU; va_start(ap, format); diff --git a/sys/sys/ktr.h b/sys/sys/ktr.h index bf3ce5243d03..050b303eae44 100644 --- a/sys/sys/ktr.h +++ b/sys/sys/ktr.h @@ -96,15 +96,12 @@ struct ktr_entry { #ifndef KTRDESCSIZE #define KTRDESCSIZE 80 #endif -#ifndef KTRFILENAMESIZE -#define KTRFILENAMESIZE 32 -#endif - char ktr_desc [KTRDESCSIZE]; - char ktr_filename [KTRFILENAMESIZE]; + char ktr_desc[KTRDESCSIZE]; + const char *ktr_filename; int ktr_line; int ktr_cpu; #else - char *ktr_desc; + const char *ktr_desc; u_long ktr_parm1; u_long ktr_parm2; u_long ktr_parm3; @@ -132,10 +129,10 @@ extern struct ktr_entry ktr_buf[]; #endif #ifdef KTR_EXTEND -void ktr_tracepoint(u_int mask, char *filename, u_int line, - char *format, ...) __printflike(4, 5); +void ktr_tracepoint(u_int mask, const char *filename, u_int line, + const char *format, ...) __printflike(4, 5); #else -void ktr_tracepoint(u_int mask, char *format, u_long arg1, u_long arg2, +void ktr_tracepoint(u_int mask, const char *format, u_long arg1, u_long arg2, u_long arg3, u_long arg4, u_long arg5); #endif