vfs_syscalls.c (132653) | vfs_syscalls.c (137355) |
---|---|
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: head/sys/kern/vfs_syscalls.c 132653 2004-07-26 07:24:04Z cperciva $"); | 38__FBSDID("$FreeBSD: head/sys/kern/vfs_syscalls.c 137355 2004-11-07 22:16:07Z phk $"); |
39 40#include "opt_compat.h" 41#include "opt_mac.h" 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/bio.h> 46#include <sys/buf.h> --- 938 unchanged lines hidden (view full) --- 985 dupfdopen(td, fdp, indx, td->td_dupfd, flags, error)) == 0) { 986 td->td_retval[0] = indx; 987 return (0); 988 } 989 /* 990 * Clean up the descriptor, but only if another thread hadn't 991 * replaced or closed it. 992 */ | 39 40#include "opt_compat.h" 41#include "opt_mac.h" 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/bio.h> 46#include <sys/buf.h> --- 938 unchanged lines hidden (view full) --- 985 dupfdopen(td, fdp, indx, td->td_dupfd, flags, error)) == 0) { 986 td->td_retval[0] = indx; 987 return (0); 988 } 989 /* 990 * Clean up the descriptor, but only if another thread hadn't 991 * replaced or closed it. 992 */ |
993 FILEDESC_LOCK(fdp); 994 if (fdp->fd_ofiles[indx] == fp) { 995 fdp->fd_ofiles[indx] = NULL; 996 fdunused(fdp, indx); 997 FILEDESC_UNLOCK(fdp); 998 fdrop(fp, td); 999 } else { 1000 FILEDESC_UNLOCK(fdp); 1001 } | 993 fdclose(fdp, fp, indx, td); |
1002 1003 if (error == ERESTART) 1004 error = EINTR; 1005 return (error); 1006 } 1007 td->td_dupfd = 0; 1008 NDFREE(&nd, NDF_ONLY_PNBUF); 1009 vp = nd.ni_vp; --- 76 unchanged lines hidden (view full) --- 1086 * Release our private reference, leaving the one associated with 1087 * the descriptor table intact. 1088 */ 1089 fdrop(fp, td); 1090 td->td_retval[0] = indx; 1091 return (0); 1092bad: 1093 mtx_unlock(&Giant); | 994 995 if (error == ERESTART) 996 error = EINTR; 997 return (error); 998 } 999 td->td_dupfd = 0; 1000 NDFREE(&nd, NDF_ONLY_PNBUF); 1001 vp = nd.ni_vp; --- 76 unchanged lines hidden (view full) --- 1078 * Release our private reference, leaving the one associated with 1079 * the descriptor table intact. 1080 */ 1081 fdrop(fp, td); 1082 td->td_retval[0] = indx; 1083 return (0); 1084bad: 1085 mtx_unlock(&Giant); |
1094 FILEDESC_LOCK(fdp); 1095 if (fdp->fd_ofiles[indx] == fp) { 1096 fdp->fd_ofiles[indx] = NULL; 1097 fdunused(fdp, indx); 1098 FILEDESC_UNLOCK(fdp); 1099 fdrop(fp, td); 1100 } else { 1101 FILEDESC_UNLOCK(fdp); 1102 } | 1086 fdclose(fdp, fp, indx, td); |
1103 fdrop(fp, td); 1104 return (error); 1105} 1106 1107#ifdef COMPAT_43 1108/* 1109 * Create a file. 1110 * --- 2902 unchanged lines hidden (view full) --- 4013 VOP_UNLOCK(vp, 0, td); 4014 if ((error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, 4015 type)) != 0) { 4016 /* 4017 * The lock request failed. Normally close the 4018 * descriptor but handle the case where someone might 4019 * have dup()d or close()d it when we weren't looking. 4020 */ | 1087 fdrop(fp, td); 1088 return (error); 1089} 1090 1091#ifdef COMPAT_43 1092/* 1093 * Create a file. 1094 * --- 2902 unchanged lines hidden (view full) --- 3997 VOP_UNLOCK(vp, 0, td); 3998 if ((error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, 3999 type)) != 0) { 4000 /* 4001 * The lock request failed. Normally close the 4002 * descriptor but handle the case where someone might 4003 * have dup()d or close()d it when we weren't looking. 4004 */ |
4021 FILEDESC_LOCK(fdp); 4022 if (fdp->fd_ofiles[indx] == fp) { 4023 fdp->fd_ofiles[indx] = NULL; 4024 fdunused(fdp, indx); 4025 FILEDESC_UNLOCK(fdp); 4026 fdrop(fp, td); 4027 } else { 4028 FILEDESC_UNLOCK(fdp); 4029 } | 4005 fdclose(fdp, fp, indx, td); 4006 |
4030 /* 4031 * release our private reference 4032 */ 4033 fdrop(fp, td); 4034 return(error); 4035 } 4036 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); 4037 fp->f_flag |= FHASLOCK; --- 774 unchanged lines hidden --- | 4007 /* 4008 * release our private reference 4009 */ 4010 fdrop(fp, td); 4011 return(error); 4012 } 4013 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); 4014 fp->f_flag |= FHASLOCK; --- 774 unchanged lines hidden --- |