kern_descrip.c (140782) | kern_descrip.c (141471) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1989, 1991, 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 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 35 */ 36 37#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1989, 1991, 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 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/kern/kern_descrip.c 140782 2005-01-25 00:40:01Z phk $"); | 38__FBSDID("$FreeBSD: head/sys/kern/kern_descrip.c 141471 2005-02-07 18:44:55Z jhb $"); |
39 40#include "opt_compat.h" 41 42#include <sys/param.h> 43#include <sys/systm.h> 44 45#include <sys/conf.h> 46#include <sys/fcntl.h> --- 978 unchanged lines hidden (view full) --- 1025#endif 1026/* 1027 * MPSAFE 1028 */ 1029/* ARGSUSED */ 1030int 1031ofstat(struct thread *td, struct ofstat_args *uap) 1032{ | 39 40#include "opt_compat.h" 41 42#include <sys/param.h> 43#include <sys/systm.h> 44 45#include <sys/conf.h> 46#include <sys/fcntl.h> --- 978 unchanged lines hidden (view full) --- 1025#endif 1026/* 1027 * MPSAFE 1028 */ 1029/* ARGSUSED */ 1030int 1031ofstat(struct thread *td, struct ofstat_args *uap) 1032{ |
1033 struct file *fp; 1034 struct stat ub; | |
1035 struct ostat oub; | 1033 struct ostat oub; |
1034 struct stat ub; |
|
1036 int error; 1037 | 1035 int error; 1036 |
1038 if ((error = fget(td, uap->fd, &fp)) != 0) 1039 goto done2; 1040 error = fo_stat(fp, &ub, td->td_ucred, td); | 1037 error = kern_fstat(td, uap->fd, &ub); |
1041 if (error == 0) { 1042 cvtstat(&ub, &oub); 1043 error = copyout(&oub, uap->sb, sizeof(oub)); 1044 } | 1038 if (error == 0) { 1039 cvtstat(&ub, &oub); 1040 error = copyout(&oub, uap->sb, sizeof(oub)); 1041 } |
1045 fdrop(fp, td); 1046done2: | |
1047 return (error); 1048} 1049#endif /* COMPAT_43 */ 1050 1051/* 1052 * Return status information about a file descriptor. 1053 */ 1054#ifndef _SYS_SYSPROTO_H_ --- 4 unchanged lines hidden (view full) --- 1059#endif 1060/* 1061 * MPSAFE 1062 */ 1063/* ARGSUSED */ 1064int 1065fstat(struct thread *td, struct fstat_args *uap) 1066{ | 1042 return (error); 1043} 1044#endif /* COMPAT_43 */ 1045 1046/* 1047 * Return status information about a file descriptor. 1048 */ 1049#ifndef _SYS_SYSPROTO_H_ --- 4 unchanged lines hidden (view full) --- 1054#endif 1055/* 1056 * MPSAFE 1057 */ 1058/* ARGSUSED */ 1059int 1060fstat(struct thread *td, struct fstat_args *uap) 1061{ |
1067 struct file *fp; | |
1068 struct stat ub; 1069 int error; 1070 | 1062 struct stat ub; 1063 int error; 1064 |
1071 if ((error = fget(td, uap->fd, &fp)) != 0) 1072 goto done2; 1073 error = fo_stat(fp, &ub, td->td_ucred, td); | 1065 error = kern_fstat(td, uap->fd, &ub); |
1074 if (error == 0) 1075 error = copyout(&ub, uap->sb, sizeof(ub)); | 1066 if (error == 0) 1067 error = copyout(&ub, uap->sb, sizeof(ub)); |
1068 return (error); 1069} 1070 1071int 1072kern_fstat(struct thread *td, int fd, struct stat *sbp) 1073{ 1074 struct file *fp; 1075 int error; 1076 1077 if ((error = fget(td, fd, &fp)) != 0) 1078 return (error); 1079 error = fo_stat(fp, sbp, td->td_ucred, td); |
|
1076 fdrop(fp, td); | 1080 fdrop(fp, td); |
1077done2: | |
1078 return (error); 1079} 1080 1081/* 1082 * Return status information about a file descriptor. 1083 */ 1084#ifndef _SYS_SYSPROTO_H_ 1085struct nfstat_args { 1086 int fd; 1087 struct nstat *sb; 1088}; 1089#endif 1090/* 1091 * MPSAFE 1092 */ 1093/* ARGSUSED */ 1094int 1095nfstat(struct thread *td, struct nfstat_args *uap) 1096{ | 1081 return (error); 1082} 1083 1084/* 1085 * Return status information about a file descriptor. 1086 */ 1087#ifndef _SYS_SYSPROTO_H_ 1088struct nfstat_args { 1089 int fd; 1090 struct nstat *sb; 1091}; 1092#endif 1093/* 1094 * MPSAFE 1095 */ 1096/* ARGSUSED */ 1097int 1098nfstat(struct thread *td, struct nfstat_args *uap) 1099{ |
1097 struct file *fp; 1098 struct stat ub; | |
1099 struct nstat nub; | 1100 struct nstat nub; |
1101 struct stat ub; |
|
1100 int error; 1101 | 1102 int error; 1103 |
1102 if ((error = fget(td, uap->fd, &fp)) != 0) 1103 goto done2; 1104 error = fo_stat(fp, &ub, td->td_ucred, td); | 1104 error = kern_fstat(td, uap->fd, &ub); |
1105 if (error == 0) { 1106 cvtnstat(&ub, &nub); 1107 error = copyout(&nub, uap->sb, sizeof(nub)); 1108 } | 1105 if (error == 0) { 1106 cvtnstat(&ub, &nub); 1107 error = copyout(&nub, uap->sb, sizeof(nub)); 1108 } |
1109 fdrop(fp, td); 1110done2: | |
1111 return (error); 1112} 1113 1114/* 1115 * Return pathconf information about a file descriptor. 1116 */ 1117#ifndef _SYS_SYSPROTO_H_ 1118struct fpathconf_args { --- 1458 unchanged lines hidden --- | 1109 return (error); 1110} 1111 1112/* 1113 * Return pathconf information about a file descriptor. 1114 */ 1115#ifndef _SYS_SYSPROTO_H_ 1116struct fpathconf_args { --- 1458 unchanged lines hidden --- |