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

vlong
seek(int fd, vlong off, int from)
{
	volatile vlong ret;
	volatile Chan *c;

	c = nil;
	ret = -1;
	checkerrstack();
	if(!waserror()){
		c = fd2chan(fd, -1);
		ret = (*c->mnt->dev->_seek)(c, off, from);
		poperror();
	}
	if(c)
		cclose(c);
	checkerrstack();
	return ret;
}


syntax highlighted by Code2HTML, v. 0.9.1