summaryrefslogtreecommitdiffstats
path: root/glusterfsd
diff options
context:
space:
mode:
Diffstat (limited to 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c33
-rw-r--r--glusterfsd/src/glusterfsd.c22
2 files changed, 28 insertions, 27 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index 81c18ffc715..749873872d2 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -31,6 +31,7 @@
#include "statedump.h"
#include "syncop.h"
#include "xlator.h"
+#include "syscall.h"
static gf_boolean_t is_mgmt_rpc_reconnect = _gf_false;
int need_emancipate = 0;
@@ -399,12 +400,12 @@ glusterfs_volume_top_write_perf (uint32_t blk_size, uint32_t blk_count,
gettimeofday (&begin, NULL);
for (iter = 0; iter < blk_count; iter++) {
- ret = read (input_fd, buf, blk_size);
+ ret = sys_read (input_fd, buf, blk_size);
if (ret != blk_size) {
ret = -1;
goto out;
}
- ret = write (fd, buf, blk_size);
+ ret = sys_write (fd, buf, blk_size);
if (ret != blk_size) {
ret = -1;
goto out;
@@ -427,11 +428,11 @@ glusterfs_volume_top_write_perf (uint32_t blk_size, uint32_t blk_count,
out:
if (fd >= 0)
- close (fd);
+ sys_close (fd);
if (input_fd >= 0)
- close (input_fd);
+ sys_close (input_fd);
GF_FREE (buf);
- unlink (export_path);
+ sys_unlink (export_path);
return ret;
}
@@ -488,24 +489,24 @@ glusterfs_volume_top_read_perf (uint32_t blk_size, uint32_t blk_count,
}
for (iter = 0; iter < blk_count; iter++) {
- ret = read (input_fd, buf, blk_size);
+ ret = sys_read (input_fd, buf, blk_size);
if (ret != blk_size) {
ret = -1;
goto out;
}
- ret = write (fd, buf, blk_size);
+ ret = sys_write (fd, buf, blk_size);
if (ret != blk_size) {
ret = -1;
goto out;
}
}
- ret = fsync (fd);
+ ret = sys_fsync (fd);
if (ret) {
gf_log ("glusterd", GF_LOG_ERROR, "could not flush cache");
goto out;
}
- ret = lseek (fd, 0L, 0);
+ ret = sys_lseek (fd, 0L, 0);
if (ret != 0) {
gf_log ("glusterd", GF_LOG_ERROR,
"could not seek back to start");
@@ -514,12 +515,12 @@ glusterfs_volume_top_read_perf (uint32_t blk_size, uint32_t blk_count,
}
gettimeofday (&begin, NULL);
for (iter = 0; iter < blk_count; iter++) {
- ret = read (fd, buf, blk_size);
+ ret = sys_read (fd, buf, blk_size);
if (ret != blk_size) {
ret = -1;
goto out;
}
- ret = write (output_fd, buf, blk_size);
+ ret = sys_write (output_fd, buf, blk_size);
if (ret != blk_size) {
ret = -1;
goto out;
@@ -542,13 +543,13 @@ glusterfs_volume_top_read_perf (uint32_t blk_size, uint32_t blk_count,
out:
if (fd >= 0)
- close (fd);
+ sys_close (fd);
if (input_fd >= 0)
- close (input_fd);
+ sys_close (input_fd);
if (output_fd >= 0)
- close (output_fd);
+ sys_close (output_fd);
GF_FREE (buf);
- unlink (export_path);
+ sys_unlink (export_path);
return ret;
}
@@ -1973,7 +1974,7 @@ glusterfs_listener_stop (glusterfs_ctx_t *ctx)
cmd_args = &ctx->cmd_args;
if (cmd_args->sock_file) {
- ret = unlink (cmd_args->sock_file);
+ ret = sys_unlink (cmd_args->sock_file);
if (ret && (ENOENT == errno)) {
ret = 0;
}
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 6ebcd6ce8c4..f767e28b18d 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -1322,8 +1322,8 @@ emancipate (glusterfs_ctx_t *ctx, int ret)
{
/* break free from the parent */
if (ctx->daemon_pipe[1] != -1) {
- write (ctx->daemon_pipe[1], (void *) &ret, sizeof (ret));
- close (ctx->daemon_pipe[1]);
+ sys_write (ctx->daemon_pipe[1], (void *) &ret, sizeof (ret));
+ sys_close (ctx->daemon_pipe[1]);
ctx->daemon_pipe[1] = -1;
}
}
@@ -1766,7 +1766,7 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx)
cmd_args = &ctx->cmd_args;
/* Do this before argp_parse so it can be overridden. */
- if (access(SECURE_ACCESS_FILE,F_OK) == 0) {
+ if (sys_access (SECURE_ACCESS_FILE, F_OK) == 0) {
cmd_args->secure_mgmt = 1;
}
@@ -1818,7 +1818,7 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx)
/* Check if the volfile exists, if not give usage output
and exit */
- ret = stat (cmd_args->volfile, &stbuf);
+ ret = sys_stat (cmd_args->volfile, &stbuf);
if (ret) {
gf_msg ("glusterfs", GF_LOG_CRITICAL, errno,
glusterfsd_msg_16);
@@ -1923,7 +1923,7 @@ glusterfs_pidfile_cleanup (glusterfs_ctx_t *ctx)
cmd_args->pid_file);
if (ctx->cmd_args.pid_file) {
- unlink (ctx->cmd_args.pid_file);
+ sys_unlink (ctx->cmd_args.pid_file);
ctx->cmd_args.pid_file = NULL;
}
@@ -1954,7 +1954,7 @@ glusterfs_pidfile_update (glusterfs_ctx_t *ctx)
return ret;
}
- ret = ftruncate (fileno (pidfp), 0);
+ ret = sys_ftruncate (fileno (pidfp), 0);
if (ret) {
gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_20,
cmd_args->pid_file);
@@ -2113,8 +2113,8 @@ daemonize (glusterfs_ctx_t *ctx)
switch (ret) {
case -1:
if (ctx->daemon_pipe[0] != -1) {
- close (ctx->daemon_pipe[0]);
- close (ctx->daemon_pipe[1]);
+ sys_close (ctx->daemon_pipe[0]);
+ sys_close (ctx->daemon_pipe[1]);
}
gf_msg ("daemonize", GF_LOG_ERROR, errno, glusterfsd_msg_24);
@@ -2122,12 +2122,12 @@ daemonize (glusterfs_ctx_t *ctx)
case 0:
/* child */
/* close read */
- close (ctx->daemon_pipe[0]);
+ sys_close (ctx->daemon_pipe[0]);
break;
default:
/* parent */
/* close write */
- close (ctx->daemon_pipe[1]);
+ sys_close (ctx->daemon_pipe[1]);
if (ctx->mnt_pid > 0) {
ret = waitpid (ctx->mnt_pid, &cstatus, 0);
@@ -2139,7 +2139,7 @@ daemonize (glusterfs_ctx_t *ctx)
}
err = 1;
- read (ctx->daemon_pipe[0], (void *)&err, sizeof (err));
+ sys_read (ctx->daemon_pipe[0], (void *)&err, sizeof (err));
_exit (err);
}