vfs_syscalls.c (315548) | vfs_syscalls.c (315550) |
---|---|
1/*- 2 * Copyright (c) 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 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 35 */ 36 37#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 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 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: stable/11/sys/kern/vfs_syscalls.c 315548 2017-03-19 14:12:55Z trasz $"); | 38__FBSDID("$FreeBSD: stable/11/sys/kern/vfs_syscalls.c 315550 2017-03-19 14:36:19Z trasz $"); |
39 40#include "opt_capsicum.h" 41#include "opt_compat.h" 42#include "opt_ktrace.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/bio.h> --- 1752 unchanged lines hidden (view full) --- 1799struct lseek_args { 1800 int fd; 1801 int pad; 1802 off_t offset; 1803 int whence; 1804}; 1805#endif 1806int | 39 40#include "opt_capsicum.h" 41#include "opt_compat.h" 42#include "opt_ktrace.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/bio.h> --- 1752 unchanged lines hidden (view full) --- 1799struct lseek_args { 1800 int fd; 1801 int pad; 1802 off_t offset; 1803 int whence; 1804}; 1805#endif 1806int |
1807sys_lseek(td, uap) 1808 struct thread *td; 1809 register struct lseek_args /* { 1810 int fd; 1811 int pad; 1812 off_t offset; 1813 int whence; 1814 } */ *uap; | 1807sys_lseek(struct thread *td, struct lseek_args *uap) |
1815{ | 1808{ |
1809 1810 return (kern_lseek(td, uap->fd, uap->offset, uap->whence)); 1811} 1812 1813int 1814kern_lseek(struct thread *td, int fd, off_t offset, int whence) 1815{ |
|
1816 struct file *fp; 1817 cap_rights_t rights; 1818 int error; 1819 | 1816 struct file *fp; 1817 cap_rights_t rights; 1818 int error; 1819 |
1820 AUDIT_ARG_FD(uap->fd); 1821 error = fget(td, uap->fd, cap_rights_init(&rights, CAP_SEEK), &fp); | 1820 AUDIT_ARG_FD(fd); 1821 error = fget(td, fd, cap_rights_init(&rights, CAP_SEEK), &fp); |
1822 if (error != 0) 1823 return (error); 1824 error = (fp->f_ops->fo_flags & DFLAG_SEEKABLE) != 0 ? | 1822 if (error != 0) 1823 return (error); 1824 error = (fp->f_ops->fo_flags & DFLAG_SEEKABLE) != 0 ? |
1825 fo_seek(fp, uap->offset, uap->whence, td) : ESPIPE; | 1825 fo_seek(fp, offset, whence, td) : ESPIPE; |
1826 fdrop(fp, td); 1827 return (error); 1828} 1829 1830#if defined(COMPAT_43) 1831/* 1832 * Reposition read/write file offset. 1833 */ 1834#ifndef _SYS_SYSPROTO_H_ 1835struct olseek_args { 1836 int fd; 1837 long offset; 1838 int whence; 1839}; 1840#endif 1841int | 1826 fdrop(fp, td); 1827 return (error); 1828} 1829 1830#if defined(COMPAT_43) 1831/* 1832 * Reposition read/write file offset. 1833 */ 1834#ifndef _SYS_SYSPROTO_H_ 1835struct olseek_args { 1836 int fd; 1837 long offset; 1838 int whence; 1839}; 1840#endif 1841int |
1842olseek(td, uap) 1843 struct thread *td; 1844 register struct olseek_args /* { 1845 int fd; 1846 long offset; 1847 int whence; 1848 } */ *uap; | 1842olseek(struct thread *td, struct olseek_args *uap) |
1849{ | 1843{ |
1850 struct lseek_args /* { 1851 int fd; 1852 int pad; 1853 off_t offset; 1854 int whence; 1855 } */ nuap; | |
1856 | 1844 |
1857 nuap.fd = uap->fd; 1858 nuap.offset = uap->offset; 1859 nuap.whence = uap->whence; 1860 return (sys_lseek(td, &nuap)); | 1845 return (kern_lseek(td, uap->fd, uap->offset, uap->whence)); |
1861} 1862#endif /* COMPAT_43 */ 1863 1864#if defined(COMPAT_FREEBSD6) 1865/* Version with the 'pad' argument */ 1866int | 1846} 1847#endif /* COMPAT_43 */ 1848 1849#if defined(COMPAT_FREEBSD6) 1850/* Version with the 'pad' argument */ 1851int |
1867freebsd6_lseek(td, uap) 1868 struct thread *td; 1869 register struct freebsd6_lseek_args *uap; | 1852freebsd6_lseek(struct thread *td, struct freebsd6_lseek_args *uap) |
1870{ | 1853{ |
1871 struct lseek_args ouap; | |
1872 | 1854 |
1873 ouap.fd = uap->fd; 1874 ouap.offset = uap->offset; 1875 ouap.whence = uap->whence; 1876 return (sys_lseek(td, &ouap)); | 1855 return (kern_lseek(td, uap->fd, uap->offset, uap->whence)); |
1877} 1878#endif 1879 1880/* 1881 * Check access permissions using passed credentials. 1882 */ 1883static int 1884vn_access(vp, user_flags, cred, td) --- 2812 unchanged lines hidden --- | 1856} 1857#endif 1858 1859/* 1860 * Check access permissions using passed credentials. 1861 */ 1862static int 1863vn_access(vp, user_flags, cred, td) --- 2812 unchanged lines hidden --- |