Deleted Added
full compact
sysv_msg.c (2729) sysv_msg.c (2836)
1/* $Id$ */
1/* $Id: sysv_msg.c,v 1.1 1994/09/13 14:46:57 dfr Exp $ */
2
3/*
4 * Implementation of SVID messages
5 *
6 * Author: Daniel Boulet
7 *
8 * Copyright 1993 Daniel Boulet and RTMX Inc.
9 *

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

32static int msgctl(), msgget(), msgsnd(), msgrcv();
33
34int (*msgcalls[])() = { msgctl, msgget, msgsnd, msgrcv };
35
36int nfree_msgmaps; /* # of free map entries */
37short free_msgmaps; /* head of linked list of free map entries */
38struct msg *free_msghdrs; /* list of free msg headers */
39
2
3/*
4 * Implementation of SVID messages
5 *
6 * Author: Daniel Boulet
7 *
8 * Copyright 1993 Daniel Boulet and RTMX Inc.
9 *

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

32static int msgctl(), msgget(), msgsnd(), msgrcv();
33
34int (*msgcalls[])() = { msgctl, msgget, msgsnd, msgrcv };
35
36int nfree_msgmaps; /* # of free map entries */
37short free_msgmaps; /* head of linked list of free map entries */
38struct msg *free_msghdrs; /* list of free msg headers */
39
40int
40void
41msginit()
42{
43 register int i;
44 vm_offset_t whocares1, whocares2;
45
46 /*
47 * msginfo.msgssz should be a power of two for efficiency reasons.
48 * It is also pretty silly if msginfo.msgssz is less than 8

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

283 struct proc *p;
284 register struct msgget_args *uap;
285 int *retval;
286{
287 int msqid, eval;
288 int key = uap->key;
289 int msgflg = uap->msgflg;
290 struct ucred *cred = p->p_ucred;
41msginit()
42{
43 register int i;
44 vm_offset_t whocares1, whocares2;
45
46 /*
47 * msginfo.msgssz should be a power of two for efficiency reasons.
48 * It is also pretty silly if msginfo.msgssz is less than 8

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

283 struct proc *p;
284 register struct msgget_args *uap;
285 int *retval;
286{
287 int msqid, eval;
288 int key = uap->key;
289 int msgflg = uap->msgflg;
290 struct ucred *cred = p->p_ucred;
291 register struct msqid_ds *msqptr;
291 register struct msqid_ds *msqptr = NULL;
292
293#ifdef MSG_DEBUG_OK
294 printf("msgget(0x%x, 0%o)\n", key, msgflg);
295#endif
296
297 if (key != IPC_PRIVATE) {
298 for (msqid = 0; msqid < msginfo.msgmni; msqid++) {
299 msqptr = &msqids[msqid];

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

445 for (;;) {
446 int need_more_resources = 0;
447
448 /*
449 * check msgsz
450 * (inside this loop in case msg_qbytes changes while we sleep)
451 */
452
292
293#ifdef MSG_DEBUG_OK
294 printf("msgget(0x%x, 0%o)\n", key, msgflg);
295#endif
296
297 if (key != IPC_PRIVATE) {
298 for (msqid = 0; msqid < msginfo.msgmni; msqid++) {
299 msqptr = &msqids[msqid];

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

445 for (;;) {
446 int need_more_resources = 0;
447
448 /*
449 * check msgsz
450 * (inside this loop in case msg_qbytes changes while we sleep)
451 */
452
453 if (msgsz < 0 || msgsz > msqptr->msg_qbytes) {
453 if (msgsz > msqptr->msg_qbytes) {
454#ifdef MSG_DEBUG_OK
455 printf("msgsz > msqptr->msg_qbytes\n");
456#endif
457 return(EINVAL);
458 }
459
460 if (msqptr->msg_perm.mode & MSG_LOCKED) {
461#ifdef MSG_DEBUG_OK

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

769
770 if ((eval = ipcperm(cred, &msqptr->msg_perm, IPC_R))) {
771#ifdef MSG_DEBUG_OK
772 printf("requester doesn't have read access\n");
773#endif
774 return(eval);
775 }
776
454#ifdef MSG_DEBUG_OK
455 printf("msgsz > msqptr->msg_qbytes\n");
456#endif
457 return(EINVAL);
458 }
459
460 if (msqptr->msg_perm.mode & MSG_LOCKED) {
461#ifdef MSG_DEBUG_OK

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

769
770 if ((eval = ipcperm(cred, &msqptr->msg_perm, IPC_R))) {
771#ifdef MSG_DEBUG_OK
772 printf("requester doesn't have read access\n");
773#endif
774 return(eval);
775 }
776
777 if (msgsz < 0) {
778#ifdef MSG_DEBUG_OK
779 printf("msgsz < 0\n");
780#endif
781 return(EINVAL);
782 }
783
784 msghdr = NULL;
785 while (msghdr == NULL) {
786 if (msgtyp == 0) {
787 msghdr = msqptr->msg_first;
788 if (msghdr != NULL) {
789 if (msgsz < msghdr->msg_ts &&
790 (msgflg & MSG_NOERROR) == 0) {
791#ifdef MSG_DEBUG_OK

--- 215 unchanged lines hidden ---
777 msghdr = NULL;
778 while (msghdr == NULL) {
779 if (msgtyp == 0) {
780 msghdr = msqptr->msg_first;
781 if (msghdr != NULL) {
782 if (msgsz < msghdr->msg_ts &&
783 (msgflg & MSG_NOERROR) == 0) {
784#ifdef MSG_DEBUG_OK

--- 215 unchanged lines hidden ---