diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index 533cf75f7222..2fec3d966398 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -1,4 +1,4 @@ -/* $Id: sysv_msg.c,v 1.7 1995/08/30 00:33:00 bde Exp $ */ +/* $Id: sysv_msg.c,v 1.8 1995/09/09 18:10:06 davidg Exp $ */ /* * Implementation of SVID messages @@ -21,10 +21,11 @@ #include #include +#include #include #include #include -#include +#include static void msginit __P((void *)); SYSINIT(sysv_msg, SI_SUB_SYSV_MSG, SI_ORDER_FIRST, msginit, NULL) @@ -32,9 +33,21 @@ SYSINIT(sysv_msg, SI_SUB_SYSV_MSG, SI_ORDER_FIRST, msginit, NULL) #define MSG_DEBUG #undef MSG_DEBUG_OK -static int msgctl(), msgget(), msgsnd(), msgrcv(); +struct msgctl_args; +static int msgctl __P((struct proc *p, struct msgctl_args *uap, int *retval)); +struct msgget_args; +static int msgget __P((struct proc *p, struct msgget_args *uap, int *retval)); +struct msgsnd_args; +static int msgsnd __P((struct proc *p, struct msgsnd_args *uap, int *retval)); +struct msgrcv_args; +static int msgrcv __P((struct proc *p, struct msgrcv_args *uap, int *retval)); +static void msg_freehdr __P((struct msg *msghdr)); -int (*msgcalls[])() = { msgctl, msgget, msgsnd, msgrcv }; +/* XXX casting to (sy_call_t *) is bogus, as usual. */ +sy_call_t *msgcalls[] = { + (sy_call_t *)msgctl, (sy_call_t *)msgget, + (sy_call_t *)msgsnd, (sy_call_t *)msgrcv +}; int nfree_msgmaps; /* # of free map entries */ short free_msgmaps; /* head of linked list of free map entries */ @@ -45,8 +58,8 @@ struct msg *msghdrs; /* MSGTQL msg headers */ struct msqid_ds *msqids; /* MSGMNI msqid_ds struct's */ void -msginit(udata) - void *udata; +msginit(dummy) + void *dummy; { register int i; @@ -104,21 +117,24 @@ msginit(udata) /* * Entry point for all MSG calls */ - -struct msgsys_args { - u_int which; -}; - int msgsys(p, uap, retval) - struct caller *p; - struct msgsys_args *uap; + struct proc *p; + /* XXX actually varargs. */ + struct msgsys_args /* { + u_int which; + int a2; + int a3; + int a4; + int a5; + int a6; + } */ *uap; int *retval; { if (uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0])) return (EINVAL); - return ((*msgcalls[uap->which])(p, &uap[1], retval)); + return ((*msgcalls[uap->which])(p, &uap->a2, retval)); } static void @@ -151,7 +167,7 @@ struct msgctl_args { struct msqid_ds *user_msqptr; }; -int +static int msgctl(p, uap, retval) struct proc *p; register struct msgctl_args *uap; @@ -285,7 +301,7 @@ struct msgget_args { int msgflg; }; -int +static int msgget(p, uap, retval) struct proc *p; register struct msgget_args *uap; @@ -392,7 +408,7 @@ struct msgsnd_args { int msgflg; }; -int +static int msgsnd(p, uap, retval) struct proc *p; register struct msgsnd_args *uap; @@ -727,7 +743,7 @@ struct msgrcv_args { int msgflg; }; -int +static int msgrcv(p, uap, retval) struct proc *p; register struct msgrcv_args *uap; diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index afcbc6d3e56a..ff4acaefeaf1 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1,4 +1,4 @@ -/* $Id: sysv_sem.c,v 1.8 1995/08/30 00:33:01 bde Exp $ */ +/* $Id: sysv_sem.c,v 1.9 1995/09/09 18:10:07 davidg Exp $ */ /* * Implementation of SVID semaphores @@ -10,16 +10,35 @@ #include #include +#include #include #include #include -#include +#include static void seminit __P((void *)); SYSINIT(sysv_sem, SI_SUB_SYSV_SEM, SI_ORDER_FIRST, seminit, NULL) -static int semctl(), semget(), semop(), semconfig(); -int (*semcalls[])() = { semctl, semget, semop, semconfig }; +struct semctl_args; +static int semctl __P((struct proc *p, struct semctl_args *uap, int *retval)); +struct semget_args; +static int semget __P((struct proc *p, struct semget_args *uap, int *retval)); +struct semop_args; +static int semop __P((struct proc *p, struct semop_args *uap, int *retval)); +struct semconfig_args; +static int semconfig __P((struct proc *p, struct semconfig_args *uap, int *retval)); + +struct sem_undo *semu_alloc __P((struct proc *p)); +int semundo_adjust __P((struct proc *p, struct sem_undo **supptr, int semid, int semnum, int adjval)); +void semundo_clear __P((int semid, int semnum)); +void semexit __P((struct proc *p)); + +/* XXX casting to (sy_call_t *) is bogus, as usual. */ +sy_call_t *semcalls[] = { + (sy_call_t *)semctl, (sy_call_t *)semget, + (sy_call_t *)semop, (sy_call_t *)semconfig +}; + int semtot = 0; struct semid_ds *sema; /* semaphore id pool */ struct sem *sem; /* semaphore pool */ @@ -30,8 +49,8 @@ int *semu; /* undo structure pool */ static struct proc *semlock_holder = NULL; void -seminit(udata) - void *udata; +seminit(dummy) + void *dummy; { register int i; @@ -54,15 +73,17 @@ seminit(udata) /* * Entry point for all SEM calls */ - -struct semsys_args { - u_int which; -}; - int semsys(p, uap, retval) struct proc *p; - struct semsys_args *uap; + /* XXX actually varargs. */ + struct semsys_args /* { + u_int which; + int a2; + int a3; + int a4; + int a5; + } */ *uap; int *retval; { @@ -71,7 +92,7 @@ semsys(p, uap, retval) if (uap->which >= sizeof(semcalls)/sizeof(semcalls[0])) return (EINVAL); - return ((*semcalls[uap->which])(p, &uap[1], retval)); + return ((*semcalls[uap->which])(p, &uap->a2, retval)); } /* @@ -93,7 +114,7 @@ struct semconfig_args { semconfig_ctl_t flag; }; -int +static int semconfig(p, uap, retval) struct proc *p; struct semconfig_args *uap; @@ -299,7 +320,7 @@ struct semctl_args { union semun *arg; }; -int +static int semctl(p, uap, retval) struct proc *p; register struct semctl_args *uap; @@ -462,7 +483,7 @@ struct semget_args { int semflg; }; -int +static int semget(p, uap, retval) struct proc *p; register struct semget_args *uap; @@ -575,7 +596,7 @@ struct semop_args { int nsops; }; -int +static int semop(p, uap, retval) struct proc *p; register struct semop_args *uap; diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index ffbad311d083..a396ea358585 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $Id: sysv_shm.c,v 1.8 1995/08/30 00:33:02 bde Exp $ */ +/* $Id: sysv_shm.c,v 1.9 1995/09/09 18:10:09 davidg Exp $ */ /* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */ /* @@ -31,29 +31,44 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include +#include +#include #include #include #include -#include -#include #include #include -#include #include +#include #include #include -#include #include +struct shmat_args; +extern int shmat __P((struct proc *p, struct shmat_args *uap, int *retval)); +struct shmctl_args; +extern int shmctl __P((struct proc *p, struct shmctl_args *uap, int *retval)); +struct shmdt_args; +extern int shmdt __P((struct proc *p, struct shmdt_args *uap, int *retval)); +struct shmget_args; +extern int shmget __P((struct proc *p, struct shmget_args *uap, int *retval)); + static void shminit __P((void *)); SYSINIT(sysv_shm, SI_SUB_SYSV_SHM, SI_ORDER_FIRST, shminit, NULL) -int oshmctl(); -int shmat(), shmctl(), shmdt(), shmget(); -int (*shmcalls[])() = { shmat, oshmctl, shmdt, shmget, shmctl }; +struct oshmctl_args; +int oshmctl __P((struct proc *p, struct oshmctl_args *uap, int *retval)); +static int shmget_allocate_segment __P((struct proc *p, struct shmget_args *uap, int mode, int *retval)); +static int shmget_existing __P((struct proc *p, struct shmget_args *uap, int mode, int segnum, int *retval)); + +/* XXX casting to (sy_call_t *) is bogus, as usual. */ +sy_call_t *shmcalls[] = { + (sy_call_t *)shmat, (sy_call_t *)oshmctl, + (sy_call_t *)shmdt, (sy_call_t *)shmget, + (sy_call_t *)shmctl +}; #define SHMSEG_FREE 0x0200 #define SHMSEG_REMOVED 0x0400 @@ -296,7 +311,8 @@ oshmctl(p, uap, retval) return error; break; default: - return shmctl(p, uap, retval); + /* XXX casting to (sy_call_t *) is bogus, as usual. */ + return ((sy_call_t *)shmctl)(p, uap, retval); } return 0; #else @@ -507,19 +523,22 @@ shmget(p, uap, retval) return shmget_allocate_segment(p, uap, mode, retval); } -struct shmsys_args { - u_int which; -}; int shmsys(p, uap, retval) struct proc *p; - struct shmsys_args *uap; + /* XXX actually varargs. */ + struct shmsys_args /* { + u_int which; + int a2; + int a3; + int a4; + } */ *uap; int *retval; { if (uap->which >= sizeof(shmcalls)/sizeof(shmcalls[0])) return EINVAL; - return ((*shmcalls[uap->which])(p, &uap[1], retval)); + return ((*shmcalls[uap->which])(p, &uap->a2, retval)); } void @@ -556,8 +575,8 @@ shmexit(p) } void -shminit(udata) - void *udata; +shminit(dummy) + void *dummy; { int i; vm_offset_t garbage1, garbage2;