This source file includes following definitions.
- osf1_sys_recvmsg_xopen
- osf1_sys_sendmsg_xopen
- osf1_sys_sendto
- osf1_sys_socket
- osf1_sys_socketpair
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 #include <sys/param.h>
62 #include <sys/systm.h>
63 #include <sys/namei.h>
64 #include <sys/proc.h>
65 #include <sys/file.h>
66 #include <sys/mount.h>
67 #include <sys/syscallargs.h>
68 #include <sys/socketvar.h>
69 #include <sys/exec.h>
70
71 #include <compat/osf1/osf1.h>
72 #include <compat/osf1/osf1_syscallargs.h>
73 #include <compat/osf1/osf1_util.h>
74 #include <compat/osf1/osf1_cvt.h>
75
76 int
77 osf1_sys_recvmsg_xopen(p, v, retval)
78 struct proc *p;
79 void *v;
80 register_t *retval;
81 {
82
83
84 return (EINVAL);
85 }
86
87 int
88 osf1_sys_sendmsg_xopen(p, v, retval)
89 struct proc *p;
90 void *v;
91 register_t *retval;
92 {
93 struct osf1_sys_sendmsg_xopen_args *uap = v;
94 struct sys_sendmsg_args a;
95 struct osf1_msghdr_xopen osf_msghdr;
96 struct osf1_iovec_xopen osf_iovec, *osf_iovec_ptr;
97 struct msghdr bsd_msghdr;
98 struct iovec bsd_iovec, *bsd_iovec_ptr;
99 unsigned long leftovers;
100 caddr_t sg;
101 unsigned int i;
102 int error;
103
104 sg = stackgap_init(p->p_emul);
105
106 SCARG(&a, s) = SCARG(uap, s);
107
108
109
110
111 if ((error = copyin(SCARG(uap, msg), &osf_msghdr,
112 sizeof osf_msghdr)) != 0)
113 return (error);
114
115 error = osf1_cvt_msghdr_xopen_to_native(&osf_msghdr, &bsd_msghdr);
116 if (error != 0)
117 return (error);
118
119 if (STACKGAPLEN < (bsd_msghdr.msg_iovlen * sizeof (struct iovec) +
120 sizeof (struct msghdr)))
121 {
122 printf("sendmsg space\n");
123 return (EINVAL);
124 }
125
126 SCARG(&a, msg) = stackgap_alloc(&sg, sizeof bsd_msghdr);
127 bsd_msghdr.msg_iov = stackgap_alloc(&sg,
128 bsd_msghdr.msg_iovlen * sizeof (struct iovec));
129
130 if ((error = copyout(&bsd_msghdr, (caddr_t)SCARG(&a, msg),
131 sizeof bsd_msghdr)) != 0)
132 return (error);
133
134 osf_iovec_ptr = osf_msghdr.msg_iov;
135 bsd_iovec_ptr = bsd_msghdr.msg_iov;
136 for (i = 0; i < bsd_msghdr.msg_iovlen; i++) {
137 if ((error = copyin(&osf_iovec_ptr[i], &osf_iovec,
138 sizeof osf_iovec)) != 0)
139 return (error);
140
141 bsd_iovec.iov_base = osf_iovec.iov_base;
142 bsd_iovec.iov_len = osf_iovec.iov_len;
143
144 if ((error = copyout(&bsd_iovec, &bsd_iovec_ptr[i],
145 sizeof bsd_iovec)) != 0)
146 return (error);
147 }
148
149
150
151
152 SCARG(&a, flags) = emul_flags_translate(osf1_sendrecv_msg_flags_xtab,
153 SCARG(uap, flags), &leftovers);
154 if (leftovers != 0)
155 {
156 printf("sendmsg flags leftover: 0x%lx\n", leftovers);
157 return (EINVAL);
158 }
159
160 return sys_sendmsg(p, &a, retval);
161 }
162
163 int
164 osf1_sys_sendto(p, v, retval)
165 struct proc *p;
166 void *v;
167 register_t *retval;
168 {
169 struct osf1_sys_sendto_args *uap = v;
170 struct sys_sendto_args a;
171 unsigned long leftovers;
172
173 SCARG(&a, s) = SCARG(uap, s);
174 SCARG(&a, buf) = SCARG(uap, buf);
175 SCARG(&a, len) = SCARG(uap, len);
176 SCARG(&a, to) = SCARG(uap, to);
177 SCARG(&a, tolen) = SCARG(uap, tolen);
178
179
180 SCARG(&a, flags) = emul_flags_translate(osf1_sendrecv_msg_flags_xtab,
181 SCARG(uap, flags), &leftovers);
182 if (leftovers != 0)
183 return (EINVAL);
184
185 return sys_sendto(p, &a, retval);
186 }
187
188 int
189 osf1_sys_socket(p, v, retval)
190 struct proc *p;
191 void *v;
192 register_t *retval;
193 {
194 struct osf1_sys_socket_args *uap = v;
195 struct sys_socket_args a;
196
197
198
199 if (SCARG(uap, domain) > AF_LINK)
200 return (EINVAL);
201
202 SCARG(&a, domain) = SCARG(uap, domain);
203 SCARG(&a, type) = SCARG(uap, type);
204 SCARG(&a, protocol) = SCARG(uap, protocol);
205
206 return sys_socket(p, &a, retval);
207 }
208
209 int
210 osf1_sys_socketpair(p, v, retval)
211 struct proc *p;
212 void *v;
213 register_t *retval;
214 {
215 struct osf1_sys_socketpair_args *uap = v;
216 struct sys_socketpair_args a;
217
218
219
220 if (SCARG(uap, domain) > AF_LINK)
221 return (EINVAL);
222
223 SCARG(&a, domain) = SCARG(uap, domain);
224 SCARG(&a, type) = SCARG(uap, type);
225 SCARG(&a, protocol) = SCARG(uap, protocol);
226 SCARG(&a, rsv) = SCARG(uap, rsv);
227
228 return sys_socketpair(p, &a, retval);
229 }