The documentation (man KTRPOINT) says:

        KTRPOINT(struct proc *p, int type);

        ...

        The KTRPOINT() macro should be used before calling any of the other
        tracing functions to verify that tracing for that particular type of
        events has been enabled.  Possible values for the type argument are a
        mask of the KTRFAC_ values described in ktrace(2).

But the kernel uses KTR_, not KTRFAC_ values:

        /usr/src/sys$ grep -rI KTRPOINT.*KTR_ . | wc -l
        62
        /usr/src/sys$ grep -rI KTRPOINT.*KTRFAC_ . | wc -l
        0

The difference between the two is such:

        #define KTR_STRUCT      8
        #define KTRFAC_STRUCT   (1<<KTR_STRUCT)

And the macro itself:

        #define KTRPOINT(p, type)       \
                ((p)->p_p->ps_traceflag & (1<<(type)) && ((p)->p_flag & 
P_INKTR) == 0)

Maybe I misunderstood what a "mask of the KTRFAC_ values" means, but I
think this is a valid fix:

Index: ktrace.9
===================================================================
RCS file: /cvs/src/share/man/man9/ktrace.9,v
retrieving revision 1.10
diff -u -p -r1.10 ktrace.9
--- ktrace.9    12 Sep 2015 15:02:28 -0000      1.10
+++ ktrace.9    15 Jun 2016 07:52:27 -0000
@@ -66,9 +66,8 @@ The
 .Fn KTRPOINT
 macro should be used before calling any of the other tracing functions
 to verify that tracing for that particular type of events has been enabled.
-Possible values for the
 .Fa type
-argument are a mask of the KTRFAC_ values described in
+must be a KTR_ value matching the respective KTRFAC_ value described in
 .Xr ktrace 2 .
 .Pp
 .Fn ktremul


-- 
Michal Mazurek

Reply via email to