summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaleb S KEITHLEY <kkeithle@redhat.com>2015-12-07 10:22:05 -0500
committerNiels de Vos <ndevos@redhat.com>2015-12-22 09:11:30 -0800
commit76f1680a2de05420934e131f934f3895fbe50db8 (patch)
tree54d7234fa2bef0f9adb43a15ef65db112b0b1ca4
parent439de31320315872d988720991e9baaead8712db (diff)
core: add preadv, pwritev, pread, pwrite syscall wrappers
add additional system calls plus pick up a couple missed unwrapped system calls that seem to have slipped into the master branch. Change-Id: If268ccd5e9a139ac3ffd38293c67cd2f62ea5b58 BUG: 1289258 Signed-off-by: Kaleb S KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/12895 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r--libglusterfs/src/syscall.c29
-rw-r--r--libglusterfs/src/syscall.h15
-rwxr-xr-xtests/basic/symbol-check.sh14
-rw-r--r--xlators/features/bit-rot/src/stub/bit-rot-stub-helpers.c4
-rw-r--r--xlators/features/changelog/lib/src/gf-history-changelog.c4
-rw-r--r--xlators/storage/bd/src/bd.c10
-rw-r--r--xlators/storage/posix/src/posix.c8
7 files changed, 66 insertions, 18 deletions
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index dc257f6cfcc..eb0c1cf983a 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -15,6 +15,7 @@
#include <utime.h>
#include <sys/time.h>
#include <fcntl.h>
+#include <unistd.h>
int
sys_lstat (const char *path, struct stat *buf)
@@ -268,6 +269,34 @@ sys_write (int fd, const void *buf, size_t count)
}
+ssize_t
+sys_preadv (int fd, const struct iovec *iov, int iovcnt, off_t offset)
+{
+ return preadv (fd, iov, iovcnt, offset);
+}
+
+
+ssize_t
+sys_pwritev (int fd, const struct iovec *iov, int iovcnt, off_t offset)
+{
+ return pwritev (fd, iov, iovcnt, offset);
+}
+
+
+ssize_t
+sys_pread (int fd, void *buf, size_t count, off_t offset)
+{
+ return pread (fd, buf, count, offset);
+}
+
+
+ssize_t
+sys_pwrite (int fd, const void *buf, size_t count, off_t offset)
+{
+ return pwrite (fd, buf, count, offset);
+}
+
+
off_t
sys_lseek (int fd, off_t offset, int whence)
{
diff --git a/libglusterfs/src/syscall.h b/libglusterfs/src/syscall.h
index 037f6c64acb..10b70927415 100644
--- a/libglusterfs/src/syscall.h
+++ b/libglusterfs/src/syscall.h
@@ -192,6 +192,19 @@ sys_access (const char *pathname, int mode);
int
sys_ftruncate (int fd, off_t length);
-int sys_fallocate(int fd, int mode, off_t offset, off_t len);
+int
+sys_fallocate(int fd, int mode, off_t offset, off_t len);
+
+ssize_t
+sys_preadv (int fd, const struct iovec *iov, int iovcnt, off_t offset);
+
+ssize_t
+sys_pwritev (int fd, const struct iovec *iov, int iovcnt, off_t offset);
+
+ssize_t
+sys_pread(int fd, void *buf, size_t count, off_t offset);
+
+ssize_t
+sys_pwrite(int fd, const void *buf, size_t count, off_t offset);
#endif /* __SYSCALL_H__ */
diff --git a/tests/basic/symbol-check.sh b/tests/basic/symbol-check.sh
index 10344a9b3e8..f84d591facb 100755
--- a/tests/basic/symbol-check.sh
+++ b/tests/basic/symbol-check.sh
@@ -5,11 +5,13 @@ fallocate64\nfchmod\nfchown\nfdatasync\nfgetxattr\nflistxattr\n\
fremovexattr\nfsetxattr\nfsync\nftruncate64\n__fxstat64\n\
__fxstatat64\nlchown\nlgetxattr\nlinkat\nllistxattr\nlremovexattr\n\
lseek64\nlsetxattr\n__lxstat64\nmkdir\nmkdirat\nopenat64\nopendir\n\
-read\nreaddir64\nreadlink\nreadv\nrename\nrmdir\nstatvfs64\nsymlink\n\
-truncate64\nunlink\nutimeswrite\nwritev\n__xmknod\n__xstat64'
+pread64\npwrite64\npreadv64\npwritev64\nread\nreaddir64\nreadlink\n\
+readv\nrename\nrmdir\n statvfs64\nsymlink\n\truncate64\nunlink\n\
+utimeswrite\nwritev\n\__xmknod\n__xstat64'
-syscalls32=$'creat\n\fallocate\n\ftruncate\n\__fxstat\n\__fxstatat\n\
-lseek\n\__lxstat\n\openat\n\readdir\n\statvfs\n\truncate\n\stat'
+syscalls32=$'creat\nfallocate\nftruncate\n__fxstat\n__fxstatat\n\
+lseek\n__lxstat\nopenat\nreaddir\nstatvfs\ntruncate\nstat\n\
+preadv\npwritev\npread\npwrite'
exclude_files=$'/libglusterfs/src/.libs/libglusterfs_la-syscall.o\n\
/libglusterfs/src/.libs/libglusterfs_la-gen_uuid.o\n\
@@ -44,6 +46,10 @@ function main()
"fallocate64") sym="fallocate";;
"ftruncate64") sym="ftruncate";;
"lseek64") sym="lseek";;
+ "preadv64") sym="preadv";;
+ "pwritev64") sym="pwritev";;
+ "pread64") sym="pread";;
+ "pwrite64") sym="pwrite";;
"openat64") sym="openat";;
"readdir64") sym="readdir";;
"truncate64") sym="truncate";;
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub-helpers.c b/xlators/features/bit-rot/src/stub/bit-rot-stub-helpers.c
index 306b44da083..7bd270d1513 100644
--- a/xlators/features/bit-rot/src/stub/bit-rot-stub-helpers.c
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub-helpers.c
@@ -229,7 +229,7 @@ br_stub_check_stub_directory (xlator_t *this, char *fullpath)
int ret = 0;
struct stat st = {0,};
- ret = stat (fullpath, &st);
+ ret = sys_stat (fullpath, &st);
if (!ret && !S_ISDIR (st.st_mode))
goto error_return;
if (ret) {
@@ -262,7 +262,7 @@ br_stub_check_stub_file (xlator_t *this, char *path)
int fd = -1;
struct stat st = {0,};
- ret = stat (path, &st);
+ ret = sys_stat (path, &st);
if (!ret && !S_ISREG (st.st_mode))
goto error_return;
if (ret) {
diff --git a/xlators/features/changelog/lib/src/gf-history-changelog.c b/xlators/features/changelog/lib/src/gf-history-changelog.c
index f7b58f5a965..389b65f3b16 100644
--- a/xlators/features/changelog/lib/src/gf-history-changelog.c
+++ b/xlators/features/changelog/lib/src/gf-history-changelog.c
@@ -335,7 +335,7 @@ gf_history_get_timestamp (int fd, int index, int len,
return -1;
}
- n_read = pread (fd, path_buf, len, offset);
+ n_read = sys_pread (fd, path_buf, len, offset);
if (n_read < 0 ) {
ret = -1;
gf_msg (this->name, GF_LOG_ERROR, errno,
@@ -524,7 +524,7 @@ gf_changelog_consume_wrap (void* data)
ccd->retval = -1;
- nread = pread (ccd->fd, ccd->changelog, PATH_MAX, ccd->offset);
+ nread = sys_pread (ccd->fd, ccd->changelog, PATH_MAX, ccd->offset);
if (nread < 0) {
gf_msg (this->name, GF_LOG_ERROR, errno,
CHANGELOG_LIB_MSG_READ_ERROR,
diff --git a/xlators/storage/bd/src/bd.c b/xlators/storage/bd/src/bd.c
index 9599f4acbd5..115b01d4ea6 100644
--- a/xlators/storage/bd/src/bd.c
+++ b/xlators/storage/bd/src/bd.c
@@ -485,7 +485,7 @@ bd_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
goto out;
}
_fd = bd_fd->fd;
- op_ret = pread (_fd, iobuf->ptr, size, offset);
+ op_ret = sys_pread (_fd, iobuf->ptr, size, offset);
if (op_ret == -1) {
op_errno = errno;
gf_log (this->name, GF_LOG_ERROR,
@@ -1787,7 +1787,7 @@ __bd_pwritev (int fd, struct iovec *vector, int count, off_t offset,
if (!vector)
return -EFAULT;
- retval = pwritev (fd, vector, count, offset);
+ retval = sys_pwritev (fd, vector, count, offset);
if (retval == -1) {
int64_t off = offset;
gf_log (THIS->name, GF_LOG_WARNING,
@@ -1810,8 +1810,8 @@ __bd_pwritev (int fd, struct iovec *vector, int count, off_t offset,
vector[index].iov_len = bd_size - internal_offset;
no_space = 1;
}
- retval = pwritev (fd, vector[index].iov_base,
- vector[index].iov_len, internal_offset);
+ retval = sys_pwritev (fd, vector[index].iov_base,
+ vector[index].iov_len, internal_offset);
if (retval == -1) {
gf_log (THIS->name, GF_LOG_WARNING,
"base %p, length %ld, offset %ld, message %s",
@@ -2174,7 +2174,7 @@ bd_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
LOCK (&fd->lock);
{
- ret = pread (_fd, buf, len, offset);
+ ret = sys_pread (_fd, buf, len, offset);
if (ret < 0) {
gf_log (this->name, GF_LOG_WARNING,
"pread of %d bytes returned %d (%s)",
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index ffae66db273..a3e0aa26bf8 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -2823,7 +2823,7 @@ posix_readv (call_frame_t *frame, xlator_t *this,
}
_fd = pfd->fd;
- op_ret = pread (_fd, iobuf->ptr, size, offset);
+ op_ret = sys_pread (_fd, iobuf->ptr, size, offset);
if (op_ret == -1) {
op_errno = errno;
gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_READ_FAILED,
@@ -2889,7 +2889,7 @@ __posix_pwritev (int fd, struct iovec *vector, int count, off_t offset)
internal_off = offset;
for (idx = 0; idx < count; idx++) {
- retval = pwrite (fd, vector[idx].iov_base, vector[idx].iov_len,
+ retval = sys_pwrite (fd, vector[idx].iov_base, vector[idx].iov_len,
internal_off);
if (retval == -1) {
op_ret = -errno;
@@ -2935,7 +2935,7 @@ __posix_writev (int fd, struct iovec *vector, int count, off_t startoff,
memcpy (buf, vector[idx].iov_base, vector[idx].iov_len);
/* not sure whether writev works on O_DIRECT'd fd */
- retval = pwrite (fd, buf, vector[idx].iov_len, internal_off);
+ retval = sys_pwrite (fd, buf, vector[idx].iov_len, internal_off);
if (retval == -1) {
op_ret = -errno;
goto err;
@@ -6105,7 +6105,7 @@ posix_rchecksum (call_frame_t *frame, xlator_t *this,
if (priv->aio_capable && priv->aio_init_done)
__posix_fd_set_odirect (fd, pfd, 0, offset, len);
- bytes_read = pread (_fd, buf, len, offset);
+ bytes_read = sys_pread (_fd, buf, len, offset);
if (bytes_read < 0) {
gf_msg (this->name, GF_LOG_WARNING, errno,
P_MSG_PREAD_FAILED,