Try and deal with the #ifdef COMPAT_FREEBSD4 sendfile stuff. This would

have been a lot easier if do_sendfile() was usable externally.
This commit is contained in:
Peter Wemm 2002-10-09 22:27:24 +00:00
parent cc7a6f19d0
commit 459e3a7a37
6 changed files with 75 additions and 6 deletions

View File

@ -26,6 +26,8 @@
* $FreeBSD$ * $FreeBSD$
*/ */
#include "opt_compat.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -1080,6 +1082,25 @@ ia32_ftruncate(struct thread *td, struct ia32_ftruncate_args *uap)
return (ftruncate(td, &ap)); return (ftruncate(td, &ap));
} }
#ifdef COMPAT_FREEBSD4
int
freebsd4_ia32_sendfile(struct thread *td,
struct freebsd4_ia32_sendfile_args *uap)
{
struct freebsd4_sendfile_args ap;
SCARG(&ap, fd) = SCARG(uap, fd);
SCARG(&ap, s) = SCARG(uap, s);
SCARG(&ap, offset) = (SCARG(uap, offsetlo)
| ((off_t)SCARG(uap, offsethi) << 32));
SCARG(&ap, nbytes) = SCARG(uap, nbytes); /* XXX check */
SCARG(&ap, hdtr) = SCARG(uap, hdtr); /* XXX check */
SCARG(&ap, sbytes) = SCARG(uap, sbytes); /* XXX FIXME!! */
SCARG(&ap, flags) = SCARG(uap, flags);
return (freebsd4_sendfile(td, &ap));
}
#endif
int int
ia32_sendfile(struct thread *td, struct ia32_sendfile_args *uap) ia32_sendfile(struct thread *td, struct ia32_sendfile_args *uap)
{ {

View File

@ -475,7 +475,7 @@
334 MNOPROTO POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } 334 MNOPROTO POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); }
335 NOPROTO BSD { int utrace(const void *addr, size_t len); } 335 NOPROTO BSD { int utrace(const void *addr, size_t len); }
; XXX note - bigendian is different ; XXX note - bigendian is different
336 MSTD BSD { int ia32_sendfile(int fd, int s, u_int32_t offsetlo, \ 336 MCOMPAT4 BSD { int ia32_osendfile(int fd, int s, u_int32_t offsetlo,\
u_int32_t offsethi, size_t nbytes, \ u_int32_t offsethi, size_t nbytes, \
struct sf_hdtr *hdtr, off_t *sbytes, int flags); } struct sf_hdtr *hdtr, off_t *sbytes, int flags); }
337 NOPROTO BSD { int kldsym(int fileid, int cmd, void *data); } 337 NOPROTO BSD { int kldsym(int fileid, int cmd, void *data); }
@ -561,7 +561,9 @@
int len); } int len); }
391 NOPROTO BSD { int lchflags(const char *path, int flags); } 391 NOPROTO BSD { int lchflags(const char *path, int flags); }
392 NOPROTO BSD { int uuidgen(struct uuid *store, int count); } 392 NOPROTO BSD { int uuidgen(struct uuid *store, int count); }
393 UNIMPL NOHIDE nsendfile 393 MSTD BSD { int ia32_sendfile(int fd, int s, u_int32_t offsetlo, \
u_int32_t offsethi, size_t nbytes, \
struct sf_hdtr *hdtr, off_t *sbytes, int flags); }
394 UNIMPL NOHIDE mac_syscall 394 UNIMPL NOHIDE mac_syscall
395 UNIMPL NOHIDE nosys 395 UNIMPL NOHIDE nosys
396 UNIMPL NOHIDE nosys 396 UNIMPL NOHIDE nosys

View File

@ -26,6 +26,8 @@
* $FreeBSD$ * $FreeBSD$
*/ */
#include "opt_compat.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -1080,6 +1082,25 @@ ia32_ftruncate(struct thread *td, struct ia32_ftruncate_args *uap)
return (ftruncate(td, &ap)); return (ftruncate(td, &ap));
} }
#ifdef COMPAT_FREEBSD4
int
freebsd4_ia32_sendfile(struct thread *td,
struct freebsd4_ia32_sendfile_args *uap)
{
struct freebsd4_sendfile_args ap;
SCARG(&ap, fd) = SCARG(uap, fd);
SCARG(&ap, s) = SCARG(uap, s);
SCARG(&ap, offset) = (SCARG(uap, offsetlo)
| ((off_t)SCARG(uap, offsethi) << 32));
SCARG(&ap, nbytes) = SCARG(uap, nbytes); /* XXX check */
SCARG(&ap, hdtr) = SCARG(uap, hdtr); /* XXX check */
SCARG(&ap, sbytes) = SCARG(uap, sbytes); /* XXX FIXME!! */
SCARG(&ap, flags) = SCARG(uap, flags);
return (freebsd4_sendfile(td, &ap));
}
#endif
int int
ia32_sendfile(struct thread *td, struct ia32_sendfile_args *uap) ia32_sendfile(struct thread *td, struct ia32_sendfile_args *uap)
{ {

View File

@ -475,7 +475,7 @@
334 MNOPROTO POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } 334 MNOPROTO POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); }
335 NOPROTO BSD { int utrace(const void *addr, size_t len); } 335 NOPROTO BSD { int utrace(const void *addr, size_t len); }
; XXX note - bigendian is different ; XXX note - bigendian is different
336 MSTD BSD { int ia32_sendfile(int fd, int s, u_int32_t offsetlo, \ 336 MCOMPAT4 BSD { int ia32_osendfile(int fd, int s, u_int32_t offsetlo,\
u_int32_t offsethi, size_t nbytes, \ u_int32_t offsethi, size_t nbytes, \
struct sf_hdtr *hdtr, off_t *sbytes, int flags); } struct sf_hdtr *hdtr, off_t *sbytes, int flags); }
337 NOPROTO BSD { int kldsym(int fileid, int cmd, void *data); } 337 NOPROTO BSD { int kldsym(int fileid, int cmd, void *data); }
@ -561,7 +561,9 @@
int len); } int len); }
391 NOPROTO BSD { int lchflags(const char *path, int flags); } 391 NOPROTO BSD { int lchflags(const char *path, int flags); }
392 NOPROTO BSD { int uuidgen(struct uuid *store, int count); } 392 NOPROTO BSD { int uuidgen(struct uuid *store, int count); }
393 UNIMPL NOHIDE nsendfile 393 MSTD BSD { int ia32_sendfile(int fd, int s, u_int32_t offsetlo, \
u_int32_t offsethi, size_t nbytes, \
struct sf_hdtr *hdtr, off_t *sbytes, int flags); }
394 UNIMPL NOHIDE mac_syscall 394 UNIMPL NOHIDE mac_syscall
395 UNIMPL NOHIDE nosys 395 UNIMPL NOHIDE nosys
396 UNIMPL NOHIDE nosys 396 UNIMPL NOHIDE nosys

View File

@ -26,6 +26,8 @@
* $FreeBSD$ * $FreeBSD$
*/ */
#include "opt_compat.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -1080,6 +1082,25 @@ ia32_ftruncate(struct thread *td, struct ia32_ftruncate_args *uap)
return (ftruncate(td, &ap)); return (ftruncate(td, &ap));
} }
#ifdef COMPAT_FREEBSD4
int
freebsd4_ia32_sendfile(struct thread *td,
struct freebsd4_ia32_sendfile_args *uap)
{
struct freebsd4_sendfile_args ap;
SCARG(&ap, fd) = SCARG(uap, fd);
SCARG(&ap, s) = SCARG(uap, s);
SCARG(&ap, offset) = (SCARG(uap, offsetlo)
| ((off_t)SCARG(uap, offsethi) << 32));
SCARG(&ap, nbytes) = SCARG(uap, nbytes); /* XXX check */
SCARG(&ap, hdtr) = SCARG(uap, hdtr); /* XXX check */
SCARG(&ap, sbytes) = SCARG(uap, sbytes); /* XXX FIXME!! */
SCARG(&ap, flags) = SCARG(uap, flags);
return (freebsd4_sendfile(td, &ap));
}
#endif
int int
ia32_sendfile(struct thread *td, struct ia32_sendfile_args *uap) ia32_sendfile(struct thread *td, struct ia32_sendfile_args *uap)
{ {

View File

@ -475,7 +475,7 @@
334 MNOPROTO POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } 334 MNOPROTO POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); }
335 NOPROTO BSD { int utrace(const void *addr, size_t len); } 335 NOPROTO BSD { int utrace(const void *addr, size_t len); }
; XXX note - bigendian is different ; XXX note - bigendian is different
336 MSTD BSD { int ia32_sendfile(int fd, int s, u_int32_t offsetlo, \ 336 MCOMPAT4 BSD { int ia32_osendfile(int fd, int s, u_int32_t offsetlo,\
u_int32_t offsethi, size_t nbytes, \ u_int32_t offsethi, size_t nbytes, \
struct sf_hdtr *hdtr, off_t *sbytes, int flags); } struct sf_hdtr *hdtr, off_t *sbytes, int flags); }
337 NOPROTO BSD { int kldsym(int fileid, int cmd, void *data); } 337 NOPROTO BSD { int kldsym(int fileid, int cmd, void *data); }
@ -561,7 +561,9 @@
int len); } int len); }
391 NOPROTO BSD { int lchflags(const char *path, int flags); } 391 NOPROTO BSD { int lchflags(const char *path, int flags); }
392 NOPROTO BSD { int uuidgen(struct uuid *store, int count); } 392 NOPROTO BSD { int uuidgen(struct uuid *store, int count); }
393 UNIMPL NOHIDE nsendfile 393 MSTD BSD { int ia32_sendfile(int fd, int s, u_int32_t offsetlo, \
u_int32_t offsethi, size_t nbytes, \
struct sf_hdtr *hdtr, off_t *sbytes, int flags); }
394 UNIMPL NOHIDE mac_syscall 394 UNIMPL NOHIDE mac_syscall
395 UNIMPL NOHIDE nosys 395 UNIMPL NOHIDE nosys
396 UNIMPL NOHIDE nosys 396 UNIMPL NOHIDE nosys