This source file includes following definitions.
- osf1_sys_access
- osf1_sys_execve
- osf1_sys_lstat
- osf1_sys_mknod
- osf1_sys_open
- osf1_sys_pathconf
- osf1_sys_stat
- osf1_sys_truncate
- osf1_sys_utimes
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/stat.h>
67 #include <sys/filedesc.h>
68 #include <sys/kernel.h>
69 #include <sys/malloc.h>
70 #include <sys/mman.h>
71 #include <sys/mount.h>
72 #include <sys/signal.h>
73 #include <sys/signalvar.h>
74 #include <sys/reboot.h>
75 #include <sys/syscallargs.h>
76 #include <sys/exec.h>
77 #include <sys/vnode.h>
78 #include <sys/socketvar.h>
79 #include <sys/resource.h>
80 #include <sys/resourcevar.h>
81 #include <sys/wait.h>
82
83 #include <compat/osf1/osf1.h>
84 #include <compat/osf1/osf1_syscallargs.h>
85 #include <compat/osf1/osf1_util.h>
86 #include <compat/osf1/osf1_cvt.h>
87
88 int
89 osf1_sys_access(p, v, retval)
90 struct proc *p;
91 void *v;
92 register_t *retval;
93 {
94 struct osf1_sys_access_args *uap = v;
95 struct sys_access_args a;
96 unsigned long leftovers;
97 caddr_t sg;
98
99 sg = stackgap_init(p->p_emul);
100 OSF1_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
101
102 SCARG(&a, path) = SCARG(uap, path);
103
104
105 SCARG(&a, flags) = emul_flags_translate(osf1_access_flags_xtab,
106 SCARG(uap, flags), &leftovers);
107 if (leftovers != 0)
108 return (EINVAL);
109
110 return sys_access(p, &a, retval);
111 }
112
113 int
114 osf1_sys_execve(p, v, retval)
115 struct proc *p;
116 void *v;
117 register_t *retval;
118 {
119 struct osf1_sys_execve_args *uap = v;
120 struct sys_execve_args ap;
121 caddr_t sg;
122
123 sg = stackgap_init(p->p_emul);
124 OSF1_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
125
126 SCARG(&ap, path) = SCARG(uap, path);
127 SCARG(&ap, argp) = SCARG(uap, argp);
128 SCARG(&ap, envp) = SCARG(uap, envp);
129
130 return sys_execve(p, &ap, retval);
131 }
132
133
134
135
136
137 int
138 osf1_sys_lstat(p, v, retval)
139 struct proc *p;
140 void *v;
141 register_t *retval;
142 {
143 struct osf1_sys_lstat_args *uap = v;
144 struct stat sb;
145 struct osf1_stat osb;
146 int error;
147 struct nameidata nd;
148 caddr_t sg;
149
150 sg = stackgap_init(p->p_emul);
151 OSF1_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
152
153 NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE,
154 SCARG(uap, path), p);
155 if ((error = namei(&nd)))
156 return (error);
157 error = vn_stat(nd.ni_vp, &sb, p);
158 vput(nd.ni_vp);
159 if (error)
160 return (error);
161 osf1_cvt_stat_from_native(&sb, &osb);
162 error = copyout((caddr_t)&osb, (caddr_t)SCARG(uap, ub), sizeof (osb));
163 return (error);
164 }
165
166 int
167 osf1_sys_mknod(p, v, retval)
168 struct proc *p;
169 void *v;
170 register_t *retval;
171 {
172 struct osf1_sys_mknod_args *uap = v;
173 struct sys_mknod_args a;
174 caddr_t sg;
175
176 sg = stackgap_init(p->p_emul);
177 OSF1_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
178
179 SCARG(&a, path) = SCARG(uap, path);
180 SCARG(&a, mode) = SCARG(uap, mode);
181 SCARG(&a, dev) = osf1_cvt_dev_to_native(SCARG(uap, dev));
182
183 return sys_mknod(p, &a, retval);
184 }
185
186 int
187 osf1_sys_open(p, v, retval)
188 struct proc *p;
189 void *v;
190 register_t *retval;
191 {
192 struct osf1_sys_open_args *uap = v;
193 struct sys_open_args a;
194 char *path;
195 caddr_t sg;
196 unsigned long leftovers;
197 #ifdef SYSCALL_DEBUG
198 char pnbuf[1024];
199
200 if (scdebug &&
201 copyinstr(SCARG(uap, path), pnbuf, sizeof pnbuf, NULL) == 0)
202 printf("osf1_open: open: %s\n", pnbuf);
203 #endif
204
205 sg = stackgap_init(p->p_emul);
206
207
208 SCARG(&a, flags) = emul_flags_translate(osf1_open_flags_xtab,
209 SCARG(uap, flags), &leftovers);
210 if (leftovers != 0)
211 return (EINVAL);
212
213
214 SCARG(&a, mode) = SCARG(uap, mode);
215
216
217 path = SCARG(uap, path);
218 if (SCARG(&a, flags) & O_CREAT)
219 OSF1_CHECK_ALT_CREAT(p, &sg, path);
220 else
221 OSF1_CHECK_ALT_EXIST(p, &sg, path);
222 SCARG(&a, path) = path;
223
224 return sys_open(p, &a, retval);
225 }
226
227 int
228 osf1_sys_pathconf(p, v, retval)
229 struct proc *p;
230 void *v;
231 register_t *retval;
232 {
233 struct osf1_sys_pathconf_args *uap = v;
234 struct sys_pathconf_args a;
235 caddr_t sg;
236 int error;
237
238 sg = stackgap_init(p->p_emul);
239
240 OSF1_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
241 SCARG(&a, path) = SCARG(uap, path);
242
243 error = osf1_cvt_pathconf_name_to_native(SCARG(uap, name),
244 &SCARG(&a, name));
245
246 if (error == 0)
247 error = sys_pathconf(p, &a, retval);
248
249 return (error);
250 }
251
252
253
254
255
256 int
257 osf1_sys_stat(p, v, retval)
258 struct proc *p;
259 void *v;
260 register_t *retval;
261 {
262 struct osf1_sys_stat_args *uap = v;
263 struct stat sb;
264 struct osf1_stat osb;
265 int error;
266 struct nameidata nd;
267 caddr_t sg;
268
269 sg = stackgap_init(p->p_emul);
270 OSF1_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
271
272 NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
273 SCARG(uap, path), p);
274 if ((error = namei(&nd)))
275 return (error);
276 error = vn_stat(nd.ni_vp, &sb, p);
277 vput(nd.ni_vp);
278 if (error)
279 return (error);
280 osf1_cvt_stat_from_native(&sb, &osb);
281 error = copyout((caddr_t)&osb, (caddr_t)SCARG(uap, ub), sizeof (osb));
282 return (error);
283 }
284
285 int
286 osf1_sys_truncate(p, v, retval)
287 struct proc *p;
288 void *v;
289 register_t *retval;
290 {
291 struct osf1_sys_truncate_args *uap = v;
292 struct sys_truncate_args a;
293 caddr_t sg;
294
295 sg = stackgap_init(p->p_emul);
296 OSF1_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
297
298 SCARG(&a, path) = SCARG(uap, path);
299 SCARG(&a, pad) = 0;
300 SCARG(&a, length) = SCARG(uap, length);
301
302 return sys_truncate(p, &a, retval);
303 }
304
305 int
306 osf1_sys_utimes(p, v, retval)
307 struct proc *p;
308 void *v;
309 register_t *retval;
310 {
311 struct osf1_sys_utimes_args *uap = v;
312 struct sys_utimes_args a;
313 struct osf1_timeval otv;
314 struct timeval tv;
315 caddr_t sg;
316 int error;
317
318 sg = stackgap_init(p->p_emul);
319
320 OSF1_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
321 SCARG(&a, path) = SCARG(uap, path);
322
323 error = 0;
324 if (SCARG(uap, tptr) == NULL)
325 SCARG(&a, tptr) = NULL;
326 else {
327 SCARG(&a, tptr) = stackgap_alloc(&sg, sizeof tv);
328
329
330 error = copyin((caddr_t)SCARG(uap, tptr),
331 (caddr_t)&otv, sizeof otv);
332 if (error == 0) {
333
334
335 memset(&tv, 0, sizeof tv);
336 tv.tv_sec = otv.tv_sec;
337 tv.tv_usec = otv.tv_usec;
338
339 error = copyout((caddr_t)&tv,
340 (caddr_t)SCARG(&a, tptr), sizeof tv);
341 }
342 }
343
344 if (error == 0)
345 error = sys_utimes(p, &a, retval);
346
347 return (error);
348 }