truss.h revision 158630
1101282Smdodd/*
2101282Smdodd * Copryight 2001 Jamey Wood
3101282Smdodd *
4101282Smdodd * Redistribution and use in source and binary forms, with or without
5101282Smdodd * modification, are permitted provided that the following conditions
6101282Smdodd * are met:
7101282Smdodd * 1. Redistributions of source code must retain the above copyright
8101282Smdodd *    notice, this list of conditions and the following disclaimer.
9101282Smdodd * 2. Redistributions in binary form must reproduce the above copyright
10101282Smdodd *    notice, this list of conditions and the following disclaimer in the
11101282Smdodd *    documentation and/or other materials provided with the distribution.
12101282Smdodd *
13101282Smdodd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14101282Smdodd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15101282Smdodd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16101282Smdodd * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17101282Smdodd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18101282Smdodd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19101282Smdodd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20101282Smdodd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21101282Smdodd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22101282Smdodd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23101282Smdodd * SUCH DAMAGE.
24101282Smdodd *
25101282Smdodd * $FreeBSD: head/usr.bin/truss/truss.h 158630 2006-05-15 21:18:28Z pav $
26101282Smdodd */
27101282Smdodd
28101283Smdodd#define FOLLOWFORKS        0x00000001
29101285Smdodd#define RELATIVETIMESTAMPS 0x00000002
30101285Smdodd#define ABSOLUTETIMESTAMPS 0x00000004
31101282Smdodd#define NOSIGS             0x00000008
32101289Smdodd#define EXECVEARGS         0x00000010
33101289Smdodd#define EXECVEENVS         0x00000020
34101282Smdodd
35101282Smdoddstruct trussinfo
36101282Smdodd{
37101282Smdodd	int pid;
38101282Smdodd	int flags;
39101283Smdodd	int in_fork;
40153963Sbrian	int strsize;
41101282Smdodd	FILE *outfile;
42101285Smdodd
43101373Smdodd	struct timespec start_time;
44101373Smdodd	struct timespec before;
45101373Smdodd	struct timespec after;
46101282Smdodd};
47158630Spav
48158630Spav#define timespecsubt(tvp, uvp, vvp)					\
49158630Spav	do {								\
50158630Spav		(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;		\
51158630Spav		(vvp)->tv_nsec = (tvp)->tv_nsec - (uvp)->tv_nsec;	\
52158630Spav		if ((vvp)->tv_nsec < 0) {				\
53158630Spav			(vvp)->tv_sec--;				\
54158630Spav			(vvp)->tv_nsec += 1000000000;			\
55158630Spav		}							\
56158630Spav	} while (0)
57