summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2000-06-12 18:06:12 +0000
committeralfred <alfred@FreeBSD.org>2000-06-12 18:06:12 +0000
commite7947cbed1b066a08b637ca36044e167837192b2 (patch)
tree523fd8746df1fd353eb3cb39b7cd644d826fc0c3
parent6c90966cad8960204e970e220ce11ccd81994f46 (diff)
downloadFreeBSD-src-e7947cbed1b066a08b637ca36044e167837192b2.zip
FreeBSD-src-e7947cbed1b066a08b637ca36044e167837192b2.tar.gz
unstatic getfp() so that other subsystems can use it.
make sendfile() use it. Approved by: dg
-rw-r--r--sys/kern/sys_generic.c3
-rw-r--r--sys/kern/uipc_syscalls.c5
-rw-r--r--sys/sys/filedesc.h2
3 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 687e4f9..bf33a4d 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -69,13 +69,12 @@ MALLOC_DEFINE(M_IOV, "iov", "large iov's");
static int pollscan __P((struct proc *, struct pollfd *, int));
static int selscan __P((struct proc *, fd_mask **, fd_mask **, int));
-static struct file* getfp __P((struct filedesc *, int, int));
static int dofileread __P((struct proc *, struct file *, int, void *,
size_t, off_t, int));
static int dofilewrite __P((struct proc *, struct file *, int,
const void *, size_t, off_t, int));
-static struct file*
+struct file*
getfp(fdp, fd, flag)
struct filedesc* fdp;
int fd, flag;
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 298bbe1..480b8dc 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1432,9 +1432,8 @@ sendfile(struct proc *p, struct sendfile_args *uap)
* Do argument checking. Must be a regular file in, stream
* type and connected socket out, positive offset.
*/
- if (((u_int)uap->fd) >= fdp->fd_nfiles ||
- (fp = fdp->fd_ofiles[uap->fd]) == NULL ||
- (fp->f_flag & FREAD) == 0) {
+ fp = getfp(fdp, uap->fd, FREAD);
+ if (fp == NULL) {
error = EBADF;
goto done;
}
diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h
index 0a43b83..2babf9c 100644
--- a/sys/sys/filedesc.h
+++ b/sys/sys/filedesc.h
@@ -142,6 +142,8 @@ void funsetown __P((struct sigio *sigio));
void funsetownlst __P((struct sigiolst *sigiolst));
int getvnode __P((struct filedesc *fdp, int fd, struct file **fpp));
void setugidsafety __P((struct proc *p));
+struct file *getfp __P((struct filedesc* fdp, int fd, int flag));
+
#endif /* _KERNEL */
#endif /* !_SYS_FILEDESC_H_ */
OpenPOWER on IntegriCloud