Deleted Added
full compact
kern_descrip.c (176471) kern_descrip.c (176957)
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.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
35 */
36
37#include <sys/cdefs.h>
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.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/kern_descrip.c 176471 2008-02-23 01:01:49Z des $");
38__FBSDID("$FreeBSD: head/sys/kern/kern_descrip.c 176957 2008-03-08 22:02:21Z antoine $");
39
40#include "opt_compat.h"
41#include "opt_ddb.h"
42#include "opt_ktrace.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
46

--- 345 unchanged lines hidden (view full) ---

392 PROC_UNLOCK(p);
393 error = EINVAL;
394 break;
395 }
396 PROC_UNLOCK(p);
397 error = do_dup(td, DUP_VARIABLE, fd, newmin, td->td_retval);
398 break;
399
39
40#include "opt_compat.h"
41#include "opt_ddb.h"
42#include "opt_ktrace.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
46

--- 345 unchanged lines hidden (view full) ---

392 PROC_UNLOCK(p);
393 error = EINVAL;
394 break;
395 }
396 PROC_UNLOCK(p);
397 error = do_dup(td, DUP_VARIABLE, fd, newmin, td->td_retval);
398 break;
399
400 case F_DUP2FD:
401 tmp = arg;
402 error = do_dup(td, DUP_FIXED, fd, tmp, td->td_retval);
403 break;
404
400 case F_GETFD:
401 FILEDESC_SLOCK(fdp);
402 if ((fp = fdtofp(fd, fdp)) == NULL) {
403 FILEDESC_SUNLOCK(fdp);
404 error = EBADF;
405 break;
406 }
407 pop = &fdp->fd_ofileflags[fd];

--- 220 unchanged lines hidden (view full) ---

628 error = EINVAL;
629 break;
630 }
631 VFS_UNLOCK_GIANT(vfslocked);
632 return (error);
633}
634
635/*
405 case F_GETFD:
406 FILEDESC_SLOCK(fdp);
407 if ((fp = fdtofp(fd, fdp)) == NULL) {
408 FILEDESC_SUNLOCK(fdp);
409 error = EBADF;
410 break;
411 }
412 pop = &fdp->fd_ofileflags[fd];

--- 220 unchanged lines hidden (view full) ---

633 error = EINVAL;
634 break;
635 }
636 VFS_UNLOCK_GIANT(vfslocked);
637 return (error);
638}
639
640/*
636 * Common code for dup, dup2, and fcntl(F_DUPFD).
641 * Common code for dup, dup2, fcntl(F_DUPFD) and fcntl(F_DUP2FD).
637 */
638static int
639do_dup(struct thread *td, enum dup_type type, int old, int new,
640 register_t *retval)
641{
642 struct filedesc *fdp;
643 struct proc *p;
644 struct file *fp;

--- 2286 unchanged lines hidden ---
642 */
643static int
644do_dup(struct thread *td, enum dup_type type, int old, int new,
645 register_t *retval)
646{
647 struct filedesc *fdp;
648 struct proc *p;
649 struct file *fp;

--- 2286 unchanged lines hidden ---