summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_ipc.c
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2006-12-20 19:30:52 +0000
committerjkim <jkim@FreeBSD.org>2006-12-20 19:30:52 +0000
commita293164e3c27522655e26536d787c9e4bafe6699 (patch)
tree7c4020b9785a6533cc4e35d598da2710da07d7b7 /sys/compat/linux/linux_ipc.c
parent0099defbac713df868b3b35559e478bb624e8e22 (diff)
downloadFreeBSD-src-a293164e3c27522655e26536d787c9e4bafe6699.zip
FreeBSD-src-a293164e3c27522655e26536d787c9e4bafe6699.tar.gz
MFP4: (part of) 110058
Use new kern_msgsnd()/kern_msgrcv() to fix linux32 emulation on amd64.
Diffstat (limited to 'sys/compat/linux/linux_ipc.c')
-rw-r--r--sys/compat/linux/linux_ipc.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c
index fdfed23..256c21c 100644
--- a/sys/compat/linux/linux_ipc.c
+++ b/sys/compat/linux/linux_ipc.c
@@ -575,37 +575,39 @@ linux_semctl(struct thread *td, struct linux_semctl_args *args)
int
linux_msgsnd(struct thread *td, struct linux_msgsnd_args *args)
{
- struct msgsnd_args /* {
- int msqid;
- void *msgp;
- size_t msgsz;
- int msgflg;
- } */ bsd_args;
+ const void *msgp;
+ long mtype;
+ l_long lmtype;
+ int error;
- bsd_args.msqid = args->msqid;
- bsd_args.msgp = PTRIN(args->msgp);
- bsd_args.msgsz = args->msgsz;
- bsd_args.msgflg = args->msgflg;
- return msgsnd(td, &bsd_args);
+ if ((l_long)args->msgsz < 0)
+ return (EINVAL);
+ msgp = PTRIN(args->msgp);
+ if ((error = copyin(msgp, &lmtype, sizeof(lmtype))) != 0)
+ return (error);
+ mtype = (long)lmtype;
+ return (kern_msgsnd(td, args->msqid,
+ (const char *)msgp + sizeof(lmtype),
+ args->msgsz, args->msgflg, mtype));
}
int
linux_msgrcv(struct thread *td, struct linux_msgrcv_args *args)
{
- struct msgrcv_args /* {
- int msqid;
- void *msgp;
- size_t msgsz;
- long msgtyp;
- int msgflg;
- } */ bsd_args;
+ void *msgp;
+ long mtype;
+ l_long lmtype;
+ int error;
- bsd_args.msqid = args->msqid;
- bsd_args.msgp = PTRIN(args->msgp);
- bsd_args.msgsz = args->msgsz;
- bsd_args.msgtyp = args->msgtyp;
- bsd_args.msgflg = args->msgflg;
- return msgrcv(td, &bsd_args);
+ if ((l_long)args->msgsz < 0)
+ return (EINVAL);
+ msgp = PTRIN(args->msgp);
+ if ((error = kern_msgrcv(td, args->msqid,
+ (char *)msgp + sizeof(lmtype), args->msgsz,
+ args->msgtyp, args->msgflg, &mtype)) != 0)
+ return (error);
+ lmtype = (l_long)mtype;
+ return (copyout(&lmtype, msgp, sizeof(lmtype)));
}
int
OpenPOWER on IntegriCloud