/* * Copyright (c) 1988 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * @(#)ktrace.h 7.1 (Berkeley) 09/04/89 */ /* * operations to ktrace system call (op & 0x3) */ #define KTROP_SET 0 /* set traces */ #define KTROP_CLEAR 1 /* clear traces */ #define KTROP_CLEARFILE 2 /* stop all tracing to file */ /* * flags to OR in with operation */ #define KTROP_INHERITFLAG 4 /* pass to children flag */ /* * ktrace record header */ struct ktr_header { int ktr_len; /* length of buf */ short ktr_type; /* trace record type */ pid_t ktr_pid; /* process id */ char ktr_comm[MAXCOMLEN+1]; /* command name */ struct timeval ktr_time; /* timestamp */ caddr_t ktr_buf; }; /* * Test for kernel trace point */ #define KTRPOINT(p, type) ((p)->p_traceflag & (1<<(type))) /* * ktrace record types - add new ones here */ /* * KTR_SYSCALL - system call record */ #define KTR_SYSCALL 0x1 struct ktr_syscall { short ktr_code; /* syscall number */ short ktr_narg; /* number of arguments */ /* * followed by ktr_narg ints */ }; /* * KTR_SYSRET - return from system call record */ #define KTR_SYSRET 0x2 struct ktr_sysret { short ktr_code; short ktr_eosys; int ktr_error; int ktr_retval; }; /* * KTR_NAMEI - namei record */ #define KTR_NAMEI 0x3 /* record contains pathname */ /* * KTR_GENIO - trace generic process i/o */ #define KTR_GENIO 0x4 struct ktr_genio { int ktr_fd; enum uio_rw ktr_rw; /* * followed by data successfully read/written */ }; /* * kernel trace facilities */ #define KTRFAC_SYSCALL (1<