1/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Apple Computer, Inc.
2
3This file is part of KeyMgr.
4
5KeyMgr is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free
7Software Foundation; either version 2, or (at your option) any later
8version.
9
10In addition to the permissions in the GNU General Public License,
11Apple Computer gives you unlimited permission to link the compiled
12version of this file into combinations with other programs, and to
13distribute those combinations without any restriction coming from the
14use of this file.  (The General Public License restrictions do apply
15in other respects; for example, they cover modification of the file,
16and distribution when not linked into a combine executable.)
17
18KeyMgr is distributed in the hope that it will be useful, but WITHOUT ANY
19WARRANTY; without even the implied warranty of MERCHANTABILITY or
20FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21for more details.
22
23You should have received a copy of the GNU General Public License
24along with KeyMgr; see the file COPYING.  If not, write to the Free
25Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2602111-1307, USA.  */
27
28#ifndef __KEYMGR_H
29#define __KEYMGR_H
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35
36
37/*
38 * keymgr - Create and maintain process-wide global data known to
39 *	    all threads across all dynamic libraries.
40 *
41 */
42
43enum {
44  NM_ALLOW_RECURSION = 1,
45  NM_RECURSION_ILLEGAL = 2
46};
47
48extern void * _keymgr_get_per_thread_data (unsigned int key);
49extern int _keymgr_set_per_thread_data (unsigned int key, void *keydata);
50extern void *_keymgr_get_and_lock_processwide_ptr (unsigned int key);
51extern int _keymgr_get_and_lock_processwide_ptr_2 (unsigned int key, void **);
52extern int _keymgr_set_and_unlock_processwide_ptr (unsigned int key,
53						   void *ptr);
54extern int _keymgr_unlock_processwide_ptr (unsigned int key);
55extern int _keymgr_set_lockmode_processwide_ptr (unsigned int key,
56						 unsigned int mode);
57extern unsigned int _keymgr_get_lockmode_processwide_ptr (unsigned int key);
58extern int _keymgr_get_lock_count_processwide_ptr (unsigned int key);
59
60/*
61 * Keys currently in use:
62 */
63
64/* Head pointer of exception context node.  */
65#define KEYMGR_EH_CONTEXT_KEY		1
66
67/* New handler.  */
68#define KEYMGR_NEW_HANDLER_KEY		2
69
70/* Unexpected exception handler.  */
71#define KEYMGR_UNEXPECTED_HANDLER_KEY	3
72
73/* Terminate handler.  */
74#define KEYMGR_TERMINATE_HANDLER_KEY	4
75
76/* Runtime mode bits.  */
77#define KEYMGR_MODE_BITS		5
78
79/* Head pointer of the list of open streams.  */
80#define KEYMGR_IO_LIST			6
81
82/* libstdc++ for GCC 2.95 stdin.  */
83#define KEYMGR_IO_STDIN			7
84
85/* libstdc++ for GCC 2.95 stdout.  */
86#define KEYMGR_IO_STDOUT		8
87
88/* libstdc++ for GCC 2.95 stdout.  */
89#define KEYMGR_IO_STDERR		9
90
91/* Number of plugins/main program currently using streams in GCC 2.95.  */
92#define KEYMGR_IO_REFCNT		10
93
94/* Flags controlling the behavior of C++ I/O.  */
95#define KEYMGR_IO_MODE_BITS		11
96
97/* Head pointer for list of per image dwarf2 unwind sections.  */
98#define KEYMGR_ZOE_IMAGE_LIST		12
99
100/* C++ runtime EH global data.  */
101#define KEYMGR_EH_GLOBALS_KEY		13
102
103/* atexit() and __cxa_atexit routine list.  */
104#define KEYMGR_ATEXIT_LIST		14
105
106/* KeyMgr 3.x is the first one supporting GCC3 stuff natively.  */
107#define KEYMGR_API_MAJOR_GCC3		3
108/* ... with these keys.  */
109#define KEYMGR_GCC3_LIVE_IMAGE_LIST	301	/* loaded images  */
110#define KEYMGR_GCC3_DW2_OBJ_LIST	302	/* Dwarf2 object list  */
111
112/*
113 * Other important data.
114 */
115
116/* Major revision number of the keymgr API.  */
117#define KEYMGR_API_REV_MAJOR		5
118/* Minor revision number of the keymgr API.  */
119#define KEYMGR_API_REV_MINOR		0
120
121#ifdef __cplusplus
122}
123#endif
124
125#endif /* __KEYMGR_H */
126