xref: /plan9-contrib/sys/src/ape/lib/ap/plan9/fstat.c (revision 219b2ee8daee37f4aad58d63f21287faa8e4ffdc)
1 #include "lib.h"
2 #include <sys/stat.h>
3 #include <errno.h>
4 #include "sys9.h"
5 #include "dir.h"
6 
7 int
8 fstat(int fd, struct stat *buf)
9 {
10 	char cd[DIRLEN];
11 
12 	if(_FSTAT(fd, cd) < 0){
13 		_syserrno();
14 		return -1;
15 	}
16 	_dirtostat(buf, cd, &_fdinfo[fd]);
17 	return 0;
18 }
19