1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 1999-2003 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _LIBC_INT_H
28*0Sstevel@tonic-gate #define	_LIBC_INT_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate /*
37*0Sstevel@tonic-gate  * Libc/rtld Runtime Interface
38*0Sstevel@tonic-gate  */
39*0Sstevel@tonic-gate #define	CI_NULL		0		/* (void) last entry */
40*0Sstevel@tonic-gate #define	CI_VERSION	1		/* current version of ri_interface */
41*0Sstevel@tonic-gate #define	CI_ATEXIT	2		/* _preexec_exit_handlers() address */
42*0Sstevel@tonic-gate #define	CI_LCMESSAGES	3		/* message locale */
43*0Sstevel@tonic-gate #define	CI_BIND_GUARD	4		/* bind_guard() address */
44*0Sstevel@tonic-gate #define	CI_BIND_CLEAR	5		/* bind_clear() address */
45*0Sstevel@tonic-gate #define	CI_THR_SELF	6		/* thr_self() address */
46*0Sstevel@tonic-gate #define	CI_TLS_MODADD	7		/* __tls_mod_add() address */
47*0Sstevel@tonic-gate #define	CI_TLS_MODREM	8		/* __tls_mod_remove() address */
48*0Sstevel@tonic-gate #define	CI_TLS_STATMOD	9		/* __tls_static_mods() address */
49*0Sstevel@tonic-gate #define	CI_THRINIT	10		/* libc thread initialization */
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate #define	CI_MAX		11
52*0Sstevel@tonic-gate 
53*0Sstevel@tonic-gate #define	CI_V_NONE	0		/* ci_version versions */
54*0Sstevel@tonic-gate #define	CI_V_ONE	1		/* original version */
55*0Sstevel@tonic-gate #define	CI_V_TWO	2
56*0Sstevel@tonic-gate #define	CI_V_THREE	3
57*0Sstevel@tonic-gate #define	CI_V_FOUR	4
58*0Sstevel@tonic-gate #define	CI_V_CURRENT	CI_V_FOUR	/* current version of libc interface */
59*0Sstevel@tonic-gate #define	CI_V_NUM	5		/* number of CI_V_* numbers */
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate /*
62*0Sstevel@tonic-gate  * Libc to ld.so.1 interface communication structure.
63*0Sstevel@tonic-gate  */
64*0Sstevel@tonic-gate typedef struct {
65*0Sstevel@tonic-gate 	int	ci_tag;
66*0Sstevel@tonic-gate 	union {
67*0Sstevel@tonic-gate 		int	(*ci_func)();
68*0Sstevel@tonic-gate 		long	ci_val;
69*0Sstevel@tonic-gate 		char	*ci_ptr;
70*0Sstevel@tonic-gate 	} ci_un;
71*0Sstevel@tonic-gate } Lc_interface;
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate /*
74*0Sstevel@tonic-gate  * Address range returned via CI_ATEXIT.  Note, the address range array passed
75*0Sstevel@tonic-gate  * back from ld.so.1 is maintained by ld.so.1 and should not be freed by libc.
76*0Sstevel@tonic-gate  */
77*0Sstevel@tonic-gate typedef struct {
78*0Sstevel@tonic-gate 	void *	lb;			/* lower bound */
79*0Sstevel@tonic-gate 	void *	ub;			/* upper bound */
80*0Sstevel@tonic-gate } Lc_addr_range_t;
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate /*
83*0Sstevel@tonic-gate  * Thread-Local storage data type and interfaces shared between
84*0Sstevel@tonic-gate  * libc & ld.so.1.
85*0Sstevel@tonic-gate  */
86*0Sstevel@tonic-gate 
87*0Sstevel@tonic-gate typedef struct {
88*0Sstevel@tonic-gate 	unsigned long	ti_moduleid;	/* module ID for TLS var */
89*0Sstevel@tonic-gate 	unsigned long	ti_tlsoffset;	/* offset into tls block for TLS var */
90*0Sstevel@tonic-gate } TLS_index;
91*0Sstevel@tonic-gate 
92*0Sstevel@tonic-gate 
93*0Sstevel@tonic-gate typedef struct {
94*0Sstevel@tonic-gate 	const char	*tm_modname;		/* name of object */
95*0Sstevel@tonic-gate 						/*	containing TLS */
96*0Sstevel@tonic-gate 	unsigned long	tm_modid;		/* TLS module id */
97*0Sstevel@tonic-gate 	void *		tm_tlsblock;		/* pointer to r/o init image */
98*0Sstevel@tonic-gate 	unsigned long	tm_filesz;		/* initialized file size */
99*0Sstevel@tonic-gate 	unsigned long	tm_memsz;		/* memory size */
100*0Sstevel@tonic-gate 	long		tm_stattlsoffset;	/* signed offset into static */
101*0Sstevel@tonic-gate 						/*	TLS block */
102*0Sstevel@tonic-gate 	unsigned long	tm_flags;
103*0Sstevel@tonic-gate 	void *		tm_tlsinitarray;	/* TLS .init function array */
104*0Sstevel@tonic-gate 	unsigned long	tm_tlsinitarraycnt;	/* # of entries in initarray */
105*0Sstevel@tonic-gate 	void *		tm_tlsfiniarray;	/* TLS .fini function array */
106*0Sstevel@tonic-gate 	unsigned long	tm_tlsfiniarraycnt;	/* # of entries in finiarray */
107*0Sstevel@tonic-gate 	unsigned long	tm_pad[5];		/* future expansion */
108*0Sstevel@tonic-gate } TLS_modinfo;
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate #ifdef _SYSCALL32
111*0Sstevel@tonic-gate typedef struct {
112*0Sstevel@tonic-gate 	caddr32_t	tm_modname;		/* name of object */
113*0Sstevel@tonic-gate 						/*	containing TLS */
114*0Sstevel@tonic-gate 	uint32_t	tm_modid;		/* TLS module id */
115*0Sstevel@tonic-gate 	caddr32_t	tm_tlsblock;		/* pointer to r/o init image */
116*0Sstevel@tonic-gate 	uint32_t	tm_filesz;		/* initialized file size */
117*0Sstevel@tonic-gate 	uint32_t	tm_memsz;		/* memory size */
118*0Sstevel@tonic-gate 	int32_t		tm_stattlsoffset;	/* signed offset into static */
119*0Sstevel@tonic-gate 						/*	TLS block */
120*0Sstevel@tonic-gate 	uint32_t	tm_flags;
121*0Sstevel@tonic-gate 	caddr32_t	tm_tlsinitarray;	/* TLS .init function array */
122*0Sstevel@tonic-gate 	uint32_t	tm_tlsinitarraycnt;	/* # of entries in initarray */
123*0Sstevel@tonic-gate 	caddr32_t	tm_tlsfiniarray;	/* TLS .fini function array */
124*0Sstevel@tonic-gate 	uint32_t	tm_tlsfiniarraycnt;	/* # of entries in finiarray */
125*0Sstevel@tonic-gate 	uint32_t	tm_pad[5];		/* future expansion */
126*0Sstevel@tonic-gate } TLS_modinfo32;
127*0Sstevel@tonic-gate #endif
128*0Sstevel@tonic-gate 
129*0Sstevel@tonic-gate 
130*0Sstevel@tonic-gate /*
131*0Sstevel@tonic-gate  * Flag values for TLS_modifo.tm_flags
132*0Sstevel@tonic-gate  */
133*0Sstevel@tonic-gate #define	TM_FLG_STATICTLS	0x0001		/* Static TLS module */
134*0Sstevel@tonic-gate 
135*0Sstevel@tonic-gate 
136*0Sstevel@tonic-gate #ifdef	__cplusplus
137*0Sstevel@tonic-gate }
138*0Sstevel@tonic-gate #endif
139*0Sstevel@tonic-gate 
140*0Sstevel@tonic-gate #endif /* _LIBC_INT_H */
141