freebsd_file.c revision 1.3 1 1.3 christos /* $NetBSD: freebsd_file.c,v 1.3 1996/05/03 17:03:09 christos Exp $ */
2 1.1 mycroft
3 1.1 mycroft /*
4 1.1 mycroft * Copyright (c) 1995 Frank van der Linden
5 1.1 mycroft * All rights reserved.
6 1.1 mycroft *
7 1.1 mycroft * Redistribution and use in source and binary forms, with or without
8 1.1 mycroft * modification, are permitted provided that the following conditions
9 1.1 mycroft * are met:
10 1.1 mycroft * 1. Redistributions of source code must retain the above copyright
11 1.1 mycroft * notice, this list of conditions and the following disclaimer.
12 1.1 mycroft * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 mycroft * notice, this list of conditions and the following disclaimer in the
14 1.1 mycroft * documentation and/or other materials provided with the distribution.
15 1.1 mycroft * 3. All advertising materials mentioning features or use of this software
16 1.1 mycroft * must display the following acknowledgement:
17 1.1 mycroft * This product includes software developed for the NetBSD Project
18 1.1 mycroft * by Frank van der Linden
19 1.1 mycroft * 4. The name of the author may not be used to endorse or promote products
20 1.1 mycroft * derived from this software without specific prior written permission
21 1.1 mycroft *
22 1.1 mycroft * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.1 mycroft * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.1 mycroft * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.1 mycroft * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.1 mycroft * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.1 mycroft * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.1 mycroft * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.1 mycroft * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.1 mycroft * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.1 mycroft * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.1 mycroft *
33 1.1 mycroft * from: linux_file.c,v 1.3 1995/04/04 04:21:30 mycroft Exp
34 1.1 mycroft */
35 1.1 mycroft
36 1.1 mycroft #include <sys/param.h>
37 1.1 mycroft #include <sys/systm.h>
38 1.1 mycroft #include <sys/namei.h>
39 1.1 mycroft #include <sys/proc.h>
40 1.1 mycroft #include <sys/file.h>
41 1.1 mycroft #include <sys/stat.h>
42 1.1 mycroft #include <sys/filedesc.h>
43 1.1 mycroft #include <sys/ioctl.h>
44 1.1 mycroft #include <sys/kernel.h>
45 1.1 mycroft #include <sys/mount.h>
46 1.1 mycroft #include <sys/malloc.h>
47 1.1 mycroft
48 1.1 mycroft #include <sys/syscallargs.h>
49 1.1 mycroft
50 1.1 mycroft #include <compat/freebsd/freebsd_syscallargs.h>
51 1.1 mycroft #include <compat/freebsd/freebsd_util.h>
52 1.1 mycroft
53 1.1 mycroft #define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0]))
54 1.1 mycroft
55 1.1 mycroft const char freebsd_emul_path[] = "/emul/freebsd";
56 1.1 mycroft
57 1.3 christos static char * convert_from_freebsd_mount_type __P((int));
58 1.3 christos
59 1.1 mycroft static char *
60 1.1 mycroft convert_from_freebsd_mount_type(type)
61 1.1 mycroft int type;
62 1.1 mycroft {
63 1.1 mycroft static char *netbsd_mount_type[] = {
64 1.1 mycroft NULL, /* 0 = MOUNT_NONE */
65 1.2 gwr "ffs", /* 1 = "Fast" Filesystem */
66 1.1 mycroft "nfs", /* 2 = Network Filesystem */
67 1.1 mycroft "mfs", /* 3 = Memory Filesystem */
68 1.1 mycroft "msdos", /* 4 = MSDOS Filesystem */
69 1.1 mycroft "lfs", /* 5 = Log-based Filesystem */
70 1.1 mycroft "lofs", /* 6 = Loopback filesystem */
71 1.1 mycroft "fdesc", /* 7 = File Descriptor Filesystem */
72 1.1 mycroft "portal", /* 8 = Portal Filesystem */
73 1.1 mycroft "null", /* 9 = Minimal Filesystem Layer */
74 1.1 mycroft "umap", /* 10 = User/Group Identifier Remapping Filesystem */
75 1.1 mycroft "kernfs", /* 11 = Kernel Information Filesystem */
76 1.1 mycroft "procfs", /* 12 = /proc Filesystem */
77 1.1 mycroft "afs", /* 13 = Andrew Filesystem */
78 1.1 mycroft "cd9660", /* 14 = ISO9660 (aka CDROM) Filesystem */
79 1.1 mycroft "union", /* 15 = Union (translucent) Filesystem */
80 1.1 mycroft NULL, /* 16 = "devfs" - existing device Filesystem */
81 1.1 mycroft #if 0 /* These filesystems don't exist in FreeBSD */
82 1.1 mycroft "adosfs", /* ?? = AmigaDOS Filesystem */
83 1.1 mycroft #endif
84 1.1 mycroft };
85 1.1 mycroft
86 1.1 mycroft if (type < 0 || type >= ARRAY_LENGTH(netbsd_mount_type))
87 1.1 mycroft return (NULL);
88 1.1 mycroft return (netbsd_mount_type[type]);
89 1.1 mycroft }
90 1.1 mycroft
91 1.1 mycroft int
92 1.1 mycroft freebsd_sys_mount(p, v, retval)
93 1.1 mycroft struct proc *p;
94 1.1 mycroft void *v;
95 1.1 mycroft register_t *retval;
96 1.1 mycroft {
97 1.1 mycroft struct freebsd_sys_mount_args /* {
98 1.1 mycroft syscallarg(int) type;
99 1.1 mycroft syscallarg(char *) path;
100 1.1 mycroft syscallarg(int) flags;
101 1.1 mycroft syscallarg(caddr_t) data;
102 1.1 mycroft } */ *uap = v;
103 1.1 mycroft int error;
104 1.1 mycroft char *type, *s;
105 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
106 1.1 mycroft struct sys_mount_args bma;
107 1.1 mycroft
108 1.1 mycroft if ((type = convert_from_freebsd_mount_type(SCARG(uap, type))) == NULL)
109 1.1 mycroft return ENODEV;
110 1.1 mycroft s = stackgap_alloc(&sg, MFSNAMELEN + 1);
111 1.3 christos if ((error = copyout(type, s, strlen(type) + 1)) != 0)
112 1.1 mycroft return error;
113 1.1 mycroft SCARG(&bma, type) = s;
114 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
115 1.1 mycroft SCARG(&bma, path) = SCARG(uap, path);
116 1.1 mycroft SCARG(&bma, flags) = SCARG(uap, flags);
117 1.1 mycroft SCARG(&bma, data) = SCARG(uap, data);
118 1.1 mycroft return sys_mount(p, &bma, retval);
119 1.1 mycroft }
120 1.1 mycroft
121 1.1 mycroft /*
122 1.1 mycroft * The following syscalls are only here because of the alternate path check.
123 1.1 mycroft */
124 1.1 mycroft
125 1.1 mycroft /* XXX - UNIX domain: int freebsd_sys_bind(int s, caddr_t name, int namelen); */
126 1.1 mycroft /* XXX - UNIX domain: int freebsd_sys_connect(int s, caddr_t name, int namelen); */
127 1.1 mycroft
128 1.1 mycroft
129 1.1 mycroft int
130 1.1 mycroft freebsd_sys_open(p, v, retval)
131 1.1 mycroft struct proc *p;
132 1.1 mycroft void *v;
133 1.1 mycroft register_t *retval;
134 1.1 mycroft {
135 1.1 mycroft struct freebsd_sys_open_args /* {
136 1.1 mycroft syscallarg(char *) path;
137 1.1 mycroft syscallarg(int) flags;
138 1.1 mycroft syscallarg(int) mode;
139 1.1 mycroft } */ *uap = v;
140 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
141 1.1 mycroft
142 1.1 mycroft if (SCARG(uap, flags) & O_CREAT)
143 1.1 mycroft FREEBSD_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
144 1.1 mycroft else
145 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
146 1.1 mycroft return sys_open(p, uap, retval);
147 1.1 mycroft }
148 1.1 mycroft
149 1.1 mycroft int
150 1.1 mycroft compat_43_freebsd_sys_creat(p, v, retval)
151 1.1 mycroft struct proc *p;
152 1.1 mycroft void *v;
153 1.1 mycroft register_t *retval;
154 1.1 mycroft {
155 1.1 mycroft struct compat_43_freebsd_sys_creat_args /* {
156 1.1 mycroft syscallarg(char *) path;
157 1.1 mycroft syscallarg(int) mode;
158 1.1 mycroft } */ *uap = v;
159 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
160 1.1 mycroft
161 1.1 mycroft FREEBSD_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
162 1.1 mycroft return compat_43_sys_creat(p, uap, retval);
163 1.1 mycroft }
164 1.1 mycroft
165 1.1 mycroft int
166 1.1 mycroft freebsd_sys_link(p, v, retval)
167 1.1 mycroft struct proc *p;
168 1.1 mycroft void *v;
169 1.1 mycroft register_t *retval;
170 1.1 mycroft {
171 1.1 mycroft struct freebsd_sys_link_args /* {
172 1.1 mycroft syscallarg(char *) path;
173 1.1 mycroft syscallarg(char *) link;
174 1.1 mycroft } */ *uap = v;
175 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
176 1.1 mycroft
177 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
178 1.1 mycroft FREEBSD_CHECK_ALT_CREAT(p, &sg, SCARG(uap, link));
179 1.1 mycroft return sys_link(p, uap, retval);
180 1.1 mycroft }
181 1.1 mycroft
182 1.1 mycroft int
183 1.1 mycroft freebsd_sys_unlink(p, v, retval)
184 1.1 mycroft struct proc *p;
185 1.1 mycroft void *v;
186 1.1 mycroft register_t *retval;
187 1.1 mycroft {
188 1.1 mycroft struct freebsd_sys_unlink_args /* {
189 1.1 mycroft syscallarg(char *) path;
190 1.1 mycroft } */ *uap = v;
191 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
192 1.1 mycroft
193 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
194 1.1 mycroft return sys_unlink(p, uap, retval);
195 1.1 mycroft }
196 1.1 mycroft
197 1.1 mycroft int
198 1.1 mycroft freebsd_sys_chdir(p, v, retval)
199 1.1 mycroft struct proc *p;
200 1.1 mycroft void *v;
201 1.1 mycroft register_t *retval;
202 1.1 mycroft {
203 1.1 mycroft struct freebsd_sys_chdir_args /* {
204 1.1 mycroft syscallarg(char *) path;
205 1.1 mycroft } */ *uap = v;
206 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
207 1.1 mycroft
208 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
209 1.1 mycroft return sys_chdir(p, uap, retval);
210 1.1 mycroft }
211 1.1 mycroft
212 1.1 mycroft int
213 1.1 mycroft freebsd_sys_mknod(p, v, retval)
214 1.1 mycroft struct proc *p;
215 1.1 mycroft void *v;
216 1.1 mycroft register_t *retval;
217 1.1 mycroft {
218 1.1 mycroft struct freebsd_sys_mknod_args /* {
219 1.1 mycroft syscallarg(char *) path;
220 1.1 mycroft syscallarg(int) mode;
221 1.1 mycroft syscallarg(int) dev;
222 1.1 mycroft } */ *uap = v;
223 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
224 1.1 mycroft
225 1.1 mycroft FREEBSD_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
226 1.1 mycroft return sys_mknod(p, uap, retval);
227 1.1 mycroft }
228 1.1 mycroft
229 1.1 mycroft int
230 1.1 mycroft freebsd_sys_chmod(p, v, retval)
231 1.1 mycroft struct proc *p;
232 1.1 mycroft void *v;
233 1.1 mycroft register_t *retval;
234 1.1 mycroft {
235 1.1 mycroft struct freebsd_sys_chmod_args /* {
236 1.1 mycroft syscallarg(char *) path;
237 1.1 mycroft syscallarg(int) mode;
238 1.1 mycroft } */ *uap = v;
239 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
240 1.1 mycroft
241 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
242 1.1 mycroft return sys_chmod(p, uap, retval);
243 1.1 mycroft }
244 1.1 mycroft
245 1.1 mycroft int
246 1.1 mycroft freebsd_sys_chown(p, v, retval)
247 1.1 mycroft struct proc *p;
248 1.1 mycroft void *v;
249 1.1 mycroft register_t *retval;
250 1.1 mycroft {
251 1.1 mycroft struct freebsd_sys_chown_args /* {
252 1.1 mycroft syscallarg(char *) path;
253 1.1 mycroft syscallarg(int) uid;
254 1.1 mycroft syscallarg(int) gid;
255 1.1 mycroft } */ *uap = v;
256 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
257 1.1 mycroft
258 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
259 1.1 mycroft return sys_chown(p, uap, retval);
260 1.1 mycroft }
261 1.1 mycroft
262 1.1 mycroft int
263 1.1 mycroft freebsd_sys_unmount(p, v, retval)
264 1.1 mycroft struct proc *p;
265 1.1 mycroft void *v;
266 1.1 mycroft register_t *retval;
267 1.1 mycroft {
268 1.1 mycroft struct freebsd_sys_unmount_args /* {
269 1.1 mycroft syscallarg(char *) path;
270 1.1 mycroft syscallarg(int) flags;
271 1.1 mycroft } */ *uap = v;
272 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
273 1.1 mycroft
274 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
275 1.1 mycroft return sys_unmount(p, uap, retval);
276 1.1 mycroft }
277 1.1 mycroft
278 1.1 mycroft int
279 1.1 mycroft freebsd_sys_access(p, v, retval)
280 1.1 mycroft struct proc *p;
281 1.1 mycroft void *v;
282 1.1 mycroft register_t *retval;
283 1.1 mycroft {
284 1.1 mycroft struct freebsd_sys_access_args /* {
285 1.1 mycroft syscallarg(char *) path;
286 1.1 mycroft syscallarg(int) flags;
287 1.1 mycroft } */ *uap = v;
288 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
289 1.1 mycroft
290 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
291 1.1 mycroft return sys_access(p, uap, retval);
292 1.1 mycroft }
293 1.1 mycroft
294 1.1 mycroft int
295 1.1 mycroft freebsd_sys_chflags(p, v, retval)
296 1.1 mycroft struct proc *p;
297 1.1 mycroft void *v;
298 1.1 mycroft register_t *retval;
299 1.1 mycroft {
300 1.1 mycroft struct freebsd_sys_chflags_args /* {
301 1.1 mycroft syscallarg(char *) path;
302 1.1 mycroft syscallarg(int) flags;
303 1.1 mycroft } */ *uap = v;
304 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
305 1.1 mycroft
306 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
307 1.1 mycroft return sys_chflags(p, uap, retval);
308 1.1 mycroft }
309 1.1 mycroft
310 1.1 mycroft int
311 1.1 mycroft compat_43_freebsd_sys_stat(p, v, retval)
312 1.1 mycroft struct proc *p;
313 1.1 mycroft void *v;
314 1.1 mycroft register_t *retval;
315 1.1 mycroft {
316 1.1 mycroft struct compat_43_freebsd_sys_stat_args /* {
317 1.1 mycroft syscallarg(char *) path;
318 1.1 mycroft syscallarg(struct ostat *) ub;
319 1.1 mycroft } */ *uap = v;
320 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
321 1.1 mycroft
322 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
323 1.1 mycroft return compat_43_sys_stat(p, uap, retval);
324 1.1 mycroft }
325 1.1 mycroft
326 1.1 mycroft int
327 1.1 mycroft compat_43_freebsd_sys_lstat(p, v, retval)
328 1.1 mycroft struct proc *p;
329 1.1 mycroft void *v;
330 1.1 mycroft register_t *retval;
331 1.1 mycroft {
332 1.1 mycroft struct compat_43_freebsd_sys_lstat_args /* {
333 1.1 mycroft syscallarg(char *) path;
334 1.1 mycroft syscallarg(struct ostat *) ub;
335 1.1 mycroft } */ *uap = v;
336 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
337 1.1 mycroft
338 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
339 1.1 mycroft return compat_43_sys_lstat(p, uap, retval);
340 1.1 mycroft }
341 1.1 mycroft
342 1.1 mycroft int
343 1.1 mycroft freebsd_sys_revoke(p, v, retval)
344 1.1 mycroft struct proc *p;
345 1.1 mycroft void *v;
346 1.1 mycroft register_t *retval;
347 1.1 mycroft {
348 1.1 mycroft struct freebsd_sys_revoke_args /* {
349 1.1 mycroft syscallarg(char *) path;
350 1.1 mycroft } */ *uap = v;
351 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
352 1.1 mycroft
353 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
354 1.1 mycroft return sys_revoke(p, uap, retval);
355 1.1 mycroft }
356 1.1 mycroft
357 1.1 mycroft int
358 1.1 mycroft freebsd_sys_symlink(p, v, retval)
359 1.1 mycroft struct proc *p;
360 1.1 mycroft void *v;
361 1.1 mycroft register_t *retval;
362 1.1 mycroft {
363 1.1 mycroft struct freebsd_sys_symlink_args /* {
364 1.1 mycroft syscallarg(char *) path;
365 1.1 mycroft syscallarg(char *) link;
366 1.1 mycroft } */ *uap = v;
367 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
368 1.1 mycroft
369 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
370 1.1 mycroft FREEBSD_CHECK_ALT_CREAT(p, &sg, SCARG(uap, link));
371 1.1 mycroft return sys_symlink(p, uap, retval);
372 1.1 mycroft }
373 1.1 mycroft
374 1.1 mycroft int
375 1.1 mycroft freebsd_sys_readlink(p, v, retval)
376 1.1 mycroft struct proc *p;
377 1.1 mycroft void *v;
378 1.1 mycroft register_t *retval;
379 1.1 mycroft {
380 1.1 mycroft struct freebsd_sys_readlink_args /* {
381 1.1 mycroft syscallarg(char *) path;
382 1.1 mycroft syscallarg(char *) buf;
383 1.1 mycroft syscallarg(int) count;
384 1.1 mycroft } */ *uap = v;
385 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
386 1.1 mycroft
387 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
388 1.1 mycroft return sys_readlink(p, uap, retval);
389 1.1 mycroft }
390 1.1 mycroft
391 1.1 mycroft int
392 1.1 mycroft freebsd_sys_execve(p, v, retval)
393 1.1 mycroft struct proc *p;
394 1.1 mycroft void *v;
395 1.1 mycroft register_t *retval;
396 1.1 mycroft {
397 1.1 mycroft struct freebsd_sys_execve_args /* {
398 1.1 mycroft syscallarg(char *) path;
399 1.1 mycroft syscallarg(char **) argp;
400 1.1 mycroft syscallarg(char **) envp;
401 1.1 mycroft } */ *uap = v;
402 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
403 1.1 mycroft
404 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
405 1.1 mycroft return sys_execve(p, uap, retval);
406 1.1 mycroft }
407 1.1 mycroft
408 1.1 mycroft int
409 1.1 mycroft freebsd_sys_chroot(p, v, retval)
410 1.1 mycroft struct proc *p;
411 1.1 mycroft void *v;
412 1.1 mycroft register_t *retval;
413 1.1 mycroft {
414 1.1 mycroft struct freebsd_sys_chroot_args /* {
415 1.1 mycroft syscallarg(char *) path;
416 1.1 mycroft } */ *uap = v;
417 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
418 1.1 mycroft
419 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
420 1.1 mycroft return sys_chroot(p, uap, retval);
421 1.1 mycroft }
422 1.1 mycroft
423 1.1 mycroft int
424 1.1 mycroft freebsd_sys_rename(p, v, retval)
425 1.1 mycroft struct proc *p;
426 1.1 mycroft void *v;
427 1.1 mycroft register_t *retval;
428 1.1 mycroft {
429 1.1 mycroft struct freebsd_sys_rename_args /* {
430 1.1 mycroft syscallarg(char *) from;
431 1.1 mycroft syscallarg(char *) to;
432 1.1 mycroft } */ *uap = v;
433 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
434 1.1 mycroft
435 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
436 1.1 mycroft FREEBSD_CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
437 1.1 mycroft return sys_rename(p, uap, retval);
438 1.1 mycroft }
439 1.1 mycroft
440 1.1 mycroft int
441 1.1 mycroft compat_43_freebsd_sys_truncate(p, v, retval)
442 1.1 mycroft struct proc *p;
443 1.1 mycroft void *v;
444 1.1 mycroft register_t *retval;
445 1.1 mycroft {
446 1.1 mycroft struct compat_43_freebsd_sys_truncate_args /* {
447 1.1 mycroft syscallarg(char *) path;
448 1.1 mycroft syscallarg(long) length;
449 1.1 mycroft } */ *uap = v;
450 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
451 1.1 mycroft
452 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
453 1.1 mycroft return compat_43_sys_truncate(p, uap, retval);
454 1.1 mycroft }
455 1.1 mycroft
456 1.1 mycroft int
457 1.1 mycroft freebsd_sys_mkfifo(p, v, retval)
458 1.1 mycroft struct proc *p;
459 1.1 mycroft void *v;
460 1.1 mycroft register_t *retval;
461 1.1 mycroft {
462 1.1 mycroft struct freebsd_sys_mkfifo_args /* {
463 1.1 mycroft syscallarg(char *) path;
464 1.1 mycroft syscallarg(int) mode;
465 1.1 mycroft } */ *uap = v;
466 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
467 1.1 mycroft
468 1.1 mycroft FREEBSD_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
469 1.1 mycroft return sys_mkfifo(p, uap, retval);
470 1.1 mycroft }
471 1.1 mycroft
472 1.1 mycroft int
473 1.1 mycroft freebsd_sys_mkdir(p, v, retval)
474 1.1 mycroft struct proc *p;
475 1.1 mycroft void *v;
476 1.1 mycroft register_t *retval;
477 1.1 mycroft {
478 1.1 mycroft struct freebsd_sys_mkdir_args /* {
479 1.1 mycroft syscallarg(char *) path;
480 1.1 mycroft syscallarg(int) mode;
481 1.1 mycroft } */ *uap = v;
482 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
483 1.1 mycroft
484 1.1 mycroft FREEBSD_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
485 1.1 mycroft return sys_mkdir(p, uap, retval);
486 1.1 mycroft }
487 1.1 mycroft
488 1.1 mycroft int
489 1.1 mycroft freebsd_sys_rmdir(p, v, retval)
490 1.1 mycroft struct proc *p;
491 1.1 mycroft void *v;
492 1.1 mycroft register_t *retval;
493 1.1 mycroft {
494 1.1 mycroft struct freebsd_sys_rmdir_args /* {
495 1.1 mycroft syscallarg(char *) path;
496 1.1 mycroft } */ *uap = v;
497 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
498 1.1 mycroft
499 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
500 1.1 mycroft return sys_rmdir(p, uap, retval);
501 1.1 mycroft }
502 1.1 mycroft
503 1.1 mycroft int
504 1.1 mycroft freebsd_sys_statfs(p, v, retval)
505 1.1 mycroft struct proc *p;
506 1.1 mycroft void *v;
507 1.1 mycroft register_t *retval;
508 1.1 mycroft {
509 1.1 mycroft struct freebsd_sys_stat_args /* {
510 1.1 mycroft syscallarg(char *) path;
511 1.1 mycroft syscallarg(struct statfs *) buf;
512 1.1 mycroft } */ *uap = v;
513 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
514 1.1 mycroft
515 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
516 1.1 mycroft return sys_statfs(p, uap, retval);
517 1.1 mycroft }
518 1.1 mycroft
519 1.1 mycroft #ifdef NFSCLIENT
520 1.1 mycroft int
521 1.1 mycroft freebsd_sys_getfh(p, v, retval)
522 1.1 mycroft struct proc *p;
523 1.1 mycroft void *v;
524 1.1 mycroft register_t *retval;
525 1.1 mycroft {
526 1.1 mycroft struct freebsd_sys_getfh_args /* {
527 1.1 mycroft syscallarg(char *) fname;
528 1.1 mycroft syscallarg(fhandle_t *) fhp;
529 1.1 mycroft } */ *uap = v;
530 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
531 1.1 mycroft
532 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, fname));
533 1.1 mycroft return sys_getfh(p, uap, retval);
534 1.1 mycroft }
535 1.1 mycroft #endif /* NFSCLIENT */
536 1.1 mycroft
537 1.1 mycroft int
538 1.1 mycroft freebsd_sys_stat(p, v, retval)
539 1.1 mycroft struct proc *p;
540 1.1 mycroft void *v;
541 1.1 mycroft register_t *retval;
542 1.1 mycroft {
543 1.1 mycroft struct freebsd_sys_stat_args /* {
544 1.1 mycroft syscallarg(char *) path;
545 1.1 mycroft syscallarg(struct stat *) ub;
546 1.1 mycroft } */ *uap = v;
547 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
548 1.1 mycroft
549 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
550 1.1 mycroft return sys_stat(p, uap, retval);
551 1.1 mycroft }
552 1.1 mycroft
553 1.1 mycroft int
554 1.1 mycroft freebsd_sys_lstat(p, v, retval)
555 1.1 mycroft struct proc *p;
556 1.1 mycroft void *v;
557 1.1 mycroft register_t *retval;
558 1.1 mycroft {
559 1.1 mycroft struct freebsd_sys_lstat_args /* {
560 1.1 mycroft syscallarg(char *) path;
561 1.1 mycroft syscallarg(struct stat *) ub;
562 1.1 mycroft } */ *uap = v;
563 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
564 1.1 mycroft
565 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
566 1.1 mycroft return sys_lstat(p, uap, retval);
567 1.1 mycroft }
568 1.1 mycroft
569 1.1 mycroft int
570 1.1 mycroft freebsd_sys_pathconf(p, v, retval)
571 1.1 mycroft struct proc *p;
572 1.1 mycroft void *v;
573 1.1 mycroft register_t *retval;
574 1.1 mycroft {
575 1.1 mycroft struct freebsd_sys_pathconf_args /* {
576 1.1 mycroft syscallarg(char *) path;
577 1.1 mycroft syscallarg(int) name;
578 1.1 mycroft } */ *uap = v;
579 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
580 1.1 mycroft
581 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
582 1.1 mycroft return sys_pathconf(p, uap, retval);
583 1.1 mycroft }
584 1.1 mycroft
585 1.1 mycroft int
586 1.1 mycroft freebsd_sys_truncate(p, v, retval)
587 1.1 mycroft struct proc *p;
588 1.1 mycroft void *v;
589 1.1 mycroft register_t *retval;
590 1.1 mycroft {
591 1.1 mycroft struct freebsd_sys_truncate_args /* {
592 1.1 mycroft syscallarg(char *) path;
593 1.1 mycroft syscallarg(int) pad;
594 1.1 mycroft syscallarg(off_t) length;
595 1.1 mycroft } */ *uap = v;
596 1.1 mycroft caddr_t sg = stackgap_init(p->p_emul);
597 1.1 mycroft
598 1.1 mycroft FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
599 1.1 mycroft return sys_truncate(p, uap, retval);
600 1.1 mycroft }
601