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
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.
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]
23 * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/param.h>
34 #include <config_admin.h>
35 #include "mema_test.h"
39 mtest_handle_t handle
,
42 struct mtest_alloc_ent
*new_ent
;
45 (struct mtest_alloc_ent
*)malloc(sizeof (struct mtest_alloc_ent
));
49 new_ent
->buf
= malloc(size
);
50 if (new_ent
->buf
== NULL
) {
51 free((void *)new_ent
);
54 /* TODO: probably not thread safe? */
55 new_ent
->next
= handle
->alloc_list
;
56 handle
->alloc_list
= new_ent
;
58 return (new_ent
->buf
);
61 /* This routine dedicated to George Cameron */
64 mtest_handle_t handle
,
67 struct mtest_alloc_ent
**p
, *p1
;
69 p
= &handle
->alloc_list
;
70 while ((*p
) != NULL
&& (*p
)->buf
!= buf
)
80 mtest_deallocate_buf_all(mtest_handle_t handle
)
82 struct mtest_alloc_ent
*p1
;
84 while ((p1
= handle
->alloc_list
) != NULL
) {
85 handle
->alloc_list
= p1
->next
;
92 mtest_message(mtest_handle_t handle
, const char *msg
)
94 if (handle
->msgp
!= NULL
&& handle
->msgp
->message_routine
!= NULL
) {
95 (*handle
->msgp
->message_routine
)(handle
->msgp
->appdata_ptr
,