aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2017-01-30 12:24:47 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2017-01-30 12:24:47 +0000
commitf67d6b5f121f093d9691d43ccedc91c30f1fcb8d (patch)
treecbbf726b207b2b7d4d5fd201425d1bc2ef98f328 /sys/kern
parentae6b6ef6cb2538b1e6fd4302de1b39b3f0d1cb3d (diff)
downloadsrc-f67d6b5f121f093d9691d43ccedc91c30f1fcb8d.tar.gz
src-f67d6b5f121f093d9691d43ccedc91c30f1fcb8d.zip
Add kern_lseek() and use it instead of sys_lseek() in various compats.
I didn't touch svr4/, there's no point. Reviewed by: ed@, kib@ MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9366
Notes
Notes: svn path=/head/; revision=312987
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_syscalls.c51
1 files changed, 15 insertions, 36 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index a04a44ad9081..7420203e4b60 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1806,25 +1806,25 @@ struct lseek_args {
};
#endif
int
-sys_lseek(td, uap)
- struct thread *td;
- register struct lseek_args /* {
- int fd;
- int pad;
- off_t offset;
- int whence;
- } */ *uap;
+sys_lseek(struct thread *td, struct lseek_args *uap)
+{
+
+ return (kern_lseek(td, uap->fd, uap->offset, uap->whence));
+}
+
+int
+kern_lseek(struct thread *td, int fd, off_t offset, int whence)
{
struct file *fp;
cap_rights_t rights;
int error;
- AUDIT_ARG_FD(uap->fd);
- error = fget(td, uap->fd, cap_rights_init(&rights, CAP_SEEK), &fp);
+ AUDIT_ARG_FD(fd);
+ error = fget(td, fd, cap_rights_init(&rights, CAP_SEEK), &fp);
if (error != 0)
return (error);
error = (fp->f_ops->fo_flags & DFLAG_SEEKABLE) != 0 ?
- fo_seek(fp, uap->offset, uap->whence, td) : ESPIPE;
+ fo_seek(fp, offset, whence, td) : ESPIPE;
fdrop(fp, td);
return (error);
}
@@ -1841,41 +1841,20 @@ struct olseek_args {
};
#endif
int
-olseek(td, uap)
- struct thread *td;
- register struct olseek_args /* {
- int fd;
- long offset;
- int whence;
- } */ *uap;
+olseek(struct thread *td, struct olseek_args *uap)
{
- struct lseek_args /* {
- int fd;
- int pad;
- off_t offset;
- int whence;
- } */ nuap;
- nuap.fd = uap->fd;
- nuap.offset = uap->offset;
- nuap.whence = uap->whence;
- return (sys_lseek(td, &nuap));
+ return (kern_lseek(td, uap->fd, uap->offset, uap->whence));
}
#endif /* COMPAT_43 */
#if defined(COMPAT_FREEBSD6)
/* Version with the 'pad' argument */
int
-freebsd6_lseek(td, uap)
- struct thread *td;
- register struct freebsd6_lseek_args *uap;
+freebsd6_lseek(struct thread *td, struct freebsd6_lseek_args *uap)
{
- struct lseek_args ouap;
- ouap.fd = uap->fd;
- ouap.offset = uap->offset;
- ouap.whence = uap->whence;
- return (sys_lseek(td, &ouap));
+ return (kern_lseek(td, uap->fd, uap->offset, uap->whence));
}
#endif