/* xread() is the same a read(), but it automatically restarts read() operations with a recoverable error (EAGAIN and EINTR). xread() DOES NOT GUARANTEE that "len" bytes is read even if the data is available.  */
static ssize_t xread(int fd, void *buf, size_t len)
/* xread() is the same a read(), but it automatically restarts read() operations with a recoverable error (EAGAIN and EINTR). xread() DOES NOT GUARANTEE that "len" bytes is read even if the data is available.  */
static ssize_t xread(int fd, void *buf, size_t len)
{
	ssize_t nr;
	while (1) {
		nr = read(fd, buf, len);
		if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
			continue;
		return nr;
	}
}