summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaleb S KEITHLEY <kkeithle@redhat.com>2015-11-16 10:54:01 -0500
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-11-16 15:20:17 -0800
commit1d0a0d180b34961ce03352283c5cb1f0c1561d88 (patch)
treea664a23383503b7bf0a7fd7d318638c64cd308ac
parentcaae86e6f8b8150ad8663c3173fcd6df3c2e260a (diff)
core: use syscall wrappers instead of direct syscalls - tail
tail, as in dog chasing its tail. These are the unwrapped syscalls that have crept in (or were missed) in the previous patches. various xlators and other components are invoking system calls directly instead of using the libglusterfs/syscall.[ch] wrappers. If not using the system call wrappers there should be a comment in the source explaining why the wrapper isn't used. Change-Id: If183487de92fc7cbc47d4c5aa3f3e80eae50b84f BUG: 1267967 Signed-off-by: Kaleb S KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/12589 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
-rw-r--r--libglusterfs/src/common-utils.h4
-rw-r--r--libglusterfs/src/gfdb/gfdb_data_store_helper.c7
-rw-r--r--libglusterfs/src/gfdb/gfdb_sqlite3.c3
-rw-r--r--libglusterfs/src/graph.y5
-rw-r--r--xlators/cluster/dht/src/tier.c4
-rw-r--r--xlators/debug/io-stats/src/io-stats.c5
-rw-r--r--xlators/features/changetimerecorder/src/changetimerecorder.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c4
8 files changed, 20 insertions, 15 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index bf574fdabc7..1c9ef13b80a 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -362,11 +362,11 @@ union gf_sock_union {
do {\
entry = NULL;\
if (dir) { \
- entry = readdir (dir); \
+ entry = sys_readdir (dir); \
while (entry && (!strcmp (entry->d_name, ".") || \
!fnmatch ("*.tmp", entry->d_name, 0) || \
!strcmp (entry->d_name, ".."))) { \
- entry = readdir (dir); \
+ entry = sys_readdir (dir); \
} \
} \
} while (0)
diff --git a/libglusterfs/src/gfdb/gfdb_data_store_helper.c b/libglusterfs/src/gfdb/gfdb_data_store_helper.c
index ff85e17169d..6d7d5c58d32 100644
--- a/libglusterfs/src/gfdb/gfdb_data_store_helper.c
+++ b/libglusterfs/src/gfdb/gfdb_data_store_helper.c
@@ -1,5 +1,6 @@
-#include "gfdb_data_store_helper.h"
+#include "gfdb_data_store_helper.h"
+#include "syscall.h"
/*Create a single link info structure*/
gfdb_link_info_t*
@@ -542,7 +543,7 @@ gfdb_read_query_record (int fd,
/* Read serialized query record length from the file*/
- ret = read (fd, &buffer_len, sizeof (int32_t));
+ ret = sys_read (fd, &buffer_len, sizeof (int32_t));
if (ret < 0) {
gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
LG_MSG_DB_ERROR, "Failed reading buffer length"
@@ -568,7 +569,7 @@ gfdb_read_query_record (int fd,
/* Read the serialized query record from file */
read_len = buffer_len;
read_buffer = buffer;
- while ((ret = read (fd, read_buffer, read_len)) < read_len) {
+ while ((ret = sys_read (fd, read_buffer, read_len)) < read_len) {
/*Any error */
if (ret < 0) {
diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3.c b/libglusterfs/src/gfdb/gfdb_sqlite3.c
index adbbac4233f..e45a21d66c8 100644
--- a/libglusterfs/src/gfdb/gfdb_sqlite3.c
+++ b/libglusterfs/src/gfdb/gfdb_sqlite3.c
@@ -11,6 +11,7 @@
#include "gfdb_sqlite3.h"
#include "gfdb_sqlite3_helper.h"
#include "libglusterfs-messages.h"
+#include "syscall.h"
/******************************************************************************
*
@@ -430,7 +431,7 @@ gf_sqlite3_init (dict_t *args, void **db_conn) {
strncpy(sql_conn->sqlite3_db_path, temp_str, PATH_MAX-1);
sql_conn->sqlite3_db_path[PATH_MAX-1] = 0;
- is_dbfile_exist = (stat (sql_conn->sqlite3_db_path, &stbuf) == 0) ?
+ is_dbfile_exist = (sys_stat (sql_conn->sqlite3_db_path, &stbuf) == 0) ?
_gf_true : _gf_false;
/*Creates DB if not created*/
diff --git a/libglusterfs/src/graph.y b/libglusterfs/src/graph.y
index 9fd02823a6c..8ac01a25177 100644
--- a/libglusterfs/src/graph.y
+++ b/libglusterfs/src/graph.y
@@ -25,6 +25,7 @@
#include "xlator.h"
#include "graph-utils.h"
#include "logging.h"
+#include "syscall.h"
#include "libglusterfs-messages.h"
static int new_volume (char *name);
@@ -565,7 +566,7 @@ glusterfs_graph_construct (FILE *fp)
if (-1 == tmp_fd)
goto err;
- ret = unlink (template);
+ ret = sys_unlink (template);
if (ret < 0) {
gf_msg ("parser", GF_LOG_WARNING, 0, LG_MSG_FILE_OP_FAILED,
"Unable to delete file: %s", template);
@@ -606,7 +607,7 @@ err:
gf_msg ("parser", GF_LOG_ERROR, 0, LG_MSG_FILE_OP_FAILED,
"cannot create temporary file");
if (-1 != tmp_fd)
- close (tmp_fd);
+ sys_close (tmp_fd);
}
glusterfs_graph_destroy (graph);
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index e857dace038..6a9bddfc179 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -743,7 +743,7 @@ out:
}
if (query_cbk_args && query_cbk_args->query_fd >= 0) {
- close (query_cbk_args->query_fd);
+ sys_close (query_cbk_args->query_fd);
query_cbk_args->query_fd = -1;
}
gfdb_methods.fini_db (conn_node);
@@ -1067,7 +1067,7 @@ tier_migrate_files_using_qfile (demotion_args_t *comp,
goto out;
}
ret = tier_migrate_using_query_file ((void *)query_cbk_args);
- close (query_cbk_args->query_fd);
+ sys_close (query_cbk_args->query_fd);
query_cbk_args->query_fd = -1;
if (ret) {
snprintf (renamed_file, sizeof renamed_file, "%s.err", qfile);
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 4aab469a585..8ce2ebbc6e9 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -8,6 +8,7 @@
cases as published by the Free Software Foundation.
*/
#include "xlator.h"
+#include "syscall.h"
/**
* xlators/debug/io_stats :
@@ -2905,7 +2906,7 @@ _ios_dump_thread (xlator_t *this) {
xlator_name = "nfsd";
instance_name = this->prev->instance_name;
}
- if (mkdir (_IOS_DUMP_DIR, S_IRWXU | S_IRWXO | S_IRWXG) == (-1)) {
+ if (sys_mkdir (_IOS_DUMP_DIR, S_IRWXU | S_IRWXO | S_IRWXG) == (-1)) {
if (errno != EEXIST) {
gf_log (this->name, GF_LOG_ERROR,
"could not create stats-dump directory %s",
@@ -2913,7 +2914,7 @@ _ios_dump_thread (xlator_t *this) {
goto out;
}
}
- if (mkdir (_IOS_SAMP_DIR, S_IRWXU | S_IRWXO | S_IRWXG) == (-1)) {
+ if (sys_mkdir (_IOS_SAMP_DIR, S_IRWXU | S_IRWXO | S_IRWXG) == (-1)) {
if (errno != EEXIST) {
gf_log (this->name, GF_LOG_ERROR,
"could not create stats-sample directory %s",
diff --git a/xlators/features/changetimerecorder/src/changetimerecorder.c b/xlators/features/changetimerecorder/src/changetimerecorder.c
index 1831316f8a3..242fb2b51fc 100644
--- a/xlators/features/changetimerecorder/src/changetimerecorder.c
+++ b/xlators/features/changetimerecorder/src/changetimerecorder.c
@@ -13,6 +13,7 @@
#include "gfdb_sqlite3.h"
#include "ctr-helper.h"
#include "ctr-messages.h"
+#include "syscall.h"
/*******************************inode forget***********************************/
@@ -1623,7 +1624,7 @@ out:
ret = query_cbk_args.count;
if (query_cbk_args.query_fd >= 0) {
- close (query_cbk_args.query_fd);
+ sys_close (query_cbk_args.query_fd);
query_cbk_args.query_fd = -1;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
index ccb9e7c17bc..14caf361544 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
@@ -3537,7 +3537,7 @@ glusterd_copy_nfs_ganesha_file (glusterd_volinfo_t *src_vol,
goto out;
}
- ret = lstat (src_path, &stbuf);
+ ret = sys_lstat (src_path, &stbuf);
if (ret) {
/* *
* If export file is not present, volume is not exported
@@ -3736,7 +3736,7 @@ glusterd_restore_nfs_ganesha_file (glusterd_volinfo_t *src_vol,
if (ret < 0)
goto out;
- ret = lstat (src_path, &stbuf);
+ ret = sys_lstat (src_path, &stbuf);
if (ret) {
if (errno == ENOENT) {
ret = 0;