summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_ipc.c
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2005-01-26 00:46:36 +0000
committersobomax <sobomax@FreeBSD.org>2005-01-26 00:46:36 +0000
commit896df27c1a394e41509463c3e85cc6841911fbaa (patch)
tree06959c04b33ebaef7bb96e6ccd3c45c642604d4a /sys/compat/linux/linux_ipc.c
parent3a3fcc332c30596888f2583c081f4e2633899eae (diff)
downloadFreeBSD-src-896df27c1a394e41509463c3e85cc6841911fbaa.zip
FreeBSD-src-896df27c1a394e41509463c3e85cc6841911fbaa.tar.gz
Split out kernel side of msgctl(2) into two parts: the first that pops data
from the userland and pushes results back and the second which does actual processing. Use the latter to eliminate stackgap in the linux wrapper of that syscall. MFC after: 2 weeks
Diffstat (limited to 'sys/compat/linux/linux_ipc.c')
-rw-r--r--sys/compat/linux/linux_ipc.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c
index 662669d..8fc33878 100644
--- a/sys/compat/linux/linux_ipc.c
+++ b/sys/compat/linux/linux_ipc.c
@@ -634,33 +634,26 @@ linux_msgget(struct thread *td, struct linux_msgget_args *args)
int
linux_msgctl(struct thread *td, struct linux_msgctl_args *args)
{
- struct msgctl_args /* {
- int msqid;
- int cmd;
- struct msqid_ds *buf;
- } */ bsd_args;
- int error;
+ int error, bsd_cmd;
struct l_msqid_ds linux_msqid;
- caddr_t sg = stackgap_init();
+ struct msqid_ds bsd_msqid;
+ struct msqid_ds *bsd_msqptr;
error = linux_msqid_pullup(args->cmd & LINUX_IPC_64,
&linux_msqid, (caddr_t)PTRIN(args->buf));
if (error != 0)
return (error);
- bsd_args.buf = (struct msqid_ds*)stackgap_alloc(&sg,
- sizeof(struct l_msqid_ds));
- bsd_args.msqid = args->msqid;
- bsd_args.cmd = args->cmd & ~LINUX_IPC_64;
- if (bsd_args.cmd == LINUX_IPC_SET)
- linux_to_bsd_msqid_ds(&linux_msqid, bsd_args.buf);
+ bsd_cmd = args->cmd & ~LINUX_IPC_64;
+ if (bsd_cmd == LINUX_IPC_SET)
+ linux_to_bsd_msqid_ds(&linux_msqid, &bsd_msqid);
- error = msgctl(td, &bsd_args);
+ error = kern_msgctl(td, args->msqid, bsd_cmd, &bsd_msqid, &bsd_msqptr);
if (error != 0)
- if (bsd_args.cmd != LINUX_IPC_RMID || error != EINVAL)
+ if (bsd_cmd != LINUX_IPC_RMID || error != EINVAL)
return (error);
- if (bsd_args.cmd == LINUX_IPC_STAT) {
- bsd_to_linux_msqid_ds(bsd_args.buf, &linux_msqid);
+ if (bsd_cmd == LINUX_IPC_STAT) {
+ bsd_to_linux_msqid_ds(bsd_msqptr, &linux_msqid);
return (linux_msqid_pushdown(args->cmd & LINUX_IPC_64,
&linux_msqid, (caddr_t)PTRIN(args->buf)));
}
OpenPOWER on IntegriCloud