vfs_cache.c (281677) | vfs_cache.c (281829) |
---|---|
1/*- 2 * Copyright (c) 1989, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Poul-Henning Kamp of the FreeBSD Project. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95 33 */ 34 35#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1989, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Poul-Henning Kamp of the FreeBSD Project. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/kern/vfs_cache.c 281677 2015-04-18 00:59:03Z mckusick $"); | 36__FBSDID("$FreeBSD: head/sys/kern/vfs_cache.c 281829 2015-04-21 13:55:24Z trasz $"); |
37 38#include "opt_ktrace.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/filedesc.h> 43#include <sys/fnv_hash.h> 44#include <sys/kernel.h> --- 1003 unchanged lines hidden (view full) --- 1048 1049/* Implementation of the getcwd syscall. */ 1050int 1051sys___getcwd(td, uap) 1052 struct thread *td; 1053 struct __getcwd_args *uap; 1054{ 1055 | 37 38#include "opt_ktrace.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/filedesc.h> 43#include <sys/fnv_hash.h> 44#include <sys/kernel.h> --- 1003 unchanged lines hidden (view full) --- 1048 1049/* Implementation of the getcwd syscall. */ 1050int 1051sys___getcwd(td, uap) 1052 struct thread *td; 1053 struct __getcwd_args *uap; 1054{ 1055 |
1056 return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen)); | 1056 return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen, 1057 MAXPATHLEN)); |
1057} 1058 1059int | 1058} 1059 1060int |
1060kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen) | 1061kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen, 1062 u_int path_max) |
1061{ 1062 char *bp, *tmpbuf; 1063 struct filedesc *fdp; 1064 struct vnode *cdir, *rdir; 1065 int error; 1066 1067 if (disablecwd) 1068 return (ENODEV); 1069 if (buflen < 2) 1070 return (EINVAL); | 1063{ 1064 char *bp, *tmpbuf; 1065 struct filedesc *fdp; 1066 struct vnode *cdir, *rdir; 1067 int error; 1068 1069 if (disablecwd) 1070 return (ENODEV); 1071 if (buflen < 2) 1072 return (EINVAL); |
1071 if (buflen > MAXPATHLEN) 1072 buflen = MAXPATHLEN; | 1073 if (buflen > path_max) 1074 buflen = path_max; |
1073 1074 tmpbuf = malloc(buflen, M_TEMP, M_WAITOK); 1075 fdp = td->td_proc->p_fd; 1076 FILEDESC_SLOCK(fdp); 1077 cdir = fdp->fd_cdir; 1078 VREF(cdir); 1079 rdir = fdp->fd_rdir; 1080 VREF(rdir); --- 399 unchanged lines hidden --- | 1075 1076 tmpbuf = malloc(buflen, M_TEMP, M_WAITOK); 1077 fdp = td->td_proc->p_fd; 1078 FILEDESC_SLOCK(fdp); 1079 cdir = fdp->fd_cdir; 1080 VREF(cdir); 1081 rdir = fdp->fd_rdir; 1082 VREF(rdir); --- 399 unchanged lines hidden --- |