linux_ipc.c (111797) | linux_ipc.c (111798) |
---|---|
1/*- 2 * Copyright (c) 1994-1995 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright | 1/*- 2 * Copyright (c) 1994-1995 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer | 9 * notice, this list of conditions and the following disclaimer |
10 * in this position and unchanged. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * | 10 * in this position and unchanged. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/compat/linux/linux_ipc.c 111797 2003-03-03 09:14:26Z des $ | 28 * $FreeBSD: head/sys/compat/linux/linux_ipc.c 111798 2003-03-03 09:17:12Z des $ |
29 */ 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/sysproto.h> 34#include <sys/proc.h> 35#include <sys/msg.h> 36#include <sys/sem.h> --- 218 unchanged lines hidden (view full) --- 255 out->key = in->key; 256 out->uid = in->uid; 257 out->gid = in->gid; 258 out->cuid = in->cuid; 259 out->cgid = in->cgid; 260 out->mode = in->mode; 261 out->seq = in->seq; 262} | 29 */ 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/sysproto.h> 34#include <sys/proc.h> 35#include <sys/msg.h> 36#include <sys/sem.h> --- 218 unchanged lines hidden (view full) --- 255 out->key = in->key; 256 out->uid = in->uid; 257 out->gid = in->gid; 258 out->cuid = in->cuid; 259 out->cgid = in->cgid; 260 out->mode = in->mode; 261 out->seq = in->seq; 262} |
263 | 263 |
264static int 265linux_msqid_pullup(l_int ver, struct l_msqid_ds *linux_msqid, caddr_t uaddr) 266{ 267 struct l_msqid64_ds linux_msqid64; 268 int error; 269 270 if (ver == LINUX_IPC_64) { 271 error = copyin(uaddr, &linux_msqid64, sizeof(linux_msqid64)); --- 254 unchanged lines hidden (view full) --- 526 if((args->cmd & ~LINUX_IPC_64) == LINUX_IPC_STAT) 527 bsd_args.cmd = IPC_STAT; 528 else 529 bsd_args.cmd = SEM_STAT; 530 unptr->buf = stackgap_alloc(&sg, sizeof(struct semid_ds)); 531 error = __semctl(td, &bsd_args); 532 if (error) 533 return error; | 264static int 265linux_msqid_pullup(l_int ver, struct l_msqid_ds *linux_msqid, caddr_t uaddr) 266{ 267 struct l_msqid64_ds linux_msqid64; 268 int error; 269 270 if (ver == LINUX_IPC_64) { 271 error = copyin(uaddr, &linux_msqid64, sizeof(linux_msqid64)); --- 254 unchanged lines hidden (view full) --- 526 if((args->cmd & ~LINUX_IPC_64) == LINUX_IPC_STAT) 527 bsd_args.cmd = IPC_STAT; 528 else 529 bsd_args.cmd = SEM_STAT; 530 unptr->buf = stackgap_alloc(&sg, sizeof(struct semid_ds)); 531 error = __semctl(td, &bsd_args); 532 if (error) 533 return error; |
534 td->td_retval[0] = IXSEQ_TO_IPCID(bsd_args.semid, | 534 td->td_retval[0] = IXSEQ_TO_IPCID(bsd_args.semid, |
535 unptr->buf->sem_perm); 536 bsd_to_linux_semid_ds(unptr->buf, &linux_semid); 537 return (linux_semid_pushdown(args->cmd & LINUX_IPC_64, 538 &linux_semid, (caddr_t)args->arg.buf)); 539 case LINUX_IPC_INFO: 540 case LINUX_SEM_INFO: 541 bcopy(&seminfo, &linux_seminfo, sizeof(linux_seminfo) ); 542/* XXX BSD equivalent? --- 19 unchanged lines hidden (view full) --- 562 } 563 return __semctl(td, &bsd_args); 564} 565 566int 567linux_msgsnd(struct thread *td, struct linux_msgsnd_args *args) 568{ 569 struct msgsnd_args /* { | 535 unptr->buf->sem_perm); 536 bsd_to_linux_semid_ds(unptr->buf, &linux_semid); 537 return (linux_semid_pushdown(args->cmd & LINUX_IPC_64, 538 &linux_semid, (caddr_t)args->arg.buf)); 539 case LINUX_IPC_INFO: 540 case LINUX_SEM_INFO: 541 bcopy(&seminfo, &linux_seminfo, sizeof(linux_seminfo) ); 542/* XXX BSD equivalent? --- 19 unchanged lines hidden (view full) --- 562 } 563 return __semctl(td, &bsd_args); 564} 565 566int 567linux_msgsnd(struct thread *td, struct linux_msgsnd_args *args) 568{ 569 struct msgsnd_args /* { |
570 int msqid; 571 void *msgp; 572 size_t msgsz; 573 int msgflg; | 570 int msqid; 571 void *msgp; 572 size_t msgsz; 573 int msgflg; |
574 } */ bsd_args; 575 576 bsd_args.msqid = args->msqid; 577 bsd_args.msgp = args->msgp; 578 bsd_args.msgsz = args->msgsz; 579 bsd_args.msgflg = args->msgflg; 580 return msgsnd(td, &bsd_args); 581} 582 583int 584linux_msgrcv(struct thread *td, struct linux_msgrcv_args *args) 585{ | 574 } */ bsd_args; 575 576 bsd_args.msqid = args->msqid; 577 bsd_args.msgp = args->msgp; 578 bsd_args.msgsz = args->msgsz; 579 bsd_args.msgflg = args->msgflg; 580 return msgsnd(td, &bsd_args); 581} 582 583int 584linux_msgrcv(struct thread *td, struct linux_msgrcv_args *args) 585{ |
586 struct msgrcv_args /* { 587 int msqid; 588 void *msgp; 589 size_t msgsz; 590 long msgtyp; 591 int msgflg; 592 } */ bsd_args; | 586 struct msgrcv_args /* { 587 int msqid; 588 void *msgp; 589 size_t msgsz; 590 long msgtyp; 591 int msgflg; 592 } */ bsd_args; |
593 594 bsd_args.msqid = args->msqid; 595 bsd_args.msgp = args->msgp; 596 bsd_args.msgsz = args->msgsz; 597 bsd_args.msgtyp = args->msgtyp; 598 bsd_args.msgflg = args->msgflg; 599 return msgrcv(td, &bsd_args); 600} 601 602int 603linux_msgget(struct thread *td, struct linux_msgget_args *args) 604{ 605 struct msgget_args /* { 606 key_t key; | 593 594 bsd_args.msqid = args->msqid; 595 bsd_args.msgp = args->msgp; 596 bsd_args.msgsz = args->msgsz; 597 bsd_args.msgtyp = args->msgtyp; 598 bsd_args.msgflg = args->msgflg; 599 return msgrcv(td, &bsd_args); 600} 601 602int 603linux_msgget(struct thread *td, struct linux_msgget_args *args) 604{ 605 struct msgget_args /* { 606 key_t key; |
607 int msgflg; | 607 int msgflg; |
608 } */ bsd_args; 609 610 bsd_args.key = args->key; 611 bsd_args.msgflg = args->msgflg; 612 return msgget(td, &bsd_args); 613} 614 615int 616linux_msgctl(struct thread *td, struct linux_msgctl_args *args) 617{ 618 struct msgctl_args /* { | 608 } */ bsd_args; 609 610 bsd_args.key = args->key; 611 bsd_args.msgflg = args->msgflg; 612 return msgget(td, &bsd_args); 613} 614 615int 616linux_msgctl(struct thread *td, struct linux_msgctl_args *args) 617{ 618 struct msgctl_args /* { |
619 int msqid; | 619 int msqid; |
620 int cmd; 621 struct msqid_ds *buf; 622 } */ bsd_args; 623 int error; 624 struct l_msqid_ds linux_msqid; 625 caddr_t sg = stackgap_init(); 626 627 error = linux_msqid_pullup(args->cmd & LINUX_IPC_64, --- 162 unchanged lines hidden --- | 620 int cmd; 621 struct msqid_ds *buf; 622 } */ bsd_args; 623 int error; 624 struct l_msqid_ds linux_msqid; 625 caddr_t sg = stackgap_init(); 626 627 error = linux_msqid_pullup(args->cmd & LINUX_IPC_64, --- 162 unchanged lines hidden --- |