vfs_syscalls_43.c revision 1.67 1 1.67 christos /* $NetBSD: vfs_syscalls_43.c,v 1.67 2021/08/15 07:57:46 christos Exp $ */
2 1.1 christos
3 1.1 christos /*
4 1.1 christos * Copyright (c) 1989, 1993
5 1.1 christos * The Regents of the University of California. All rights reserved.
6 1.1 christos * (c) UNIX System Laboratories, Inc.
7 1.1 christos * All or some portions of this file are derived from material licensed
8 1.1 christos * to the University of California by American Telephone and Telegraph
9 1.1 christos * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 1.1 christos * the permission of UNIX System Laboratories, Inc.
11 1.1 christos *
12 1.1 christos * Redistribution and use in source and binary forms, with or without
13 1.1 christos * modification, are permitted provided that the following conditions
14 1.1 christos * are met:
15 1.1 christos * 1. Redistributions of source code must retain the above copyright
16 1.1 christos * notice, this list of conditions and the following disclaimer.
17 1.1 christos * 2. Redistributions in binary form must reproduce the above copyright
18 1.1 christos * notice, this list of conditions and the following disclaimer in the
19 1.1 christos * documentation and/or other materials provided with the distribution.
20 1.25 agc * 3. Neither the name of the University nor the names of its contributors
21 1.1 christos * may be used to endorse or promote products derived from this software
22 1.1 christos * without specific prior written permission.
23 1.1 christos *
24 1.1 christos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 1.1 christos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 1.1 christos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 1.1 christos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 1.1 christos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 1.1 christos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 1.1 christos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 1.1 christos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 1.1 christos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 1.1 christos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 1.1 christos * SUCH DAMAGE.
35 1.1 christos *
36 1.1 christos * @(#)vfs_syscalls.c 8.28 (Berkeley) 12/10/94
37 1.1 christos */
38 1.20 lukem
39 1.20 lukem #include <sys/cdefs.h>
40 1.67 christos __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.67 2021/08/15 07:57:46 christos Exp $");
41 1.9 thorpej
42 1.18 mrg #if defined(_KERNEL_OPT)
43 1.50 dyoung #include "opt_compat_netbsd.h"
44 1.15 jdolecek #endif
45 1.1 christos
46 1.1 christos #include <sys/param.h>
47 1.1 christos #include <sys/systm.h>
48 1.1 christos #include <sys/filedesc.h>
49 1.1 christos #include <sys/kernel.h>
50 1.1 christos #include <sys/proc.h>
51 1.1 christos #include <sys/file.h>
52 1.1 christos #include <sys/vnode.h>
53 1.1 christos #include <sys/namei.h>
54 1.1 christos #include <sys/dirent.h>
55 1.1 christos #include <sys/socket.h>
56 1.1 christos #include <sys/socketvar.h>
57 1.1 christos #include <sys/stat.h>
58 1.27 christos #include <sys/malloc.h>
59 1.1 christos #include <sys/ioctl.h>
60 1.1 christos #include <sys/fcntl.h>
61 1.1 christos #include <sys/syslog.h>
62 1.1 christos #include <sys/unistd.h>
63 1.1 christos #include <sys/resourcevar.h>
64 1.1 christos
65 1.1 christos #include <sys/mount.h>
66 1.64 pgoyette #include <sys/syscall.h>
67 1.64 pgoyette #include <sys/syscallvar.h>
68 1.1 christos #include <sys/syscallargs.h>
69 1.37 dsl #include <sys/vfs_syscalls.h>
70 1.1 christos
71 1.30 christos #include <compat/sys/stat.h>
72 1.30 christos #include <compat/sys/mount.h>
73 1.56 christos #include <compat/sys/dirent.h>
74 1.30 christos
75 1.48 ad #include <compat/common/compat_util.h>
76 1.55 pgoyette #include <compat/common/compat_mod.h>
77 1.48 ad
78 1.64 pgoyette static struct syscall_package vfs_syscalls_43_syscalls[] = {
79 1.65 pgoyette { SYS_compat_43_oquota, 0, (sy_call_t *)compat_43_sys_quota },
80 1.65 pgoyette { SYS_compat_43_stat43, 0, (sy_call_t *)compat_43_sys_stat },
81 1.65 pgoyette { SYS_compat_43_lstat43, 0, (sy_call_t *)compat_43_sys_lstat },
82 1.65 pgoyette { SYS_compat_43_fstat43, 0, (sy_call_t *)compat_43_sys_fstat },
83 1.65 pgoyette { SYS_compat_43_otruncate, 0, (sy_call_t *)compat_43_sys_ftruncate },
84 1.65 pgoyette { SYS_compat_43_oftruncate, 0, (sy_call_t *)compat_43_sys_ftruncate },
85 1.65 pgoyette { SYS_compat_43_olseek, 0, (sy_call_t *)compat_43_sys_lseek },
86 1.65 pgoyette { SYS_compat_43_ocreat, 0, (sy_call_t *)compat_43_sys_creat },
87 1.65 pgoyette { SYS_compat_43_ogetdirentries, 0,
88 1.65 pgoyette (sy_call_t *)compat_43_sys_getdirentries },
89 1.64 pgoyette { 0, 0, NULL }
90 1.64 pgoyette };
91 1.64 pgoyette
92 1.1 christos /*
93 1.58 mrg * Convert from an old to a new timespec structure.
94 1.58 mrg */
95 1.58 mrg static void
96 1.67 christos cvttimespec(struct timespec50 *ots, const struct timespec *ts)
97 1.58 mrg {
98 1.58 mrg
99 1.58 mrg if (ts->tv_sec > INT_MAX) {
100 1.58 mrg #if defined(DEBUG) || 1
101 1.58 mrg static bool first = true;
102 1.58 mrg
103 1.58 mrg if (first) {
104 1.58 mrg first = false;
105 1.58 mrg printf("%s[%s:%d]: time_t does not fit\n",
106 1.58 mrg __func__, curlwp->l_proc->p_comm,
107 1.58 mrg curlwp->l_lid);
108 1.58 mrg }
109 1.58 mrg #endif
110 1.58 mrg ots->tv_sec = INT_MAX;
111 1.58 mrg } else
112 1.58 mrg ots->tv_sec = ts->tv_sec;
113 1.58 mrg ots->tv_nsec = ts->tv_nsec;
114 1.58 mrg }
115 1.58 mrg
116 1.58 mrg /*
117 1.1 christos * Convert from an old to a new stat structure.
118 1.1 christos */
119 1.4 christos static void
120 1.67 christos cvtstat(struct stat43 *ost, const struct stat *st)
121 1.1 christos {
122 1.1 christos
123 1.58 mrg /* Handle any padding. */
124 1.67 christos memset(ost, 0, sizeof(*ost));
125 1.1 christos ost->st_dev = st->st_dev;
126 1.1 christos ost->st_ino = st->st_ino;
127 1.11 wrstuden ost->st_mode = st->st_mode & 0xffff;
128 1.1 christos ost->st_nlink = st->st_nlink;
129 1.1 christos ost->st_uid = st->st_uid;
130 1.1 christos ost->st_gid = st->st_gid;
131 1.1 christos ost->st_rdev = st->st_rdev;
132 1.1 christos if (st->st_size < (quad_t)1 << 32)
133 1.1 christos ost->st_size = st->st_size;
134 1.1 christos else
135 1.1 christos ost->st_size = -2;
136 1.67 christos cvttimespec(&ost->st_atimespec, &st->st_atimespec);
137 1.67 christos cvttimespec(&ost->st_mtimespec, &st->st_mtimespec);
138 1.67 christos cvttimespec(&ost->st_ctimespec, &st->st_ctimespec);
139 1.1 christos ost->st_blksize = st->st_blksize;
140 1.1 christos ost->st_blocks = st->st_blocks;
141 1.1 christos ost->st_flags = st->st_flags;
142 1.1 christos ost->st_gen = st->st_gen;
143 1.1 christos }
144 1.1 christos
145 1.1 christos /*
146 1.1 christos * Get file status; this version follows links.
147 1.1 christos */
148 1.1 christos /* ARGSUSED */
149 1.1 christos int
150 1.45 dsl compat_43_sys_stat(struct lwp *l, const struct compat_43_sys_stat_args *uap, register_t *retval)
151 1.2 thorpej {
152 1.45 dsl /* {
153 1.1 christos syscallarg(char *) path;
154 1.8 christos syscallarg(struct stat43 *) ub;
155 1.45 dsl } */
156 1.1 christos struct stat sb;
157 1.8 christos struct stat43 osb;
158 1.1 christos int error;
159 1.1 christos
160 1.46 ad error = do_sys_stat(SCARG(uap, path), FOLLOW, &sb);
161 1.1 christos if (error)
162 1.67 christos return error;
163 1.67 christos cvtstat(&osb, &sb);
164 1.67 christos return copyout(&osb, SCARG(uap, ub), sizeof(osb));
165 1.1 christos }
166 1.1 christos
167 1.1 christos /*
168 1.1 christos * Get file status; this version does not follow links.
169 1.1 christos */
170 1.1 christos /* ARGSUSED */
171 1.1 christos int
172 1.45 dsl compat_43_sys_lstat(struct lwp *l, const struct compat_43_sys_lstat_args *uap, register_t *retval)
173 1.2 thorpej {
174 1.45 dsl /* {
175 1.1 christos syscallarg(char *) path;
176 1.67 christos syscallarg(struct stat43 *) ub;
177 1.45 dsl } */
178 1.66 jdolecek struct stat sb;
179 1.8 christos struct stat43 osb;
180 1.1 christos int error;
181 1.1 christos
182 1.66 jdolecek error = do_sys_stat(SCARG(uap, path), NOFOLLOW, &sb);
183 1.66 jdolecek if (error)
184 1.54 dholland return error;
185 1.54 dholland
186 1.10 fvdl /*
187 1.66 jdolecek * For symbolic links, BSD4.3 returned the attributes of its
188 1.10 fvdl * containing directory, except for mode, size, and links.
189 1.66 jdolecek * This is no longer emulated, the parent directory is not consulted.
190 1.10 fvdl */
191 1.67 christos cvtstat(&osb, &sb);
192 1.67 christos return copyout(&osb, SCARG(uap, ub), sizeof(osb));
193 1.1 christos }
194 1.1 christos
195 1.1 christos /*
196 1.1 christos * Return status information about a file descriptor.
197 1.1 christos */
198 1.1 christos /* ARGSUSED */
199 1.4 christos int
200 1.45 dsl compat_43_sys_fstat(struct lwp *l, const struct compat_43_sys_fstat_args *uap, register_t *retval)
201 1.2 thorpej {
202 1.45 dsl /* {
203 1.1 christos syscallarg(int) fd;
204 1.8 christos syscallarg(struct stat43 *) sb;
205 1.45 dsl } */
206 1.67 christos struct stat sb;
207 1.67 christos struct stat43 osb;
208 1.1 christos int error;
209 1.1 christos
210 1.67 christos error = do_sys_fstat(SCARG(uap, fd), &sb);
211 1.67 christos if (error)
212 1.67 christos return error;
213 1.16 jdolecek
214 1.67 christos cvtstat(&osb, &sb);
215 1.67 christos return copyout(&osb, SCARG(uap, sb), sizeof(osb));
216 1.1 christos }
217 1.1 christos
218 1.1 christos
219 1.1 christos /*
220 1.1 christos * Truncate a file given a file descriptor.
221 1.1 christos */
222 1.1 christos /* ARGSUSED */
223 1.1 christos int
224 1.45 dsl compat_43_sys_ftruncate(struct lwp *l, const struct compat_43_sys_ftruncate_args *uap, register_t *retval)
225 1.2 thorpej {
226 1.45 dsl /* {
227 1.1 christos syscallarg(int) fd;
228 1.1 christos syscallarg(long) length;
229 1.45 dsl } */
230 1.3 mycroft struct sys_ftruncate_args /* {
231 1.1 christos syscallarg(int) fd;
232 1.1 christos syscallarg(int) pad;
233 1.1 christos syscallarg(off_t) length;
234 1.1 christos } */ nuap;
235 1.1 christos
236 1.1 christos SCARG(&nuap, fd) = SCARG(uap, fd);
237 1.1 christos SCARG(&nuap, length) = SCARG(uap, length);
238 1.67 christos return sys_ftruncate(l, &nuap, retval);
239 1.1 christos }
240 1.1 christos
241 1.1 christos /*
242 1.1 christos * Truncate a file given its path name.
243 1.1 christos */
244 1.1 christos /* ARGSUSED */
245 1.1 christos int
246 1.45 dsl compat_43_sys_truncate(struct lwp *l, const struct compat_43_sys_truncate_args *uap, register_t *retval)
247 1.2 thorpej {
248 1.45 dsl /* {
249 1.1 christos syscallarg(char *) path;
250 1.1 christos syscallarg(long) length;
251 1.45 dsl } */
252 1.3 mycroft struct sys_truncate_args /* {
253 1.1 christos syscallarg(char *) path;
254 1.1 christos syscallarg(int) pad;
255 1.1 christos syscallarg(off_t) length;
256 1.1 christos } */ nuap;
257 1.1 christos
258 1.1 christos SCARG(&nuap, path) = SCARG(uap, path);
259 1.1 christos SCARG(&nuap, length) = SCARG(uap, length);
260 1.22 thorpej return (sys_truncate(l, &nuap, retval));
261 1.1 christos }
262 1.1 christos
263 1.1 christos
264 1.1 christos /*
265 1.1 christos * Reposition read/write file offset.
266 1.1 christos */
267 1.1 christos int
268 1.45 dsl compat_43_sys_lseek(struct lwp *l, const struct compat_43_sys_lseek_args *uap, register_t *retval)
269 1.2 thorpej {
270 1.45 dsl /* {
271 1.1 christos syscallarg(int) fd;
272 1.1 christos syscallarg(long) offset;
273 1.1 christos syscallarg(int) whence;
274 1.45 dsl } */
275 1.3 mycroft struct sys_lseek_args /* {
276 1.1 christos syscallarg(int) fd;
277 1.1 christos syscallarg(int) pad;
278 1.1 christos syscallarg(off_t) offset;
279 1.1 christos syscallarg(int) whence;
280 1.1 christos } */ nuap;
281 1.1 christos off_t qret;
282 1.1 christos int error;
283 1.1 christos
284 1.1 christos SCARG(&nuap, fd) = SCARG(uap, fd);
285 1.1 christos SCARG(&nuap, offset) = SCARG(uap, offset);
286 1.1 christos SCARG(&nuap, whence) = SCARG(uap, whence);
287 1.57 matt error = sys_lseek(l, &nuap, (register_t *)&qret);
288 1.1 christos *(long *)retval = qret;
289 1.1 christos return (error);
290 1.1 christos }
291 1.1 christos
292 1.1 christos
293 1.1 christos /*
294 1.1 christos * Create a file.
295 1.1 christos */
296 1.1 christos int
297 1.45 dsl compat_43_sys_creat(struct lwp *l, const struct compat_43_sys_creat_args *uap, register_t *retval)
298 1.2 thorpej {
299 1.45 dsl /* {
300 1.1 christos syscallarg(char *) path;
301 1.1 christos syscallarg(int) mode;
302 1.45 dsl } */
303 1.3 mycroft struct sys_open_args /* {
304 1.1 christos syscallarg(char *) path;
305 1.1 christos syscallarg(int) flags;
306 1.1 christos syscallarg(int) mode;
307 1.1 christos } */ nuap;
308 1.1 christos
309 1.1 christos SCARG(&nuap, path) = SCARG(uap, path);
310 1.1 christos SCARG(&nuap, mode) = SCARG(uap, mode);
311 1.1 christos SCARG(&nuap, flags) = O_WRONLY | O_CREAT | O_TRUNC;
312 1.22 thorpej return (sys_open(l, &nuap, retval));
313 1.1 christos }
314 1.1 christos
315 1.1 christos /*ARGSUSED*/
316 1.1 christos int
317 1.45 dsl compat_43_sys_quota(struct lwp *l, const void *v, register_t *retval)
318 1.1 christos {
319 1.1 christos
320 1.1 christos return (ENOSYS);
321 1.1 christos }
322 1.1 christos
323 1.1 christos
324 1.1 christos /*
325 1.1 christos * Read a block of directory entries in a file system independent format.
326 1.1 christos */
327 1.1 christos int
328 1.45 dsl compat_43_sys_getdirentries(struct lwp *l, const struct compat_43_sys_getdirentries_args *uap, register_t *retval)
329 1.2 thorpej {
330 1.45 dsl /* {
331 1.1 christos syscallarg(int) fd;
332 1.1 christos syscallarg(char *) buf;
333 1.1 christos syscallarg(u_int) count;
334 1.1 christos syscallarg(long *) basep;
335 1.45 dsl } */
336 1.56 christos struct dirent *bdp;
337 1.13 augustss struct vnode *vp;
338 1.57 matt void *tbuf; /* Current-format */
339 1.57 matt char *inp; /* Current-format */
340 1.56 christos int len, reclen; /* Current-format */
341 1.56 christos char *outp; /* Dirent12-format */
342 1.56 christos int resid, old_reclen = 0; /* Dirent12-format */
343 1.1 christos struct file *fp;
344 1.56 christos struct uio auio;
345 1.56 christos struct iovec aiov;
346 1.56 christos struct dirent43 idb;
347 1.56 christos off_t off; /* true file offset */
348 1.56 christos int buflen, error, eofflag, nbytes;
349 1.56 christos struct vattr va;
350 1.56 christos off_t *cookiebuf = NULL, *cookie;
351 1.56 christos int ncookies;
352 1.1 christos long loff;
353 1.56 christos
354 1.47 ad /* fd_getvnode() will use the descriptor for us */
355 1.47 ad if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0)
356 1.1 christos return (error);
357 1.56 christos
358 1.12 thorpej if ((fp->f_flag & FREAD) == 0) {
359 1.12 thorpej error = EBADF;
360 1.56 christos goto out1;
361 1.12 thorpej }
362 1.56 christos
363 1.57 matt vp = fp->f_vnode;
364 1.12 thorpej if (vp->v_type != VDIR) {
365 1.56 christos error = ENOTDIR;
366 1.56 christos goto out1;
367 1.12 thorpej }
368 1.56 christos
369 1.56 christos vn_lock(vp, LK_SHARED | LK_RETRY);
370 1.56 christos error = VOP_GETATTR(vp, &va, l->l_cred);
371 1.56 christos VOP_UNLOCK(vp);
372 1.56 christos if (error)
373 1.56 christos goto out1;
374 1.56 christos
375 1.56 christos loff = fp->f_offset;
376 1.56 christos nbytes = SCARG(uap, count);
377 1.63 riastrad buflen = uimin(MAXBSIZE, nbytes);
378 1.56 christos if (buflen < va.va_blocksize)
379 1.56 christos buflen = va.va_blocksize;
380 1.56 christos tbuf = malloc(buflen, M_TEMP, M_WAITOK);
381 1.56 christos
382 1.56 christos vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
383 1.56 christos off = fp->f_offset;
384 1.56 christos again:
385 1.56 christos aiov.iov_base = tbuf;
386 1.56 christos aiov.iov_len = buflen;
387 1.1 christos auio.uio_iov = &aiov;
388 1.1 christos auio.uio_iovcnt = 1;
389 1.1 christos auio.uio_rw = UIO_READ;
390 1.56 christos auio.uio_resid = buflen;
391 1.56 christos auio.uio_offset = off;
392 1.56 christos UIO_SETUP_SYSSPACE(&auio);
393 1.56 christos /*
394 1.56 christos * First we read into the malloc'ed buffer, then
395 1.56 christos * we massage it into user space, one record at a time.
396 1.56 christos */
397 1.56 christos error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, &cookiebuf,
398 1.56 christos &ncookies);
399 1.56 christos if (error)
400 1.56 christos goto out;
401 1.56 christos
402 1.57 matt inp = (char *)tbuf;
403 1.56 christos outp = SCARG(uap, buf);
404 1.56 christos resid = nbytes;
405 1.56 christos if ((len = buflen - auio.uio_resid) == 0)
406 1.56 christos goto eof;
407 1.56 christos
408 1.56 christos for (cookie = cookiebuf; len > 0; len -= reclen) {
409 1.56 christos bdp = (struct dirent *)inp;
410 1.56 christos reclen = bdp->d_reclen;
411 1.60 riastrad if (reclen & 3) {
412 1.60 riastrad error = EIO;
413 1.60 riastrad goto out;
414 1.60 riastrad }
415 1.56 christos if (bdp->d_fileno == 0) {
416 1.56 christos inp += reclen; /* it is a hole; squish it out */
417 1.56 christos if (cookie)
418 1.56 christos off = *cookie++;
419 1.56 christos else
420 1.56 christos off += reclen;
421 1.56 christos continue;
422 1.56 christos }
423 1.62 christos if (bdp->d_namlen >= sizeof(idb.d_name))
424 1.62 christos idb.d_namlen = sizeof(idb.d_name) - 1;
425 1.62 christos else
426 1.62 christos idb.d_namlen = bdp->d_namlen;
427 1.56 christos old_reclen = _DIRENT_RECLEN(&idb, bdp->d_namlen);
428 1.56 christos if (reclen > len || resid < old_reclen) {
429 1.56 christos /* entry too big for buffer, so just stop */
430 1.56 christos outp++;
431 1.56 christos break;
432 1.1 christos }
433 1.56 christos /*
434 1.56 christos * Massage in place to make a Dirent12-shaped dirent (otherwise
435 1.56 christos * we have to worry about touching user memory outside of
436 1.56 christos * the copyout() call).
437 1.56 christos */
438 1.56 christos idb.d_fileno = (uint32_t)bdp->d_fileno;
439 1.56 christos idb.d_reclen = (uint16_t)old_reclen;
440 1.62 christos idb.d_fileno = (uint32_t)bdp->d_fileno;
441 1.62 christos (void)memcpy(idb.d_name, bdp->d_name, idb.d_namlen);
442 1.62 christos memset(idb.d_name + idb.d_namlen, 0,
443 1.62 christos idb.d_reclen - _DIRENT_NAMEOFF(&idb) - idb.d_namlen);
444 1.56 christos if ((error = copyout(&idb, outp, old_reclen)))
445 1.56 christos goto out;
446 1.56 christos /* advance past this real entry */
447 1.56 christos inp += reclen;
448 1.56 christos if (cookie)
449 1.56 christos off = *cookie++; /* each entry points to itself */
450 1.56 christos else
451 1.56 christos off += reclen;
452 1.56 christos /* advance output past Dirent12-shaped entry */
453 1.56 christos outp += old_reclen;
454 1.56 christos resid -= old_reclen;
455 1.1 christos }
456 1.1 christos
457 1.56 christos /* if we squished out the whole block, try again */
458 1.56 christos if (outp == SCARG(uap, buf)) {
459 1.56 christos if (cookiebuf)
460 1.56 christos free(cookiebuf, M_TEMP);
461 1.56 christos cookiebuf = NULL;
462 1.56 christos goto again;
463 1.1 christos }
464 1.56 christos fp->f_offset = off; /* update the vnode offset */
465 1.56 christos
466 1.56 christos eof:
467 1.56 christos *retval = nbytes - resid;
468 1.56 christos out:
469 1.56 christos VOP_UNLOCK(vp);
470 1.56 christos if (cookiebuf)
471 1.56 christos free(cookiebuf, M_TEMP);
472 1.56 christos free(tbuf, M_TEMP);
473 1.56 christos out1:
474 1.46 ad fd_putfile(SCARG(uap, fd));
475 1.56 christos if (error)
476 1.56 christos return error;
477 1.67 christos return copyout(&loff, SCARG(uap, basep), sizeof(loff));
478 1.1 christos }
479 1.30 christos
480 1.64 pgoyette int
481 1.64 pgoyette vfs_syscalls_43_init(void)
482 1.64 pgoyette {
483 1.64 pgoyette
484 1.64 pgoyette return syscall_establish(NULL, vfs_syscalls_43_syscalls);
485 1.64 pgoyette }
486 1.48 ad
487 1.64 pgoyette int
488 1.64 pgoyette vfs_syscalls_43_fini(void)
489 1.30 christos {
490 1.30 christos
491 1.64 pgoyette return syscall_disestablish(NULL, vfs_syscalls_43_syscalls);
492 1.30 christos }
493