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

int
errstr(char *err, uint nerr)
{
	Syscallmem *c;

	c = _getsyscallmem();
	strcpy((char*)(&c[1]), err);
	c->arg[0] = 0;
	c->arg[1] = nerr;
	c->nr = Serrstr;
	if(_dosyscall(c) < 0)
		return -1;
	strcpy(err, (char*)(&c[1]));
	return c->ret;
}
