xref: /titanic_41/usr/src/cmd/sgs/link_audit/common/bindings.h (revision 6a634c9dca3093f3922e4b7ab826d7bdf17bf78e)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*20c1c355SRod Evans  * Common Development and Distribution License (the "License").
6*20c1c355SRod Evans  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*20c1c355SRod Evans  * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate #ifndef	_BINDINGS_H
267c478bd9Sstevel@tonic-gate #define	_BINDINGS_H
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #include <sys/lwp.h>
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
317c478bd9Sstevel@tonic-gate extern "C" {
327c478bd9Sstevel@tonic-gate #endif
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #define	BINDVERS	2
357c478bd9Sstevel@tonic-gate #define	BINDCURVERS	BINDVERS
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #define	DEFFILE		"/tmp/bindings.data"
387c478bd9Sstevel@tonic-gate #define	FILEENV		"BT_BUFFER"
397c478bd9Sstevel@tonic-gate #define	BLKSIZE		0x4000
407c478bd9Sstevel@tonic-gate #define	STRBLKSIZE	0x1000
417c478bd9Sstevel@tonic-gate #define	DEFBKTS		3571			/* nice big prime number */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #define	MASK		(~(unsigned long)0<<28)
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate typedef struct _bind_entry {
467c478bd9Sstevel@tonic-gate 	unsigned int	be_sym_name;
477c478bd9Sstevel@tonic-gate 	unsigned int	be_lib_name;
487c478bd9Sstevel@tonic-gate 	unsigned int	be_count;
497c478bd9Sstevel@tonic-gate 	unsigned int	be_next;
507c478bd9Sstevel@tonic-gate } binding_entry;
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate typedef struct {
537c478bd9Sstevel@tonic-gate 	unsigned int	bb_head;	/* first entry in bucket */
547c478bd9Sstevel@tonic-gate 	unsigned int	bb_pad;		/* maintain alignment for 32/64bit */
557c478bd9Sstevel@tonic-gate 	lwp_mutex_t	bb_lock;	/* bucket chain lock */
567c478bd9Sstevel@tonic-gate } binding_bucket;
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate typedef struct {
597c478bd9Sstevel@tonic-gate 	unsigned int	bh_vers;
607c478bd9Sstevel@tonic-gate 	unsigned int	bh_size;
617c478bd9Sstevel@tonic-gate 	lwp_mutex_t	bh_lock;
627c478bd9Sstevel@tonic-gate 	unsigned int	bh_end;
637c478bd9Sstevel@tonic-gate 	unsigned int	bh_bktcnt;
647c478bd9Sstevel@tonic-gate 	unsigned int	bh_strcur;		/* current strbuff ptr */
657c478bd9Sstevel@tonic-gate 	unsigned int	bh_strend;		/* end of current strbuf */
667c478bd9Sstevel@tonic-gate 	lwp_mutex_t	bh_strlock;		/* mutex to protect strings */
677c478bd9Sstevel@tonic-gate 	binding_bucket	bh_bkts[DEFBKTS];
687c478bd9Sstevel@tonic-gate } bindhead;
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
717c478bd9Sstevel@tonic-gate }
727c478bd9Sstevel@tonic-gate #endif
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate #endif	/* _BINDINGS_H */
75