summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2006-11-08 01:45:44 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:26:51 +0200
commitd5e26a0d71996764e78b351d4b8ece4857e7265b (patch)
treede75036e989810a678f0a7432c3245f16f696290 /kern
parentf65186d6363e0e16a5898e6391c7c967b34aa931 (diff)
2006-11-07 Barry deFreese <bddebian@comcast.net>
[task #5726 --- ``GCC built-in functions''] * include/printf.h: New file. (printf_init, _doprnt, printnum, sprintf, printf, indent, iprint): New declarations. * include/string.h (strchr, strcmp, strcpy, strlen, strncmp, strncpy, strrchr, strsep): New extern declarations. * kern/strings.c: Don't include `kern/strings.h', include `string.h'. (strncmp, strncpy, strlen): Fix prototypes into using size_t. * kern/strings.h: Removed file. * kern/debug.c: Include `printf.h'. (do_cnputc): New function. (panic, log): Use do_cnputc instead of cnputc. * chips/busses.c: Don't include `kern/strings.h', include `printf.h' and `string.h'. (_doprnt): Remove extern declaration. (indent): Remove extern declaration. * chips/busses.c: Likewise. * ddb/db_aout.c: Likewise. * ddb/db_command.c: Likewise. * ddb/db_lex.c: Likewise. * ddb/db_macro.c: Likewise. * ddb/db_output.c: Likewise. * ddb/db_print.c: Likewise. * ddb/db_sym.c: Likewise. * device/dev_name.c: Likewise. * device/dev_pager.c: Likewise. * device/dk_label.c: Likewise. * device/ds_routines.c: Likewise. * device/net_io.c: Likewise. * device/subrs.c: Likewise. * i386/i386/db_trace.c: Likewise. * i386/i386/debug_i386.c: Likewise. * i386/i386/fpu.c: Likewise. * i386/i386/io_map.c: Likewise. * i386/i386/kttd_interface.c: Likewise. * i386/i386/pic.c: Likewise. * i386/i386/trap.c: Likewise. * i386/i386at/autoconf.c: Likewise. * i386/i386at/com.c: Likewise. * i386/i386at/i386at_ds_routines.c: Likewise. * i386/i386at/kd.c: Likewise. * i386/i386at/kd_event.c: Likewise. * i386/i386at/kd_mouse.c: Likewise. * i386/i386at/lpr.c: Likewise. * i386/i386at/model_dep.c: Likewise. * i386/intel/pmap.c: Likewise. * ipc/ipc_entry.c: Likewise. * ipc/ipc_hash.c: Likewise. * ipc/ipc_kmsg.c: Likewise. * ipc/ipc_notify.c: Likewise. * ipc/ipc_object.c: Likewise. * ipc/ipc_port.c: Likewise. * ipc/ipc_pset.c: Likewise. * ipc/mach_msg.c: Likewise. * ipc/mach_port.c: Likewise. * ipc/mach_rpc.c: Likewise. * kern/bootstrap.c: Likewise. * kern/eventcount.c: Likewise. * kern/ipc_kobject.c: Likewise. * kern/pc_sample.c: Likewise. * kern/printf.c: Likewise. * kern/sched_prim.c: Likewise. * kern/thread.c: Likewise. * kern/zalloc.c: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_map.c: Likewise. * vm/vm_object.c: Likewise. * vm/vm_resident.c: Likewise.
Diffstat (limited to 'kern')
-rw-r--r--kern/bootstrap.c2
-rw-r--r--kern/debug.c11
-rw-r--r--kern/eventcount.c1
-rw-r--r--kern/ipc_kobject.c1
-rw-r--r--kern/pc_sample.c1
-rw-r--r--kern/printf.c2
-rw-r--r--kern/sched_prim.c1
-rw-r--r--kern/strings.c8
-rw-r--r--kern/strings.h56
-rw-r--r--kern/thread.c1
-rw-r--r--kern/zalloc.c1
11 files changed, 21 insertions, 64 deletions
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index 3613e38..540322d 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -31,6 +31,7 @@
*/
#include <alloca.h>
+#include <printf.h>
#include <string.h>
#include <mach/port.h>
@@ -58,7 +59,6 @@
#else
#include <mach/machine/multiboot.h>
#include <mach/exec/exec.h>
-#include <kern/strings.h>
extern struct multiboot_info boot_info; /* XXX put this in a header! */
#endif
diff --git a/kern/debug.c b/kern/debug.c
index 6a31ab8..42764bd 100644
--- a/kern/debug.c
+++ b/kern/debug.c
@@ -24,6 +24,7 @@
* the rights to redistribute these changes.
*/
+#include <printf.h>
#include <stdarg.h>
#include "cpu_number.h"
@@ -45,6 +46,12 @@ extern int db_breakpoints_inserted;
simple_lock_data_t Assert_print_lock; /* uninited, we take our chances */
#endif
+static void
+do_cnputc(char c, vm_offset_t offset)
+{
+ cnputc(c);
+}
+
void
Assert(char *exp, char *file, int line)
{
@@ -144,7 +151,7 @@ panic(const char *s, ...)
#endif
printf(": ");
va_start(listp, s);
- _doprnt(s, &listp, cnputc, 0);
+ _doprnt(s, &listp, do_cnputc, 0, 0);
va_end(listp);
printf("\n");
@@ -175,6 +182,6 @@ log(int level, const char *fmt, ...)
level++;
#endif
va_start(listp, fmt);
- _doprnt(fmt, &listp, cnputc, 0);
+ _doprnt(fmt, &listp, do_cnputc, 0, 0);
va_end(listp);
}
diff --git a/kern/eventcount.c b/kern/eventcount.c
index b562f1a..4a8ebd7 100644
--- a/kern/eventcount.c
+++ b/kern/eventcount.c
@@ -35,6 +35,7 @@
*
*/
+#include <printf.h>
#include <string.h>
#include <mach/machine.h>
diff --git a/kern/ipc_kobject.c b/kern/ipc_kobject.c
index 7e51d92..d642228 100644
--- a/kern/ipc_kobject.c
+++ b/kern/ipc_kobject.c
@@ -33,6 +33,7 @@
* Functions for letting a port represent a kernel object.
*/
+#include <printf.h>
#include <mach/port.h>
#include <mach/kern_return.h>
#include <mach/message.h>
diff --git a/kern/pc_sample.c b/kern/pc_sample.c
index b414941..a335c47 100644
--- a/kern/pc_sample.c
+++ b/kern/pc_sample.c
@@ -24,6 +24,7 @@
* the rights to redistribute these changes.
*/
+#include <printf.h>
#include <string.h>
#include <mach/mach_types.h> /* vm_address_t */
diff --git a/kern/printf.c b/kern/printf.c
index 7dcb798..a1f18b0 100644
--- a/kern/printf.c
+++ b/kern/printf.c
@@ -113,9 +113,9 @@
* (compatibility)
*/
+#include <string.h>
#include <mach/boolean.h>
#include <kern/lock.h>
-#include <kern/strings.h>
#include <stdarg.h>
#define isdigit(d) ((d) >= '0' && (d) <= '9')
diff --git a/kern/sched_prim.c b/kern/sched_prim.c
index 24b64f9..116bfe6 100644
--- a/kern/sched_prim.c
+++ b/kern/sched_prim.c
@@ -32,6 +32,7 @@
*
*/
+#include <printf.h>
#include <mach/machine.h>
#include <kern/ast.h>
#include <kern/counters.h>
diff --git a/kern/strings.c b/kern/strings.c
index 89563cd..80e410e 100644
--- a/kern/strings.c
+++ b/kern/strings.c
@@ -31,7 +31,7 @@
* String functions.
*/
-#include <kern/strings.h> /* make sure we sell the truth */
+#include <string.h>
#ifdef strcpy
#undef strcmp
@@ -84,7 +84,7 @@ int
strncmp(
register const char *s1,
register const char *s2,
- unsigned long n)
+ size_t n)
{
register unsigned int a, b;
@@ -137,7 +137,7 @@ char *
strncpy(
register char *to,
register const char *from,
- register unsigned long count)
+ register size_t count)
{
register char *ret = to;
@@ -161,7 +161,7 @@ strncpy(
* the terminating null character.
*/
-unsigned long
+size_t
strlen(
register const char *string)
{
diff --git a/kern/strings.h b/kern/strings.h
deleted file mode 100644
index 225228d..0000000
--- a/kern/strings.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1993 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-/*
- * File: strings.h
- * Author: Alessandro Forin, Carnegie Mellon University
- * Date: 3/93
- *
- * Prototypes for string functions. The way GCC wants them.
- */
-
-extern int strcmp(
- const char *,
- const char * );
-
-extern int strncmp(
- const char *,
- const char *,
- unsigned long);
-
-extern char *strcpy(
- char *,
- const char *);
-
-extern char *strncpy(
- char *,
- const char *,
- unsigned long);
-
-extern unsigned long strlen(
- const char *);
-
-extern char *strsep(char **, const char *);
-extern char *strchr(const char *, int);
diff --git a/kern/thread.c b/kern/thread.c
index 333ee9a..911ceb9 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -31,6 +31,7 @@
* Thread management primitives implementation.
*/
+#include <printf.h>
#include <mach/std_types.h>
#include <mach/policy.h>
#include <mach/thread_info.h>
diff --git a/kern/zalloc.c b/kern/zalloc.c
index 48fbb32..e089023 100644
--- a/kern/zalloc.c
+++ b/kern/zalloc.c
@@ -34,6 +34,7 @@
* data blocks for which quick allocation/deallocation is possible.
*/
+#include <printf.h>
#include <string.h>
#include <kern/macro_help.h>