linux_file.c (89311) | linux_file.c (89319) |
---|---|
1/*- 2 * Copyright (c) 1994-1995 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * | 1/*- 2 * Copyright (c) 1994-1995 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/compat/linux/linux_file.c 89311 2002-01-13 14:12:16Z alfred $ | 28 * $FreeBSD: head/sys/compat/linux/linux_file.c 89319 2002-01-14 00:13:45Z alfred $ |
29 */ 30 31#include "opt_compat.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/conf.h> 36#include <sys/dirent.h> --- 95 unchanged lines hidden (view full) --- 132 bsd_open_args.mode = args->mode; 133 134 error = open(td, &bsd_open_args); 135 PROC_LOCK(p); 136 if (!error && !(bsd_open_args.flags & O_NOCTTY) && 137 SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) { 138 struct file *fp; 139 | 29 */ 30 31#include "opt_compat.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/conf.h> 36#include <sys/dirent.h> --- 95 unchanged lines hidden (view full) --- 132 bsd_open_args.mode = args->mode; 133 134 error = open(td, &bsd_open_args); 135 PROC_LOCK(p); 136 if (!error && !(bsd_open_args.flags & O_NOCTTY) && 137 SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) { 138 struct file *fp; 139 |
140 fp = ffind_hold(td, td->td_retval[0]); | 140 error = fget(td, td->td_retval[0], &fp); |
141 PROC_UNLOCK(p); | 141 PROC_UNLOCK(p); |
142 if (fp->f_type == DTYPE_VNODE) 143 fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, td); 144 fdrop(fp, td); | 142 if (!error) { 143 if (fp->f_type == DTYPE_VNODE) 144 fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, td); 145 fdrop(fp, td); 146 } |
145 } else 146 PROC_UNLOCK(p); 147#ifdef DEBUG 148 if (ldebug(open)) 149 printf(LMSG("open returns error %d"), error); 150#endif 151 return error; 152} --- 838 unchanged lines hidden (view full) --- 991 return (fcntl(td, &fcntl_args)); 992 993 case LINUX_F_SETOWN: 994 /* 995 * XXX some Linux applications depend on F_SETOWN having no 996 * significant effect for pipes (SIGIO is not delivered for 997 * pipes under Linux-2.2.35 at least). 998 */ | 147 } else 148 PROC_UNLOCK(p); 149#ifdef DEBUG 150 if (ldebug(open)) 151 printf(LMSG("open returns error %d"), error); 152#endif 153 return error; 154} --- 838 unchanged lines hidden (view full) --- 993 return (fcntl(td, &fcntl_args)); 994 995 case LINUX_F_SETOWN: 996 /* 997 * XXX some Linux applications depend on F_SETOWN having no 998 * significant effect for pipes (SIGIO is not delivered for 999 * pipes under Linux-2.2.35 at least). 1000 */ |
999 fp = ffind_hold(td, args->fd); 1000 if (fp == NULL) 1001 return EBADF; | 1001 error = fget(td, args->fd, &fp); 1002 if (error) 1003 return (error); |
1002 if (fp->f_type == DTYPE_PIPE) { 1003 fdrop(fp, td); 1004 return (EINVAL); 1005 } 1006 fdrop(fp, td); 1007 1008 fcntl_args.cmd = F_SETOWN; 1009 fcntl_args.arg = args->arg; --- 173 unchanged lines hidden --- | 1004 if (fp->f_type == DTYPE_PIPE) { 1005 fdrop(fp, td); 1006 return (EINVAL); 1007 } 1008 fdrop(fp, td); 1009 1010 fcntl_args.cmd = F_SETOWN; 1011 fcntl_args.arg = args->arg; --- 173 unchanged lines hidden --- |