1 /* $NetBSD: pecoff_misc.c,v 1.8 2003/06/29 22:29:43 fvdl Exp $ */
2
3 /*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #include <sys/cdefs.h>
40 __KERNEL_RCSID(0, "$NetBSD: pecoff_misc.c,v 1.8 2003/06/29 22:29:43 fvdl Exp $");
41
42 #if defined(_KERNEL_OPT)
43 #include "opt_ktrace.h"
44 #include "opt_nfsserver.h"
45 #include "opt_compat_netbsd.h"
46 #include "opt_sysv.h"
47 #include "opt_compat_43.h"
48
49 #include "fs_lfs.h"
50 #include "fs_nfs.h"
51 #endif
52
53 #include <sys/param.h>
54 #include <sys/systm.h>
55 #include <sys/mount.h>
56 #include <sys/fcntl.h>
57 #include <sys/proc.h>
58
59 #include <sys/sa.h>
60 #include <sys/syscallargs.h>
61
62 #include <compat/common/compat_util.h>
63 #include <compat/pecoff/pecoff_syscallargs.h>
64
65 int
66 pecoff_sys_open(l, v, retval)
67 struct lwp *l;
68 void *v;
69 register_t *retval;
70 {
71 struct proc *p = l->l_proc;
72 struct pecoff_sys_open_args *uap = v;
73 caddr_t sg = stackgap_init(p, 0);
74
75 #if 0
76 if (SCARG(uap, flags) & O_CREAT)
77 CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
78 else
79 #endif
80 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
81
82 return sys_open(l, v, retval);
83 }
84
85
86 int
87 pecoff_sys_link(l, v, retval)
88 struct lwp *l;
89 void *v;
90 register_t *retval;
91 {
92 struct proc *p = l->l_proc;
93 struct pecoff_sys_link_args *uap = v;
94 caddr_t sg = stackgap_init(p, 0);
95
96 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
97 #if 0
98 CHECK_ALT_CREAT(p, &sg, SCARG(uap, link));
99 #endif
100
101 return sys_link(l, v, retval);
102 }
103
104
105 int
106 pecoff_sys_unlink(l, v, retval)
107 struct lwp *l;
108 void *v;
109 register_t *retval;
110 {
111 struct proc *p = l->l_proc;
112 struct pecoff_sys_unlink_args *uap = v;
113 caddr_t sg = stackgap_init(p, 0);
114
115 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
116
117 return sys_unlink(l, v, retval);
118 }
119
120
121 int
122 pecoff_sys_chdir(l, v, retval)
123 struct lwp *l;
124 void *v;
125 register_t *retval;
126 {
127 struct proc *p = l->l_proc;
128 struct pecoff_sys_chdir_args *uap = v;
129 caddr_t sg = stackgap_init(p, 0);
130
131 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
132
133 return sys_chdir(l, v, retval);
134 }
135
136
137 int
138 pecoff_sys_chmod(l, v, retval)
139 struct lwp *l;
140 void *v;
141 register_t *retval;
142 {
143 struct proc *p = l->l_proc;
144 struct pecoff_sys_chmod_args *uap = v;
145 caddr_t sg = stackgap_init(p, 0);
146
147 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
148
149 return sys_chmod(l, v, retval);
150 }
151
152
153 int
154 pecoff_sys_chown(l, v, retval)
155 struct lwp *l;
156 void *v;
157 register_t *retval;
158 {
159 struct proc *p = l->l_proc;
160 struct pecoff_sys_chown_args *uap = v;
161 caddr_t sg = stackgap_init(p, 0);
162
163 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
164
165 return sys_chown(l, v, retval);
166 }
167
168
169 int
170 pecoff_sys_unmount(l, v, retval)
171 struct lwp *l;
172 void *v;
173 register_t *retval;
174 {
175 struct proc *p = l->l_proc;
176 struct pecoff_sys_unmount_args *uap = v;
177 caddr_t sg = stackgap_init(p, 0);
178
179 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
180
181 return sys_unmount(l, v, retval);
182 }
183
184
185 int
186 pecoff_sys_access(l, v, retval)
187 struct lwp *l;
188 void *v;
189 register_t *retval;
190 {
191 struct proc *p = l->l_proc;
192 struct pecoff_sys_access_args *uap = v;
193 caddr_t sg = stackgap_init(p, 0);
194
195 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
196
197 return sys_access(l, v, retval);
198 }
199
200
201 int
202 pecoff_sys_chflags(l, v, retval)
203 struct lwp *l;
204 void *v;
205 register_t *retval;
206 {
207 struct proc *p = l->l_proc;
208 struct pecoff_sys_chflags_args *uap = v;
209 caddr_t sg = stackgap_init(p, 0);
210
211 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
212
213 return sys_chflags(l, v, retval);
214 }
215
216
217 #ifdef PECOFF_INCLUDE_COMPAT
218 int
219 pecoff_compat_43_sys_stat(l, v, retval)
220 struct lwp *l;
221 void *v;
222 register_t *retval;
223 {
224 struct proc *p = l->l_proc;
225 struct pecoff_compat_43_sys_stat_args *uap = v;
226 caddr_t sg = stackgap_init(p, 0);
227
228 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
229
230 return compat_43_sys_stat(l, v, retval);
231 }
232
233
234 int
235 pecoff_compat_43_sys_lstat(l, v, retval)
236 struct lwp *l;
237 void *v;
238 register_t *retval;
239 {
240 struct proc *p = l->l_proc;
241 struct pecoff_compat_43_sys_lstat_args *uap = v;
242 caddr_t sg = stackgap_init(p, 0);
243
244 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
245
246 return compat_43_sys_lstat(l, v, retval);
247 }
248 #endif /* PECOFF_INCLUDE_COMPAT */
249
250
251 int
252 pecoff_sys_revoke(l, v, retval)
253 struct lwp *l;
254 void *v;
255 register_t *retval;
256 {
257 struct proc *p = l->l_proc;
258 struct pecoff_sys_revoke_args *uap = v;
259 caddr_t sg = stackgap_init(p, 0);
260
261 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
262
263 return sys_revoke(l, v, retval);
264 }
265
266
267 int
268 pecoff_sys_symlink(l, v, retval)
269 struct lwp *l;
270 void *v;
271 register_t *retval;
272 {
273 struct proc *p = l->l_proc;
274 struct pecoff_sys_symlink_args *uap = v;
275 caddr_t sg = stackgap_init(p, 0);
276
277 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
278 #if 0
279 CHECK_ALT_CREAT(p, &sg, SCARG(uap, link));
280 #endif
281
282 return sys_symlink(l, v, retval);
283 }
284
285
286 int
287 pecoff_sys_readlink(l, v, retval)
288 struct lwp *l;
289 void *v;
290 register_t *retval;
291 {
292 struct proc *p = l->l_proc;
293 struct pecoff_sys_readlink_args *uap = v;
294 caddr_t sg = stackgap_init(p, 0);
295
296 CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
297
298 return sys_readlink(l, v, retval);
299 }
300
301
302 int
303 pecoff_sys_execve(l, v, retval)
304 struct lwp *l;
305 void *v;
306 register_t *retval;
307 {
308 struct proc *p = l->l_proc;
309 struct pecoff_sys_execve_args *uap = v;
310 caddr_t sg = stackgap_init(p, 0);
311
312 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
313
314 return sys_execve(l, v, retval);
315 }
316
317
318 int
319 pecoff_sys_chroot(l, v, retval)
320 struct lwp *l;
321 void *v;
322 register_t *retval;
323 {
324 struct proc *p = l->l_proc;
325 struct pecoff_sys_chroot_args *uap = v;
326 caddr_t sg = stackgap_init(p, 0);
327
328 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
329
330 return sys_chroot(l, v, retval);
331 }
332
333
334 int
335 pecoff_sys_rename(l, v, retval)
336 struct lwp *l;
337 void *v;
338 register_t *retval;
339 {
340 struct proc *p = l->l_proc;
341 struct pecoff_sys_rename_args *uap = v;
342 caddr_t sg = stackgap_init(p, 0);
343
344 CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
345 #if 0
346 CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
347 #endif
348
349 return sys_rename(l, v, retval);
350 }
351
352
353 #ifdef PECOFF_INCLUDE_COMPAT
354 int
355 pecoff_compat_43_sys_truncate(l, v, retval)
356 struct lwp *l;
357 void *v;
358 register_t *retval;
359 {
360 struct proc *p = l->l_proc;
361 struct pecoff_compat_43_sys_truncate_args *uap = v;
362 caddr_t sg = stackgap_init(p, 0);
363
364 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
365
366 return compat_43_sys_truncate(l, v, retval);
367 }
368 #endif /* PECOFF_INCLUDE_COMPAT */
369
370
371 int
372 pecoff_sys_rmdir(l, v, retval)
373 struct lwp *l;
374 void *v;
375 register_t *retval;
376 {
377 struct proc *p = l->l_proc;
378 struct pecoff_sys_rmdir_args *uap = v;
379 caddr_t sg = stackgap_init(p, 0);
380
381 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
382
383 return sys_rmdir(l, v, retval);
384 }
385
386
387 int
388 pecoff_sys_utimes(l, v, retval)
389 struct lwp *l;
390 void *v;
391 register_t *retval;
392 {
393 struct proc *p = l->l_proc;
394 struct pecoff_sys_utimes_args *uap = v;
395 caddr_t sg = stackgap_init(p, 0);
396
397 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
398
399 return sys_utimes(l, v, retval);
400 }
401
402
403 int
404 pecoff_sys_statfs(l, v, retval)
405 struct lwp *l;
406 void *v;
407 register_t *retval;
408 {
409 struct proc *p = l->l_proc;
410 struct pecoff_sys_statfs_args *uap = v;
411 caddr_t sg = stackgap_init(p, 0);
412
413 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
414
415 return sys_statfs(l, v, retval);
416 }
417
418
419 int
420 pecoff_sys_getfh(l, v, retval)
421 struct lwp *l;
422 void *v;
423 register_t *retval;
424 {
425 struct proc *p = l->l_proc;
426 struct pecoff_sys_getfh_args *uap = v;
427 caddr_t sg = stackgap_init(p, 0);
428
429 CHECK_ALT_EXIST(p, &sg, SCARG(uap, fname));
430
431 return sys_getfh(l, v, retval);
432 }
433
434
435 #ifdef PECOFF_INCLUDE_COMPAT
436 int
437 pecoff_compat_12_sys_stat(l, v, retval)
438 struct lwp *l;
439 void *v;
440 register_t *retval;
441 {
442 struct proc *p = l->l_proc;
443 struct pecoff_compat_12_sys_stat_args *uap = v;
444 caddr_t sg = stackgap_init(p, 0);
445
446 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
447
448 return compat_12_sys_stat(l, v, retval);
449 }
450
451
452 int
453 pecoff_compat_12_sys_lstat(l, v, retval)
454 struct lwp *l;
455 void *v;
456 register_t *retval;
457 {
458 struct proc *p = l->l_proc;
459 struct pecoff_compat_12_sys_lstat_args *uap = v;
460 caddr_t sg = stackgap_init(p, 0);
461
462 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
463
464 return compat_12_sys_lstat(l, v, retval);
465 }
466 #endif /* PECOFF_INCLUDE_COMPAT */
467
468 int
469 pecoff_sys_pathconf(l, v, retval)
470 struct lwp *l;
471 void *v;
472 register_t *retval;
473 {
474 struct proc *p = l->l_proc;
475 struct pecoff_sys_pathconf_args *uap = v;
476 caddr_t sg = stackgap_init(p, 0);
477
478 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
479
480 return sys_pathconf(l, v, retval);
481 }
482
483
484 int
485 pecoff_sys_truncate(l, v, retval)
486 struct lwp *l;
487 void *v;
488 register_t *retval;
489 {
490 struct proc *p = l->l_proc;
491 struct pecoff_sys_truncate_args *uap = v;
492 caddr_t sg = stackgap_init(p, 0);
493
494 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
495
496 return sys_truncate(l, v, retval);
497 }
498
499
500 int
501 pecoff_sys_undelete(l, v, retval)
502 struct lwp *l;
503 void *v;
504 register_t *retval;
505 {
506 struct proc *p = l->l_proc;
507 struct pecoff_sys_undelete_args *uap = v;
508 caddr_t sg = stackgap_init(p, 0);
509
510 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
511
512 return sys_undelete(l, v, retval);
513 }
514
515
516 int
517 pecoff_sys___posix_rename(l, v, retval)
518 struct lwp *l;
519 void *v;
520 register_t *retval;
521 {
522 struct proc *p = l->l_proc;
523 struct pecoff_sys___posix_rename_args *uap = v;
524 caddr_t sg = stackgap_init(p, 0);
525
526 CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
527 #if 0
528 CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
529 #endif
530
531 return sys___posix_rename(l, v, retval);
532 }
533
534
535 int
536 pecoff_sys_lchmod(l, v, retval)
537 struct lwp *l;
538 void *v;
539 register_t *retval;
540 {
541 struct proc *p = l->l_proc;
542 struct pecoff_sys_lchmod_args *uap = v;
543 caddr_t sg = stackgap_init(p, 0);
544
545 CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
546
547 return sys_lchmod(l, v, retval);
548 }
549
550
551 int
552 pecoff_sys_lchown(l, v, retval)
553 struct lwp *l;
554 void *v;
555 register_t *retval;
556 {
557 struct proc *p = l->l_proc;
558 struct pecoff_sys_lchown_args *uap = v;
559 caddr_t sg = stackgap_init(p, 0);
560
561 CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
562
563 return sys_lchown(l, v, retval);
564 }
565
566
567 int
568 pecoff_sys_lutimes(l, v, retval)
569 struct lwp *l;
570 void *v;
571 register_t *retval;
572 {
573 struct proc *p = l->l_proc;
574 struct pecoff_sys_lutimes_args *uap = v;
575 caddr_t sg = stackgap_init(p, 0);
576
577 CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
578
579 return sys_lutimes(l, v, retval);
580 }
581
582
583 int
584 pecoff_sys___stat13(l, v, retval)
585 struct lwp *l;
586 void *v;
587 register_t *retval;
588 {
589 struct proc *p = l->l_proc;
590 struct pecoff_sys___stat13_args *uap = v;
591 caddr_t sg = stackgap_init(p, 0);
592
593 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
594
595 return sys___stat13(l, v, retval);
596 }
597
598
599 int
600 pecoff_sys___lstat13(l, v, retval)
601 struct lwp *l;
602 void *v;
603 register_t *retval;
604 {
605 struct proc *p = l->l_proc;
606 struct pecoff_sys___lstat13_args *uap = v;
607 caddr_t sg = stackgap_init(p, 0);
608
609 CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
610
611 return sys___lstat13(l, v, retval);
612 }
613
614
615 int
616 pecoff_sys___posix_chown(l, v, retval)
617 struct lwp *l;
618 void *v;
619 register_t *retval;
620 {
621 struct proc *p = l->l_proc;
622 struct pecoff_sys___posix_chown_args *uap = v;
623 caddr_t sg = stackgap_init(p, 0);
624
625 CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
626
627 return sys___posix_chown(l, v, retval);
628 }
629
630
631 int
632 pecoff_sys___posix_lchown(l, v, retval)
633 struct lwp *l;
634 void *v;
635 register_t *retval;
636 {
637 struct proc *p = l->l_proc;
638 struct pecoff_sys___posix_lchown_args *uap = v;
639 caddr_t sg = stackgap_init(p, 0);
640
641 CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
642
643 return sys___posix_lchown(l, v, retval);
644 }
645
646
647 int
648 pecoff_sys_lchflags(l, v, retval)
649 struct lwp *l;
650 void *v;
651 register_t *retval;
652 {
653 struct proc *p = l->l_proc;
654 struct pecoff_sys_lchflags_args *uap = v;
655 caddr_t sg = stackgap_init(p, 0);
656
657 CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
658
659 return sys_lchflags(l, v, retval);
660 }
Cache object: 4ec04c3d41b5cb805ad8c450aa920303
|