/************************************************************************ ** * ** Copyright © 1996 Digital Equipment Corporation. * ** All rights reserved. * ** * ** Redistribution and use in source and binary forms are permitted * ** provided that the above copyright notice and this paragraph are * ** duplicated in all such forms and that any documentation, * ** advertising materials, and other materials related to such * ** distribution and use acknowledge that the software was developed * ** by Digital Equipment Corporation. The name of the * ** Corporation may not be used to endorse or promote products derived * ** from this software without specific prior written permission. * ** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * ** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * ** WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * ** * ************************************************************************* **++ ** FACILITY: ** ** ppp_mgmt.h. ** ** ABSTRACT: ** ** This header file implements macros to do memory allocation ** on VMS. ** ** AUTHORS: ** ** Patrick Crilly, Networks Engineering (Australia). ** ** CREATION DATE: ** ** 14-February-1996 ** ** MODIFICATION HISTORY: ** ** 17-December-1996 Barry W. Kierstein ** Replaced the standard Digital copyright with ** one compatible with the CMU copyright. ** ** 24-July-1996 Barry W. Kierstein ** Corrected copyright notice. ** ** 14-February-1996 Original version. ** **-- */ #ifndef _PPP_MEM_VMS_H_ #define _PPP_MEM_VMS_H_ /* ** ** import definitions: ** SS$_xxx ** */ #ifndef __SSDEF_LOADED #include "ssdef.h" #endif /* ** ** import definitions: ** exe_std$xxx rotuines ** */ #ifndef __EXE_ROUTINES_LOADED #include "exe_routines.h" #endif /* ** ** import definitions: ** DYN$C_BUFIO ** */ #ifndef __DYNDEF_LOADED #include "dyndef.h" #endif /* ** Define a VMS type for PPP */ #define PPP_MEM_TYPE DYN$C_BUFIO #define PPP_MEM_SUBTYPE 0 typedef struct vms_mem_hdr { u_long flink; /* forward queue link */ u_long blink; /* backward queue link */ short size; /* block size */ u_char type; /* block type */ u_char subtype; /* block subtype */ u_long fill; /* force quadword alignement */ } vms_mem_hdr; #define MEM_HDR_SIZE sizeof(vms_mem_hdr) #define ALLOC_MEM(addr, bsize, cast ) \ { \ vms_mem_hdr *__hdr_p; \ signed __int32 __size; \ if ( exe_std$alononpaged((bsize)+ MEM_HDR_SIZE, &__size, (void **)&__hdr_p) == SS$_NORMAL ) \ { \ __hdr_p->size = __size; \ __hdr_p->type = PPP_MEM_TYPE; \ __hdr_p->subtype = PPP_MEM_SUBTYPE; \ (addr) = (cast) ((int)__hdr_p + MEM_HDR_SIZE); \ } \ else addr = NULL; \ } #define DEALLOC_MEM(addr) exe_std$deanonpaged((char *)addr - MEM_HDR_SIZE) #endif /* _PPP_MEM_VMS_H */