1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1998,2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_MY_ALLOC_H
28 #define	_MY_ALLOC_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <netdb.h>
37 #include <netdir.h>
38 #include <rpc/nettype.h>
39 
40 int add_alloc(char *, void *, size_t, const char *, int);
41 int drop_alloc(const char *, void *, const char *, int);
42 
43 void *my_malloc(size_t, const char *, int);
44 void *my_realloc(void *, size_t, const char *, int);
45 void my_free(void *, const char *, int);
46 char *my_strdup(const char *, const char *, int);
47 
48 int  my_sethostent(int, const char *, int);
49 int  my_endhostent(const char *, int);
50 
51 void *my_setnetconfig(const char *, int);
52 int  my_endnetconfig(void *, const char *, int);
53 
54 void *my_setnetpath(const char *, int);
55 int  my_endnetpath(void *, const char *, int);
56 
57 int  my_netdir_getbyname(struct netconfig *, struct nd_hostserv *,
58 	struct nd_addrlist **, const char *, int);
59 int  my_netdir_free(void *, int, const char *, int);
60 
61 struct hostent *my_getipnodebyname(const char *, int, int, int *, char *, int);
62 void my_freehostent(struct hostent *, char *, int);
63 
64 struct netconfig *my_getnetconfigent(char *, char *, int);
65 void  my_freenetconfigent(struct netconfig *, char *, int);
66 
67 void *my__rpc_setconf(char *, char *, int);
68 void my__rpc_endconf(void *, char *, int);
69 
70 void check_leaks(char *);
71 
72 #define	AUTOFS_DUMP_DEBUG	1000000
73 #define	free(a)			my_free(a, __FILE__, __LINE__)
74 #define	malloc(a)		my_malloc(a, __FILE__, __LINE__)
75 #define	realloc(a, s)		my_realloc(a, s, __FILE__, __LINE__)
76 #define	strdup(a)		my_strdup(a, __FILE__, __LINE__)
77 
78 #define	sethostent(s)		my_sethostent(s, __FILE__, __LINE__)
79 #define	endhostent()		my_endhostent(__FILE__, __LINE__)
80 
81 #define	setnetconfig()		my_setnetconfig(__FILE__, __LINE__)
82 #define	endnetconfig(v)		my_endnetconfig(v, __FILE__, __LINE__)
83 
84 #define	setnetpath()		my_setnetpath(__FILE__, __LINE__)
85 #define	endnetpath(v)		my_endnetpath(v, __FILE__, __LINE__)
86 
87 #define	netdir_getbyname(t, s, a)	\
88 	my_netdir_getbyname(t, s, a, __FILE__, __LINE__)
89 #define	netdir_free(a, t)	my_netdir_free(a, t, __FILE__, __LINE__)
90 
91 #define	getipnodebyname(n, a, f, e)	\
92 	my_getipnodebyname(n, a, f, e, __FILE__, __LINE__)
93 #define	 freehostent(h)		my_freehostent(h, __FILE__, __LINE__)
94 
95 #define	getnetconfigent(n)	my_getnetconfigent(n, __FILE__, __LINE__)
96 #define	freenetconfigent(n)	my_freenetconfigent(n, __FILE__, __LINE__)
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif	/* _MY_ALLOC_H */
103