usr/src/lib/libc/port/gen/memalign.c
changeset 6515 10dab2b883e0
parent 2658 bd713408aa10
child 6812 febeba71273d
--- a/usr/src/lib/libc/port/gen/memalign.c	Tue Apr 29 12:46:10 2008 -0700
+++ b/usr/src/lib/libc/port/gen/memalign.c	Tue Apr 29 14:12:45 2008 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -70,6 +70,11 @@
 	size_t	frag_size;	/* size of fragments fore and aft */
 	size_t	 x;
 
+	if (!primary_link_map) {
+		errno = ENOTSUP;
+		return (NULL);
+	}
+
 	/*
 	 * check for valid size and alignment parameters
 	 * MAX_ALIGN check prevents overflow in later calculation.
@@ -114,7 +119,7 @@
 		/* malloc sets errno */
 		return (NULL);
 	}
-	(void) _private_mutex_lock(&libc_malloc_lock);
+	(void) mutex_lock(&libc_malloc_lock);
 
 	/*
 	 * get size of the entire block (overhead and all)
@@ -175,6 +180,6 @@
 		SIZE(blk) = frag_size | BIT0;
 		_free_unlocked(DATA(blk));
 	}
-	(void) _private_mutex_unlock(&libc_malloc_lock);
+	(void) mutex_unlock(&libc_malloc_lock);
 	return (DATA(aligned_blk));
 }