Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jun 2000 10:31:07 -0700
From:      Alfred Perlstein <bright@wintelcom.net>
To:        dg@freebsd.org
Cc:        hackers@freebsd.org
Subject:   sendfile should use getfp.
Message-ID:  <20000612103107.B18462@fw.wintelcom.net>

next in thread | raw e-mail | index | archive | help
May I commit this?  I'm going to need getfp to be non-static for
some stuff I have in the queue, I figured sendfile might as well
use it.

thanks,
-Alfred


Index: sys/filedesc.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/filedesc.h,v
retrieving revision 1.21
diff -u -u -r1.21 filedesc.h
--- sys/filedesc.h	2000/04/30 06:31:28	1.21
+++ sys/filedesc.h	2000/06/12 17:28:02
@@ -142,6 +142,8 @@
 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_ */
Index: kern/uipc_syscalls.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/uipc_syscalls.c,v
retrieving revision 1.66
diff -u -u -r1.66 uipc_syscalls.c
--- kern/uipc_syscalls.c	2000/04/16 18:53:13	1.66
+++ kern/uipc_syscalls.c	2000/06/10 01:21:31
@@ -1432,9 +1432,8 @@
 	 * 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;
 	}
Index: kern/sys_generic.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/sys_generic.c,v
retrieving revision 1.56
diff -u -u -r1.56 sys_generic.c
--- kern/sys_generic.c	2000/05/09 17:43:20	1.56
+++ kern/sys_generic.c	2000/06/12 17:26:30
@@ -69,13 +69,12 @@
 
 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;



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000612103107.B18462>