From 5b976b6d8d996bf25028267a42ebd0f20149113c Mon Sep 17 00:00:00 2001 From: dillon Date: Mon, 14 Dec 1998 08:34:55 +0000 Subject: [PATCH] Fixed problems with kernel config file overrides of sysv semaphore parameters. Prior to this fix a kernel config override would effect only some of the kernel files, resulting in panics. PR: kern/9068 --- sys/conf/param.c | 4 +++- sys/kern/subr_param.c | 4 +++- sys/kern/sysv_sem.c | 4 ++-- sys/sys/sem.h | 6 +++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sys/conf/param.c b/sys/conf/param.c index 6736b9688de2..ef98c59c6e25 100644 --- a/sys/conf/param.c +++ b/sys/conf/param.c @@ -36,9 +36,11 @@ * SUCH DAMAGE. * * @(#)param.c 8.3 (Berkeley) 8/20/94 - * $Id: param.c,v 1.30 1998/07/11 13:06:38 bde Exp $ + * $Id: param.c,v 1.31 1998/11/05 14:28:17 dg Exp $ */ +#include + #include "opt_sysvipc.h" #include "opt_param.h" diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index 6736b9688de2..ef98c59c6e25 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -36,9 +36,11 @@ * SUCH DAMAGE. * * @(#)param.c 8.3 (Berkeley) 8/20/94 - * $Id: param.c,v 1.30 1998/07/11 13:06:38 bde Exp $ + * $Id: param.c,v 1.31 1998/11/05 14:28:17 dg Exp $ */ +#include + #include "opt_sysvipc.h" #include "opt_param.h" diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index d35bbca0b818..fb04c42b029a 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1,4 +1,4 @@ -/* $Id: sysv_sem.c,v 1.20 1997/11/06 19:29:24 phk Exp $ */ +/* $Id: sysv_sem.c,v 1.21 1998/03/30 09:50:41 phk Exp $ */ /* * Implementation of SVID semaphores @@ -276,7 +276,7 @@ semundo_adjust(p, supptr, semid, semnum, adjval) /* Didn't find the right entry - create it */ if (adjval == 0) return(0); - if (suptr->un_cnt != SEMUME) { + if (suptr->un_cnt != seminfo.semume) { sunptr = &suptr->un_ent[suptr->un_cnt]; suptr->un_cnt++; sunptr->un_adjval = adjval; diff --git a/sys/sys/sem.h b/sys/sys/sem.h index a57e9b886a71..77681806ab95 100644 --- a/sys/sys/sem.h +++ b/sys/sys/sem.h @@ -1,4 +1,4 @@ -/* $Id: sem.h,v 1.14 1998/05/31 04:09:09 steve Exp $ */ +/* $Id: sem.h,v 1.15 1998/07/15 02:32:32 bde Exp $ */ /* $NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $ */ /* @@ -141,7 +141,7 @@ extern struct seminfo seminfo; #endif /* actual size of an undo structure */ -#define SEMUSZ (sizeof(struct sem_undo)+sizeof(struct undo)*SEMUME) +#define SEMUSZ (offsetof(struct sem_undo, un_ent[SEMUME])) extern struct semid_ds *sema; /* semaphore id pool */ extern struct sem *sem; /* semaphore pool */ @@ -150,7 +150,7 @@ extern int *semu; /* undo structure pool */ /* * Macro to find a particular sem_undo vector */ -#define SEMU(ix) ((struct sem_undo *)(((intptr_t)semu)+ix * SEMUSZ)) +#define SEMU(ix) ((struct sem_undo *)(((intptr_t)semu)+ix * seminfo.semusz)) /* * Process sem_undo vectors at proc exit.