1 /* $NetBSD: pecoff_misc.c,v 1.15 2006/07/13 21:31:31 martin 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.15 2006/07/13 21:31:31 martin Exp $");
41
42 #if defined(_KERNEL_OPT)
43 #include "opt_nfsserver.h"
44 #include "opt_compat_netbsd.h"
45 #include "opt_sysv.h"
46 #include "opt_compat_43.h"
47
48 #include "fs_lfs.h"
49 #include "fs_nfs.h"
50 #endif
51
52 #include <sys/param.h>
53 #include <sys/systm.h>
54 #include <sys/mount.h>
55 #include <sys/fcntl.h>
56 #include <sys/proc.h>
57
58 #include <sys/sa.h>
59 #include <sys/syscallargs.h>
60
61 #include <compat/common/compat_util.h>
62 #include <compat/pecoff/pecoff_syscallargs.h>
63
64 int
65 pecoff_sys_open(l, v, retval)
66 struct lwp *l;
67 void *v;
68 register_t *retval;
69 {
70 struct proc *p = l->l_proc;
71 struct pecoff_sys_open_args *uap = v;
72 caddr_t sg = stackgap_init(p, 0);
73
74 #if 0
75 if (SCARG(uap, flags) & O_CREAT)
76 CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
77 else
78 #endif
79 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
80
81 return sys_open(l, v, retval);
82 }
83
84
85 int
86 pecoff_sys_link(l, v, retval)
87 struct lwp *l;
88 void *v;
89 register_t *retval;
90 {
91 struct proc *p = l->l_proc;
92 struct pecoff_sys_link_args *uap = v;
93 caddr_t sg = stackgap_init(p, 0);
94
95 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
96 #if 0
97 CHECK_ALT_CREAT(l, &sg, SCARG(uap, link));
98 #endif
99
100 return sys_link(l, v, retval);
101 }
102
103
104 int
105 pecoff_sys_unlink(l, v, retval)
106 struct lwp *l;
107 void *v;
108 register_t *retval;
109 {
110 struct proc *p = l->l_proc;
111 struct pecoff_sys_unlink_args *uap = v;
112 caddr_t sg = stackgap_init(p, 0);
113
114 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
115
116 return sys_unlink(l, v, retval);
117 }
118
119
120 int
121 pecoff_sys_chdir(l, v, retval)
122 struct lwp *l;
123 void *v;
124 register_t *retval;
125 {
126 struct proc *p = l->l_proc;
127 struct pecoff_sys_chdir_args *uap = v;
128 caddr_t sg = stackgap_init(p, 0);
129
130 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
131
132 return sys_chdir(l, v, retval);
133 }
134
135
136 int
137 pecoff_sys_chmod(l, v, retval)
138 struct lwp *l;
139 void *v;
140 register_t *retval;
141 {
142 struct proc *p = l->l_proc;
143 struct pecoff_sys_chmod_args *uap = v;
144 caddr_t sg = stackgap_init(p, 0);
145
146 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
147
148 return sys_chmod(l, v, retval);
149 }
150
151
152 int
153 pecoff_sys_chown(l, v, retval)
154 struct lwp *l;
155 void *v;
156 register_t *retval;
157 {
158 struct proc *p = l->l_proc;
159 struct pecoff_sys_chown_args *uap = v;
160 caddr_t sg = stackgap_init(p, 0);
161
162 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
163
164 return sys_chown(l, v, retval);
165 }
166
167
168 int
169 pecoff_sys_unmount(l, v, retval)
170 struct lwp *l;
171 void *v;
172 register_t *retval;
173 {
174 struct proc *p = l->l_proc;
175 struct pecoff_sys_unmount_args *uap = v;
176 caddr_t sg = stackgap_init(p, 0);
177
178 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
179
180 return sys_unmount(l, v, retval);
181 }
182
183
184 int
185 pecoff_sys_access(l, v, retval)
186 struct lwp *l;
187 void *v;
188 register_t *retval;
189 {
190 struct proc *p = l->l_proc;
191 struct pecoff_sys_access_args *uap = v;
192 caddr_t sg = stackgap_init(p, 0);
193
194 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
195
196 return sys_access(l, v, retval);
197 }
198
199
200 int
201 pecoff_sys_chflags(l, v, retval)
202 struct lwp *l;
203 void *v;
204 register_t *retval;
205 {
206 struct proc *p = l->l_proc;
207 struct pecoff_sys_chflags_args *uap = v;
208 caddr_t sg = stackgap_init(p, 0);
209
210 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
211
212 return sys_chflags(l, v, retval);
213 }
214
215
216 #ifdef PECOFF_INCLUDE_COMPAT
217 int
218 pecoff_compat_43_sys_stat(l, v, retval)
219 struct lwp *l;
220 void *v;
221 register_t *retval;
222 {
223 struct proc *p = l->l_proc;
224 struct pecoff_compat_43_sys_stat_args *uap = v;
225 caddr_t sg = stackgap_init(p, 0);
226
227 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
228
229 return compat_43_sys_stat(l, v, retval);
230 }
231
232
233 int
234 pecoff_compat_43_sys_lstat(l, v, retval)
235 struct lwp *l;
236 void *v;
237 register_t *retval;
238 {
239 struct proc *p = l->l_proc;
240 struct pecoff_compat_43_sys_lstat_args *uap = v;
241 caddr_t sg = stackgap_init(p, 0);
242
243 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
244
245 return compat_43_sys_lstat(l, v, retval);
246 }
247 #endif /* PECOFF_INCLUDE_COMPAT */
248
249
250 int
251 pecoff_sys_revoke(l, v, retval)
252 struct lwp *l;
253 void *v;
254 register_t *retval;
255 {
256 struct proc *p = l->l_proc;
257 struct pecoff_sys_revoke_args *uap = v;
258 caddr_t sg = stackgap_init(p, 0);
259
260 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
261
262 return sys_revoke(l, v, retval);
263 }
264
265
266 int
267 pecoff_sys_symlink(l, v, retval)
268 struct lwp *l;
269 void *v;
270 register_t *retval;
271 {
272 struct proc *p = l->l_proc;
273 struct pecoff_sys_symlink_args *uap = v;
274 caddr_t sg = stackgap_init(p, 0);
275
276 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
277 #if 0
278 CHECK_ALT_CREAT(l, &sg, SCARG(uap, link));
279 #endif
280
281 return sys_symlink(l, v, retval);
282 }
283
284
285 ssize_t
286 pecoff_sys_readlink(l, v, retval)
287 struct lwp *l;
288 void *v;
289 register_t *retval;
290 {
291 struct proc *p = l->l_proc;
292 struct pecoff_sys_readlink_args *uap = v;
293 caddr_t sg = stackgap_init(p, 0);
294
295 CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
296
297 return sys_readlink(l, v, retval);
298 }
299
300
301 int
302 pecoff_sys_execve(l, v, retval)
303 struct lwp *l;
304 void *v;
305 register_t *retval;
306 {
307 struct proc *p = l->l_proc;
308 struct pecoff_sys_execve_args *uap = v;
309 caddr_t sg = stackgap_init(p, 0);
310
311 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
312
313 return sys_execve(l, v, retval);
314 }
315
316
317 int
318 pecoff_sys_chroot(l, v, retval)
319 struct lwp *l;
320 void *v;
321 register_t *retval;
322 {
323 struct proc *p = l->l_proc;
324 struct pecoff_sys_chroot_args *uap = v;
325 caddr_t sg = stackgap_init(p, 0);
326
327 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
328
329 return sys_chroot(l, v, retval);
330 }
331
332
333 int
334 pecoff_sys_rename(l, v, retval)
335 struct lwp *l;
336 void *v;
337 register_t *retval;
338 {
339 struct proc *p = l->l_proc;
340 struct pecoff_sys_rename_args *uap = v;
341 caddr_t sg = stackgap_init(p, 0);
342
343 CHECK_ALT_EXIST(l, &sg, SCARG(uap, from));
344 #if 0
345 CHECK_ALT_CREAT(l, &sg, SCARG(uap, to));
346 #endif
347
348 return sys_rename(l, v, retval);
349 }
350
351
352 #ifdef PECOFF_INCLUDE_COMPAT
353 int
354 pecoff_compat_43_sys_truncate(l, v, retval)
355 struct lwp *l;
356 void *v;
357 register_t *retval;
358 {
359 struct proc *p = l->l_proc;
360 struct pecoff_compat_43_sys_truncate_args *uap = v;
361 caddr_t sg = stackgap_init(p, 0);
362
363 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
364
365 return compat_43_sys_truncate(l, v, retval);
366 }
367 #endif /* PECOFF_INCLUDE_COMPAT */
368
369
370 int
371 pecoff_sys_rmdir(l, v, retval)
372 struct lwp *l;
373 void *v;
374 register_t *retval;
375 {
376 struct proc *p = l->l_proc;
377 struct pecoff_sys_rmdir_args *uap = v;
378 caddr_t sg = stackgap_init(p, 0);
379
380 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
381
382 return sys_rmdir(l, v, retval);
383 }
384
385
386 int
387 pecoff_sys_utimes(l, v, retval)
388 struct lwp *l;
389 void *v;
390 register_t *retval;
391 {
392 struct proc *p = l->l_proc;
393 struct pecoff_sys_utimes_args *uap = v;
394 caddr_t sg = stackgap_init(p, 0);
395
396 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
397
398 return sys_utimes(l, v, retval);
399 }
400
401
402 int
403 pecoff_sys_statfs(l, v, retval)
404 struct lwp *l;
405 void *v;
406 register_t *retval;
407 {
408 struct proc *p = l->l_proc;
409 struct pecoff_sys_statfs_args *uap = v;
410 caddr_t sg = stackgap_init(p, 0);
411
412 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
413
414 return compat_20_sys_statfs(l, v, retval);
415 }
416
417
418 #ifdef COMPAT_30
419 int
420 pecoff_compat_30_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_compat_30_sys_getfh_args *uap = v;
427 caddr_t sg = stackgap_init(p, 0);
428
429 CHECK_ALT_EXIST(l, &sg, SCARG(uap, fname));
430
431 return compat_30_sys_getfh(l, v, retval);
432 }
433 #endif
434
435 int
436 pecoff_sys___getfh30(l, v, retval)
437 struct lwp *l;
438 void *v;
439 register_t *retval;
440 {
441 struct proc *p = l->l_proc;
442 struct pecoff_sys___getfh30_args *uap = v;
443 caddr_t sg = stackgap_init(p, 0);
444
445 CHECK_ALT_EXIST(l, &sg, SCARG(uap, fname));
446
447 return sys___getfh30(l, v, retval);
448 }
449
450
451 #ifdef PECOFF_INCLUDE_COMPAT
452 int
453 pecoff_compat_12_sys_stat(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_stat_args *uap = v;
460 caddr_t sg = stackgap_init(p, 0);
461
462 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
463
464 return compat_12_sys_stat(l, v, retval);
465 }
466
467
468 int
469 pecoff_compat_12_sys_lstat(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_compat_12_sys_lstat_args *uap = v;
476 caddr_t sg = stackgap_init(p, 0);
477
478 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
479
480 return compat_12_sys_lstat(l, v, retval);
481 }
482 #endif /* PECOFF_INCLUDE_COMPAT */
483
484 int
485 pecoff_sys_pathconf(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_pathconf_args *uap = v;
492 caddr_t sg = stackgap_init(p, 0);
493
494 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
495
496 return sys_pathconf(l, v, retval);
497 }
498
499
500 int
501 pecoff_sys_truncate(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_truncate_args *uap = v;
508 caddr_t sg = stackgap_init(p, 0);
509
510 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
511
512 return sys_truncate(l, v, retval);
513 }
514
515
516 int
517 pecoff_sys_undelete(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_undelete_args *uap = v;
524 caddr_t sg = stackgap_init(p, 0);
525
526 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
527
528 return sys_undelete(l, v, retval);
529 }
530
531
532 int
533 pecoff_sys___posix_rename(l, v, retval)
534 struct lwp *l;
535 void *v;
536 register_t *retval;
537 {
538 struct proc *p = l->l_proc;
539 struct pecoff_sys___posix_rename_args *uap = v;
540 caddr_t sg = stackgap_init(p, 0);
541
542 CHECK_ALT_EXIST(l, &sg, SCARG(uap, from));
543 #if 0
544 CHECK_ALT_CREAT(l, &sg, SCARG(uap, to));
545 #endif
546
547 return sys___posix_rename(l, v, retval);
548 }
549
550
551 int
552 pecoff_sys_lchmod(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_lchmod_args *uap = v;
559 caddr_t sg = stackgap_init(p, 0);
560
561 CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
562
563 return sys_lchmod(l, v, retval);
564 }
565
566
567 int
568 pecoff_sys_lchown(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_lchown_args *uap = v;
575 caddr_t sg = stackgap_init(p, 0);
576
577 CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
578
579 return sys_lchown(l, v, retval);
580 }
581
582
583 int
584 pecoff_sys_lutimes(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_lutimes_args *uap = v;
591 caddr_t sg = stackgap_init(p, 0);
592
593 CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
594
595 return sys_lutimes(l, v, retval);
596 }
597
598 #ifdef COMPAT_30
599 int
600 pecoff_sys___stat13(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___stat13_args *uap = v;
607 caddr_t sg = stackgap_init(p, 0);
608
609 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
610
611 return compat_30_sys___stat13(l, v, retval);
612 }
613
614
615 int
616 pecoff_sys___lstat13(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___lstat13_args *uap = v;
623 caddr_t sg = stackgap_init(p, 0);
624
625 CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
626
627 return compat_30_sys___lstat13(l, v, retval);
628 }
629 #endif
630
631 int
632 pecoff_sys___stat30(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___stat30_args *uap = v;
639 caddr_t sg = stackgap_init(p, 0);
640
641 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
642
643 return sys___stat30(l, v, retval);
644 }
645
646
647 int
648 pecoff_sys___lstat30(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___lstat30_args *uap = v;
655 caddr_t sg = stackgap_init(p, 0);
656
657 CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
658
659 return sys___lstat30(l, v, retval);
660 }
661
662
663 int
664 pecoff_sys___posix_chown(l, v, retval)
665 struct lwp *l;
666 void *v;
667 register_t *retval;
668 {
669 struct proc *p = l->l_proc;
670 struct pecoff_sys___posix_chown_args *uap = v;
671 caddr_t sg = stackgap_init(p, 0);
672
673 CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
674
675 return sys___posix_chown(l, v, retval);
676 }
677
678
679 int
680 pecoff_sys___posix_lchown(l, v, retval)
681 struct lwp *l;
682 void *v;
683 register_t *retval;
684 {
685 struct proc *p = l->l_proc;
686 struct pecoff_sys___posix_lchown_args *uap = v;
687 caddr_t sg = stackgap_init(p, 0);
688
689 CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
690
691 return sys___posix_lchown(l, v, retval);
692 }
693
694
695 int
696 pecoff_sys_lchflags(l, v, retval)
697 struct lwp *l;
698 void *v;
699 register_t *retval;
700 {
701 struct proc *p = l->l_proc;
702 struct pecoff_sys_lchflags_args *uap = v;
703 caddr_t sg = stackgap_init(p, 0);
704
705 CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
706
707 return sys_lchflags(l, v, retval);
708 }
Cache object: 69cf50c180251fb8e741c5e937433d96
|