/* * @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: cmalib_crtlx.h,v $ * Revision 1.1.10.2 1993/05/24 20:50:34 cjd * Submitting 102-dme port to 103i * [1993/05/24 20:18:03 cjd] * * Revision 1.1.8.2 1993/05/11 22:02:35 jd * Initial 486 port. * [1993/05/11 21:44:42 jd] * * Revision 1.1.6.2 1992/12/15 22:33:11 alan * Insert copyright notices * [1992/12/07 19:44:35 alan] * * Revision 1.1.2.2 1992/05/14 20:50:19 keane * Address defect 3483. Reconfigure configuration symbols so DEC platforms * can compile either with _STDC_ or without. * [1992/05/14 17:37:37 keane] * * Revision 1.1 1992/01/19 14:41:23 devrcs * Initial revision * * $EndLog$ */ /* */ /* * Copyright (c) 1990, 1991 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: * * CMALIB services * * ABSTRACT: * * Header file for C run-time library wrapper routines * * AUTHORS: * * Webb Scales * * CREATION DATE: * * 29 March 1990 * * MODIFICATION HISTORY: * * 001 Dave Butenhof 30 March 1990 * Use "int" instead of "sigset_t" type. * 002 Webb Scales 12 April 1990 * Return to sigset_t, and supply a typedef for it on VMS. * 003 Webb Scales 27 April 1990 * And correct the routine prototype for sigwait to use sigset_t. * 004 Dave Butenhof 18 May 1990 * move sigwait to new cma_px.h (POSIX emulation). * 005 Dave Butenhof 29 June 1990 * Add typecasts to the VM macros to correct for not having * mutable types ("void *"). * 006 Paul Curtin 17 September 1990 * Added module to CMALIB, from CMA. * 007 Webb Scales 17 September 1990 * Corrected macro values, moved errno macro to CMA.H * 008 Dave Butenhof 11 October 1990 * Remove redundant cma_errno prototype. * 009 Paul Curtin 24 January 1991 * Removed arguments from wrapper macros, changed the * return values on protos, and removed arguments from protos. * Return values now match `man' pages. * 010 Paul Curtin 28 January 1991 * Conditionalized wrapper macros on _CMA_NOWRAPPERS_ * 011 Paul Curtin 06 February 1991 * More reworking of return types. * 012 Dave Butenhof 19 February 1991 * Fix prototypes to work with C++ (hopefully without breaking * anyone else). * 013 Paul Curtin 06 June 1991 * Removed wrapper protos. * 014 Dave Butenhof 19 September 1991 * Integrate HPUX CMA5 reverse drop: remove wrappers if * _POSIX_REENTRANT_FUNCTIONS is defined. * 015 Dave Butenhof 19 November 1991 * Remove direct check for _POSIX_REENTRANT_FUNCTIONS; rely on * _CMA_REENTRANT_CLIB_, since we control that. OSF/1 defines * _POSIX_REENTRANT_FUNCTIONS, but OSF DCE reference port isn't * using libc_r.a. */ #ifndef CMA_CRTLX #define CMA_CRTLX /* * INCLUDE FILES */ #include #include /* * Determine the proper types used by stdlib.h for memory management * functions */ #if _CMA_PLATFORM_ == _CMA__IBMR2_UNIX # define STDLIB_MEM_PTR_T void # define STDLIB_MEM_SIZE_T size_t #endif #if _CMA_PLATFORM_ == _CMA__MIPS_UNIX # if _CMA_OSIMPL_ == _CMA__OS_OSF # define STDLIB_MEM_PTR_T void # define STDLIB_MEM_SIZE_T size_t # else # define STDLIB_MEM_PTR_T char # define STDLIB_MEM_SIZE_T unsigned # endif #endif #if _CMA_PLATFORM_ == _CMA__I386_UNIX # define STDLIB_MEM_PTR_T void # define STDLIB_MEM_SIZE_T size_t #endif /* * PUT YOUR PLATFORM HERE * # if _CMA_PLATFORM == _???_ # define STDLIB_MEM_PTR_T ??? # define STDLIB_MEM_SIZE_T ??? # endif */ #if defined(__STDC__) && !defined(STDLIB_MEM_PTR_T) # define STDLIB_MEM_PTR_T void # define STDLIB_MEM_SIZE_T size_t #endif /* * CONSTANTS AND MACROS */ /* * Memory Allocation Routine Wrappers */ #if !_CMA_REENTRANT_CLIB_ #if defined(CMA_CRTLX_IMPLEMENTATION) || !defined(_CMA_NOWRAPPERS_) /* * TYPEDEFS */ /* * GLOBAL DATA */ /* * INTERFACES */ /* Each prototype declared in this file is defined as a macro. The macro is expanded twice: Once to generate a duplicate prototype for the system function, ensuring that the prototypes match, and a second time to generate a prototype for the wrapper function, ensuring that its interface is identical to the interface of the system function. */ #define CALLOC_PROTOTYPE(cma_lib_calloc) \ extern STDLIB_MEM_PTR_T * \ cma_lib_calloc _CMA_PROTOTYPE_ ((STDLIB_MEM_SIZE_T number, STDLIB_MEM_SIZE_T size)) CALLOC_PROTOTYPE(calloc); CALLOC_PROTOTYPE(cma_lib_calloc); #define CFREE_PROTOTYPE(cma_lib_cfree) \ extern void \ cma_lib_cfree _CMA_PROTOTYPE_ ((STDLIB_MEM_PTR_T *vm)) CFREE_PROTOTYPE(cfree); CFREE_PROTOTYPE(cma_lib_cfree); #define FREE_PROTOTYPE(cma_lib_free) \ extern void \ cma_lib_free _CMA_PROTOTYPE_ ((STDLIB_MEM_PTR_T *vm)) FREE_PROTOTYPE(free); FREE_PROTOTYPE(cma_lib_free); #define MALLOC_PROTOTYPE(cma_lib_malloc) \ extern STDLIB_MEM_PTR_T * \ cma_lib_malloc _CMA_PROTOTYPE_ ((STDLIB_MEM_SIZE_T size)) MALLOC_PROTOTYPE(malloc); MALLOC_PROTOTYPE(cma_lib_malloc); #define REALLOC_PROTOTYPE(cma_lib_realloc) \ extern STDLIB_MEM_PTR_T * \ cma_lib_realloc _CMA_PROTOTYPE_((STDLIB_MEM_PTR_T *ptr, STDLIB_MEM_SIZE_T size)) REALLOC_PROTOTYPE(realloc); REALLOC_PROTOTYPE(cma_lib_realloc); #ifndef CMA_CRTLX_IMPLEMENTATION /* Redefine the system functions names, so that the wrapper functions will be called instead of the system functions. */ # define calloc cma_lib_calloc # define cfree cma_lib_cfree # define free cma_lib_free # define malloc cma_lib_malloc # define realloc cma_lib_realloc #endif /* CMA_CRTLX_IMPLEMENTATION */ #endif /* CMA_CRTLX_IMPLEMENTATION || !_CMA_NOWRAPPERS_ */ #endif /* !_CMA_REENTRANT_CLIB_ */ #endif /* CMA_CRTLX */ /* DEC/CMS REPLACEMENT HISTORY, Element CMALIB_CRTLX.H */ /* *12 19-NOV-1991 12:17:44 BUTENHOF "Remove tests for _POSIX_REENTRANT_FUNCTIONS" */ /* *11 14-OCT-1991 13:37:21 BUTENHOF "Use new config symbols" */ /* *10 24-SEP-1991 16:26:09 BUTENHOF "Merge CMA5 reverse IBM/HP/Apollo drops" */ /* *9 11-JUN-1991 10:36:38 BUTENHOF "Convert to stream format for ULTRIX build" */ /* *8 10-JUN-1991 19:19:51 BUTENHOF "Fix the sccs headers" */ /* *7 10-JUN-1991 18:16:20 SCALES "Add sccs headers for Ultrix" */ /* *6 6-JUN-1991 14:08:40 CURTIN "removed wrapper protos" */ /* *5 20-FEB-1991 16:07:07 CURTIN "" */ /* *4 19-FEB-1991 17:23:02 BUTENHOF "Integrate new C++ fixes" */ /* *3 6-FEB-1991 19:17:10 CURTIN "adjusting routine return types" */ /* *2 28-JAN-1991 11:18:01 CURTIN "Keeping up with the LIBRARY cms" */ /* *1 15-JAN-1991 22:03:44 BUTENHOF "HACK: interlocked malloc/free until CMALIB" */ /* DEC/CMS REPLACEMENT HISTORY, Element CMALIB_CRTLX.H */