summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
Diffstat (limited to 'kern')
-rw-r--r--kern/act.c4
-rw-r--r--kern/boot_script.c2
-rw-r--r--kern/bootstrap.c5
-rw-r--r--kern/eventcount.c4
-rw-r--r--kern/host.c16
-rw-r--r--kern/lock.c4
-rw-r--r--kern/lock_mon.c6
-rw-r--r--kern/mach_clock.c4
-rw-r--r--kern/pc_sample.c20
-rw-r--r--kern/processor.c4
-rw-r--r--kern/syscall_emulation.c28
-rw-r--r--kern/task.c4
-rw-r--r--kern/xpr.c4
-rw-r--r--kern/zalloc.c6
14 files changed, 67 insertions, 44 deletions
diff --git a/kern/act.c b/kern/act.c
index 0d0baea..a7a8ac9 100644
--- a/kern/act.c
+++ b/kern/act.c
@@ -26,6 +26,8 @@
#ifdef MIGRATING_THREADS
+#include <string.h>
+
#include <mach_ipc_compat.h> /* XXX */
#include <mach/kern_return.h>
#include <mach/alert.h>
@@ -113,7 +115,7 @@ kern_return_t act_create(task_t task, vm_offset_t user_stack,
/* XXX ipt_unlock(act_freelist); */
act->ipt_next = 0;
#endif
- bzero(act, sizeof(*act)); /*XXX shouldn't be needed */
+ memset(act, 0, sizeof(*act)); /*XXX shouldn't be needed */
#ifdef DEBUG
act->lower = act->higher = 0;
diff --git a/kern/boot_script.c b/kern/boot_script.c
index d031752..9349126 100644
--- a/kern/boot_script.c
+++ b/kern/boot_script.c
@@ -3,9 +3,7 @@
/* Written by Shantanu Goel (goel@cs.columbia.edu). */
#include <mach/mach_types.h>
-#if !KERNEL || OSKIT_MACH
#include <string.h>
-#endif
#include "boot_script.h"
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index 19e25ea..3613e38 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -30,6 +30,9 @@
* Bootstrap the various built-in servers.
*/
+#include <alloca.h>
+#include <string.h>
+
#include <mach/port.h>
#include <mach/message.h>
#include <machine/vm_param.h>
@@ -40,7 +43,6 @@
#include <kern/lock.h>
#include <vm/vm_kern.h>
#include <device/device_port.h>
-#include <alloca.h>
#if MACH_KDB
#include <machine/db_machdep.h>
@@ -49,7 +51,6 @@
#if OSKIT_MACH
#include <stddef.h>
-#include <string.h>
#include <oskit/machine/base_multiboot.h>
#include <oskit/exec/exec.h>
#include <oskit/c/stdio.h>
diff --git a/kern/eventcount.c b/kern/eventcount.c
index 1418c82..b562f1a 100644
--- a/kern/eventcount.c
+++ b/kern/eventcount.c
@@ -35,6 +35,8 @@
*
*/
+#include <string.h>
+
#include <mach/machine.h>
#include <kern/ast.h>
#include "cpu_number.h"
@@ -67,7 +69,7 @@ evc_init(evc_t ev)
{
int i;
- bzero((char*)ev, sizeof(*ev));
+ memset(ev, 0, sizeof(*ev));
/* keep track of who is who */
for (i = 0; i < MAX_EVCS; i++)
diff --git a/kern/host.c b/kern/host.c
index a757266..6e98c2c 100644
--- a/kern/host.c
+++ b/kern/host.c
@@ -29,6 +29,8 @@
* Non-ipc host functions.
*/
+#include <string.h>
+
#include <kern/assert.h>
#include <kern/kalloc.h>
#include <kern/host.h>
@@ -182,12 +184,12 @@ kern_return_t host_info(
load_info = (host_load_info_t) info;
- bcopy((char *) avenrun,
- (char *) load_info->avenrun,
- sizeof avenrun);
- bcopy((char *) mach_factor,
- (char *) load_info->mach_factor,
- sizeof mach_factor);
+ memcpy(load_info->avenrun,
+ avenrun,
+ sizeof avenrun);
+ memcpy(load_info->mach_factor,
+ mach_factor,
+ sizeof mach_factor);
*count = HOST_LOAD_INFO_COUNT;
return KERN_SUCCESS;
@@ -302,7 +304,7 @@ host_processor_sets(
return KERN_RESOURCE_SHORTAGE;
}
- bcopy((char *) addr, (char *) newaddr, size_needed);
+ memcpy((char *) newaddr, (char *) addr, size_needed);
kfree(addr, size);
psets = (processor_set_t *) newaddr;
}
diff --git a/kern/lock.c b/kern/lock.c
index 15bc988..ba0f0c2 100644
--- a/kern/lock.c
+++ b/kern/lock.c
@@ -34,6 +34,8 @@
* Locking primitives implementation
*/
+#include <string.h>
+
#include <kern/lock.h>
#include <kern/thread.h>
#include <kern/sched_prim.h>
@@ -219,7 +221,7 @@ void lock_init(
lock_t l,
boolean_t can_sleep)
{
- bzero((char *)l, sizeof(lock_data_t));
+ memset(l, 0, sizeof(lock_data_t));
simple_lock_init(&l->interlock);
l->want_write = FALSE;
l->want_upgrade = FALSE;
diff --git a/kern/lock_mon.c b/kern/lock_mon.c
index 1d92ebf..a9a3989 100644
--- a/kern/lock_mon.c
+++ b/kern/lock_mon.c
@@ -39,6 +39,8 @@
*/
#include <sys/types.h>
+#include <string.h>
+
#include <mach/machine/vm_types.h>
#include <mach/boolean.h>
#include <kern/thread.h>
@@ -263,10 +265,10 @@ lock_info_clear()
for (bucket = 0; bucket < LOCK_INFO_HASH_COUNT; bucket++) {
li = &lock_info[bucket].info[0];
for (i= 0; i< LOCK_INFO_PER_BUCKET; i++, li++) {
- bzero(li, sizeof(struct lock_info));
+ memset(li, 0, sizeof(struct lock_info));
}
}
- bzero(&default_lock_info, sizeof(struct lock_info));
+ memset(&default_lock_info, 0, sizeof(struct lock_info));
}
print_lock_info(li)
diff --git a/kern/mach_clock.c b/kern/mach_clock.c
index 71cd583..d67897b 100644
--- a/kern/mach_clock.c
+++ b/kern/mach_clock.c
@@ -34,6 +34,8 @@
* Clock primitives.
*/
+#include <string.h>
+
#include <mach/boolean.h>
#include <mach/machine.h>
#include <mach/time_value.h>
@@ -491,7 +493,7 @@ void mapable_time_init()
if (kmem_alloc_wired(kernel_map, (vm_offset_t *) &mtime, PAGE_SIZE)
!= KERN_SUCCESS)
panic("mapable_time_init");
- bzero((char *)mtime, PAGE_SIZE);
+ memset(mtime, 0, PAGE_SIZE);
update_mapped_time(&time);
}
diff --git a/kern/pc_sample.c b/kern/pc_sample.c
index 87c7a6c..b414941 100644
--- a/kern/pc_sample.c
+++ b/kern/pc_sample.c
@@ -24,6 +24,8 @@
* the rights to redistribute these changes.
*/
+#include <string.h>
+
#include <mach/mach_types.h> /* vm_address_t */
#include <mach/std_types.h> /* pointer_t */
#include <mach/pc_sample.h>
@@ -174,19 +176,19 @@ get_sampled_pcs(
* Simple case: no wraparound.
* Copy from seqidx1 to seqidx2.
*/
- bcopy((sampled_pc_array_t)cp->buffer + seqidx1 + 1,
- sampled_pcs_out,
- nsamples * sizeof(sampled_pc_t));
+ memcpy(sampled_pcs_out,
+ (sampled_pc_array_t)cp->buffer + seqidx1 + 1,
+ nsamples * sizeof(sampled_pc_t));
} else {
/* seqidx1 > seqidx2 -- Handle wraparound. */
- bcopy((sampled_pc_array_t)cp->buffer + seqidx1 + 1,
- sampled_pcs_out,
- (MAX_PC_SAMPLES - seqidx1 - 1) * sizeof(sampled_pc_t));
+ memcpy(sampled_pcs_out,
+ (sampled_pc_array_t)cp->buffer + seqidx1 + 1,
+ (MAX_PC_SAMPLES - seqidx1 - 1) * sizeof(sampled_pc_t));
- bcopy((sampled_pc_array_t)cp->buffer,
- sampled_pcs_out + (MAX_PC_SAMPLES - seqidx1 - 1),
- (seqidx2 + 1) * sizeof(sampled_pc_t));
+ memcpy(sampled_pcs_out + (MAX_PC_SAMPLES - seqidx1 - 1),
+ (sampled_pc_array_t)cp->buffer,
+ (seqidx2 + 1) * sizeof(sampled_pc_t));
}
} else {
/* could either be zero because of overflow, or because
diff --git a/kern/processor.c b/kern/processor.c
index a6e65c8..df9cb2e 100644
--- a/kern/processor.c
+++ b/kern/processor.c
@@ -27,6 +27,8 @@
* processor.c: processor and processor_set manipulation routines.
*/
+#include <string.h>
+
#include <mach/boolean.h>
#include <mach/policy.h>
#include <mach/processor_info.h>
@@ -971,7 +973,7 @@ processor_set_things(
return KERN_RESOURCE_SHORTAGE;
}
- bcopy((char *) addr, (char *) newaddr, size_needed);
+ memcpy((void *) newaddr, (void *) addr, size_needed);
kfree(addr, size);
addr = newaddr;
}
diff --git a/kern/syscall_emulation.c b/kern/syscall_emulation.c
index 5443a33..06781d5 100644
--- a/kern/syscall_emulation.c
+++ b/kern/syscall_emulation.c
@@ -24,6 +24,8 @@
* the rights to redistribute these changes.
*/
+#include <string.h>
+
#include <mach/error.h>
#include <mach/vm_param.h>
#include <kern/syscall_emulation.h>
@@ -198,9 +200,9 @@ task_set_emulation_vector_internal(task, vector_start, emulation_vector,
* Copy the entries to the new emulation vector,
* deallocate the current one, and use the new one.
*/
- bcopy((char *)&cur_eml->disp_vector[0],
- (char *)&new_eml->disp_vector[cur_start-new_start],
- cur_eml->disp_count * sizeof(vm_offset_t));
+ memcpy(&new_eml->disp_vector[cur_start-new_start],
+ &cur_eml->disp_vector[0],
+ cur_eml->disp_count * sizeof(vm_offset_t));
if (--cur_eml->ref_count == 0)
old_eml = cur_eml; /* discard old vector */
@@ -258,7 +260,7 @@ task_set_emulation_vector_internal(task, vector_start, emulation_vector,
new_size = count_to_size(new_end - new_start);
new_eml = (eml_dispatch_t) kalloc(new_size);
- bzero((char *)new_eml, new_size);
+ memset(new_eml, 0, new_size);
simple_lock_init(&new_eml->lock);
new_eml->ref_count = 1;
new_eml->disp_min = new_start;
@@ -271,9 +273,9 @@ task_set_emulation_vector_internal(task, vector_start, emulation_vector,
* We have the emulation vector.
* Install the new emulation entries.
*/
- bcopy((char *)&emulation_vector[0],
- (char *)&cur_eml->disp_vector[vector_start - cur_eml->disp_min],
- emulation_vector_count * sizeof(vm_offset_t));
+ memcpy(&cur_eml->disp_vector[vector_start - cur_eml->disp_min],
+ &emulation_vector[0],
+ emulation_vector_count * sizeof(vm_offset_t));
task_unlock(task);
@@ -417,9 +419,9 @@ task_get_emulation_vector(task, vector_start, emulation_vector,
*/
*vector_start = eml->disp_min;
*emulation_vector_count = eml->disp_count;
- bcopy((char *)eml->disp_vector,
- (char *)addr,
- vector_size);
+ memcpy((void *)addr,
+ eml->disp_vector,
+ vector_size);
/*
* Unlock the task and free any memory we did not need
@@ -444,7 +446,7 @@ task_get_emulation_vector(task, vector_start, emulation_vector,
*/
size_left = size_used - vector_size;
if (size_left > 0)
- bzero((char *)addr + vector_size, size_left);
+ memset((char *)addr + vector_size, 0, size_left);
/*
* Make memory into copyin form - this unwires it.
@@ -495,8 +497,8 @@ xxx_task_get_emulation_vector(task, vector_start, emulation_vector,
*vector_start = eml->disp_min;
*emulation_vector_count = eml->disp_count;
- bcopy((char *)eml->disp_vector, (char *)emulation_vector,
- *emulation_vector_count * sizeof(vm_offset_t));
+ memcpy(emulation_vector, eml->disp_vector,
+ *emulation_vector_count * sizeof(vm_offset_t));
simple_unlock(&eml->lock);
task_unlock(task);
diff --git a/kern/task.c b/kern/task.c
index c7633c1..f620bdf 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -31,6 +31,8 @@
* Task management primitives implementation.
*/
+#include <string.h>
+
#include <mach/machine/vm_types.h>
#include <mach/vm_param.h>
#include <mach/task_info.h>
@@ -625,7 +627,7 @@ kern_return_t task_threads(
return KERN_RESOURCE_SHORTAGE;
}
- bcopy((char *) addr, (char *) newaddr, size_needed);
+ memcpy((void *) newaddr, (void *) addr, size_needed);
kfree(addr, size);
threads = (thread_t *) newaddr;
}
diff --git a/kern/xpr.c b/kern/xpr.c
index e3e5377..b5f6e71 100644
--- a/kern/xpr.c
+++ b/kern/xpr.c
@@ -27,6 +27,8 @@
/*
* xpr silent tracing circular buffer.
*/
+#include <string.h>
+
#include <kern/xpr.h>
#include <kern/lock.h>
#include "cpu_number.h"
@@ -112,7 +114,7 @@ void xprbootstrap()
* the previous buffer contents.
*/
- bzero((char *) addr, size);
+ memset((char *) addr, 0, size);
}
xprbase = (struct xprbuf *) addr;
diff --git a/kern/zalloc.c b/kern/zalloc.c
index 18239be..48fbb32 100644
--- a/kern/zalloc.c
+++ b/kern/zalloc.c
@@ -34,6 +34,8 @@
* data blocks for which quick allocation/deallocation is possible.
*/
+#include <string.h>
+
#include <kern/macro_help.h>
#include <kern/sched.h>
#include <kern/time_out.h>
@@ -942,7 +944,7 @@ kern_return_t host_zone_info(host, namesp, namesCntp, infop, infoCntp)
used = max_zones * sizeof *names;
if (used != names_size)
- bzero((char *) (names_addr + used), names_size - used);
+ memset((char *) (names_addr + used), 0, names_size - used);
kr = vm_map_copyin(ipc_kernel_map, names_addr, names_size,
TRUE, &copy);
@@ -959,7 +961,7 @@ kern_return_t host_zone_info(host, namesp, namesCntp, infop, infoCntp)
used = max_zones * sizeof *info;
if (used != info_size)
- bzero((char *) (info_addr + used), info_size - used);
+ memset((char *) (info_addr + used), 0, info_size - used);
kr = vm_map_copyin(ipc_kernel_map, info_addr, info_size,
TRUE, &copy);