Example #1
0
ssize_t pread(int fd, void *buf, size_t size, off_t ofs)
{
    if (smbw_fd(fd)) {
        return smbw_pread(fd, buf, size, ofs);
    }

    return real_pread(fd, buf, size, ofs);
}
Example #2
0
ssize_t pread(int fd, void *buf, size_t count, off_t offset) {
	if (nfs_fd_list[fd].is_nfs == 1) {
		int ret;

		LD_NFS_DPRINTF(9, "pread(fd:%d offset:%d count:%d)", fd,
			(int)offset, (int)count);
		if ((ret = nfs_pread(nfs_fd_list[fd].nfs, nfs_fd_list[fd].fh,
				offset, count, buf)) < 0) {
			errno = -ret;
			return -1;
		}
		return ret;
	}
	return real_pread(fd, buf, count, offset);
}
Example #3
0
ssize_t HdfsFile::read(void *ptr, size_t count)
{
	boost::mutex::scoped_lock lock(m_mutex);
	int savedErrno;

	tOffset offset = tell();
	if (offset < 0)
		return offset;
	/* May get a performance boost by implementing read() s.t. it
	doesn't require a seek afterward, but probably not though. */
	ssize_t numRead = real_pread(ptr, offset, count);
	savedErrno = errno;
	if (numRead > 0)
		hdfsSeek(m_fs, m_file, offset + numRead);
	errno = savedErrno;
	return numRead;
}
Example #4
0
ssize_t pread(int fd, void *buf, size_t count, off_t offset) {
	if ((iscsi_fd_list[fd].is_iscsi == 1 && iscsi_fd_list[fd].in_flight == 0)) {
		off_t old_offset;
		if ((old_offset = lseek(fd, 0, SEEK_CUR)) < 0) {
			errno = EIO;
			return -1;
		}
		if (lseek(fd, offset, SEEK_SET) < 0) {
			return -1;
		}
		if (read(fd, buf, count) < 0) {
			lseek(fd, old_offset, SEEK_SET);
			return -1;
		}
		lseek(fd, old_offset, SEEK_SET);
		return count;
	}
	return real_pread(fd, buf, count, offset);
}
Example #5
0
ssize_t HdfsFile::pread(void *ptr, off64_t offset, size_t count)
{
	boost::mutex::scoped_lock lock(m_mutex);
	return real_pread(ptr, offset, count);
}