Пример #1
0
int
bc_readv(int fd, struct iovec *iov, int iovcnt)
{
	int ret, off;
	int i, size, total = 0;
	char *nbuf;

	if (fd_get(fd) != -1) {
		for (i = 0; i < iovcnt; i++) {
			size = getmodsize(iov[i].iov_len,
			    sizeof (struct compat_utmp),
			    sizeof (struct utmpx));

			if ((nbuf = (void *)malloc(size)) == NULL) {
				fprintf(stderr, "readv: malloc failed\n");
				exit(-1);
			}

			if ((ret = _read(fd, nbuf, size)) == -1) {
				free(nbuf);
				return (-1);
			}

			to_utmp(iov[i].iov_base, nbuf, ret);

			ret = getmodsize(ret, sizeof (struct utmpx),
			    sizeof (struct compat_utmp));
			total += ret;

			free(nbuf);
		}
		return (total);
	}

	return (_readv(fd, iov, iovcnt));
}
std::vector< std::vector<double> > InputFileFITS::read64fv(int ncol, long frow, long lrow, int vsize)
{
	std::vector< std::vector<double> > buff;
	_readv(ncol, buff, TDOUBLE, frow, lrow, vsize);
	return buff;
}
std::vector< std::vector<float> > InputFileFITS::read32fv(int ncol, long frow, long lrow, int vsize)
{
	std::vector< std::vector<float> > buff;
	_readv(ncol, buff, TFLOAT, frow, lrow, vsize);
	return buff;
}
std::vector< std::vector<int64_t> > InputFileFITS::read64iv(int ncol, long frow, long lrow, int vsize)
{
	std::vector< std::vector<int64_t> > buff;
	_readv(ncol, buff, TLONG, frow, lrow, vsize);
	return buff;
}
std::vector< std::vector<int32_t> > InputFileFITS::read32iv(int ncol, long frow, long lrow, int vsize)
{
	std::vector< std::vector<int32_t> > buff;
	_readv(ncol, buff, TINT, frow, lrow, vsize);
	return buff;
}
std::vector< std::vector<int16_t> > InputFileFITS::read16iv(int ncol, long frow, long lrow, int vsize)
{
	std::vector< std::vector<int16_t> > buff;
	_readv(ncol, buff, TSHORT, frow, lrow, vsize);
	return buff;
}
std::vector< std::vector<uint8_t> > InputFileFITS::readu8iv(int ncol, long frow, long lrow, int vsize)
{
	std::vector< std::vector<uint8_t> > buff;
	_readv(ncol, buff, TBYTE, frow, lrow, vsize);
	return buff;
}