PERFORCE change 52142 for review

Andrew Reisse areisse at FreeBSD.org
Mon May 3 15:37:57 GMT 2004


http://perforce.freebsd.org/chv.cgi?CH=52142

Change 52142 by areisse at areisse_ibook on 2004/05/03 08:37:37

	use some different malloc functions

Affected files ...

.. //depot/projects/trustedbsd/sedarwin73/apsl/xnu/security/sebsd/ss/global.h#2 edit
.. //depot/projects/trustedbsd/sedarwin73/apsl/xnu/security/sebsd/ss/queue.c#2 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin73/apsl/xnu/security/sebsd/ss/global.h#2 (text+ko) ====

@@ -31,7 +31,9 @@
 #include <errno.h>
 #define sebsd_malloc(a,b,c) (c&M_ZERO)?calloc(1,a):malloc(a)
 #define sebsd_free(a,b) free(a)
-#define kmalloc(l, f) malloc(l)
+#define sebsd_ss_malloc(a,b) (b&M_ZERO)?calloc(1,a):malloc(a)
+#define sebsd_ss_free(a) free(a)
+#define kmalloc(l,f) sebsd_ss_malloc(l,f)
 #define	mtx_lock(a)
 #define	mtx_unlock(a)
 #endif /* _KERNEL */

==== //depot/projects/trustedbsd/sedarwin73/apsl/xnu/security/sebsd/ss/queue.c#2 (text+ko) ====

@@ -11,9 +11,6 @@
 #include <sys/param.h>
 #include <sys/conf.h>
 #include <sys/kernel.h>
-#else /* FreeBSD _KERNEL */
-#define malloc(a,b,c) (c&M_ZERO)?calloc(1,a):malloc(a)
-#define free(a,b) free(a)
 #endif
 
 #include <security/sebsd/linux-compat.h>
@@ -25,8 +22,8 @@
 {
 	queue_t q;
 
-	q = (queue_t) malloc(sizeof(struct queue_info),
-				   M_SEBSD, M_WAITOK);
+	q = (queue_t) sebsd_ss_malloc(sizeof(struct queue_info),
+				      M_WAITOK);
 	if (q == NULL)
 		return NULL;
 
@@ -43,8 +40,8 @@
 	if (!q)
 		return -1;
 
-	newnode = (queue_node_ptr_t) malloc(sizeof(struct queue_node),
-						  M_SEBSD, M_WAITOK);
+	newnode = (queue_node_ptr_t) sebsd_ss_malloc(sizeof(struct queue_node),
+						     M_WAITOK);
 	if (newnode == NULL)
 		return -1;
 
@@ -69,8 +66,8 @@
 	if (!q)
 		return -1;
 
-	newnode = (queue_node_ptr_t) malloc(sizeof(struct queue_node),
-						  M_SEBSD, M_WAITOK);
+	newnode = (queue_node_ptr_t) sebsd_ss_malloc(sizeof(struct queue_node),
+						     M_WAITOK);
 	if (newnode == NULL)
 		return -1;
 
@@ -106,7 +103,7 @@
 		q->tail = NULL;
 
 	e = node->element;
-	free(node, M_SEBSD);
+	sebsd_ss_free(node);
 
 	return e;
 }
@@ -135,10 +132,10 @@
 	while (p != NULL) {
 		temp = p;
 		p = p->next;
-		free(temp, M_SEBSD);
+		sebsd_ss_free(temp);
 	}
 
-	free(q, M_SEBSD);
+	sebsd_ss_free(q);
 }
 
 int queue_map(queue_t q, int (*f) (queue_element_t, void *), void *vp)
@@ -191,7 +188,7 @@
 			temp = p;
 			p = p->next;
 			g(temp->element, vp);
-			free(temp, M_SEBSD);
+			sebsd_ss_free(temp);
 		} else {
 			last = p;
 			p = p->next;
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list