예제 #1
0
int __fxstat64(int ver, int fd, struct stat64 *buf)
{
	if (nfs_fd_list[fd].is_nfs == 1) {
		int ret;
		struct stat64 st64;

		LD_NFS_DPRINTF(9, "__fxstat64(%d)", fd);
		if ((ret = nfs_fstat(nfs_fd_list[fd].nfs, nfs_fd_list[fd].fh,
				(void *)&st64)) < 0) {
			errno = -ret;
			return -1;
		}

		buf->st_dev     = st64.st_dev;
		buf->st_ino     = st64.st_ino;
		buf->st_mode    = st64.st_mode;
		buf->st_nlink   = st64.st_nlink;
		buf->st_uid     = st64.st_uid;
		buf->st_gid     = st64.st_gid;
		buf->st_rdev    = st64.st_rdev;
		buf->st_size    = st64.st_size;
		buf->st_blksize = st64.st_blksize;
		buf->st_blocks  = st64.st_blocks;
		buf->st_atime   = st64.st_atime;
		buf->st_mtime   = st64.st_mtime;
		buf->st_ctime   = st64.st_ctime;

		LD_NFS_DPRINTF(9, "__fxstat64(%d) success", fd);
		return ret;
	}

	return real_fxstat64(ver, fd, buf);
}
예제 #2
0
파일: ld_iscsi.c 프로젝트: agrare/libiscsi
int __fxstat64(int ver, int fd, struct stat64 *buf)
{
	if (iscsi_fd_list[fd].is_iscsi == 1) {
		if (iscsi_fd_list[fd].dup2fd >= 0) {
			return __fxstat64(ver, iscsi_fd_list[fd].dup2fd, buf);
		}

		memset(buf, 0, sizeof(struct stat64));
		buf->st_mode = S_IRUSR | S_IRGRP | S_IROTH | S_IFREG;
		buf->st_size = iscsi_fd_list[fd].num_blocks * iscsi_fd_list[fd].block_size;
		return 0;
	}

	return real_fxstat64(ver, fd, buf);
}