1 #include "lib.h" 2 #include <sys/stat.h> 3 #include <errno.h> 4 #include <stdlib.h> 5 #include "sys9.h" 6 #include "dir.h" 7 8 int fstat(int fd,struct stat * buf)9fstat(int fd, struct stat *buf) 10 { 11 Dir *d; 12 13 if((d = _dirfstat(fd)) == nil){ 14 _syserrno(); 15 return -1; 16 } 17 _dirtostat(buf, d, &_fdinfo[fd]); 18 free(d); 19 return 0; 20 } 21