xref: /titanic_52/usr/src/lib/libtnfprobe/prb_internals.h (revision 263f549e5da8b32c4922f586afb365b8ae388a6c)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *      Copyright (c) 1994, by Sun Microsytems, Inc.
24  */
25 
26 #ifndef _PRB_INTERNALS_H
27 #define	_PRB_INTERNALS_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Includes
33  */
34 
35 #include <synch.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /*
42  * Notes:
43  *
44  * There is a memseg statically allocated in libtnfprobe.  This memory is
45  * consumed by the internal and external probe control fucntions for
46  * initial_final blocks, and compositions.
47  *
48  * There is no mechanism for freeing this memory; it is leaked.  This is
49  * because the overhead involved to protect uses of old memory is too
50  * high for probes.
51  *
52  * The target program internally allocates memory from the bottom edge of
53  * the segment, and the external program allocates from the high edge of
54  * the segment.
55  *
56  * The i_reqsz field is set by the internal memory allocation routine
57  * while it is allocating.  If the external process happens to freeze the
58  * target process while it is in the middle of an internal allocation the
59  * i_reqsz field allows the external process to be extra conservative in
60  * avoiding a memory collision.
61  */
62 
63 /*
64  * Typedefs
65  */
66 
67 typedef struct tnf_memseg
68 {
69     char *	min_p;		/* points to min free byte */
70     char *	max_p;		/* points past max free byte */
71 
72     mutex_t	i_lock;		/* internal sync lock */
73     size_t	i_reqsz;	/* internal request size */
74 
75 } tnf_memseg_t;
76 
77 
78 /*
79  * Declarations
80  */
81 
82 char *		__tnf_probe_alloc(size_t size);
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif /* _PRB_INTERNALS_H */
89