diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2006-11-08 01:45:44 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2009-06-18 00:26:51 +0200 |
commit | d5e26a0d71996764e78b351d4b8ece4857e7265b (patch) | |
tree | de75036e989810a678f0a7432c3245f16f696290 | |
parent | f65186d6363e0e16a5898e6391c7c967b34aa931 (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.
57 files changed, 141 insertions, 82 deletions
diff --git a/chips/busses.c b/chips/busses.c index dd64f48..94f580e 100644 --- a/chips/busses.c +++ b/chips/busses.c @@ -36,6 +36,8 @@ * */ +#include <printf.h> +#include <string.h> #include <mach/boolean.h> #include <mach/std_types.h> #include <chips/busses.h> diff --git a/ddb/db_aout.c b/ddb/db_aout.c index c47d37a..03c9790 100644 --- a/ddb/db_aout.c +++ b/ddb/db_aout.c @@ -34,6 +34,7 @@ * Symbol table routines for a.out format files. */ +#include <string.h> #include <mach/std_types.h> #include <machine/db_machdep.h> /* data types */ #include <ddb/db_sym.h> diff --git a/ddb/db_command.c b/ddb/db_command.c index 573c697..b6927e6 100644 --- a/ddb/db_command.c +++ b/ddb/db_command.c @@ -34,8 +34,8 @@ * Command dispatcher. */ +#include <string.h> #include <mach/boolean.h> -#include <kern/strings.h> #include <machine/db_machdep.h> #include <ddb/db_lex.h> diff --git a/ddb/db_lex.c b/ddb/db_lex.c index f770eaf..3d05404 100644 --- a/ddb/db_lex.c +++ b/ddb/db_lex.c @@ -33,8 +33,8 @@ /* * Lexical analyzer. */ +#include <string.h> #include <machine/db_machdep.h> -#include <kern/strings.h> #include <ddb/db_lex.h> char db_line[DB_LEX_LINE_SIZE]; diff --git a/ddb/db_macro.c b/ddb/db_macro.c index e71e83b..83c30ce 100644 --- a/ddb/db_macro.c +++ b/ddb/db_macro.c @@ -26,6 +26,7 @@ #if MACH_KDB +#include <string.h> #include <kern/thread.h> #include <machine/db_machdep.h> diff --git a/ddb/db_output.c b/ddb/db_output.c index daf141d..1506bcd 100644 --- a/ddb/db_output.c +++ b/ddb/db_output.c @@ -34,6 +34,7 @@ * Printf and character output for debugger. */ +#include <printf.h> #include <stdarg.h> #include <mach/boolean.h> #include <machine/db_machdep.h> @@ -201,11 +202,6 @@ void db_end_line() db_printf("\n"); } -/* - * Printing - */ -extern void _doprnt(); - /*VARARGS1*/ void db_printf(const char *fmt, ...) diff --git a/ddb/db_print.c b/ddb/db_print.c index 5c15d00..e9d8e4b 100644 --- a/ddb/db_print.c +++ b/ddb/db_print.c @@ -33,8 +33,8 @@ /* * Miscellaneous printing. */ +#include <string.h> #include <mach/port.h> -#include <kern/strings.h> #include <kern/task.h> #include <kern/thread.h> #include <kern/queue.h> diff --git a/ddb/db_sym.c b/ddb/db_sym.c index ab2cd1f..cd4632f 100644 --- a/ddb/db_sym.c +++ b/ddb/db_sym.c @@ -30,8 +30,8 @@ #if MACH_KDB +#include <string.h> #include <mach/std_types.h> -#include <kern/strings.h> #include <machine/db_machdep.h> #include <ddb/db_sym.h> #include <ddb/db_task_thread.h> diff --git a/device/dev_name.c b/device/dev_name.c index 29a144b..1f41335 100644 --- a/device/dev_name.c +++ b/device/dev_name.c @@ -28,6 +28,8 @@ * Date: 8/89 */ +#include <printf.h> +#include <string.h> #include <device/device_types.h> #include <device/dev_hdr.h> #include <device/conf.h> diff --git a/device/dev_pager.c b/device/dev_pager.c index 75b7451..be2daa4 100644 --- a/device/dev_pager.c +++ b/device/dev_pager.c @@ -30,6 +30,7 @@ * Device pager. */ +#include <printf.h> #include <string.h> #include <mach/boolean.h> diff --git a/device/dk_label.c b/device/dk_label.c index 8639e33..c3400ef 100644 --- a/device/dk_label.c +++ b/device/dk_label.c @@ -31,6 +31,7 @@ */ #include <sys/types.h> +#include <printf.h> #include <sys/ioctl.h> #include <device/device_types.h> #include <device/disk_status.h> diff --git a/device/ds_routines.c b/device/ds_routines.c index f7ca4e6..d1fbd4b 100644 --- a/device/ds_routines.c +++ b/device/ds_routines.c @@ -28,6 +28,7 @@ * Date: 3/89 */ +#include <printf.h> #include <string.h> #include <mach/boolean.h> diff --git a/device/net_io.c b/device/net_io.c index 6a08235..7091ffa 100644 --- a/device/net_io.c +++ b/device/net_io.c @@ -39,6 +39,7 @@ */ #include <sys/types.h> +#include <printf.h> #include <string.h> #include <device/net_status.h> diff --git a/device/subrs.c b/device/subrs.c index e6e8b6b..4aa0688 100644 --- a/device/subrs.c +++ b/device/subrs.c @@ -27,6 +27,7 @@ * Random device subroutines and stubs. */ +#include <printf.h> #include <vm/vm_kern.h> #include <device/buf.h> #include <device/if_hdr.h> diff --git a/i386/i386/db_trace.c b/i386/i386/db_trace.c index dec0ac1..4402161 100644 --- a/i386/i386/db_trace.c +++ b/i386/i386/db_trace.c @@ -26,6 +26,8 @@ #if MACH_KDB +#include <string.h> + #include <mach/boolean.h> #include <vm/vm_map.h> #include <kern/thread.h> diff --git a/i386/i386/debug_i386.c b/i386/i386/debug_i386.c index ae77779..d758e43 100644 --- a/i386/i386/debug_i386.c +++ b/i386/i386/debug_i386.c @@ -21,6 +21,8 @@ * Author: Bryan Ford, University of Utah CSL */ +#include <printf.h> + #include "thread.h" #include "trap.h" #include "debug.h" diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c index c436cfe..c61b4a0 100644 --- a/i386/i386/fpu.c +++ b/i386/i386/fpu.c @@ -27,6 +27,7 @@ * Support for 80387 floating point or FP emulator. */ +#include <printf.h> #include <string.h> #include <mach/exception.h> diff --git a/i386/i386/io_map.c b/i386/i386/io_map.c index 256a9a0..00c9a7a 100644 --- a/i386/i386/io_map.c +++ b/i386/i386/io_map.c @@ -24,6 +24,7 @@ * the rights to redistribute these changes. */ +#include <printf.h> #include <mach/vm_param.h> #include <vm/vm_kern.h> #include <vm/vm_map.h> diff --git a/i386/i386/kttd_interface.c b/i386/i386/kttd_interface.c index d0d7efd..016bd9c 100644 --- a/i386/i386/kttd_interface.c +++ b/i386/i386/kttd_interface.c @@ -26,6 +26,9 @@ #if MACH_TTD +#include <sys/types.h> +#include <printf.h> + #include <mach/machine/eflags.h> #include <kern/thread.h> @@ -33,7 +36,6 @@ #include <mach/thread_status.h> #include <mach/vm_param.h> #include <i386/seg.h> -#include <sys/types.h> #include <ttd/ttd_types.h> #include <ttd/ttd_stub.h> diff --git a/i386/i386/pic.c b/i386/i386/pic.c index 4fa17f7..58953fc 100644 --- a/i386/i386/pic.c +++ b/i386/i386/pic.c @@ -50,6 +50,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <sys/types.h> +#include <printf.h> #include <i386/ipl.h> #include <i386/pic.h> #include <i386/machspl.h> diff --git a/i386/i386/trap.c b/i386/i386/trap.c index d57ce17..16a9405 100644 --- a/i386/i386/trap.c +++ b/i386/i386/trap.c @@ -28,6 +28,7 @@ */ #include <sys/types.h> +#include <printf.h> #include <string.h> #include <mach/machine/eflags.h> diff --git a/i386/i386at/autoconf.c b/i386/i386at/autoconf.c index 9426f44..d6cfe3d 100644 --- a/i386/i386at/autoconf.c +++ b/i386/i386at/autoconf.c @@ -24,6 +24,7 @@ * the rights to redistribute these changes. */ +#include <printf.h> #ifdef MACH_KERNEL #include <mach/std_types.h> #else /* MACH_KERNEL */ diff --git a/i386/i386at/com.c b/i386/i386at/com.c index 950ef95..7ff8815 100644 --- a/i386/i386at/com.c +++ b/i386/i386at/com.c @@ -28,6 +28,7 @@ #include <mach/std_types.h> #include <sys/types.h> +#include <printf.h> #include <sys/time.h> #include <device/conf.h> #include <device/errno.h> diff --git a/i386/i386at/i386at_ds_routines.c b/i386/i386at/i386at_ds_routines.c index 48050ac..bc2a433 100644 --- a/i386/i386at/i386at_ds_routines.c +++ b/i386/i386at/i386at_ds_routines.c @@ -23,6 +23,8 @@ * Author: Shantanu Goel, University of Utah CSL */ +#include <printf.h> + #include <mach/boolean.h> #include <mach/kern_return.h> #include <mach/mig_errors.h> diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c index f7b3fc8..09ea902 100644 --- a/i386/i386at/kd.c +++ b/i386/i386at/kd.c @@ -77,6 +77,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* $ Header: $ */ #include <sys/types.h> +#include <printf.h> #include <kern/time_out.h> #include <device/conf.h> #include <device/tty.h> diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c index 909f066..b10d7f3 100644 --- a/i386/i386at/kd_event.c +++ b/i386/i386at/kd_event.c @@ -56,6 +56,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <mach/boolean.h> #include <sys/types.h> +#include <printf.h> #include <string.h> #ifdef MACH_KERNEL diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c index 82fdd78..a89d6b2 100644 --- a/i386/i386at/kd_mouse.c +++ b/i386/i386at/kd_mouse.c @@ -66,6 +66,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <mach/boolean.h> #include <sys/types.h> +#include <printf.h> #ifdef MACH_KERNEL #include <device/errno.h> #include <device/io_req.h> diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c index f085265..f071d23 100644 --- a/i386/i386at/lpr.c +++ b/i386/i386at/lpr.c @@ -33,6 +33,7 @@ #ifdef MACH_KERNEL #include <mach/std_types.h> #include <sys/types.h> +#include <printf.h> #include <sys/time.h> #include <device/conf.h> #include <device/errno.h> diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index 565f189..f31a8d7 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -32,6 +32,9 @@ * Basic initialization for I386 - ISA bus machines. */ +#include <printf.h> +#include <string.h> + #include <mach/vm_param.h> #include <mach/vm_prot.h> #include <mach/machine.h> diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c index 58fc5d4..e75d054 100644 --- a/i386/intel/pmap.c +++ b/i386/intel/pmap.c @@ -55,6 +55,7 @@ * and to when physical maps must be made correct. */ +#include <printf.h> #include <string.h> #include <mach/machine/vm_types.h> diff --git a/include/printf.h b/include/printf.h new file mode 100644 index 0000000..e309d21 --- /dev/null +++ b/include/printf.h @@ -0,0 +1,50 @@ +/* + * Header file for printf type functions. + * Copyright (C) 2006 Free Software Foundation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * String handling functions. + * + */ + +#ifndef _MACH_SA_SYS_PRINTF_H_ +#define _MACH_SA_SYS_PRINTF_H_ + +#include <sys/types.h> +#include <stdarg.h> + +extern void printf_init (); + +extern void _doprnt (const char *fmt, + va_list *argp, + void (*putc)(char, vm_offset_t), + int radix, + vm_offset_t putc_arg); + +extern void printnum (unsigned long u, int base, + void (*putc)(char, vm_offset_t), + vm_offset_t putc_arg); + +extern int sprintf (char *buf, const char *fmt, ...); + +extern int printf (const char *fmt, ...); + +extern int indent; +extern int iprintf (const char *fmt, ...); + +#endif /* _MACH_SA_SYS_PRINTF_H_ */ + diff --git a/include/string.h b/include/string.h index 34ef555..0d805ea 100644 --- a/include/string.h +++ b/include/string.h @@ -32,4 +32,20 @@ extern void *memcpy (void *dest, const void *src, size_t n); extern void *memset (void *s, int c, size_t n); +extern char *strchr (const char *s, int c); + +extern char *strcpy (char *dest, const char *src); + +extern char *strncpy (char *dest, const char *src, size_t n); + +extern char *strrchr (const char *s, int c); + +extern char *strsep (char **strp, const char *delim); + +extern int strcmp (const char *s1, const char *s2); + +extern int strncmp (const char *s1, const char *s2, size_t n); + +extern size_t strlen (const char *s); + #endif /* _MACH_SA_SYS_STRING_H_ */ diff --git a/ipc/ipc_entry.c b/ipc/ipc_entry.c index 85404b6..705638d 100644 --- a/ipc/ipc_entry.c +++ b/ipc/ipc_entry.c @@ -25,7 +25,7 @@ * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. - * + */ /* * File: ipc/ipc_entry.c * Author: Rich Draves @@ -34,6 +34,7 @@ * Primitive functions to manipulate translation entries. */ +#include <printf.h> #include <string.h> #include <mach/kern_return.h> diff --git a/ipc/ipc_hash.c b/ipc/ipc_hash.c index 1c5bfa9..4f21073 100644 --- a/ipc/ipc_hash.c +++ b/ipc/ipc_hash.c @@ -31,6 +31,7 @@ * Entry hash table operations. */ +#include <printf.h> #include <mach/boolean.h> #include <mach/port.h> #include <kern/lock.h> diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c index 100cc93..1c9ef87 100644 --- a/ipc/ipc_kmsg.c +++ b/ipc/ipc_kmsg.c @@ -34,6 +34,7 @@ * Operations on kernel messages. */ +#include <printf.h> #include <string.h> #include <mach/boolean.h> diff --git a/ipc/ipc_notify.c b/ipc/ipc_notify.c index c90796f..30cfac4 100644 --- a/ipc/ipc_notify.c +++ b/ipc/ipc_notify.c @@ -31,6 +31,7 @@ * Notification-sending functions. */ +#include <printf.h> #include <mach/port.h> #include <mach/message.h> #include <mach/notify.h> diff --git a/ipc/ipc_object.c b/ipc/ipc_object.c index 713a581..53f7793 100644 --- a/ipc/ipc_object.c +++ b/ipc/ipc_object.c @@ -31,6 +31,7 @@ * Functions to manipulate IPC objects. */ +#include <printf.h> #include <string.h> #include <mach/boolean.h> diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c index a23375c..fa8ed3a 100644 --- a/ipc/ipc_port.c +++ b/ipc/ipc_port.c @@ -34,6 +34,7 @@ * Functions to manipulate IPC ports. */ +#include <printf.h> #include <string.h> #include <mach/port.h> @@ -1448,8 +1449,6 @@ void ipc_port_print(port) ipc_port_t port; { - extern int indent; - printf("port 0x%x\n", port); indent += 2; diff --git a/ipc/ipc_pset.c b/ipc/ipc_pset.c index b535e3f..049c66d 100644 --- a/ipc/ipc_pset.c +++ b/ipc/ipc_pset.c @@ -36,6 +36,7 @@ * Functions to manipulate IPC port sets. */ +#include <printf.h> #include <mach/port.h> #include <mach/kern_return.h> #include <mach/message.h> @@ -330,8 +331,6 @@ void ipc_pset_print( ipc_pset_t pset) { - extern int indent; - printf("pset 0x%x\n", pset); indent += 2; diff --git a/ipc/mach_msg.c b/ipc/mach_msg.c index cdb406e..a02462d 100644 --- a/ipc/mach_msg.c +++ b/ipc/mach_msg.c @@ -36,6 +36,7 @@ * Exported message traps. See mach/message.h. */ +#include <printf.h> #include <mach/kern_return.h> #include <mach/port.h> #include <mach/message.h> diff --git a/ipc/mach_port.c b/ipc/mach_port.c index 0ddad53..b78ab25 100644 --- a/ipc/mach_port.c +++ b/ipc/mach_port.c @@ -36,6 +36,7 @@ * Exported kernel calls. See mach/mach_port.defs. */ +#include <printf.h> #include <mach/port.h> #include <mach/kern_return.h> #include <mach/notify.h> diff --git a/ipc/mach_rpc.c b/ipc/mach_rpc.c index 0ceeeb4..dae097a 100644 --- a/ipc/mach_rpc.c +++ b/ipc/mach_rpc.c @@ -21,6 +21,7 @@ #ifdef MIGRATING_THREADS +#include <printf.h> #include <mach/kern_return.h> #include <mach/port.h> #include <mach/rpc.h> 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> diff --git a/vm/vm_fault.c b/vm/vm_fault.c index b757208..0506e0a 100644 --- a/vm/vm_fault.c +++ b/vm/vm_fault.c @@ -33,6 +33,7 @@ * Page fault handling module. */ +#include <printf.h> #include <vm/vm_fault.h> #include <mach/kern_return.h> #include <mach/message.h> /* for error codes */ diff --git a/vm/vm_map.c b/vm/vm_map.c index 193146c..71de048 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -34,6 +34,7 @@ * Virtual memory mapping module. */ +#include <printf.h> #include <mach/kern_return.h> #include <mach/port.h> #include <mach/vm_attributes.h> @@ -4688,7 +4689,6 @@ void vm_map_print(map) register vm_map_t map; { register vm_map_entry_t entry; - extern int indent; iprintf("Task map 0x%X: pmap=0x%X,", (vm_offset_t) map, (vm_offset_t) (map->pmap)); @@ -4756,7 +4756,6 @@ void vm_map_print(map) void vm_map_copy_print(copy) vm_map_copy_t copy; { - extern int indent; int i, npages; printf("copy object 0x%x\n", copy); diff --git a/vm/vm_object.c b/vm/vm_object.c index 7d00fbe..0e8a514 100644 --- a/vm/vm_object.c +++ b/vm/vm_object.c @@ -33,6 +33,7 @@ * Virtual memory object module. */ +#include <printf.h> #include <string.h> #include <mach/memory_object.h> @@ -2969,7 +2970,6 @@ void vm_object_print( vm_object_t object) { register vm_page_t p; - extern indent; register int count; diff --git a/vm/vm_resident.c b/vm/vm_resident.c index 2c99ab5..2b5ecee 100644 --- a/vm/vm_resident.c +++ b/vm/vm_resident.c @@ -33,6 +33,7 @@ * Resident memory management module. */ +#include <printf.h> #include <string.h> #include <mach/vm_prot.h> |