1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)fstat_.c 5.2 (Berkeley) 04/12/91"; 10 #endif /* not lint */ 11 12 /* 13 * get file status 14 * 15 * calling sequence: 16 * integer fstat, statb(12) 17 * call fstat (name, statb) 18 * where: 19 * 'statb' will receive the stat structure for file 'name'. 20 */ 21 22 #include <sys/types.h> 23 #include <sys/stat.h> 24 #include "../libI77/f_errno.h" 25 #include "../libI77/fiodefs.h" 26 27 extern unit units[]; 28 29 long fstat_(lunit, stbuf) 30 long *lunit, *stbuf; 31 { 32 struct stat statb; 33 34 if (*lunit < 0 || *lunit >= MXUNIT) 35 return((long)(errno=F_ERUNIT)); 36 if (!units[*lunit].ufd) 37 return((long)(errno=F_ERNOPEN)); 38 if (fstat(fileno(units[*lunit].ufd), &statb) == 0) 39 { 40 *stbuf++ = statb.st_dev; 41 *stbuf++ = statb.st_ino; 42 *stbuf++ = statb.st_mode; 43 *stbuf++ = statb.st_nlink; 44 *stbuf++ = statb.st_uid; 45 *stbuf++ = statb.st_gid; 46 *stbuf++ = statb.st_rdev; 47 *stbuf++ = statb.st_size; 48 *stbuf++ = statb.st_atime; 49 *stbuf++ = statb.st_mtime; 50 *stbuf++ = statb.st_ctime; 51 *stbuf++ = statb.st_blksize; 52 return(0L); 53 } 54 return ((long)errno); 55 } 56