sys_generic.c (192080) | sys_generic.c (195104) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1989, 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 * @(#)sys_generic.c 8.5 (Berkeley) 1/21/94 35 */ 36 37#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1989, 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 * @(#)sys_generic.c 8.5 (Berkeley) 1/21/94 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/kern/sys_generic.c 192080 2009-05-14 03:24:22Z jeff $"); | 38__FBSDID("$FreeBSD: head/sys/kern/sys_generic.c 195104 2009-06-27 13:58:44Z rwatson $"); |
39 40#include "opt_compat.h" 41#include "opt_ktrace.h" 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/sysproto.h> 46#include <sys/filedesc.h> --- 509 unchanged lines hidden (view full) --- 556kern_ftruncate(td, fd, length) 557 struct thread *td; 558 int fd; 559 off_t length; 560{ 561 struct file *fp; 562 int error; 563 | 39 40#include "opt_compat.h" 41#include "opt_ktrace.h" 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/sysproto.h> 46#include <sys/filedesc.h> --- 509 unchanged lines hidden (view full) --- 556kern_ftruncate(td, fd, length) 557 struct thread *td; 558 int fd; 559 off_t length; 560{ 561 struct file *fp; 562 int error; 563 |
564 AUDIT_ARG(fd, fd); | 564 AUDIT_ARG_FD(fd); |
565 if (length < 0) 566 return (EINVAL); 567 error = fget(td, fd, &fp); 568 if (error) 569 return (error); | 565 if (length < 0) 566 return (EINVAL); 567 error = fget(td, fd, &fp); 568 if (error) 569 return (error); |
570 AUDIT_ARG(file, td->td_proc, fp); | 570 AUDIT_ARG_FILE(td->td_proc, fp); |
571 if (!(fp->f_flag & FWRITE)) { 572 fdrop(fp, td); 573 return (EINVAL); 574 } 575 error = fo_truncate(fp, length, td->td_ucred, td); 576 fdrop(fp, td); 577 return (error); 578} --- 956 unchanged lines hidden --- | 571 if (!(fp->f_flag & FWRITE)) { 572 fdrop(fp, td); 573 return (EINVAL); 574 } 575 error = fo_truncate(fp, length, td->td_ucred, td); 576 fdrop(fp, td); 577 return (error); 578} --- 956 unchanged lines hidden --- |