vfs_extattr.c (29041) | vfs_extattr.c (29391) |
---|---|
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. --- 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 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 | 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. --- 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 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 |
39 * $Id: vfs_syscalls.c,v 1.66 1997/07/17 07:17:33 dfr Exp $ | 39 * $Id: vfs_syscalls.c,v 1.67 1997/09/02 20:06:03 bde Exp $ |
40 */ 41 42/* 43 * XXX - The following is required because of some magic done 44 * in getdirentries() below which is only done if the translucent 45 * filesystem `UNION' is compiled into the kernel. This is broken, 46 * but I don't have time to study the code deeply enough to understand 47 * what's going on and determine an appropriate fix. -GAW --- 2710 unchanged lines hidden (view full) --- 2758 if ((u_int)fd >= fdp->fd_nfiles || 2759 (fp = fdp->fd_ofiles[fd]) == NULL) 2760 return (EBADF); 2761 if (fp->f_type != DTYPE_VNODE && fp->f_type != DTYPE_FIFO) 2762 return (EINVAL); 2763 *fpp = fp; 2764 return (0); 2765} | 40 */ 41 42/* 43 * XXX - The following is required because of some magic done 44 * in getdirentries() below which is only done if the translucent 45 * filesystem `UNION' is compiled into the kernel. This is broken, 46 * but I don't have time to study the code deeply enough to understand 47 * what's going on and determine an appropriate fix. -GAW --- 2710 unchanged lines hidden (view full) --- 2758 if ((u_int)fd >= fdp->fd_nfiles || 2759 (fp = fdp->fd_ofiles[fd]) == NULL) 2760 return (EBADF); 2761 if (fp->f_type != DTYPE_VNODE && fp->f_type != DTYPE_FIFO) 2762 return (EINVAL); 2763 *fpp = fp; 2764 return (0); 2765} |
2766#ifndef _SYS_SYSPROTO_H_ 2767struct __getcwd_args { 2768 u_char * buf; 2769 u_int buflen; 2770}; 2771#endif 2772/* ARGSUSED */ 2773int 2774__getcwd(p, uap, retval) 2775 struct proc *p; 2776 register struct __getcwd_args *uap; 2777 register_t *retval; 2778{ 2779 struct filedesc *fdp = p->p_fd; 2780 struct vnode *vp; 2781 struct namecache *ncp; 2782 int i,j=0; 2783 2784 for (vp = fdp->fd_cdir; vp != fdp->fd_rdir && vp != rootvnode;) { 2785 if (vp->v_dd->v_id != vp->v_ddid) 2786 return(ENOENT); 2787 ncp = TAILQ_FIRST(&vp->v_cache_dst); 2788 if (!ncp) 2789 return(ENOENT); 2790 if (ncp->nc_dvp != vp->v_dd) 2791 return(ENOENT); 2792 for (i=ncp->nc_nlen-1; i >= 0; i--) { 2793 if (uap->buflen-- < 2) 2794 return(ENOMEM); 2795 subyte(uap->buf, ncp->nc_name[i]); 2796 uap->buf++; 2797 } 2798 if (uap->buflen-- < 2) 2799 return(ENOMEM); 2800 subyte(uap->buf, '/' ); 2801 uap->buf++; 2802 j++; 2803 vp = vp->v_dd; 2804 } 2805 if (!j) { 2806 if (uap->buflen-- < 2) 2807 return(ENOMEM); 2808 subyte(uap->buf, '/' ); 2809 uap->buf++; 2810 } 2811 subyte(uap->buf, '\0' ); 2812 uap->buf++; 2813 return (0); 2814} |
|