| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: osf1_file.c,v 1.34 2009/05/28 14:48:20 njoly Exp $ */ | | 1 | /* $NetBSD: osf1_file.c,v 1.35 2009/05/28 15:21:26 njoly Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. | | 4 | * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * 3. All advertising materials mentioning features or use of this software | | 14 | * 3. All advertising materials mentioning features or use of this software |
| @@ -48,27 +48,27 @@ | | | @@ -48,27 +48,27 @@ |
48 | * | | 48 | * |
49 | * Carnegie Mellon requests users of this software to return to | | 49 | * Carnegie Mellon requests users of this software to return to |
50 | * | | 50 | * |
51 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | | 51 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU |
52 | * School of Computer Science | | 52 | * School of Computer Science |
53 | * Carnegie Mellon University | | 53 | * Carnegie Mellon University |
54 | * Pittsburgh PA 15213-3890 | | 54 | * Pittsburgh PA 15213-3890 |
55 | * | | 55 | * |
56 | * any improvements or extensions that they make and grant Carnegie the | | 56 | * any improvements or extensions that they make and grant Carnegie the |
57 | * rights to redistribute these changes. | | 57 | * rights to redistribute these changes. |
58 | */ | | 58 | */ |
59 | | | 59 | |
60 | #include <sys/cdefs.h> | | 60 | #include <sys/cdefs.h> |
61 | __KERNEL_RCSID(0, "$NetBSD: osf1_file.c,v 1.34 2009/05/28 14:48:20 njoly Exp $"); | | 61 | __KERNEL_RCSID(0, "$NetBSD: osf1_file.c,v 1.35 2009/05/28 15:21:26 njoly Exp $"); |
62 | | | 62 | |
63 | #if defined(_KERNEL_OPT) | | 63 | #if defined(_KERNEL_OPT) |
64 | #include "opt_syscall_debug.h" | | 64 | #include "opt_syscall_debug.h" |
65 | #endif | | 65 | #endif |
66 | | | 66 | |
67 | #include <sys/param.h> | | 67 | #include <sys/param.h> |
68 | #include <sys/systm.h> | | 68 | #include <sys/systm.h> |
69 | #include <sys/namei.h> | | 69 | #include <sys/namei.h> |
70 | #include <sys/proc.h> | | 70 | #include <sys/proc.h> |
71 | #include <sys/file.h> | | 71 | #include <sys/file.h> |
72 | #include <sys/stat.h> | | 72 | #include <sys/stat.h> |
73 | #include <sys/filedesc.h> | | 73 | #include <sys/filedesc.h> |
74 | #include <sys/kernel.h> | | 74 | #include <sys/kernel.h> |
| @@ -233,30 +233,30 @@ again: | | | @@ -233,30 +233,30 @@ again: |
233 | | | 233 | |
234 | /* if we squished out the whole block, try again */ | | 234 | /* if we squished out the whole block, try again */ |
235 | if (outp == (char *)SCARG(uap, buf)) | | 235 | if (outp == (char *)SCARG(uap, buf)) |
236 | goto again; | | 236 | goto again; |
237 | fp->f_offset = off; /* update the vnode offset */ | | 237 | fp->f_offset = off; /* update the vnode offset */ |
238 | | | 238 | |
239 | eof: | | 239 | eof: |
240 | *retval = SCARG(uap, nbytes) - resid; | | 240 | *retval = SCARG(uap, nbytes) - resid; |
241 | out: | | 241 | out: |
242 | VOP_UNLOCK(vp, 0); | | 242 | VOP_UNLOCK(vp, 0); |
243 | if (cookiebuf) | | 243 | if (cookiebuf) |
244 | free(cookiebuf, M_TEMP); | | 244 | free(cookiebuf, M_TEMP); |
245 | free(buf, M_TEMP); | | 245 | free(buf, M_TEMP); |
| | | 246 | if (SCARG(uap, basep) != NULL) |
| | | 247 | error = copyout(&eofflag, SCARG(uap, basep), sizeof(long)); |
246 | out1: | | 248 | out1: |
247 | fd_putfile(fd); | | 249 | fd_putfile(fd); |
248 | if (error == 0 && SCARG(uap, basep) != NULL) | | | |
249 | error = copyout(&eofflag, SCARG(uap, basep), sizeof(long)); | | | |
250 | return error; | | 250 | return error; |
251 | } | | 251 | } |
252 | | | 252 | |
253 | /* | | 253 | /* |
254 | * Get file status; this version does not follow links. | | 254 | * Get file status; this version does not follow links. |
255 | */ | | 255 | */ |
256 | /* ARGSUSED */ | | 256 | /* ARGSUSED */ |
257 | int | | 257 | int |
258 | osf1_sys_lstat(struct lwp *l, const struct osf1_sys_lstat_args *uap, register_t *retval) | | 258 | osf1_sys_lstat(struct lwp *l, const struct osf1_sys_lstat_args *uap, register_t *retval) |
259 | { | | 259 | { |
260 | struct stat sb; | | 260 | struct stat sb; |
261 | struct osf1_stat osb; | | 261 | struct osf1_stat osb; |
262 | int error; | | 262 | int error; |