PERFORCE change 34947 for review
Chris Vance
cvance at FreeBSD.org
Thu Jul 24 17:12:30 GMT 2003
http://perforce.freebsd.org/chv.cgi?CH=34947
Change 34947 by cvance at cvance_osx_laptop on 2003/07/24 10:11:30
A bunch of small changes to get closer to having the Darwin kernel
build and boot with the basic TrustedBSD framework in place.
- Add support for strsep
- Fix up condition variables by removing unsupported API calls
wait_queue_empty() and wait_queue_is_queue()
- Get sbuf support to compile: replace _KERNEL with KERNEL in ifdefs,
fix up include file paths, change malloc macros, add M_SBUF to
malloc types
- Install _label.h with the rest of the system headers
- Temporarily remove mbuf security labels, since it has binary
compatibility issues
Affected files ...
.. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/conf/files#5 edit
.. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/kern_condvar.c#3 edit
.. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/subr_sbuf.c#2 edit
.. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/libkern/strsep.c#1 add
.. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/Makefile#4 edit
.. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/libkern.h#1 add
.. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/malloc.h#4 edit
.. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/mbuf.h#3 edit
Differences ...
==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/conf/files#5 (text+ko) ====
@@ -124,6 +124,7 @@
bsd/libkern/skpc.c standard
bsd/libkern/inet_ntoa.c standard
bsd/libkern/bcd.c standard
+bsd/libkern/strsep.c standard
bsd/vfs/vfs_bio.c standard
bsd/vfs/vfs_cache.c standard
==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/kern_condvar.c#3 (text+ko) ====
@@ -38,7 +38,6 @@
#include <sys/condvar.h>
#include <kern/lock.h>
-#include <kern/wait_queue.h>
void
cv_init(struct cv *cvp, const char *desc)
@@ -54,8 +53,14 @@
cv_destroy(struct cv *cvp)
{
+#if 0
+ /*
+ * TBD/CDV this method is marked both
+ * __APPLE_API_PRIVATE and MACH_KERNEL_PRIVATE
+ */
if (!wait_queue_is_queue(cvp->cv_wait_queue))
panic("cv_destroy: !wait_queue_is_queue");
+#endif
bzero(cvp, sizeof(*cvp));
}
@@ -134,12 +139,19 @@
panic("cv_waitq_remove: not currently supported");
}
+#if 0
int
cv_waitq_empty(struct cv *cvp)
{
- return (queue_empty(cvp->cv_wait_queue));
+ /*
+ * TBD/CDV wait_queue_empty() should probably be used, but
+ * it's marked both __APPLE_API_PRIVATE and MACH_KERNEL_PRIVATE
+ *
+ */
+ return (wait_queue_empty(cvp->cv_wait_queue));
}
+#endif
const char *
cv_wmesg(struct cv *cvp)
==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/subr_sbuf.c#2 (text+ko) ====
@@ -30,33 +30,36 @@
#include <sys/param.h>
-#ifdef _KERNEL
-#include <sys/ctype.h>
+#ifdef KERNEL
+/* #include <ctype.h> */
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/systm.h>
#include <sys/uio.h>
-#include <machine/stdarg.h>
-#else /* _KERNEL */
+#include <sys/systm.h>
+#include <stdarg.h>
+#else /* KERNEL */
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif /* _KERNEL */
+#endif /* KERNEL */
#include <sys/sbuf.h>
-#ifdef _KERNEL
-MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers");
-#define SBMALLOC(size) malloc(size, M_SBUF, M_WAITOK)
-#define SBFREE(buf) free(buf, M_SBUF)
-#else /* _KERNEL */
+#ifdef KERNEL
+/* MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers"); */
+#define SBMALLOC(size) _MALLOC(size, M_SBUF, M_WAITOK)
+#define SBFREE(buf) FREE(buf, M_SBUF)
+#define va_copy(d,s) __builtin_va_copy((d),(s))
+#else /* KERNEL */
#define KASSERT(e, m)
#define SBMALLOC(size) malloc(size)
#define SBFREE(buf) free(buf)
#define min(x,y) MIN(x,y)
-#endif /* _KERNEL */
+
+#endif /* KERNEL */
/*
* Predicates
@@ -82,7 +85,7 @@
/*
* Debugging support
*/
-#if defined(_KERNEL) && defined(INVARIANTS)
+#if defined(KERNEL) && defined(INVARIANTS)
static void
_assert_sbuf_integrity(const char *fun, struct sbuf *s)
{
@@ -103,10 +106,10 @@
}
#define assert_sbuf_integrity(s) _assert_sbuf_integrity(__func__, (s))
#define assert_sbuf_state(s, i) _assert_sbuf_state(__func__, (s), (i))
-#else /* _KERNEL && INVARIANTS */
+#else /* KERNEL && INVARIANTS */
#define assert_sbuf_integrity(s) do { } while (0)
#define assert_sbuf_state(s, i) do { } while (0)
-#endif /* _KERNEL && INVARIANTS */
+#endif /* KERNEL && INVARIANTS */
static int
sbuf_extendsize(int size)
@@ -193,7 +196,7 @@
return (s);
}
-#ifdef _KERNEL
+#ifdef KERNEL
/*
* Create an sbuf with uio data
*/
@@ -280,7 +283,7 @@
return (0);
}
-#ifdef _KERNEL
+#ifdef KERNEL
/*
* Copy a byte string from userland into an sbuf.
*/
@@ -344,7 +347,7 @@
return (0);
}
-#ifdef _KERNEL
+#ifdef KERNEL
/*
* Append a string from userland to an sbuf.
*/
==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/Makefile#4 (text+ko) ====
@@ -20,7 +20,7 @@
EXPINC_SUBDIRS_I386 = \
DATAFILES = \
- appleapiopts.h \
+ _label.h appleapiopts.h \
acct.h attr.h buf.h callout.h cdefs.h clist.h conf.h \
condvar.h \
dir.h dirent.h disk.h disklabel.h disktab.h dkstat.h dmap.h domain.h \
==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/malloc.h#4 (text+ko) ====
@@ -169,9 +169,9 @@
#define M_JNL_TR 92 /* Journaling: "struct transaction" */
#define M_MACPIPELABEL 93
#define M_MACTEMP 94
+#define M_SBUF 95
+#define M_LAST 96 /* Must be last type + 1 */
-#define M_LAST 95 /* Must be last type + 1 */
-
/* Strings corresponding to types of memory */
/* Must be in synch with the #defines above */
#define INITKMEMNAMES { \
@@ -270,6 +270,7 @@
"Transaction", /* 92 M_JNL_TR */\
"macpipelabel", /* 93 M_MACPIPELABEL */\
"mactemp", /* 94 M_MACTEMP */\
+ "sbuf", /* 95 M_SBUF */\
}
struct kmemstats {
==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/mbuf.h#3 (text+ko) ====
@@ -131,7 +131,7 @@
struct mbuf *aux; /* extra data buffer; ipsec/others */
void *reserved1; /* for future use */
void *reserved2; /* for future use */
- struct label label; /* MAC label for packet */
+ /* struct label label; /* MAC label for packet */
};
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