The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/ktrace.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1988, 1993
    3  *      The Regents of the University of California.  All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 4. Neither the name of the University nor the names of its contributors
   14  *    may be used to endorse or promote products derived from this software
   15  *    without specific prior written permission.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   27  * SUCH DAMAGE.
   28  *
   29  *      @(#)ktrace.h    8.1 (Berkeley) 6/2/93
   30  * $FreeBSD: releng/6.1/sys/sys/ktrace.h 158179 2006-04-30 16:44:43Z cvs2svn $
   31  */
   32 
   33 #ifndef _SYS_KTRACE_H_
   34 #define _SYS_KTRACE_H_
   35 
   36 /*
   37  * operations to ktrace system call  (KTROP(op))
   38  */
   39 #define KTROP_SET               0       /* set trace points */
   40 #define KTROP_CLEAR             1       /* clear trace points */
   41 #define KTROP_CLEARFILE         2       /* stop all tracing to file */
   42 #define KTROP(o)                ((o)&3) /* macro to extract operation */
   43 /*
   44  * flags (ORed in with operation)
   45  */
   46 #define KTRFLAG_DESCEND         4       /* perform op on all children too */
   47 
   48 /*
   49  * ktrace record header
   50  */
   51 struct ktr_header {
   52         int     ktr_len;                /* length of buf */
   53         short   ktr_type;               /* trace record type */
   54         pid_t   ktr_pid;                /* process id */
   55         char    ktr_comm[MAXCOMLEN+1];  /* command name */
   56         struct  timeval ktr_time;       /* timestamp */
   57         intptr_t        ktr_tid;        /* was ktr_buffer */
   58 };
   59 
   60 /*
   61  * Test for kernel trace point (MP SAFE).
   62  *
   63  * KTRCHECK() just checks that the type is enabled and is only for
   64  * internal use in the ktrace subsystem.  KTRPOINT() checks against
   65  * ktrace recursion as well as checking that the type is enabled and
   66  * is the public interface.
   67  */
   68 #define KTRCHECK(td, type)      ((td)->td_proc->p_traceflag & (1 << type))
   69 #define KTRPOINT(td, type)                                              \
   70         (KTRCHECK((td), (type)) && !((td)->td_pflags & TDP_INKTRACE))
   71 
   72 /*
   73  * ktrace record types
   74  */
   75 
   76 /*
   77  * KTR_SYSCALL - system call record
   78  */
   79 #define KTR_SYSCALL     1
   80 struct ktr_syscall {
   81         short   ktr_code;               /* syscall number */
   82         short   ktr_narg;               /* number of arguments */
   83         /*
   84          * followed by ktr_narg register_t
   85          */
   86         register_t      ktr_args[1];
   87 };
   88 
   89 /*
   90  * KTR_SYSRET - return from system call record
   91  */
   92 #define KTR_SYSRET      2
   93 struct ktr_sysret {
   94         short   ktr_code;
   95         short   ktr_eosys;
   96         int     ktr_error;
   97         register_t      ktr_retval;
   98 };
   99 
  100 /*
  101  * KTR_NAMEI - namei record
  102  */
  103 #define KTR_NAMEI       3
  104         /* record contains pathname */
  105 
  106 /*
  107  * KTR_GENIO - trace generic process i/o
  108  */
  109 #define KTR_GENIO       4
  110 struct ktr_genio {
  111         int     ktr_fd;
  112         enum    uio_rw ktr_rw;
  113         /*
  114          * followed by data successfully read/written
  115          */
  116 };
  117 
  118 /*
  119  * KTR_PSIG - trace processed signal
  120  */
  121 #define KTR_PSIG        5
  122 struct ktr_psig {
  123         int     signo;
  124         sig_t   action;
  125         int     code;
  126         sigset_t mask;
  127 };
  128 
  129 /*
  130  * KTR_CSW - trace context switches
  131  */
  132 #define KTR_CSW         6
  133 struct ktr_csw {
  134         int     out;    /* 1 if switch out, 0 if switch in */
  135         int     user;   /* 1 if usermode (ivcsw), 0 if kernel (vcsw) */
  136 };
  137 
  138 /*
  139  * KTR_USER - data comming from userland
  140  */
  141 #define KTR_USER_MAXLEN 2048    /* maximum length of passed data */
  142 #define KTR_USER        7
  143 
  144 /*
  145  * KTR_DROP - If this bit is set in ktr_type, then at least one event
  146  * between the previous record and this record was dropped.
  147  */
  148 #define KTR_DROP        0x8000
  149 
  150 /*
  151  * kernel trace points (in p_traceflag)
  152  */
  153 #define KTRFAC_MASK     0x00ffffff
  154 #define KTRFAC_SYSCALL  (1<<KTR_SYSCALL)
  155 #define KTRFAC_SYSRET   (1<<KTR_SYSRET)
  156 #define KTRFAC_NAMEI    (1<<KTR_NAMEI)
  157 #define KTRFAC_GENIO    (1<<KTR_GENIO)
  158 #define KTRFAC_PSIG     (1<<KTR_PSIG)
  159 #define KTRFAC_CSW      (1<<KTR_CSW)
  160 #define KTRFAC_USER     (1<<KTR_USER)
  161 /*
  162  * trace flags (also in p_traceflags)
  163  */
  164 #define KTRFAC_ROOT     0x80000000      /* root set this trace */
  165 #define KTRFAC_INHERIT  0x40000000      /* pass trace flags to children */
  166 #define KTRFAC_DROP     0x20000000      /* last event was dropped */
  167 
  168 #ifdef  _KERNEL
  169 extern struct mtx ktrace_mtx;
  170 
  171 void    ktrnamei(char *);
  172 void    ktrcsw(int, int);
  173 void    ktrpsig(int, sig_t, sigset_t *, int);
  174 void    ktrgenio(int, enum uio_rw, struct uio *, int);
  175 void    ktrsyscall(int, int narg, register_t args[]);
  176 void    ktrsysret(int, int, register_t);
  177 
  178 #else
  179 
  180 #include <sys/cdefs.h>
  181 
  182 __BEGIN_DECLS
  183 int     ktrace(const char *, int, int, pid_t);
  184 int     utrace(const void *, size_t);
  185 __END_DECLS
  186 
  187 #endif
  188 
  189 #endif

Cache object: c43b20b1133087eb56cbeebd8769af87


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.