shithub: riscv

ref: 6033931b02f9a9bbe33a84f9c777bb8ce9260b2f
dir: /sys/src/libgio/writep.c/

View raw version
#include <u.h>
#include <libc.h>
#include <gio.h>

long
gwrite(int fd, void *buf, long len, vlong offset)
{
	ReadWriter *rd;
	long rval;

	rd = getrdstruct(fd);
	if(rd == nil)
		return -1;
	if(rd->pwrite == nil)
		return -2;
	wlock(rd);
	rval = rd->pwrite(rd, buf, len, offset);
	wunlock(rd);
	return rval;
}