10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 56515Sraf * Common Development and Distribution License (the "License"). 66515Sraf * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 216515Sraf 220Sstevel@tonic-gate /* 23*9569SRod.Evans@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _LIBC_INT_H 280Sstevel@tonic-gate #define _LIBC_INT_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifdef __cplusplus 310Sstevel@tonic-gate extern "C" { 320Sstevel@tonic-gate #endif 330Sstevel@tonic-gate 340Sstevel@tonic-gate /* 350Sstevel@tonic-gate * Libc/rtld Runtime Interface 360Sstevel@tonic-gate */ 370Sstevel@tonic-gate #define CI_NULL 0 /* (void) last entry */ 380Sstevel@tonic-gate #define CI_VERSION 1 /* current version of ri_interface */ 390Sstevel@tonic-gate #define CI_ATEXIT 2 /* _preexec_exit_handlers() address */ 400Sstevel@tonic-gate #define CI_LCMESSAGES 3 /* message locale */ 410Sstevel@tonic-gate #define CI_BIND_GUARD 4 /* bind_guard() address */ 420Sstevel@tonic-gate #define CI_BIND_CLEAR 5 /* bind_clear() address */ 430Sstevel@tonic-gate #define CI_THR_SELF 6 /* thr_self() address */ 440Sstevel@tonic-gate #define CI_TLS_MODADD 7 /* __tls_mod_add() address */ 450Sstevel@tonic-gate #define CI_TLS_MODREM 8 /* __tls_mod_remove() address */ 460Sstevel@tonic-gate #define CI_TLS_STATMOD 9 /* __tls_static_mods() address */ 470Sstevel@tonic-gate #define CI_THRINIT 10 /* libc thread initialization */ 48*9569SRod.Evans@Sun.COM #define CI_CRITICAL 11 /* critical level query interface */ 490Sstevel@tonic-gate 50*9569SRod.Evans@Sun.COM #define CI_MAX 12 510Sstevel@tonic-gate 520Sstevel@tonic-gate #define CI_V_NONE 0 /* ci_version versions */ 530Sstevel@tonic-gate #define CI_V_ONE 1 /* original version */ 540Sstevel@tonic-gate #define CI_V_TWO 2 550Sstevel@tonic-gate #define CI_V_THREE 3 560Sstevel@tonic-gate #define CI_V_FOUR 4 576515Sraf #define CI_V_FIVE 5 58*9569SRod.Evans@Sun.COM #define CI_V_SIX 6 59*9569SRod.Evans@Sun.COM #define CI_V_CURRENT CI_V_SIX /* current version of libc interface */ 60*9569SRod.Evans@Sun.COM #define CI_V_NUM 7 /* number of CI_V_* numbers */ 616515Sraf 626515Sraf /* 636515Sraf * Flags for the bindguard routines. 646515Sraf * THR_FLG_RTLD used to live in usr/src/cmd/sgs/rtld/common/_rtld.h 656515Sraf * THR_FLG_NOLOCK and THR_FLG_REENTER are new in version CI_V_FIVE. 666515Sraf */ 676515Sraf #define THR_FLG_RTLD 0x00000001 /* bind_guard() flag */ 686515Sraf #define THR_FLG_NOLOCK 0x00000002 /* don't use ld.so.1's lock */ 696515Sraf #define THR_FLG_REENTER 0x00000004 /* temporary leave / reenter */ 700Sstevel@tonic-gate 710Sstevel@tonic-gate /* 720Sstevel@tonic-gate * Libc to ld.so.1 interface communication structure. 730Sstevel@tonic-gate */ 740Sstevel@tonic-gate typedef struct { 750Sstevel@tonic-gate int ci_tag; 760Sstevel@tonic-gate union { 770Sstevel@tonic-gate int (*ci_func)(); 780Sstevel@tonic-gate long ci_val; 790Sstevel@tonic-gate char *ci_ptr; 800Sstevel@tonic-gate } ci_un; 810Sstevel@tonic-gate } Lc_interface; 820Sstevel@tonic-gate 830Sstevel@tonic-gate /* 840Sstevel@tonic-gate * Address range returned via CI_ATEXIT. Note, the address range array passed 850Sstevel@tonic-gate * back from ld.so.1 is maintained by ld.so.1 and should not be freed by libc. 860Sstevel@tonic-gate */ 870Sstevel@tonic-gate typedef struct { 880Sstevel@tonic-gate void * lb; /* lower bound */ 890Sstevel@tonic-gate void * ub; /* upper bound */ 900Sstevel@tonic-gate } Lc_addr_range_t; 910Sstevel@tonic-gate 920Sstevel@tonic-gate /* 930Sstevel@tonic-gate * Thread-Local storage data type and interfaces shared between 940Sstevel@tonic-gate * libc & ld.so.1. 950Sstevel@tonic-gate */ 960Sstevel@tonic-gate 970Sstevel@tonic-gate typedef struct { 980Sstevel@tonic-gate unsigned long ti_moduleid; /* module ID for TLS var */ 990Sstevel@tonic-gate unsigned long ti_tlsoffset; /* offset into tls block for TLS var */ 1000Sstevel@tonic-gate } TLS_index; 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate typedef struct { 1040Sstevel@tonic-gate const char *tm_modname; /* name of object */ 1050Sstevel@tonic-gate /* containing TLS */ 1060Sstevel@tonic-gate unsigned long tm_modid; /* TLS module id */ 1070Sstevel@tonic-gate void * tm_tlsblock; /* pointer to r/o init image */ 1080Sstevel@tonic-gate unsigned long tm_filesz; /* initialized file size */ 1090Sstevel@tonic-gate unsigned long tm_memsz; /* memory size */ 1100Sstevel@tonic-gate long tm_stattlsoffset; /* signed offset into static */ 1110Sstevel@tonic-gate /* TLS block */ 1120Sstevel@tonic-gate unsigned long tm_flags; 1130Sstevel@tonic-gate void * tm_tlsinitarray; /* TLS .init function array */ 1140Sstevel@tonic-gate unsigned long tm_tlsinitarraycnt; /* # of entries in initarray */ 1150Sstevel@tonic-gate void * tm_tlsfiniarray; /* TLS .fini function array */ 1160Sstevel@tonic-gate unsigned long tm_tlsfiniarraycnt; /* # of entries in finiarray */ 1170Sstevel@tonic-gate unsigned long tm_pad[5]; /* future expansion */ 1180Sstevel@tonic-gate } TLS_modinfo; 1190Sstevel@tonic-gate 1200Sstevel@tonic-gate #ifdef _SYSCALL32 1210Sstevel@tonic-gate typedef struct { 1220Sstevel@tonic-gate caddr32_t tm_modname; /* name of object */ 1230Sstevel@tonic-gate /* containing TLS */ 1240Sstevel@tonic-gate uint32_t tm_modid; /* TLS module id */ 1250Sstevel@tonic-gate caddr32_t tm_tlsblock; /* pointer to r/o init image */ 1260Sstevel@tonic-gate uint32_t tm_filesz; /* initialized file size */ 1270Sstevel@tonic-gate uint32_t tm_memsz; /* memory size */ 1280Sstevel@tonic-gate int32_t tm_stattlsoffset; /* signed offset into static */ 1290Sstevel@tonic-gate /* TLS block */ 1300Sstevel@tonic-gate uint32_t tm_flags; 1310Sstevel@tonic-gate caddr32_t tm_tlsinitarray; /* TLS .init function array */ 1320Sstevel@tonic-gate uint32_t tm_tlsinitarraycnt; /* # of entries in initarray */ 1330Sstevel@tonic-gate caddr32_t tm_tlsfiniarray; /* TLS .fini function array */ 1340Sstevel@tonic-gate uint32_t tm_tlsfiniarraycnt; /* # of entries in finiarray */ 1350Sstevel@tonic-gate uint32_t tm_pad[5]; /* future expansion */ 1360Sstevel@tonic-gate } TLS_modinfo32; 1370Sstevel@tonic-gate #endif 1380Sstevel@tonic-gate 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate /* 1410Sstevel@tonic-gate * Flag values for TLS_modifo.tm_flags 1420Sstevel@tonic-gate */ 1430Sstevel@tonic-gate #define TM_FLG_STATICTLS 0x0001 /* Static TLS module */ 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate 1460Sstevel@tonic-gate #ifdef __cplusplus 1470Sstevel@tonic-gate } 1480Sstevel@tonic-gate #endif 1490Sstevel@tonic-gate 1500Sstevel@tonic-gate #endif /* _LIBC_INT_H */ 151