sysv_msg.c (88633) | sysv_msg.c (91703) |
---|---|
1/* $FreeBSD: head/sys/kern/sysv_msg.c 88633 2001-12-29 07:13:47Z alfred $ */ | 1/* $FreeBSD: head/sys/kern/sysv_msg.c 91703 2002-03-05 18:57:36Z jhb $ */ |
2 3/* 4 * Implementation of SVID messages 5 * 6 * Author: Daniel Boulet 7 * 8 * Copyright 1993 Daniel Boulet and RTMX Inc. 9 * --- 273 unchanged lines hidden (view full) --- 283 int a3; 284 int a4; 285 int a5; 286 int a6; 287 } */ *uap; 288{ 289 int error; 290 | 2 3/* 4 * Implementation of SVID messages 5 * 6 * Author: Daniel Boulet 7 * 8 * Copyright 1993 Daniel Boulet and RTMX Inc. 9 * --- 273 unchanged lines hidden (view full) --- 283 int a3; 284 int a4; 285 int a5; 286 int a6; 287 } */ *uap; 288{ 289 int error; 290 |
291 if (!jail_sysvipc_allowed && jailed(td->td_ucred)) 292 return (ENOSYS); 293 if (uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0])) 294 return (EINVAL); |
|
291 mtx_lock(&Giant); | 295 mtx_lock(&Giant); |
292 if (!jail_sysvipc_allowed && jailed(td->td_proc->p_ucred)) { 293 error = ENOSYS; 294 goto done2; 295 } 296 if (uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0])) { 297 error = EINVAL; 298 goto done2; 299 } | |
300 error = (*msgcalls[uap->which])(td, &uap->a2); | 296 error = (*msgcalls[uap->which])(td, &uap->a2); |
301done2: | |
302 mtx_unlock(&Giant); 303 return (error); 304} 305 306static void 307msg_freehdr(msghdr) 308 struct msg *msghdr; 309{ --- 38 unchanged lines hidden (view full) --- 348 struct msqid_ds *user_msqptr = uap->buf; 349 int rval, error; 350 struct msqid_ds msqbuf; 351 register struct msqid_ds *msqptr; 352 353#ifdef MSG_DEBUG_OK 354 printf("call to msgctl(%d, %d, 0x%x)\n", msqid, cmd, user_msqptr); 355#endif | 297 mtx_unlock(&Giant); 298 return (error); 299} 300 301static void 302msg_freehdr(msghdr) 303 struct msg *msghdr; 304{ --- 38 unchanged lines hidden (view full) --- 343 struct msqid_ds *user_msqptr = uap->buf; 344 int rval, error; 345 struct msqid_ds msqbuf; 346 register struct msqid_ds *msqptr; 347 348#ifdef MSG_DEBUG_OK 349 printf("call to msgctl(%d, %d, 0x%x)\n", msqid, cmd, user_msqptr); 350#endif |
356 mtx_lock(&Giant); 357 if (!jail_sysvipc_allowed && jailed(td->td_proc->p_ucred)) { 358 error = ENOSYS; 359 goto done2; 360 } | 351 if (!jail_sysvipc_allowed && jailed(td->td_ucred)) 352 return (ENOSYS); |
361 | 353 |
354 mtx_lock(&Giant); |
|
362 msqid = IPCID_TO_IX(msqid); 363 364 if (msqid < 0 || msqid >= msginfo.msgmni) { 365#ifdef MSG_DEBUG_OK 366 printf("msqid (%d) out of range (0<=msqid<%d)\n", msqid, 367 msginfo.msgmni); 368#endif 369 error = EINVAL; --- 123 unchanged lines hidden (view full) --- 493int 494msgget(td, uap) 495 struct thread *td; 496 register struct msgget_args *uap; 497{ 498 int msqid, error = 0; 499 int key = uap->key; 500 int msgflg = uap->msgflg; | 355 msqid = IPCID_TO_IX(msqid); 356 357 if (msqid < 0 || msqid >= msginfo.msgmni) { 358#ifdef MSG_DEBUG_OK 359 printf("msqid (%d) out of range (0<=msqid<%d)\n", msqid, 360 msginfo.msgmni); 361#endif 362 error = EINVAL; --- 123 unchanged lines hidden (view full) --- 486int 487msgget(td, uap) 488 struct thread *td; 489 register struct msgget_args *uap; 490{ 491 int msqid, error = 0; 492 int key = uap->key; 493 int msgflg = uap->msgflg; |
501 struct ucred *cred = td->td_proc->p_ucred; | 494 struct ucred *cred = td->td_ucred; |
502 register struct msqid_ds *msqptr = NULL; 503 504#ifdef MSG_DEBUG_OK 505 printf("msgget(0x%x, 0%o)\n", key, msgflg); 506#endif 507 | 495 register struct msqid_ds *msqptr = NULL; 496 497#ifdef MSG_DEBUG_OK 498 printf("msgget(0x%x, 0%o)\n", key, msgflg); 499#endif 500 |
508 mtx_lock(&Giant); 509 if (!jail_sysvipc_allowed && jailed(td->td_proc->p_ucred)) { 510 error = ENOSYS; 511 goto done2; 512 } | 501 if (!jail_sysvipc_allowed && jailed(td->td_ucred)) 502 return (ENOSYS); |
513 | 503 |
504 mtx_lock(&Giant); |
|
514 if (key != IPC_PRIVATE) { 515 for (msqid = 0; msqid < msginfo.msgmni; msqid++) { 516 msqptr = &msqids[msqid]; 517 if (msqptr->msg_qbytes != 0 && 518 msqptr->msg_perm.key == key) 519 break; 520 } 521 if (msqid < msginfo.msgmni) { --- 103 unchanged lines hidden (view full) --- 625 register struct msqid_ds *msqptr; 626 register struct msg *msghdr; 627 short next; 628 629#ifdef MSG_DEBUG_OK 630 printf("call to msgsnd(%d, 0x%x, %d, %d)\n", msqid, user_msgp, msgsz, 631 msgflg); 632#endif | 505 if (key != IPC_PRIVATE) { 506 for (msqid = 0; msqid < msginfo.msgmni; msqid++) { 507 msqptr = &msqids[msqid]; 508 if (msqptr->msg_qbytes != 0 && 509 msqptr->msg_perm.key == key) 510 break; 511 } 512 if (msqid < msginfo.msgmni) { --- 103 unchanged lines hidden (view full) --- 616 register struct msqid_ds *msqptr; 617 register struct msg *msghdr; 618 short next; 619 620#ifdef MSG_DEBUG_OK 621 printf("call to msgsnd(%d, 0x%x, %d, %d)\n", msqid, user_msgp, msgsz, 622 msgflg); 623#endif |
633 mtx_lock(&Giant); 634 if (!jail_sysvipc_allowed && jailed(td->td_proc->p_ucred)) { 635 error = ENOSYS; 636 goto done2; 637 } | 624 if (!jail_sysvipc_allowed && jailed(td->td_ucred)) 625 return (ENOSYS); |
638 | 626 |
627 mtx_lock(&Giant); |
|
639 msqid = IPCID_TO_IX(msqid); 640 641 if (msqid < 0 || msqid >= msginfo.msgmni) { 642#ifdef MSG_DEBUG_OK 643 printf("msqid (%d) out of range (0<=msqid<%d)\n", msqid, 644 msginfo.msgmni); 645#endif 646 error = EINVAL; --- 322 unchanged lines hidden (view full) --- 969 int error = 0; 970 short next; 971 972#ifdef MSG_DEBUG_OK 973 printf("call to msgrcv(%d, 0x%x, %d, %ld, %d)\n", msqid, user_msgp, 974 msgsz, msgtyp, msgflg); 975#endif 976 | 628 msqid = IPCID_TO_IX(msqid); 629 630 if (msqid < 0 || msqid >= msginfo.msgmni) { 631#ifdef MSG_DEBUG_OK 632 printf("msqid (%d) out of range (0<=msqid<%d)\n", msqid, 633 msginfo.msgmni); 634#endif 635 error = EINVAL; --- 322 unchanged lines hidden (view full) --- 958 int error = 0; 959 short next; 960 961#ifdef MSG_DEBUG_OK 962 printf("call to msgrcv(%d, 0x%x, %d, %ld, %d)\n", msqid, user_msgp, 963 msgsz, msgtyp, msgflg); 964#endif 965 |
977 mtx_lock(&Giant); 978 if (!jail_sysvipc_allowed && jailed(td->td_proc->p_ucred)) { 979 error = ENOSYS; 980 goto done2; 981 } | 966 if (!jail_sysvipc_allowed && jailed(td->td_ucred)) 967 return (ENOSYS); |
982 | 968 |
969 mtx_lock(&Giant); |
|
983 msqid = IPCID_TO_IX(msqid); 984 985 if (msqid < 0 || msqid >= msginfo.msgmni) { 986#ifdef MSG_DEBUG_OK 987 printf("msqid (%d) out of range (0<=msqid<%d)\n", msqid, 988 msginfo.msgmni); 989#endif 990 error = EINVAL; --- 263 unchanged lines hidden --- | 970 msqid = IPCID_TO_IX(msqid); 971 972 if (msqid < 0 || msqid >= msginfo.msgmni) { 973#ifdef MSG_DEBUG_OK 974 printf("msqid (%d) out of range (0<=msqid<%d)\n", msqid, 975 msginfo.msgmni); 976#endif 977 error = EINVAL; --- 263 unchanged lines hidden --- |