diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2007-09-07 15:00:21 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2007-09-07 15:00:21 +0000 |
commit | 85ce33f47337d8ae2200b69c865bad9704a53564 (patch) | |
tree | 45c03da13cdd18d57180b1614667ab28a7a26012 /sys/kern/sysv_sem.c | |
parent | 27eb8946aec561bdd8abb9e09db43d6f4093d59a (diff) |
Use M_ZERO in a few more places to shave bytes from the kernel.
eyeballed and ok dlg@
Diffstat (limited to 'sys/kern/sysv_sem.c')
-rw-r--r-- | sys/kern/sysv_sem.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index c680a97b928..fe14f0731e3 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_sem.c,v 1.33 2006/08/10 17:03:48 millert Exp $ */ +/* $OpenBSD: sysv_sem.c,v 1.34 2007/09/07 15:00:20 art Exp $ */ /* $NetBSD: sysv_sem.c,v 1.26 1996/02/09 19:00:25 christos Exp $ */ /* @@ -72,11 +72,9 @@ seminit(void) pool_init(&semu_pool, SEMUSZ, 0, 0, 0, "semupl", &pool_allocator_nointr); sema = malloc(seminfo.semmni * sizeof(struct semid_ds *), - M_SEM, M_WAITOK); - bzero(sema, seminfo.semmni * sizeof(struct semid_ds *)); + M_SEM, M_WAITOK|M_ZERO); semseqs = malloc(seminfo.semmni * sizeof(unsigned short), - M_SEM, M_WAITOK); - bzero(semseqs, seminfo.semmni * sizeof(unsigned short)); + M_SEM, M_WAITOK|M_ZERO); SLIST_INIT(&semu_list); } @@ -416,8 +414,7 @@ sys_semget(struct proc *p, void *v, register_t *retval) } semaptr_new = pool_get(&sema_pool, PR_WAITOK); semaptr_new->sem_base = malloc(nsems * sizeof(struct sem), - M_SEM, M_WAITOK); - bzero(semaptr_new->sem_base, nsems * sizeof(struct sem)); + M_SEM, M_WAITOK|M_ZERO); } if (key != IPC_PRIVATE) { @@ -851,16 +848,13 @@ sysctl_sysvsem(int *name, u_int namelen, void *oldp, size_t *oldlenp, /* Expand semsegs and semseqs arrays */ sema_new = malloc(val * sizeof(struct semid_ds *), - M_SEM, M_WAITOK); + M_SEM, M_WAITOK|M_ZERO); bcopy(sema, sema_new, seminfo.semmni * sizeof(struct semid_ds *)); - bzero(sema_new + seminfo.semmni, - (val - seminfo.semmni) * sizeof(struct semid_ds *)); - newseqs = malloc(val * sizeof(unsigned short), M_SEM, M_WAITOK); + newseqs = malloc(val * sizeof(unsigned short), M_SEM, + M_WAITOK|M_ZERO); bcopy(semseqs, newseqs, seminfo.semmni * sizeof(unsigned short)); - bzero(newseqs + seminfo.semmni, - (val - seminfo.semmni) * sizeof(unsigned short)); free(sema, M_SEM); free(semseqs, M_SEM); sema = sema_new; |