- In the KTR_EXTEND case, use a const char * to point to the passed in

filename insteada of copying the first 32 characters of it.
- Add in const modifiers for the passed in format strings and filenames
  and their respective members in the ktr_entry struct.
This commit is contained in:
John Baldwin 2001-02-20 10:39:55 +00:00
parent dd76c70387
commit 62d654c142
2 changed files with 11 additions and 14 deletions

View File

@ -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);

View File

@ -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