xref: /titanic_50/usr/src/cmd/sgs/link_audit/common/bindings.h (revision 23a1ccea6aac035f084a7a4cdc968687d1b02daf)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef	_BINDINGS_H
26 #define	_BINDINGS_H
27 
28 #include <sys/lwp.h>
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #define	BINDVERS	2
35 #define	BINDCURVERS	BINDVERS
36 
37 #define	DEFFILE		"/tmp/bindings.data"
38 #define	FILEENV		"BT_BUFFER"
39 #define	BLKSIZE		0x4000
40 #define	STRBLKSIZE	0x1000
41 #define	DEFBKTS		3571			/* nice big prime number */
42 
43 #define	MASK		(~(unsigned long)0<<28)
44 
45 typedef struct _bind_entry {
46 	unsigned int	be_sym_name;
47 	unsigned int	be_lib_name;
48 	unsigned int	be_count;
49 	unsigned int	be_next;
50 } binding_entry;
51 
52 typedef struct {
53 	unsigned int	bb_head;	/* first entry in bucket */
54 	unsigned int	bb_pad;		/* maintain alignment for 32/64bit */
55 	lwp_mutex_t	bb_lock;	/* bucket chain lock */
56 } binding_bucket;
57 
58 typedef struct {
59 	unsigned int	bh_vers;
60 	unsigned int	bh_size;
61 	lwp_mutex_t	bh_lock;
62 	unsigned int	bh_end;
63 	unsigned int	bh_bktcnt;
64 	unsigned int	bh_strcur;		/* current strbuff ptr */
65 	unsigned int	bh_strend;		/* end of current strbuf */
66 	lwp_mutex_t	bh_strlock;		/* mutex to protect strings */
67 	binding_bucket	bh_bkts[DEFBKTS];
68 } bindhead;
69 
70 #ifdef	__cplusplus
71 }
72 #endif
73 
74 #endif	/* _BINDINGS_H */
75