#include <9pm/windows.h>
#include <9pm/u.h>
#include <9pm/libc.h>
#include "syscall.h"

int
fstat(int fd, uchar *buf, int nbuf)
{
	Syscallmem *c;

	c = _getsyscallmem();
	c->arg[0] = fd;
	c->arg[1] = 0;
	c->arg[2] = nbuf;
	c->nr = Sfstat;
	if(_dosyscall(c) < 0)
		return -1;
	memmove(buf, &c[1], c->ret);
	return c->ret;
}


syntax highlighted by Code2HTML, v. 0.9.1