summaryrefslogtreecommitdiff
path: root/exec
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-12-01 23:55:25 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-12-10 13:45:05 +0100
commit0a4ada8d40fb687a659161ff7e0d1d0994264402 (patch)
tree9bba4a3017b9943de69c112e7e6d8aa3f04afefe /exec
parent51c2bd7408b0a4ee73ecd1928d4c17d4fafb1ec2 (diff)
Replace `bzero' with `memset'
For reference, this patch was created using the following semantic patch, and then manually applying the change in all functions containing nested functions, as those are not supported by Coccinelle. @@ expression A, B; @@ - bzero (A, B) + memset (A, 0, B) * auth/auth.c: Replace `bzero' with `memset'. * boot/boot.c: Likewise. * defpager/defpager.c: Likewise. * exec/exec.c: Likewise. Also, drop `safe_bzero' and just use `hurd_safe_memset' directly. * ext2fs/ext2fs.c: Likewise. * ext2fs/getblk.c: Likewise. * ext2fs/pager.c: Likewise. * fatfs/pager.c: Likewise. * ftpfs/dir.c: Likewise. * ftpfs/netfs.c: Likewise. * isofs/inode.c: Likewise. * isofs/pager.c: Likewise. * libdiskfs/file-getfh.c: Likewise. * libdiskfs/file-statfs.c: Likewise. * libfshelp/fetch-root.c: Likewise. * libfshelp/start-translator.c: Likewise. * libftpconn/create.c: Likewise. * libftpconn/open.c: Likewise. * libftpconn/unix.c: Likewise. * libpipe/pipe.c: Likewise. * libps/procstat.c: Likewise. * libps/spec.c: Likewise. * libshouldbeinlibc/cacheq.c: Likewise. * libshouldbeinlibc/idvec.c: Likewise. * libshouldbeinlibc/ugids.c: Likewise. * libstore/argp.c: Likewise. * libstore/enc.c: Likewise. * libstore/kids.c: Likewise. * libthreads/alpha/thread.c: Likewise. * libtreefs/fsys.c: Likewise. * libtrivfs/file-statfs.c: Likewise. * mach-defpager/default_pager.c: Likewise. * pfinet/glue-include/asm/uaccess.h: Likewise. * pfinet/io-ops.c: Likewise. * pfinet/options.c: Likewise. * pfinet/socket.c: Likewise. * pfinet/timer-emul.c: Likewise. * pflocal/io.c: Likewise. * startup/startup.c: Likewise. * storeio/storeio.c: Likewise. * sutils/fstab.c: Likewise. * usermux/usermux.c: Likewise. * utils/fakeauth.c: Likewise. * utils/frobauth.c: Likewise. * utils/login.c: Likewise. * utils/x.c: Likewise.
Diffstat (limited to 'exec')
-rw-r--r--exec/exec.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/exec/exec.c b/exec/exec.c
index 0ecf2d3e..bbe02446 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -47,13 +47,6 @@ pthread_rwlock_t std_lock = PTHREAD_RWLOCK_INITIALIZER;
#include <hurd/sigpreempt.h>
-static error_t
-safe_bzero (void *ptr, size_t size)
-{
- return hurd_safe_memset (ptr, 0, size);
-}
-
-
/* Load or allocate a section. */
static void
load_section (void *section, struct execdata *u)
@@ -328,7 +321,9 @@ load_section (void *section, struct execdata *u)
vm_deallocate (u->task, mapstart, memsz);
return;
}
- u->error = safe_bzero ((void *) (ourpage + (addr - overlap_page)),
+ u->error = hurd_safe_memset (
+ (void *) (ourpage + (addr - overlap_page)),
+ 0,
size - (addr - overlap_page));
if (! u->error && !(vm_prot & VM_PROT_WRITE))
u->error = vm_protect (u->task, overlap_page, size,
@@ -887,7 +882,7 @@ do_exec (file_t file,
pthread_rwlock_unlock (&std_lock);
goto out;
}
- bzero (&boot->pi + 1, (char *) &boot[1] - (char *) (&boot->pi + 1));
+ memset (&boot->pi + 1, 0, (char *) &boot[1] - (char *) (&boot->pi + 1));
/* These flags say the information we pass through to the new program
may need to be modified. */
@@ -960,7 +955,7 @@ do_exec (file_t file,
/* Keep track of which ports in BOOT->portarray come from the original
PORTARRAY, and which we replace. */
ports_replaced = alloca (boot->nports * sizeof *ports_replaced);
- bzero (ports_replaced, boot->nports * sizeof *ports_replaced);
+ memset (ports_replaced, 0, boot->nports * sizeof *ports_replaced);
if (portarray[INIT_PORT_BOOTSTRAP] == MACH_PORT_NULL &&
oldtask != MACH_PORT_NULL)
@@ -1326,7 +1321,8 @@ do_exec (file_t file,
/* Kill the pointers to the argument information so the cleanup
of BOOT doesn't deallocate it. It will be deallocated my MiG
when we return the error. */
- bzero (&boot->pi + 1, (char *) &boot[1] - (char *) (&boot->pi + 1));
+ memset (&boot->pi + 1, 0,
+ (char *) &boot[1] - (char *) (&boot->pi + 1));
else
/* Do this before we release the last reference. */
if (boot->nports > INIT_PORT_PROC)