xnu-1486.2.11.tar.gz
[apple/xnu.git] / osfmk / kern / misc_protos.h
index edd4eadcdb98ce4e4c1e3a5e10f0b2343a714b31..0b7d5a0cc9deade82595b03c032deef2754c2704 100644 (file)
@@ -1,14 +1,19 @@
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
  * This file contains Original Code and/or Modifications of Original Code
  * as defined in and that are subject to the Apple Public Source License
  * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
  * 
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * Please see the License for the specific language governing rights and
  * limitations under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 /*
  * @OSF_COPYRIGHT@
  */
+/*
+ * NOTICE: This file was modified by McAfee Research in 2004 to introduce
+ * support for mandatory and extensible security protections.  This notice
+ * is included in support of clause 2.2 (b) of the Apple Public License,
+ * Version 2.0.
+ */
 
 #ifndef        _MISC_PROTOS_H_
 #define        _MISC_PROTOS_H_
 #include <ipc/ipc_types.h>
 #include <kern/debug.h>
 
+#ifndef MIN
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#endif /* MIN */
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif  /* MAX */
+
 /* Set a bit in a bit array */
 extern void setbit(
        int             which,
@@ -80,7 +98,7 @@ extern int copyinmsg(
 
 /* Move arbitrarily-aligned data from a kernel space to user space */
 extern int copyout(
-       const char      *kernel_addr,
+       const void      *kernel_addr,
        user_addr_t     user_addr,
        vm_size_t       nbytes);
 
@@ -90,18 +108,40 @@ extern int copyoutmsg(
        user_addr_t     user_addr,
        mach_msg_size_t nbytes);
 
-extern int sscanf(const char *input, const char *fmt, ...);
+/* Invalidate copy window(s) cache */
+extern void    inval_copy_windows(thread_t);
+
+extern int sscanf(const char *input, const char *fmt, ...) __scanflike(2,3);
+
+/* sprintf() is being deprecated. Please use snprintf() instead. */ 
+extern integer_t sprintf(char *buf, const char *fmt, ...) __deprecated;
+
+extern int printf(const char *format, ...) __printflike(1,2);
+
+#if KERNEL_PRIVATE
+int     _consume_printf_args(int, ...);
+#endif
 
-extern integer_t sprintf(char *buf, const char *fmt, ...);
+#if CONFIG_NO_PRINTF_STRINGS
+#if KERNEL_PRIVATE
+#define printf(x, ...)  _consume_printf_args( 0, ## __VA_ARGS__ )
+#else
+#define printf(x, ...)  do {} while (0)
+#endif
+#endif
 
-extern void printf(const char *format, ...);
+extern void dbugprintf(const char *format, ...) __printflike(1,2);
 
-extern void dbugprintf(const char *format, ...);
+extern int kdb_printf(const char *format, ...) __printflike(1,2);
 
-extern void kdp_printf(const char *format, ...);
+extern int kdb_log(const char *format, ...) __printflike(1,2);
+
+extern int kdb_printf_unbuffered(const char *format, ...) __printflike(1,2);
 
 extern void printf_init(void);
 
+extern int snprintf(char *, size_t, const char *, ...) __printflike(3,4);
+
 extern void log(int level, char *fmt, ...);
 
 void 
@@ -113,7 +153,7 @@ _doprnt(
 int
 __doprnt(
        register const char     *fmt,
-       va_list                 *argp,
+       va_list                 argp,
        void                    (*putc)(int, void *),
        void                    *arg,
        int                     radix);
@@ -128,8 +168,14 @@ extern void conslog_putc(char);
 
 extern void consdebug_putc(char);
 
+extern void consdebug_log(char);
+
+extern void consdebug_putc_unbuffered(char);
+
 extern void cnputc(char);
 
+extern void cnputc_unbuffered(char);
+
 extern int cngetc(void);
 
 extern int cnmaygetc(void);
@@ -150,7 +196,6 @@ extern void delay(
                int             n);
 
 
-extern void norma_bootstrap(void);
 
 #if    DIPC
 extern boolean_t       no_bootstrap_task(void);
@@ -162,4 +207,9 @@ extern kern_return_t        kernel_set_special_port(
                int             which,
                ipc_port_t      port);
 
+user_addr_t get_useraddr(void);
+
+/* symbol lookup */
+struct kmod_info_t;
+
 #endif /* _MISC_PROTOS_H_ */