summaryrefslogtreecommitdiff
path: root/sys/src/ape/lib/ap/plan9/fstat.c
blob: 62e6c653aa0dcdf4ab655fe6790fd438f2fb963d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "lib.h"
#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
#include "sys9.h"
#include "dir.h"

int
fstat(int fd, struct stat *buf)
{
	Dir *d;

	if((d = _dirfstat(fd)) == nil){
		_syserrno();
		return -1;
	}
	_dirtostat(buf, d, &_fdinfo[fd]);
	free(d);
	return 0;
}