home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / sys / ktrace.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  5.0 KB  |  179 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    ktrace.h,v $
  29.  * Revision 2.1  92/04/21  17:15:45  rwd
  30.  * BSDSS
  31.  * 
  32.  *
  33.  */
  34.  
  35. /*
  36.  * Copyright (c) 1988 The Regents of the University of California.
  37.  * All rights reserved.
  38.  *
  39.  * Redistribution and use in source and binary forms, with or without
  40.  * modification, are permitted provided that the following conditions
  41.  * are met:
  42.  * 1. Redistributions of source code must retain the above copyright
  43.  *    notice, this list of conditions and the following disclaimer.
  44.  * 2. Redistributions in binary form must reproduce the above copyright
  45.  *    notice, this list of conditions and the following disclaimer in the
  46.  *    documentation and/or other materials provided with the distribution.
  47.  * 3. All advertising materials mentioning features or use of this software
  48.  *    must display the following acknowledgement:
  49.  *    This product includes software developed by the University of
  50.  *    California, Berkeley and its contributors.
  51.  * 4. Neither the name of the University nor the names of its contributors
  52.  *    may be used to endorse or promote products derived from this software
  53.  *    without specific prior written permission.
  54.  *
  55.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  56.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  57.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  58.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  59.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  60.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  61.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  62.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  63.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  64.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  65.  * SUCH DAMAGE.
  66.  *
  67.  *    @(#)ktrace.h    7.4 (Berkeley) 5/7/91
  68.  */
  69.  
  70. /*
  71.  * operations to ktrace system call  (KTROP(op))
  72.  */
  73. #define KTROP_SET        0    /* set trace points */
  74. #define KTROP_CLEAR        1    /* clear trace points */
  75. #define KTROP_CLEARFILE        2    /* stop all tracing to file */
  76. #define    KTROP(o)        ((o)&3)    /* macro to extract operation */
  77. /*
  78.  * flags (ORed in with operation)
  79.  */
  80. #define KTRFLAG_DESCEND        4    /* perform op on all children too */
  81.  
  82. /*
  83.  * ktrace record header
  84.  */
  85. struct ktr_header {
  86.     int    ktr_len;        /* length of buf */
  87.     short    ktr_type;        /* trace record type */
  88.     pid_t    ktr_pid;        /* process id */
  89.     char    ktr_comm[MAXCOMLEN+1];    /* command name */
  90.     struct    timeval ktr_time;    /* timestamp */
  91.     caddr_t    ktr_buf;
  92. };
  93.  
  94. /*
  95.  * Test for kernel trace point
  96.  */
  97. #define KTRPOINT(p, type)    ((p)->p_traceflag & (1<<(type)))
  98.  
  99. /*
  100.  * ktrace record types
  101.  */
  102.  
  103. /*
  104.  * KTR_SYSCALL - system call record
  105.  */
  106. #define KTR_SYSCALL    1
  107. struct ktr_syscall {
  108.     short    ktr_code;        /* syscall number */
  109.     short    ktr_narg;        /* number of arguments */
  110.     /*
  111.      * followed by ktr_narg ints
  112.      */
  113. };
  114.  
  115. /*
  116.  * KTR_SYSRET - return from system call record
  117.  */
  118. #define KTR_SYSRET    2
  119. struct ktr_sysret {
  120.     short    ktr_code;
  121.     short    ktr_eosys;
  122.     int    ktr_error;
  123.     int    ktr_retval;
  124. };
  125.  
  126. /*
  127.  * KTR_NAMEI - namei record
  128.  */
  129. #define KTR_NAMEI    3
  130.     /* record contains pathname */
  131.  
  132. /*
  133.  * KTR_GENIO - trace generic process i/o
  134.  */
  135. #define KTR_GENIO    4
  136. struct ktr_genio {
  137.     int    ktr_fd;
  138.     enum    uio_rw ktr_rw;
  139.     /*
  140.      * followed by data successfully read/written
  141.      */
  142. };
  143.  
  144. /*
  145.  * KTR_PSIG - trace processed signal
  146.  */
  147. #define    KTR_PSIG    5
  148. struct ktr_psig {
  149.     int    signo;
  150.     sig_t    action;
  151.     int    mask;
  152.     int    code;
  153. };
  154.  
  155. /*
  156.  * kernel trace points (in p_traceflag)
  157.  */
  158. #define KTRFAC_MASK    0x00ffffff
  159. #define KTRFAC_SYSCALL    (1<<KTR_SYSCALL)
  160. #define KTRFAC_SYSRET    (1<<KTR_SYSRET)
  161. #define KTRFAC_NAMEI    (1<<KTR_NAMEI)
  162. #define KTRFAC_GENIO    (1<<KTR_GENIO)
  163. #define    KTRFAC_PSIG    (1<<KTR_PSIG)
  164. /*
  165.  * trace flags (also in p_traceflags)
  166.  */
  167. #define KTRFAC_ROOT    0x80000000    /* root set this trace */
  168. #define KTRFAC_INHERIT    0x40000000    /* pass trace flags to children */
  169.  
  170. #ifndef    KERNEL
  171.  
  172. #include <sys/cdefs.h>
  173.  
  174. __BEGIN_DECLS
  175. int    ktrace __P((const char *, int, int, pid_t));
  176. __END_DECLS
  177.  
  178. #endif    /* !KERNEL */
  179.