1*47944Sbostic /*- 2*47944Sbostic * Copyright (c) 1980 The Regents of the University of California. 3*47944Sbostic * All rights reserved. 42514Sdlw * 5*47944Sbostic * %sccs.include.proprietary.c% 623016Skre */ 723016Skre 8*47944Sbostic #ifndef lint 9*47944Sbostic static char sccsid[] = "@(#)fstat_.c 5.2 (Berkeley) 04/12/91"; 10*47944Sbostic #endif /* not lint */ 11*47944Sbostic 1223016Skre /* 132514Sdlw * get file status 142514Sdlw * 152514Sdlw * calling sequence: 1612030Sdlw * integer fstat, statb(12) 172514Sdlw * call fstat (name, statb) 182514Sdlw * where: 192514Sdlw * 'statb' will receive the stat structure for file 'name'. 202514Sdlw */ 212514Sdlw 222514Sdlw #include <sys/types.h> 232514Sdlw #include <sys/stat.h> 242514Sdlw #include "../libI77/f_errno.h" 252514Sdlw #include "../libI77/fiodefs.h" 262514Sdlw 272514Sdlw extern unit units[]; 282514Sdlw fstat_(lunit,stbuf)292514Sdlwlong fstat_(lunit, stbuf) 302514Sdlw long *lunit, *stbuf; 312514Sdlw { 322514Sdlw struct stat statb; 332514Sdlw 342514Sdlw if (*lunit < 0 || *lunit >= MXUNIT) 352579Sdlw return((long)(errno=F_ERUNIT)); 362514Sdlw if (!units[*lunit].ufd) 372514Sdlw return((long)(errno=F_ERNOPEN)); 382514Sdlw if (fstat(fileno(units[*lunit].ufd), &statb) == 0) 392514Sdlw { 402514Sdlw *stbuf++ = statb.st_dev; 412514Sdlw *stbuf++ = statb.st_ino; 422514Sdlw *stbuf++ = statb.st_mode; 432514Sdlw *stbuf++ = statb.st_nlink; 442514Sdlw *stbuf++ = statb.st_uid; 452514Sdlw *stbuf++ = statb.st_gid; 462514Sdlw *stbuf++ = statb.st_rdev; 472514Sdlw *stbuf++ = statb.st_size; 482514Sdlw *stbuf++ = statb.st_atime; 492514Sdlw *stbuf++ = statb.st_mtime; 502514Sdlw *stbuf++ = statb.st_ctime; 5112030Sdlw *stbuf++ = statb.st_blksize; 522514Sdlw return(0L); 532514Sdlw } 542514Sdlw return ((long)errno); 552514Sdlw } 56