summaryrefslogtreecommitdiffstats
path: root/ipc/compat.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-07-09 10:34:35 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-07-15 20:46:46 -0400
commit9b1404c24a357332cb2a6df7c4337e943a4545fd (patch)
treed69d1b464c5f2ba3d4a25f1f4ab5c6ec62b03252 /ipc/compat.c
parent20bc2a3aff5a88a666e81182fd277ea2a521fd3d (diff)
msgrcv(2), msgsnd(2): move compat to native
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'ipc/compat.c')
-rw-r--r--ipc/compat.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/ipc/compat.c b/ipc/compat.c
index 00c2e3beccc8..0586687c3e31 100644
--- a/ipc/compat.c
+++ b/ipc/compat.c
@@ -34,11 +34,6 @@
34 34
35#include "util.h" 35#include "util.h"
36 36
37struct compat_msgbuf {
38 compat_long_t mtype;
39 char mtext[1];
40};
41
42int get_compat_ipc64_perm(struct ipc64_perm *to, 37int get_compat_ipc64_perm(struct ipc64_perm *to,
43 struct compat_ipc64_perm __user *from) 38 struct compat_ipc64_perm __user *from)
44{ 39{
@@ -85,38 +80,6 @@ void to_compat_ipc_perm(struct compat_ipc_perm *to, struct ipc64_perm *from)
85 to->seq = from->seq; 80 to->seq = from->seq;
86} 81}
87 82
88static long compat_do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz)
89{
90 struct compat_msgbuf __user *msgp = dest;
91 size_t msgsz;
92
93 if (put_user(msg->m_type, &msgp->mtype))
94 return -EFAULT;
95
96 msgsz = (bufsz > msg->m_ts) ? msg->m_ts : bufsz;
97 if (store_msg(msgp->mtext, msg, msgsz))
98 return -EFAULT;
99 return msgsz;
100}
101
102COMPAT_SYSCALL_DEFINE4(msgsnd, int, msqid, compat_uptr_t, msgp,
103 compat_ssize_t, msgsz, int, msgflg)
104{
105 struct compat_msgbuf __user *up = compat_ptr(msgp);
106 compat_long_t mtype;
107
108 if (get_user(mtype, &up->mtype))
109 return -EFAULT;
110 return do_msgsnd(msqid, mtype, up->mtext, (ssize_t)msgsz, msgflg);
111}
112
113COMPAT_SYSCALL_DEFINE5(msgrcv, int, msqid, compat_uptr_t, msgp,
114 compat_ssize_t, msgsz, compat_long_t, msgtyp, int, msgflg)
115{
116 return do_msgrcv(msqid, compat_ptr(msgp), (ssize_t)msgsz, (long)msgtyp,
117 msgflg, compat_do_msg_fill);
118}
119
120#ifndef COMPAT_SHMLBA 83#ifndef COMPAT_SHMLBA
121#define COMPAT_SHMLBA SHMLBA 84#define COMPAT_SHMLBA SHMLBA
122#endif 85#endif