Deleted Added
full compact
sysv_msg.c (12819) sysv_msg.c (12866)
1/* $Id: sysv_msg.c,v 1.9 1995/10/21 19:49:57 bde Exp $ */
1/* $Id: sysv_msg.c,v 1.10 1995/12/14 08:31:51 phk Exp $ */
2
3/*
4 * Implementation of SVID messages
5 *
6 * Author: Daniel Boulet
7 *
8 * Copyright 1993 Daniel Boulet and RTMX Inc.
9 *

--- 18 unchanged lines hidden (view full) ---

28#include <sys/sysent.h>
29
30static void msginit __P((void *));
31SYSINIT(sysv_msg, SI_SUB_SYSV_MSG, SI_ORDER_FIRST, msginit, NULL)
32
33#define MSG_DEBUG
34#undef MSG_DEBUG_OK
35
2
3/*
4 * Implementation of SVID messages
5 *
6 * Author: Daniel Boulet
7 *
8 * Copyright 1993 Daniel Boulet and RTMX Inc.
9 *

--- 18 unchanged lines hidden (view full) ---

28#include <sys/sysent.h>
29
30static void msginit __P((void *));
31SYSINIT(sysv_msg, SI_SUB_SYSV_MSG, SI_ORDER_FIRST, msginit, NULL)
32
33#define MSG_DEBUG
34#undef MSG_DEBUG_OK
35
36#ifndef _SYS_SYSPROTO_H_
36struct msgctl_args;
37struct msgctl_args;
37static int msgctl __P((struct proc *p, struct msgctl_args *uap, int *retval));
38int msgctl __P((struct proc *p, struct msgctl_args *uap, int *retval));
38struct msgget_args;
39struct msgget_args;
39static int msgget __P((struct proc *p, struct msgget_args *uap, int *retval));
40int msgget __P((struct proc *p, struct msgget_args *uap, int *retval));
40struct msgsnd_args;
41struct msgsnd_args;
41static int msgsnd __P((struct proc *p, struct msgsnd_args *uap, int *retval));
42int msgsnd __P((struct proc *p, struct msgsnd_args *uap, int *retval));
42struct msgrcv_args;
43struct msgrcv_args;
43static int msgrcv __P((struct proc *p, struct msgrcv_args *uap, int *retval));
44int msgrcv __P((struct proc *p, struct msgrcv_args *uap, int *retval));
45#endif
44static void msg_freehdr __P((struct msg *msghdr));
45
46/* XXX casting to (sy_call_t *) is bogus, as usual. */
47static sy_call_t *msgcalls[] = {
48 (sy_call_t *)msgctl, (sy_call_t *)msgget,
49 (sy_call_t *)msgsnd, (sy_call_t *)msgrcv
50};
51

--- 104 unchanged lines hidden (view full) ---

156 msghdr->msg_ts = 0;
157 }
158 if (msghdr->msg_spot != -1)
159 panic("msghdr->msg_spot != -1");
160 msghdr->msg_next = free_msghdrs;
161 free_msghdrs = msghdr;
162}
163
46static void msg_freehdr __P((struct msg *msghdr));
47
48/* XXX casting to (sy_call_t *) is bogus, as usual. */
49static sy_call_t *msgcalls[] = {
50 (sy_call_t *)msgctl, (sy_call_t *)msgget,
51 (sy_call_t *)msgsnd, (sy_call_t *)msgrcv
52};
53

--- 104 unchanged lines hidden (view full) ---

158 msghdr->msg_ts = 0;
159 }
160 if (msghdr->msg_spot != -1)
161 panic("msghdr->msg_spot != -1");
162 msghdr->msg_next = free_msghdrs;
163 free_msghdrs = msghdr;
164}
165
166#ifndef _SYS_SYSPROTO_H_
164struct msgctl_args {
165 int msqid;
166 int cmd;
167struct msgctl_args {
168 int msqid;
169 int cmd;
167 struct msqid_ds *user_msqptr;
170 struct msqid_ds *buf;
168};
171};
172#endif
169
173
170static int
174int
171msgctl(p, uap, retval)
172 struct proc *p;
173 register struct msgctl_args *uap;
174 int *retval;
175{
176 int msqid = uap->msqid;
177 int cmd = uap->cmd;
175msgctl(p, uap, retval)
176 struct proc *p;
177 register struct msgctl_args *uap;
178 int *retval;
179{
180 int msqid = uap->msqid;
181 int cmd = uap->cmd;
178 struct msqid_ds *user_msqptr = uap->user_msqptr;
182 struct msqid_ds *user_msqptr = uap->buf;
179 struct ucred *cred = p->p_ucred;
180 int rval, eval;
181 struct msqid_ds msqbuf;
182 register struct msqid_ds *msqptr;
183
184#ifdef MSG_DEBUG_OK
185 printf("call to msgctl(%d, %d, 0x%x)\n", msqid, cmd, user_msqptr);
186#endif

--- 104 unchanged lines hidden (view full) ---

291 return(EINVAL);
292 }
293
294 if (eval == 0)
295 *retval = rval;
296 return(eval);
297}
298
183 struct ucred *cred = p->p_ucred;
184 int rval, eval;
185 struct msqid_ds msqbuf;
186 register struct msqid_ds *msqptr;
187
188#ifdef MSG_DEBUG_OK
189 printf("call to msgctl(%d, %d, 0x%x)\n", msqid, cmd, user_msqptr);
190#endif

--- 104 unchanged lines hidden (view full) ---

295 return(EINVAL);
296 }
297
298 if (eval == 0)
299 *retval = rval;
300 return(eval);
301}
302
303#ifndef _SYS_SYSPROTO_H_
299struct msgget_args {
300 key_t key;
301 int msgflg;
302};
304struct msgget_args {
305 key_t key;
306 int msgflg;
307};
308#endif
303
309
304static int
310int
305msgget(p, uap, retval)
306 struct proc *p;
307 register struct msgget_args *uap;
308 int *retval;
309{
310 int msqid, eval;
311 int key = uap->key;
312 int msgflg = uap->msgflg;

--- 83 unchanged lines hidden (view full) ---

396 }
397
398found:
399 /* Construct the unique msqid */
400 *retval = IXSEQ_TO_IPCID(msqid, msqptr->msg_perm);
401 return(0);
402}
403
311msgget(p, uap, retval)
312 struct proc *p;
313 register struct msgget_args *uap;
314 int *retval;
315{
316 int msqid, eval;
317 int key = uap->key;
318 int msgflg = uap->msgflg;

--- 83 unchanged lines hidden (view full) ---

402 }
403
404found:
405 /* Construct the unique msqid */
406 *retval = IXSEQ_TO_IPCID(msqid, msqptr->msg_perm);
407 return(0);
408}
409
410#ifndef _SYS_SYSPROTO_H_
404struct msgsnd_args {
405 int msqid;
411struct msgsnd_args {
412 int msqid;
406 void *user_msgp;
413 void *msgp;
407 size_t msgsz;
408 int msgflg;
409};
414 size_t msgsz;
415 int msgflg;
416};
417#endif
410
418
411static int
419int
412msgsnd(p, uap, retval)
413 struct proc *p;
414 register struct msgsnd_args *uap;
415 int *retval;
416{
417 int msqid = uap->msqid;
420msgsnd(p, uap, retval)
421 struct proc *p;
422 register struct msgsnd_args *uap;
423 int *retval;
424{
425 int msqid = uap->msqid;
418 void *user_msgp = uap->user_msgp;
426 void *user_msgp = uap->msgp;
419 size_t msgsz = uap->msgsz;
420 int msgflg = uap->msgflg;
421 int segs_needed, eval;
422 struct ucred *cred = p->p_ucred;
423 register struct msqid_ds *msqptr;
424 register struct msg *msghdr;
425 short next;
426

--- 303 unchanged lines hidden (view full) ---

730 msqptr->msg_lspid = p->p_pid;
731 msqptr->msg_stime = time.tv_sec;
732
733 wakeup((caddr_t)msqptr);
734 *retval = 0;
735 return(0);
736}
737
427 size_t msgsz = uap->msgsz;
428 int msgflg = uap->msgflg;
429 int segs_needed, eval;
430 struct ucred *cred = p->p_ucred;
431 register struct msqid_ds *msqptr;
432 register struct msg *msghdr;
433 short next;
434

--- 303 unchanged lines hidden (view full) ---

738 msqptr->msg_lspid = p->p_pid;
739 msqptr->msg_stime = time.tv_sec;
740
741 wakeup((caddr_t)msqptr);
742 *retval = 0;
743 return(0);
744}
745
746#ifndef _SYS_SYSPROTO_H_
738struct msgrcv_args {
739 int msqid;
740 void *msgp;
741 size_t msgsz;
742 long msgtyp;
743 int msgflg;
744};
747struct msgrcv_args {
748 int msqid;
749 void *msgp;
750 size_t msgsz;
751 long msgtyp;
752 int msgflg;
753};
754#endif
745
755
746static int
756int
747msgrcv(p, uap, retval)
748 struct proc *p;
749 register struct msgrcv_args *uap;
750 int *retval;
751{
752 int msqid = uap->msqid;
753 void *user_msgp = uap->msgp;
754 size_t msgsz = uap->msgsz;

--- 268 unchanged lines hidden ---
757msgrcv(p, uap, retval)
758 struct proc *p;
759 register struct msgrcv_args *uap;
760 int *retval;
761{
762 int msqid = uap->msqid;
763 void *user_msgp = uap->msgp;
764 size_t msgsz = uap->msgsz;

--- 268 unchanged lines hidden ---