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

long
pread(int fd, void *buf, long n, vlong off)
{
	Syscallmem *c;

	c = _getsyscallmem();
	c->arg[0] = fd;
	c->arg[1] = 0;
	if(n > CallBuf)
		n = CallBuf;
	c->arg[2] = n;
	*(vlong*)(&c->arg[3]) = off;
	c->nr = Spread;
	if(_dosyscall(c) > 0)
		memmove(buf, &c[1], c->ret);
	return c->ret;
}

