shithub: riscv

ref: 3bd5ff9583c4b33aa27754fb4c3b6792261feb8a
dir: /sys/src/ape/lib/ap/plan9/9readn.c/

View raw version
#include "sys9.h"

long
_READN(int f, void *av, long n)
{
	char *a;
	long m, t;

	a = av;
	t = 0;
	while(t < n){
		m = _READ(f, a+t, n-t);
		if(m <= 0){
			if(t == 0)
				return m;
			break;
		}
		t += m;
	}
	return t;
}