12514Sdlw /* 2*23016Skre * Copyright (c) 1980 Regents of the University of California. 3*23016Skre * All rights reserved. The Berkeley software License Agreement 4*23016Skre * specifies the terms and conditions for redistribution. 52514Sdlw * 6*23016Skre * @(#)fstat_.c 5.1 06/07/85 7*23016Skre */ 8*23016Skre 9*23016Skre /* 102514Sdlw * get file status 112514Sdlw * 122514Sdlw * calling sequence: 1312030Sdlw * integer fstat, statb(12) 142514Sdlw * call fstat (name, statb) 152514Sdlw * where: 162514Sdlw * 'statb' will receive the stat structure for file 'name'. 172514Sdlw */ 182514Sdlw 192514Sdlw #include <sys/types.h> 202514Sdlw #include <sys/stat.h> 212514Sdlw #include "../libI77/f_errno.h" 222514Sdlw #include "../libI77/fiodefs.h" 232514Sdlw 242514Sdlw extern unit units[]; 252514Sdlw 262514Sdlw long fstat_(lunit, stbuf) 272514Sdlw long *lunit, *stbuf; 282514Sdlw { 292514Sdlw struct stat statb; 302514Sdlw 312514Sdlw if (*lunit < 0 || *lunit >= MXUNIT) 322579Sdlw return((long)(errno=F_ERUNIT)); 332514Sdlw if (!units[*lunit].ufd) 342514Sdlw return((long)(errno=F_ERNOPEN)); 352514Sdlw if (fstat(fileno(units[*lunit].ufd), &statb) == 0) 362514Sdlw { 372514Sdlw *stbuf++ = statb.st_dev; 382514Sdlw *stbuf++ = statb.st_ino; 392514Sdlw *stbuf++ = statb.st_mode; 402514Sdlw *stbuf++ = statb.st_nlink; 412514Sdlw *stbuf++ = statb.st_uid; 422514Sdlw *stbuf++ = statb.st_gid; 432514Sdlw *stbuf++ = statb.st_rdev; 442514Sdlw *stbuf++ = statb.st_size; 452514Sdlw *stbuf++ = statb.st_atime; 462514Sdlw *stbuf++ = statb.st_mtime; 472514Sdlw *stbuf++ = statb.st_ctime; 4812030Sdlw *stbuf++ = statb.st_blksize; 492514Sdlw return(0L); 502514Sdlw } 512514Sdlw return ((long)errno); 522514Sdlw } 53