xref: /titanic_52/usr/src/cmd/sgs/link_audit/common/bindings.h (revision d58fda4376e4bf67072ce2e69f6f47036f9dbb68)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_BINDINGS_H
28 #define	_BINDINGS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/lwp.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #define	BINDVERS	2
39 #define	BINDCURVERS	BINDVERS
40 
41 #define	DEFFILE		"/tmp/bindings.data"
42 #define	FILEENV		"BT_BUFFER"
43 #define	BLKSIZE		0x4000
44 #define	STRBLKSIZE	0x1000
45 #define	DEFBKTS		3571			/* nice big prime number */
46 
47 #define	MASK		(~(unsigned long)0<<28)
48 
49 typedef struct _bind_entry {
50 	unsigned int	be_sym_name;
51 	unsigned int	be_lib_name;
52 	unsigned int	be_count;
53 	unsigned int	be_next;
54 } binding_entry;
55 
56 typedef struct {
57 	unsigned int	bb_head;	/* first entry in bucket */
58 	unsigned int	bb_pad;		/* maintain alignment for 32/64bit */
59 	lwp_mutex_t	bb_lock;	/* bucket chain lock */
60 } binding_bucket;
61 
62 typedef struct {
63 	unsigned int	bh_vers;
64 	unsigned int	bh_size;
65 	lwp_mutex_t	bh_lock;
66 	unsigned int	bh_end;
67 	unsigned int	bh_bktcnt;
68 	unsigned int	bh_strcur;		/* current strbuff ptr */
69 	unsigned int	bh_strend;		/* end of current strbuf */
70 	lwp_mutex_t	bh_strlock;		/* mutex to protect strings */
71 	binding_bucket	bh_bkts[DEFBKTS];
72 } bindhead;
73 
74 #ifdef	__cplusplus
75 }
76 #endif
77 
78 #endif	/* _BINDINGS_H */
79