kern_descrip.c (101983) | kern_descrip.c (102003) |
---|---|
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 101983 2002-08-16 12:52:03Z rwatson $ | 39 * $FreeBSD: head/sys/kern/kern_descrip.c 102003 2002-08-17 02:36:16Z rwatson $ |
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> --- 48 unchanged lines hidden (view full) --- 96 /* flags */ 0, 97}; 98 99static int do_dup(struct filedesc *fdp, int old, int new, register_t *retval, 100 struct thread *td); 101static int badfo_readwrite(struct file *fp, struct uio *uio, 102 struct ucred *active_cred, int flags, struct thread *td); 103static int badfo_ioctl(struct file *fp, u_long com, void *data, | 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> --- 48 unchanged lines hidden (view full) --- 96 /* flags */ 0, 97}; 98 99static int do_dup(struct filedesc *fdp, int old, int new, register_t *retval, 100 struct thread *td); 101static int badfo_readwrite(struct file *fp, struct uio *uio, 102 struct ucred *active_cred, int flags, struct thread *td); 103static int badfo_ioctl(struct file *fp, u_long com, void *data, |
104 struct thread *td); | 104 struct ucred *active_cred, struct thread *td); |
105static int badfo_poll(struct file *fp, int events, 106 struct ucred *active_cred, struct thread *td); 107static int badfo_kqfilter(struct file *fp, struct knote *kn); 108static int badfo_stat(struct file *fp, struct stat *sb, 109 struct ucred *active_cred, struct thread *td); 110static int badfo_close(struct file *fp, struct thread *td); 111 112/* --- 197 unchanged lines hidden (view full) --- 310 break; 311 312 case F_SETFL: 313 fhold(fp); 314 FILEDESC_UNLOCK(fdp); 315 fp->f_flag &= ~FCNTLFLAGS; 316 fp->f_flag |= FFLAGS(uap->arg & ~O_ACCMODE) & FCNTLFLAGS; 317 tmp = fp->f_flag & FNONBLOCK; | 105static int badfo_poll(struct file *fp, int events, 106 struct ucred *active_cred, struct thread *td); 107static int badfo_kqfilter(struct file *fp, struct knote *kn); 108static int badfo_stat(struct file *fp, struct stat *sb, 109 struct ucred *active_cred, struct thread *td); 110static int badfo_close(struct file *fp, struct thread *td); 111 112/* --- 197 unchanged lines hidden (view full) --- 310 break; 311 312 case F_SETFL: 313 fhold(fp); 314 FILEDESC_UNLOCK(fdp); 315 fp->f_flag &= ~FCNTLFLAGS; 316 fp->f_flag |= FFLAGS(uap->arg & ~O_ACCMODE) & FCNTLFLAGS; 317 tmp = fp->f_flag & FNONBLOCK; |
318 error = fo_ioctl(fp, FIONBIO, &tmp, td); | 318 error = fo_ioctl(fp, FIONBIO, &tmp, td->td_ucred, td); |
319 if (error) { 320 fdrop(fp, td); 321 break; 322 } 323 tmp = fp->f_flag & FASYNC; | 319 if (error) { 320 fdrop(fp, td); 321 break; 322 } 323 tmp = fp->f_flag & FASYNC; |
324 error = fo_ioctl(fp, FIOASYNC, &tmp, td); | 324 error = fo_ioctl(fp, FIOASYNC, &tmp, td->td_ucred, td); |
325 if (!error) { 326 fdrop(fp, td); 327 break; 328 } 329 fp->f_flag &= ~FNONBLOCK; 330 tmp = 0; | 325 if (!error) { 326 fdrop(fp, td); 327 break; 328 } 329 fp->f_flag &= ~FNONBLOCK; 330 tmp = 0; |
331 (void)fo_ioctl(fp, FIONBIO, &tmp, td); | 331 (void)fo_ioctl(fp, FIONBIO, &tmp, td->td_ucred, td); |
332 fdrop(fp, td); 333 break; 334 335 case F_GETOWN: 336 fhold(fp); 337 FILEDESC_UNLOCK(fdp); | 332 fdrop(fp, td); 333 break; 334 335 case F_GETOWN: 336 fhold(fp); 337 FILEDESC_UNLOCK(fdp); |
338 error = fo_ioctl(fp, FIOGETOWN, (void *)td->td_retval, td); | 338 error = fo_ioctl(fp, FIOGETOWN, (void *)td->td_retval, 339 td->td_ucred, td); |
339 fdrop(fp, td); 340 break; 341 342 case F_SETOWN: 343 fhold(fp); 344 FILEDESC_UNLOCK(fdp); | 340 fdrop(fp, td); 341 break; 342 343 case F_SETOWN: 344 fhold(fp); 345 FILEDESC_UNLOCK(fdp); |
345 error = fo_ioctl(fp, FIOSETOWN, &uap->arg, td); | 346 error = fo_ioctl(fp, FIOSETOWN, &uap->arg, td->td_ucred, td); |
346 fdrop(fp, td); 347 break; 348 349 case F_SETLKW: 350 flg |= F_WAIT; 351 /* Fall into F_SETLK */ 352 353 case F_SETLK: --- 1800 unchanged lines hidden (view full) --- 2154 struct thread *td; 2155 int flags; 2156{ 2157 2158 return (EBADF); 2159} 2160 2161static int | 347 fdrop(fp, td); 348 break; 349 350 case F_SETLKW: 351 flg |= F_WAIT; 352 /* Fall into F_SETLK */ 353 354 case F_SETLK: --- 1800 unchanged lines hidden (view full) --- 2155 struct thread *td; 2156 int flags; 2157{ 2158 2159 return (EBADF); 2160} 2161 2162static int |
2162badfo_ioctl(fp, com, data, td) | 2163badfo_ioctl(fp, com, data, active_cred, td) |
2163 struct file *fp; 2164 u_long com; 2165 void *data; | 2164 struct file *fp; 2165 u_long com; 2166 void *data; |
2167 struct ucred *active_cred; |
|
2166 struct thread *td; 2167{ 2168 2169 return (EBADF); 2170} 2171 2172static int 2173badfo_poll(fp, events, active_cred, td) --- 55 unchanged lines hidden --- | 2168 struct thread *td; 2169{ 2170 2171 return (EBADF); 2172} 2173 2174static int 2175badfo_poll(fp, events, active_cred, td) --- 55 unchanged lines hidden --- |