#include <9pm/u.h>
#include <9pm/libc.h>
#include <9pm/fcall.h>
#include <9pm/ns.h>

int
stat(char *file, uchar *edir, int nedir)
{
	char *path;
	volatile long m;
	Mnt *mnt;

	if((path = nsassign(file, &mnt, nil)) == nil)
		return -1;
	m = -1;
	checkerrstack();
	if(!waserror()){
		m = (*mnt->dev->_stat)(mnt, path, edir, nedir);
		poperror();
	}
	mntclose(mnt);
	free(path);
	checkerrstack();
	return m;
}

