kern_descrip.c (89961) | kern_descrip.c (89969) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 |
39 * $FreeBSD: head/sys/kern/kern_descrip.c 89961 2002-01-29 17:12:10Z alfred $ | 39 * $FreeBSD: head/sys/kern/kern_descrip.c 89969 2002-01-29 22:54:19Z alfred $ |
40 */ 41 42#include "opt_compat.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/lock.h> 47#include <sys/malloc.h> --- 1439 unchanged lines hidden (view full) --- 1487{ 1488 struct filedesc *fdp; 1489 struct file *fp; 1490 1491 *fpp = NULL; 1492 if (td == NULL || (fdp = td->td_proc->p_fd) == NULL) 1493 return(EBADF); 1494 FILEDESC_LOCK(fdp); | 40 */ 41 42#include "opt_compat.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/lock.h> 47#include <sys/malloc.h> --- 1439 unchanged lines hidden (view full) --- 1487{ 1488 struct filedesc *fdp; 1489 struct file *fp; 1490 1491 *fpp = NULL; 1492 if (td == NULL || (fdp = td->td_proc->p_fd) == NULL) 1493 return(EBADF); 1494 FILEDESC_LOCK(fdp); |
1495 if (fd < 0 || (u_int)fd >= fdp->fd_nfiles || 1496 (fp = fdp->fd_ofiles[fd]) == NULL || 1497 fp->f_ops == &badfileops) { | 1495 if ((fp = fget_locked(fdp, fd)) == NULL || fp->f_ops == &badfileops) { |
1498 FILEDESC_UNLOCK(fdp); 1499 return(EBADF); 1500 } 1501 1502 /* 1503 * Note: FREAD failures returns EBADF to maintain backwards 1504 * compatibility with what routines returned before. 1505 * --- 530 unchanged lines hidden --- | 1496 FILEDESC_UNLOCK(fdp); 1497 return(EBADF); 1498 } 1499 1500 /* 1501 * Note: FREAD failures returns EBADF to maintain backwards 1502 * compatibility with what routines returned before. 1503 * --- 530 unchanged lines hidden --- |