diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2006-11-05 18:54:52 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2009-06-18 00:26:50 +0200 |
commit | ffc607f8a4c1c6f1c63a7b61b54f185ada87a9a5 (patch) | |
tree | 35fb5835c103b647de4de4a53ba94e4b1b5cb563 /ipc | |
parent | 7e8b31e61e4bd9207bde37662e757a5988c556df (diff) | |
download | gnumach-ffc607f8a4c1c6f1c63a7b61b54f185ada87a9a5.tar.gz gnumach-ffc607f8a4c1c6f1c63a7b61b54f185ada87a9a5.tar.bz2 gnumach-ffc607f8a4c1c6f1c63a7b61b54f185ada87a9a5.zip |
2006-11-05 Barry deFreese <bddebian@comcast.net>
memcpy/memset cleanup.
* include/string.h: New file.
* include/mach/mig_support.h: Include `string.h'.
[MACH_KERNEL] (bcopy): Remove extern declaration.
[MACH_KERNEL] (memcpy): Remove macro.
* device/cirbuf.c: Include `string.h'.
(q_to_b, b_to_q): Replace bcopy() with memcpy() and bzero() with
memset(), clean memcpy() and memset() invocation.
* device/cons.c (cnputc): Likewise.
* device/dev_pager.c (device_pager_data_request_done): Likewise.
* device/ds_routines.c (device_write_get, ds_read_done): Likewise.
* device/kmsg.c: Likewise.
* device/net_io.c (net_filter, net_set_filter, net_getstat): Likewise.
* i386/i386/fpu.c (fpu_set_state, fpu_get_state) fp_load)
(fp_state_alloc): Likewise.
* i386/i386/iopb.c (io_tss_init, i386_io_port_list): Likewise.
* i386/i386/mp_desc.c (mp_desc_init): Likewise.
* i386/i386/pcb.c (pcb_init, thread_setstatus)
(thread_getstatus): Likewise.
* i386/i386/phys.c (pmap_zero_page, pmap_copy_page, copy_to_phys)
(copy_from_phys): Likewise.
* i386/i386/trap.c (v86_assist): Likewise.
* i386/i386/user_ldt.c (i386_set_ldt, i386_get_ldt): Likewise.
* i386/i386at/immc.c (immc_cnputc): Likewise.
* i386/i386at/kd_event.c (X_kdb_enter_init, X_kdb_exit_init): Likewise.
* i386/intel/pmap.c (pmap_init, pmap_page_table_page_alloc)
(pmap_create): Likewise.
* ipc/ipc_entry.c (ipc_entry_grow_table): Likewise.
* ipc/ipc_kmsg.c (ipc_kmsg_get_from_kernel)
(ipc_kmsg_put_to_kernel): Likewise.
* ipc/ipc_object.c (ipc_object_alloc, ipc_object_alloc_name): Likewise.
* ipc/ipc_port.c (ipc_port_dngrow): Likewise.
* ipc/ipc_space.c: Likewise.
* ipc/mach_debug.c (mach_port_space_info)
(mach_port_space_info): Likewise.
* kern/act.c (act_create): Likewise.
* kern/boot_script.c: Likewise.
* kern/bootstrap.c: Likewise.
* kern/eventcount.c (evc_init): Likewise.
* kern/host.c (host_info, host_processor_sets): Likewise.
* kern/lock.c (lock_init): Likewise.
* kern/lock_mon.c (lock_info_clear): Likewise.
* kern/mach_clock.c (mapable_time_init): Likewise.
* kern/pc_sample.c (get_sampled_pcs): Likewise.
* kern/processor.c (processor_set_things): Likewise.
* kern/syscall_emulation.c (task_set_emulation_vector_internal)
(task_get_emulation_vector, xxx_task_get_emulation_vector): Likewise.
* kern/task.c (task_threads): Likewise.
* kern/xpr.c (xprbootstrap): Likewise.
* kern/zalloc.c (host_zone_info): Likewise.
* vm/vm_debug.c (mach_vm_object_pages): Likewise.
* vm/vm_kern.c (projected_buffer_allocate, copyinmap)
(copyoutmap): Likewise.
* vm/vm_object.c (vm_object_bootstrap): Likewise.
* vm/vm_resident.c (vm_page_grab_contiguous_pages): Likewise.
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/ipc_entry.c | 4 | ||||
-rw-r--r-- | ipc/ipc_kmsg.c | 6 | ||||
-rw-r--r-- | ipc/ipc_object.c | 10 | ||||
-rw-r--r-- | ipc/ipc_port.c | 4 | ||||
-rw-r--r-- | ipc/ipc_space.c | 2 | ||||
-rw-r--r-- | ipc/mach_debug.c | 6 |
6 files changed, 22 insertions, 10 deletions
diff --git a/ipc/ipc_entry.c b/ipc/ipc_entry.c index 523f0704..85404b6a 100644 --- a/ipc/ipc_entry.c +++ b/ipc/ipc_entry.c @@ -34,6 +34,8 @@ * Primitive functions to manipulate translation entries. */ +#include <string.h> + #include <mach/kern_return.h> #include <mach/port.h> #include <kern/assert.h> @@ -635,7 +637,7 @@ ipc_entry_grow_table(space) */ if (!it_entries_reallocable(oits)) - (void) memcpy((void *) table, (const void *) otable, + memcpy(table, otable, osize * sizeof(struct ipc_entry)); for (i = 0; i < osize; i++) diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c index 12bd0c77..100cc93c 100644 --- a/ipc/ipc_kmsg.c +++ b/ipc/ipc_kmsg.c @@ -34,6 +34,8 @@ * Operations on kernel messages. */ +#include <string.h> + #include <mach/boolean.h> #include <mach/kern_return.h> #include <mach/message.h> @@ -558,7 +560,7 @@ ipc_kmsg_get_from_kernel(msg, size, kmsgp) return MACH_SEND_NO_BUFFER; ikm_init(kmsg, size); - bcopy((char *) msg, (char *) &kmsg->ikm_header, size); + memcpy(&kmsg->ikm_header, msg, size); kmsg->ikm_header.msgh_size = size; *kmsgp = kmsg; @@ -623,7 +625,7 @@ ipc_kmsg_put_to_kernel( assert(!KMSG_IN_DIPC(kmsg)); #endif /* DIPC */ - (void) memcpy((void *) msg, (const void *) &kmsg->ikm_header, size); + memcpy(msg, &kmsg->ikm_header, size); ikm_free(kmsg); } diff --git a/ipc/ipc_object.c b/ipc/ipc_object.c index e0cbbc3d..713a581c 100644 --- a/ipc/ipc_object.c +++ b/ipc/ipc_object.c @@ -31,6 +31,8 @@ * Functions to manipulate IPC objects. */ +#include <string.h> + #include <mach/boolean.h> #include <mach/kern_return.h> #include <mach/port.h> @@ -239,11 +241,11 @@ ipc_object_alloc( if (otype == IOT_PORT) { ipc_port_t port = (ipc_port_t)object; - bzero((char *)port, sizeof(*port)); + memset(port, 0, sizeof(*port)); } else if (otype == IOT_PORT_SET) { ipc_pset_t pset = (ipc_pset_t)object; - bzero((char *)pset, sizeof(*pset)); + memset(pset, 0, sizeof(*pset)); } kr = ipc_entry_alloc(space, namep, &entry); if (kr != KERN_SUCCESS) { @@ -305,11 +307,11 @@ ipc_object_alloc_name( if (otype == IOT_PORT) { ipc_port_t port = (ipc_port_t)object; - bzero((char *)port, sizeof(*port)); + memset(port, 0, sizeof(*port)); } else if (otype == IOT_PORT_SET) { ipc_pset_t pset = (ipc_pset_t)object; - bzero((char *)pset, sizeof(*pset)); + memset(pset, 0, sizeof(*pset)); } kr = ipc_entry_alloc_name(space, name, &entry); diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c index aaba82d7..a23375cd 100644 --- a/ipc/ipc_port.c +++ b/ipc/ipc_port.c @@ -34,6 +34,8 @@ * Functions to manipulate IPC ports. */ +#include <string.h> + #include <mach/port.h> #include <mach/kern_return.h> #include <kern/lock.h> @@ -182,7 +184,7 @@ ipc_port_dngrow(port) osize = oits->its_size; free = otable->ipr_next; - bcopy((char *)(otable + 1), (char *)(ntable + 1), + memcpy((ntable + 1), (otable + 1), (osize - 1) * sizeof(struct ipc_port_request)); } else { osize = 1; diff --git a/ipc/ipc_space.c b/ipc/ipc_space.c index e3817f5b..444f400f 100644 --- a/ipc/ipc_space.c +++ b/ipc/ipc_space.c @@ -36,6 +36,8 @@ * Functions to manipulate IPC capability spaces. */ +#include <string.h> + #include <mach/boolean.h> #include <mach/kern_return.h> #include <mach/port.h> diff --git a/ipc/mach_debug.c b/ipc/mach_debug.c index 04d0c74a..acb9f974 100644 --- a/ipc/mach_debug.c +++ b/ipc/mach_debug.c @@ -33,6 +33,8 @@ * Exported kernel calls. See mach_debug/mach_debug.defs. */ +#include <string.h> + #include <mach/kern_return.h> #include <mach/port.h> #include <mach/machine/vm_types.h> @@ -453,7 +455,7 @@ mach_port_space_info( table_size - rsize_used); if (size_used != rsize_used) - bzero((char *) (table_addr + size_used), + memset((char *) (table_addr + size_used), 0, rsize_used - size_used); kr = vm_map_copyin(ipc_kernel_map, table_addr, rsize_used, @@ -488,7 +490,7 @@ mach_port_space_info( tree_size - rsize_used); if (size_used != rsize_used) - bzero((char *) (tree_addr + size_used), + memset((char *) (tree_addr + size_used), 0, rsize_used - size_used); kr = vm_map_copyin(ipc_kernel_map, tree_addr, rsize_used, |