1/*
2 * Copyright (c) 2010 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1.  Redistributions of source code must retain the above copyright
11 *     notice, this list of conditions and the following disclaimer.
12 * 2.  Redistributions in binary form must reproduce the above copyright
13 *     notice, this list of conditions and the following disclaimer in the
14 *     documentation and/or other materials provided with the distribution.
15 * 3.  Neither the name of Apple Inc. ("Apple") nor the names of its
16 *     contributors may be used to endorse or promote products derived from
17 *     this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
20 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * Portions of this software have been released under the following terms:
31 *
32 * (c) Copyright 1989-1993 OPEN SOFTWARE FOUNDATION, INC.
33 * (c) Copyright 1989-1993 HEWLETT-PACKARD COMPANY
34 * (c) Copyright 1989-1993 DIGITAL EQUIPMENT CORPORATION
35 *
36 * To anyone who acknowledges that this file is provided "AS IS"
37 * without any express or implied warranty:
38 * permission to use, copy, modify, and distribute this file for any
39 * purpose is hereby granted without fee, provided that the above
40 * copyright notices and this notice appears in all source code copies,
41 * and that none of the names of Open Software Foundation, Inc., Hewlett-
42 * Packard Company or Digital Equipment Corporation be used
43 * in advertising or publicity pertaining to distribution of the software
44 * without specific, written prior permission.  Neither Open Software
45 * Foundation, Inc., Hewlett-Packard Company nor Digital
46 * Equipment Corporation makes any representations about the suitability
47 * of this software for any purpose.
48 *
49 * Copyright (c) 2007, Novell, Inc. All rights reserved.
50 * Redistribution and use in source and binary forms, with or without
51 * modification, are permitted provided that the following conditions
52 * are met:
53 *
54 * 1.  Redistributions of source code must retain the above copyright
55 *     notice, this list of conditions and the following disclaimer.
56 * 2.  Redistributions in binary form must reproduce the above copyright
57 *     notice, this list of conditions and the following disclaimer in the
58 *     documentation and/or other materials provided with the distribution.
59 * 3.  Neither the name of Novell Inc. nor the names of its contributors
60 *     may be used to endorse or promote products derived from this
61 *     this software without specific prior written permission.
62 *
63 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
64 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
65 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
66 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY
67 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
68 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
69 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
70 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
71 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
72 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
73 *
74 * @APPLE_LICENSE_HEADER_END@
75 */
76
77/*
78**
79**  NAME:
80**
81**      rpcmem.h
82**
83**  FACILITY:
84**
85**      Remote Procedure Call (RPC)
86**
87**  ABSTRACT:
88**
89**  Various macros and data for runtime memory allocation.
90**
91**
92*/
93
94#ifndef _RPCMEM_H
95#define _RPCMEM_H	1
96
97/*
98 * Memory Allocation.
99 *
100 * The runtime dynamically allocates several classes of objects, each
101 * with differing sizes and lifetimes.  There are a few structures that
102 * are allocated in the "critical path" performance wise.  While the
103 * runtime will likely be caching some of these structures, the performance
104 * of the memory allocator should be of some concern.
105 *
106 * Note that some structures are allocated by the listener task.  In
107 * a kernel environment where the listener is implemented as a network
108 * software interrupt handler, the memory allocators must be capable
109 * of being called from an interrupt handler.  Additionally, the interface
110 * we use allows one to specify blocking or non-blocking allocations,
111 * non-blocking mode being required for interrupt level operations (which
112 * obviously must be prepared to deal with a "no memory available"
113 * indication).
114 *
115 * We want to maintain a flexible interface to cope with the variety
116 * of environments that this code may be ported to and to provide us
117 * with hooks for determining how memory is being used.  The interface
118 * we create and use is the same as that of OSF/1 NET_MALLOC (which is
119 * like BSD4.4 kernel malloc).  We can always make RPC_MEM_ALLOC()
120 * "smarter" and maintain a pool for various objects including a fast
121 * allocation / free scheme layered on top of malloc(), etc.
122 *
123 * If calling the allocator in a blocking mode (RPC_MEM_WAITOK), one
124 * should be prepaired that the process may yield the processor (i.e.
125 * make sure that you aren't violating the runtime's mutex lock rules).
126 */
127
128/*
129 * Types of RPC memory objects that we allocate.
130 */
131
132#define RPC_C_MEM_AVAIL             0
133#define RPC_C_MEM_DG_CHAND          1       /* rpc_dg_handle_client_t       */
134#define RPC_C_MEM_DG_SHAND          2       /* rpc_dg_handle_server_t       */
135#define RPC_C_MEM_DG_CCALL          3       /* rpc_dg_ccall_t               */
136#define RPC_C_MEM_DG_SCALL          4       /* rpc_dg_scall_t               */
137#define RPC_C_MEM_DG_PKT_POOL_ELT   5       /* rpc_dg_pkt_pool_t            */
138#define RPC_C_MEM_DG_UNUSED         6       /*                              */
139#define RPC_C_MEM_DG_RAWPKT         7       /* rpc_dg_raw_pkt_t             */
140#define RPC_C_MEM_DG_PKTBODY        8       /* rpc_dg_pkt_body_t            */
141#define RPC_C_MEM_DG_PKTLOG         9       /* from dg pktlog()             */
142#define RPC_C_MEM_DG_CCTE          10       /* rpc_dg_cct_elt_t             */
143#define RPC_C_MEM_DG_SCTE          11       /* rpc_dg_sct_elt_t             */
144#define RPC_C_MEM_IF_RGY_ENTRY     12       /* rpc_if_rgy_entry_t           */
145#define RPC_C_MEM_UTIL             13       /* from rpc_util_malloc()       */
146#define RPC_C_MEM_SOCK_INFO        14       /* rpc_sock_info_t              */
147#define RPC_C_MEM_IOVE_LIST        15       /* rpc_iove_list_elt_t          */
148#define RPC_C_MEM_DG_LOSSY         16       /* misc stuff for dglossy.c     */
149#define RPC_C_MEM_V1_PKTBODY       17
150                                   /* pkt buff rpc__pre_v2_iface_server_call */
151#define RPC_C_MEM_V1_STUB          18       /* rpc1_{alloc,free}_pkt()      */
152#define RPC_C_MEM_IF_TYPE_INFO     19       /* rpc_if_type_info_t           */
153#define RPC_C_MEM_LOOKASIDE_LIST   20       /* generic cn lookaside list elt */
154#define RPC_C_MEM_RPC_ADDR         21       /* rpc_addr + naf data          */
155#define RPC_C_MEM_DG_CLIENT_REP    22       /* rpc_dg_client_rep_t          */
156#define RPC_C_MEM_DG_MAINT         23       /* maintain liveness structure  */
157#define RPC_C_MEM_UUID             24       /* idl_uuid_t                       */
158#define RPC_C_MEM_NSENTRY          25       /* rpc_nsentry_t                */
159#define RPC_C_MEM_NSATTR           26       /* rpc_nsattr_t                 */
160#define RPC_C_MEM_NSUUID           27       /* rpc_nsuuid_t                 */
161#define RPC_C_MEM_TOWER_REF        28       /* rpc_tower_ref_t              */
162#define RPC_C_MEM_TOWER            29       /* twr_t                        */
163#define RPC_C_MEM_SYNTAX_ID        30       /* rpc_syntax_id_t              */
164#define RPC_C_MEM_BINDING_VEC      31       /* rpc_binding_vector_t         */
165#define RPC_C_MEM_CN_ASSOC_GRP_BLK 32
166                        /* rpc_assoc_group_t[rpc_c_assoc_grp_tbl_alloc_size] */
167#define RPC_C_MEM_CN_ASSOC         33       /* rpc_assoc_t                  */
168#define RPC_C_MEM_CN_CALL_REP      34       /* rpc_cn_call_rep_t            */
169#define RPC_C_MEM_CN_LG_FRAGBUF    35       /* lg_fragbuf_alloc_size        */
170#define RPC_C_MEM_CN_SM_FRAGBUF    36       /* sm_fragbuf_alloc_size        */
171#define RPC_C_MEM_CN_BINDING_REP   37       /* rpc_cn_binding_rep_t         */
172#define RPC_C_MEM_IMPORT           38       /* rpc_import_rep_t             */
173#define RPC_C_MEM_IF_REP           39       /* rpc_if_rep_t                 */
174#define RPC_C_MEM_LKUP_REP         40       /* rpc_lkup_rep_t               */
175#define RPC_C_MEM_LKUP_NODE        41       /* rpc_lkup_node_t              */
176#define RPC_C_MEM_LKUP_MBR         42       /* rpc_lkup_mbr_t               */
177#define RPC_C_MEM_INQ_REP          43       /* rpc_inq_rep_t                */
178#define RPC_C_MEM_NSPROFILE_ELT    44       /* rpc_nsprofile_elt_t          */
179#define RPC_C_MEM_NSPROFILE_OCTET_STR 45    /* rpc_profile_elt_octet_string_t */
180#define RPC_C_MEM_BINDING_VECTOR   46       /* rpc_binding_vector_t         */
181#define RPC_C_MEM_CN_SYNTAX        47       /* rpc_syntax_t                 */
182#define RPC_C_MEM_RPC_ADDR_VEC     48       /* rpc_addr + naf data          */
183#define RPC_C_MEM_IF_ID            49       /* rpc_if_id_t                  */
184#define RPC_C_MEM_IF_ID_VECTOR     50       /* rpc_if_id_vector_t           */
185#define RPC_C_MEM_PROTSEQ_VECTOR   51       /* rpc_protseq_vector_t         */
186#define RPC_C_MEM_STRING           52       /* various string types         */
187#define RPC_C_MEM_MGR_EPV          53       /* manager epv                  */
188#define RPC_C_MEM_EPT_ENTRY        54       /* endpoint mapper struct       */
189#define RPC_C_MEM_UUID_VECTOR      55       /* uuid_vector_t                */
190#define RPC_C_MEM_OBJ_RGY_ENTRY    56       /* rpc_obj_rgy_entry_t          */
191#define RPC_C_MEM_THREAD_CONTEXT   57       /* rpc_thread_context_t         */
192#define RPC_C_MEM_LISTENER_STATE   58       /* rpc_listener_state_t         */
193#define RPC_C_MEM_NSRESOLUTION     59       /* portion of resolved name     */
194#define RPC_C_MEM_NSRESIDUAL       60       /* portion of unresolved name   */
195#define RPC_C_MEM_DG_SELACK_MASK   61       /* selective ack mask array     */
196#define RPC_C_MEM_V1_HANDLE        62       /* pre-v2 binding handle        */
197#define RPC_C_MEM_TOWER_FLOOR      63       /* rpc_tower_floor_t            */
198#define RPC_C_MEM_TOWER_FLOOR_OCTET 64      /* rpc_tower_floor_t octet field */
199#define RPC_C_MEM_TOWER_FLOOR_ID   65       /* rpc_tower_floor_t prot id field */
200#define RPC_C_MEM_TOWER_PROT_IDS   66       /* rpc_tower_prot_ids_t         */
201#define RPC_C_MEM_TOWER_REF_VECTOR 67       /* rpc_tower_ref_vector_t       */
202#define RPC_C_MEM_SOCKADDR         68       /* sockaddr_p_t                 */
203#define RPC_C_MEM_SOCKET_LIST      69       /* rpc_socket_t[*]              */
204#define RPC_C_MEM_STATS_VECTOR     70       /* rpc_stats_vector             */
205#define RPC_C_MEM_TOWER_VECTOR     71       /* rpc_tower_vector_t           */
206#define RPC_C_MEM_DNA_TOWER        72       /* dna tower                    */
207#define RPC_C_MEM_CN_SEC_CONTEXT   73       /* rpc_cn_sec_context_t         */
208#define RPC_C_MEM_CTHREAD_POOL     74       /* cthread_pool_elt_t           */
209#define RPC_C_MEM_CTHREAD_CTBL     75       /* cthread_elt_t[]              */
210#define RPC_C_MEM_CTHREAD_QETBL    76       /* cthread_queue_elt_t[]        */
211#define RPC_C_MEM_DG_SOCK_POOL_ELT 77       /* DG socket pool element       */
212#define RPC_C_MEM_NOAUTH_INFO      78       /* rpc_noauth_info_t            */
213#define RPC_C_MEM_NOAUTH_CN_INFO   79       /* rpc_noauth_cn_info_t         */
214#define RPC_C_MEM_KRB_INFO         80       /* rpc_krb_info_t               */
215#define RPC_C_MEM_KRB_CN_INFO      81       /* rpc_krb_cn_info_t            */
216#define RPC_C_MEM_CN_ENCRYPT_BUF   82
217                                   /* buffer for encryption & checksumming */
218#define RPC_C_MEM_PORT_RESTRICT_LIST 83     /* rpc_port_restriction_list_t  */
219#define RPC_C_MEM_PORT_RANGE_ELEMENTS 84    /* rpc_port_range_element_t     */
220#define RPC_C_MEM_CN_PAC_BUF       85       /* buffer for big PACs          */
221#define RPC_C_MEM_FUNC             86       /* rpc_eval_func_t    */
222#define RPC_C_MEM_EVAL             87       /* rpc_binding_eval_t    */
223#define RPC_C_MEM_LIST             88       /* rpc_eval_list_t    */
224#define RPC_C_MEM_DG_EPAC          89       /* used for oversized PACs      */
225#define RPC_C_MEM_CDS_ATTR         90       /* attribute stored in CDS   */
226#define RPC_C_MEM_PROTOCOL_VERSION 91       /* rpc_protocol_version_t */
227#define RPC_C_MEM_NTLMSSPAUTH_INFO    92    /* rpc_ntlmsspauth_info_t       */
228#define RPC_C_MEM_NTLMSSPAUTH_CN_INFO 93    /* rpc_ntlmsspauth_cn_info_t    */
229#define RPC_C_MEM_GSSAUTH_INFO	94			/* rpc_gssauth_info_t */
230#define RPC_C_MEM_GSSAUTH_CN_INFO	95		/* rpc_gssauth_cn_info_t */
231#define RPC_C_MEM_NP_SEC_CONTEXT	96
232#define RPC_C_MEM_NS_INFO 96                /* name services info err...    */
233#define RPC_C_MEM_SCHNAUTH_INFO    98
234#define RPC_C_MEM_SCHNAUTH_CN_INFO 99
235#define RPC_C_MEM_NAMED_PIPE_INFO  100      /* rpc_np_auth_info_t */
236
237/* can only use up to "rpc_c_mem_maxtypes - 1" without upping it */
238#define RPC_C_MEM_MAX_TYPES        101       /* i.e. 0 : (max_types - 1)     */
239
240/*
241 * RPC memory use statistics database and database mutex.
242 * This is a LEVEL 3 mutex.
243 *
244 * See rpcglob.[ch] for the actual database and lock.
245 */
246
247typedef struct
248{
249    unsigned32 inuse;         /* number currently allocated */
250    unsigned32 calls;         /* total ever allocated */
251    unsigned32 fails;         /* denied alloc requests */
252    size_t maxsize;           /* max size allocated for this type */
253} rpc_mem_stats_elt_t, *rpc_mem_stats_elt_p_t;
254
255EXTERNAL rpc_mem_stats_elt_t rpc_g_mem_stats[];
256
257/*
258 * Values for the 'flags' argument to RPC_MEM_ALLOC
259 */
260
261#define RPC_C_MEM_WAITOK    0
262#define RPC_C_MEM_NOWAIT    1
263
264/*
265 * Concurrency control for the mem statistics database.
266 * We avoid the locking for the moment... after all, this is
267 * only statistics stuff.
268 */
269
270#ifdef RPC_STATISTICS_LOCK	/* ??? */
271#define RPC_MEM_LOCK_INIT(junk)         RPC_MUTEX_INIT(rpc_g_global_mutex)
272#define RPC_MEM_LOCK(junk)              RPC_MUTEX_LOCK(rpc_g_global_mutex)
273#define RPC_MEM_UNLOCK(junk)            RPC_MUTEX_UNLOCK(rpc_g_global_mutex)
274#define RPC_MEM_TRY_LOCK(bp)            RPC_MUTEX_TRY_LOCK(rpc_g_global_mutex,(bp))
275#define RPC_MEM_LOCK_DELETE(junk)       RPC_MUTEX_DELETE(rpc_g_global_mutex)
276#define RPC_MEM_LOCK_ASSERT(junk)       RPC_MUTEX_LOCK_ASSERT(rpc_g_global_mutex)
277#define RPC_MEM_UNLOCK_ASSERT(junk)     RPC_MUTEX_UNLOCKED_ASSERT(rpc_g_global_mutex)
278#else
279#define RPC_MEM_LOCK_INIT(junk)
280#define RPC_MEM_LOCK(junk)
281#define RPC_MEM_UNLOCK(junk)
282#define RPC_MEM_TRY_LOCK(bp)
283#define RPC_MEM_LOCK_DELETE(junk)
284#define RPC_MEM_LOCK_ASSERT(junk)
285#define RPC_MEM_UNLOCK_ASSERT(junk)
286#endif /* RPC_STATISTICS_LOCK */
287
288/*
289 * Map the RPC_MEM_ operations to either INLINE or Out-of-line
290 * implementations.  The default is Out-of-line, but this can be
291 * changed via the system specific configuration file.
292 */
293
294#ifdef RPC_MEM_DEFAULT_INLINE
295#  define RPC_MEM_ALLOC(addr, cast, size, type, flags) \
296        RPC_MEM_ALLOC_IL(addr, cast, size, type, flags)
297
298#  define RPC_MEM_REALLOC(addr, cast, size, type, flags) \
299        RPC_MEM_REALLOC_IL(addr, cast, size, type, flags)
300
301#  define RPC_MEM_FREE(addr, type) \
302        RPC_MEM_FREE_IL(addr, type)
303#else
304#  define RPC_MEM_ALLOC(addr, cast, size, type, flags) \
305        (addr) = (cast) rpc__mem_alloc(size, type, flags)
306
307#  define RPC_MEM_REALLOC(addr, cast, size, type, flags) \
308        (addr) = (cast) rpc__mem_realloc(addr, size, type, flags)
309
310#  define RPC_MEM_FREE(addr, type) \
311        rpc__mem_free((dce_pointer_t)(addr), type)
312#endif
313
314/*
315 * R P C _ M E M _ A L L O C _ I L
316 *
317 * (addr) == NULL iff "no memory available"
318 *
319 * Sample usage:
320 *      rpc_dg_ccall_p_t ccall;
321 *      RPC_MEM_ALLOC(ccall, rpc_dg_ccall_p_t, sizeof *rpc_dg_ccall_p_t,
322 *              rpc_c_mem_dg_ccall, rpc_c_mem_nowait);
323 *      if (ccall == NULL)
324 *          alloc failed
325 *
326 * Note that we just raise an exception if the malloc fails (since most
327 * callers don't yet check the return value).  In any case, this will
328 * probably always be the correct thing to do in a user space NCK
329 * implementation).
330 */
331
332#define RPC_MEM_ALLOC_IL(addr, cast, size, type, flags) \
333{ \
334    RPC_LOG_MEM_ALLOC_NTR; \
335    (addr) = (cast) malloc(size); \
336    RPC_MEM_LOCK (0); \
337    rpc_g_mem_stats[type].calls++; \
338    if ((addr) == NULL) { \
339        rpc_g_mem_stats[type].fails++; \
340        rpc_dce_svc_printf ( \
341            __FILE__, __LINE__, \
342            "%s", \
343            rpc_svc_mem, \
344            svc_c_sev_fatal | svc_c_action_abort, \
345            rpc_m_alloc_fail, \
346            "RPC_MEM_ALLOC" ); \
347    } else \
348        rpc_g_mem_stats[type].inuse++; \
349    if ((size) > rpc_g_mem_stats[type].maxsize) \
350        rpc_g_mem_stats[type].maxsize = (size); \
351    RPC_MEM_UNLOCK (0); \
352    RPC_LOG_MEM_ALLOC_XIT; \
353}
354
355/*
356 * R P C _ M E M _ R E A L L O C _ I L
357 *
358 * (addr) == NULL iff "no memory available"
359 *
360 * Sample usage:
361 *      rpc_dg_ccall_p_t ccall;
362 *      RPC_MEM_REALLOC(ccall, rpc_dg_ccall_p_t, sizeof *rpc_dg_ccall_p_t,
363 *              rpc_c_mem_dg_ccall, rpc_c_mem_nowait);
364 *      if (ccall == NULL)
365 *          alloc failed
366 *
367 * Note that we just raise an exception if the realloc fails (since most
368 * callers don't yet check the return value).  In any case, this will
369 * probably always be the correct thing to do in a user space NCK
370 * implementation).
371 */
372
373#define RPC_MEM_REALLOC_IL(addr, cast, size, type, flags) \
374{ \
375    RPC_LOG_MEM_REALLOC_NTR; \
376    (addr) = (cast) realloc(addr, size); \
377    RPC_MEM_LOCK (0); \
378    rpc_g_mem_stats[type].calls++; \
379    if ((addr) == NULL) { \
380        rpc_g_mem_stats[type].fails++; \
381        rpc_dce_svc_printf ( \
382            __FILE__, __LINE__, \
383            "%s", \
384            rpc_svc_mem, \
385            svc_c_sev_fatal | svc_c_action_abort, \
386            rpc_m_realloc_fail, \
387            "RPC_MEM_REALLOC" ); \
388    } else \
389        rpc_g_mem_stats[type].inuse++; \
390    if ((size) > rpc_g_mem_stats[type].maxsize) \
391        rpc_g_mem_stats[type].maxsize = (size); \
392    RPC_MEM_UNLOCK (0); \
393    RPC_LOG_MEM_REALLOC_XIT; \
394}
395
396/*
397 * R P C _ M E M _ F R E E _ I L
398 *
399 * Sample useage:
400 *      ...
401 *      RPC_MEM_FREE(ccall, rpc_c_mem_dg_ccall);
402 */
403
404#define RPC_MEM_FREE_IL(addr, type) \
405{ \
406    RPC_LOG_MEM_FREE_NTR; \
407    free(((char *) (addr))); \
408    RPC_MEM_LOCK (0); \
409    --rpc_g_mem_stats[type].inuse; \
410    RPC_MEM_UNLOCK (0); \
411    RPC_LOG_MEM_FREE_XIT; \
412}
413
414PRIVATE dce_pointer_t rpc__mem_alloc (
415        size_t /*size*/,
416        unsigned32 /*type*/,
417        unsigned32  /*flags*/
418    );
419
420PRIVATE dce_pointer_t rpc__mem_realloc (
421        dce_pointer_t  /*addr*/,
422        unsigned32 /*size*/,
423        unsigned32 /*type*/,
424        unsigned32  /*flags*/
425    );
426
427PRIVATE void rpc__mem_free (
428        dce_pointer_t   /*addr*/,
429        unsigned32  /*type*/
430    );
431
432#endif /* _RPCMEM_H */
433