/* * @OSF_COPYRIGHT@ * COPYRIGHT NOTICE * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc. * ALL RIGHTS RESERVED (DCE). See the file named COPYRIGHT.DCE in the * src directory for the full copyright text. */ /* * HISTORY * $Log: cma_init.h,v $ * Revision 1.1.2.4 1993/02/01 22:18:20 hinman * [hinman@sni] - Final merge before bsubmit * [1993/01/31 17:26:32 hinman] * * [hinman] - Check in merged SNI version * [1993/01/11 16:20:21 hinman] * * Revision 9.5.1.3 92/12/17 13:41:32 raj * [raj] New naming + parallelized reentrant library changes. * * Revision 9.5.3.2 92/11/06 11:10:53 raj * [raj] Changes for new naming scheme with reentrant libraries. * * Revision 9.5.1.2 92/09/10 16:33:02 hinman * [hinman] - Fold forward from raj_om * * Revision 9.5.2.2 92/09/10 16:02:49 raj * [raj] merging SVR4 changes into 1.0.2 * * Revision 9.9 92/09/02 14:03:52 hinman * Update checkin * * Revision 1.1.2.2 1992/05/08 23:28:29 bolinger * BL10 CMA sources from DEC. * [1992/05/08 23:28:14 bolinger] * * $EndLog$ */ /* * %W% (DEC OSF/1) %G% */ /* * Copyright (c) 1989, 1992 by * Digital Equipment Corporation, Maynard Massachusetts. * All rights reserved. * * This software is furnished under a license and may be used and copied * only in accordance with the terms of such license and with the * inclusion of the above copyright notice. This software or any other * copies thereof may not be provided or otherwise made available to any * other person. No title to and ownership of the software is hereby * transferred. * * The information in this software is subject to change without notice * and should not be construed as a commitment by DIGITAL Equipment * Corporation. * * DIGITAL assumes no responsibility for the use or reliability of its * software on equipment which is not supplied by DIGITAL. */ /* * FACILITY: * * CMA services * * ABSTRACT: * * Header file for CMA initialization * * AUTHORS: * * Dave Butenhof * * CREATION DATE: * * 11 September 1989 * * MODIFICATION HISTORY: * * 001 Dave butenhof 1 June 1990 * Add structure and global for environment definition code. * 002 Dave Butenhof 28 August 1990 * Change cma_shr_init to cma__shr_init, since it's really an * internal interface (even though it's called from the client * image and must be in the transfer vector, no client should * call it directly). * 003 Dave Butenhof 22 January 1991 * Merge cma_init back into this module (should have been done a * while ago when we removed the requirement that client link * against cma_client.obj). * 004 Dave Butenhof 29 March 1991 * Change environment initialization stuff * 005 Paul Curtin 7 May 1991 * Created cma__int_init macro. * 006 Dave Butenhof 19 September 1991 * Integrate HPUX CMA5 reverse drop: HP has apparently * integrated DECthreads initialization into crt0.o, and * therefore makes the optimization of defining cma__int_init() * to expand to a null string. * 007 Dave Butenhof 14 November 1991 * Improve performance of cma__int_init() by doing an * uninterlocked test first; then repeat with interlock if it * doesn't appear to have been set to gain cache coherency. * 008 Dave Butenhof 22 November 1991 * Remove include of cma_kernel.h, which isn't needed: all it * needs is cma_host.h (which should also avoid a circularity * that seems to be confusing c89). Also, include cma_errors.h * to pick up cma__error(). * 009 Dave Butenhof 17 April 1992 * Define the extern version string. */ #ifndef CMA_INIT #define CMA_INIT /* * INCLUDE FILES */ #include #include /* * CONSTANTS AND MACROS */ #define cma__c_env_maxattr 0 #define cma__c_env_minattr 1 #define cma__c_env_maxcond 2 #define cma__c_env_mincond 3 #define cma__c_env_maxmutex 4 #define cma__c_env_minmutex 5 #define cma__c_env_maxthread 6 #define cma__c_env_minthread 7 #define cma__c_env_maxcluster 8 #define cma__c_env_mincluster 9 #define cma__c_env_maxvp 10 #define cma__c_env_multiplex 11 #define cma__c_env_trace 12 #define cma__c_env_trace_file 13 #define cma__c_env_count 13 /* * cma__int_init * * Initialize the main body of CMA exactly once. * * We raise an exception if, for some odd reason, there are already threads * in the environment (e.g. kernel threads), and one of them is trying to * initialize CMA before the first thread got all the way through the actual * initialization. This code maintains the invariants: "after successfully * calling CMA_INIT, you can call any CMA function", and "CMA is actually * initialized at most once". */ /*#ifndef _HP_LIBC_R */ #if defined _HP_LIBC_R ||(defined(SNI_SVR4) && !defined(CMA_INIT_NEEDED)) # define cma__int_init() #else # define cma__int_init() { \ if (!cma__tac_isset(&cma__g_init_started)) { \ if (!cma__test_and_set (&cma__g_init_started)) { \ cma__init_static (); \ cma__test_and_set (&cma__g_init_done); \ } \ else if (!cma__tac_isset (&cma__g_init_done)) { \ cma__error (cma_s_inialrpro); \ }}} #endif /* * TYPEDEFS */ typedef enum CMA__T_ENV_TYPE { cma__c_env_type_int, cma__c_env_type_file } cma__t_env_type; typedef struct CMA__T_ENV { char *name; /* Name of environment variable */ cma__t_env_type type; /* Type of variable */ cma_t_integer value; /* Numeric value of the variable */ } cma__t_env; /* * GLOBAL DATA */ extern cma__t_env cma__g_env[cma__c_env_count]; extern cma__t_atomic_bit cma__g_init_started; extern cma__t_atomic_bit cma__g_init_done; extern char *cma__g_version; /* * INTERNAL INTERFACES */ extern void cma__init_static _CMA_PROTOTYPE_ ((void)); /* Initialize static data */ #endif /* DEC/CMS REPLACEMENT HISTORY, Element CMA_INIT.H */ /* *12 17-APR-1992 11:11:33 BUTENHOF "Add version number string" */ /* *11 22-NOV-1991 11:56:19 BUTENHOF "Don't include cma_kernel.h" */ /* *10 18-NOV-1991 11:23:51 BUTENHOF "Add non-interlocked test to cma__int_init()" */ /* *9 24-SEP-1991 16:27:26 BUTENHOF "Merge CMA5 reverse IBM/HP/Apollo drops" */ /* *8 10-JUN-1991 19:53:36 SCALES "Convert to stream format for ULTRIX build" */ /* *7 10-JUN-1991 19:20:56 BUTENHOF "Fix the sccs headers" */ /* *6 10-JUN-1991 18:22:05 SCALES "Add sccs headers for Ultrix" */ /* *5 7-MAY-1991 10:10:52 CURTIN "created cma__int_init macro" */ /* *4 12-APR-1991 23:35:56 BUTENHOF "Change type of internal locks" */ /* *3 1-APR-1991 18:09:00 BUTENHOF "Change environment setup" */ /* *2 24-JAN-1991 00:34:59 BUTENHOF "Get rid of cma_client module" */ /* *1 12-DEC-1990 21:46:25 BUTENHOF "CMA initializer" */ /* DEC/CMS REPLACEMENT HISTORY, Element CMA_INIT.H */ #ifdef ADA_PTHREAD #include #endif