unstatic getfp() so that other subsystems can use it.

make sendfile() use it.

Approved by: dg
This commit is contained in:
Alfred Perlstein 2000-06-12 18:06:12 +00:00
parent 79a4bee867
commit 8757e5bbc5
3 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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_ */