1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ctdb-common: Drop CTDB's copy of sys_read() and sys_write()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Nov 29 11:22:40 CET 2016 on sn-devel-144
This commit is contained in:
Martin Schwenke 2016-11-29 12:55:06 +11:00 committed by Amitay Isaacs
parent dcde6f1619
commit bdc049dfce
20 changed files with 27 additions and 66 deletions

View File

@ -30,11 +30,11 @@
#include "lib/util/dlinklist.h" #include "lib/util/dlinklist.h"
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "lib/util/sys_rw.h"
#include "ctdb_private.h" #include "ctdb_private.h"
#include "ctdb_client.h" #include "ctdb_client.h"
#include "common/system.h"
#include "common/logging.h" #include "common/logging.h"
#include "common/common.h" #include "common/common.h"

View File

@ -60,9 +60,6 @@ void lockdown_memory(bool valgrinding);
int mkdir_p(const char *dir, int mode); int mkdir_p(const char *dir, int mode);
void mkdir_p_or_die(const char *dir, int mode); void mkdir_p_or_die(const char *dir, int mode);
ssize_t sys_read(int fd, void *buf, size_t count);
ssize_t sys_write(int fd, const void *buf, size_t count);
void ctdb_wait_for_process_to_exit(pid_t pid); void ctdb_wait_for_process_to_exit(pid_t pid);
int ctdb_parse_connections(FILE *fp, TALLOC_CTX *mem_ctx, int ctdb_parse_connections(FILE *fp, TALLOC_CTX *mem_ctx,

View File

@ -349,40 +349,6 @@ void mkdir_p_or_die(const char *dir, int mode)
} }
} }
/* A read wrapper that will deal with EINTR. For now, copied from
* source3/lib/system.c
*/
ssize_t sys_read(int fd, void *buf, size_t count)
{
ssize_t ret;
do {
ret = read(fd, buf, count);
#if defined(EWOULDBLOCK)
} while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
#else
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
#endif
return ret;
}
/* A write wrapper that will deal with EINTR. For now, copied from
* source3/lib/system.c
*/
ssize_t sys_write(int fd, const void *buf, size_t count)
{
ssize_t ret;
do {
ret = write(fd, buf, count);
#if defined(EWOULDBLOCK)
} while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
#else
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
#endif
return ret;
}
void ctdb_wait_for_process_to_exit(pid_t pid) void ctdb_wait_for_process_to_exit(pid_t pid)
{ {
while (kill(pid, 0) == 0 || errno != ESRCH) { while (kill(pid, 0) == 0 || errno != ESRCH) {

View File

@ -30,6 +30,7 @@
#include "lib/util/dlinklist.h" #include "lib/util/dlinklist.h"
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "lib/util/samba_util.h" #include "lib/util/samba_util.h"
#include "lib/util/sys_rw.h"
#include "lib/util/util_process.h" #include "lib/util/util_process.h"
#include "ctdb_private.h" #include "ctdb_private.h"

View File

@ -28,12 +28,12 @@
#include "lib/util/time.h" #include "lib/util/time.h"
#include "lib/util/strv.h" #include "lib/util/strv.h"
#include "lib/util/strv_util.h" #include "lib/util/strv_util.h"
#include "lib/util/sys_rw.h"
#include "lib/util/blocking.h" #include "lib/util/blocking.h"
#include "ctdb_private.h" #include "ctdb_private.h"
#include "common/common.h" #include "common/common.h"
#include "common/logging.h" #include "common/logging.h"
#include "common/system.h"
#include "ctdb_cluster_mutex.h" #include "ctdb_cluster_mutex.h"

View File

@ -25,6 +25,7 @@
#include <talloc.h> #include <talloc.h>
#include "lib/util/blocking.h" #include "lib/util/blocking.h"
#include "lib/util/sys_rw.h"
#include "ctdb_private.h" #include "ctdb_private.h"

View File

@ -28,10 +28,10 @@
#include "lib/util/dlinklist.h" #include "lib/util/dlinklist.h"
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "lib/util/samba_util.h" #include "lib/util/samba_util.h"
#include "lib/util/sys_rw.h"
#include "ctdb_private.h" #include "ctdb_private.h"
#include "common/system.h"
#include "common/common.h" #include "common/common.h"
#include "common/logging.h" #include "common/logging.h"

View File

@ -24,6 +24,8 @@
#include <talloc.h> #include <talloc.h>
#include <tdb.h> #include <tdb.h>
#include "lib/util/sys_rw.h"
#include "protocol/protocol.h" #include "protocol/protocol.h"
#include "common/system.h" #include "common/system.h"

View File

@ -29,12 +29,12 @@
#include "lib/util/dlinklist.h" #include "lib/util/dlinklist.h"
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "lib/util/blocking.h" #include "lib/util/blocking.h"
#include "lib/util/sys_rw.h"
#include "lib/util/time.h" #include "lib/util/time.h"
#include "ctdb_private.h" #include "ctdb_private.h"
#include "ctdb_client.h" #include "ctdb_client.h"
#include "common/system.h"
#include "common/common.h" #include "common/common.h"
#include "common/logging.h" #include "common/logging.h"

View File

@ -25,13 +25,12 @@
#include <talloc.h> #include <talloc.h>
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "lib/util/sys_rw.h"
#include "lib/util/time_basic.h" #include "lib/util/time_basic.h"
#include "ctdb_private.h" #include "ctdb_private.h"
#include "ctdb_client.h" #include "ctdb_client.h"
#include "common/system.h"
#define CTDB_LOG_FILE_PREFIX "file" #define CTDB_LOG_FILE_PREFIX "file"
struct file_state { struct file_state {

View File

@ -21,6 +21,8 @@
#include "system/filesys.h" #include "system/filesys.h"
#include "system/network.h" #include "system/network.h"
#include "lib/util/sys_rw.h"
/* protocol.h is just needed for ctdb_sock_addr, which is used in system.h */ /* protocol.h is just needed for ctdb_sock_addr, which is used in system.h */
#include "protocol/protocol.h" #include "protocol/protocol.h"
#include "common/system.h" #include "common/system.h"

View File

@ -32,6 +32,7 @@
#include "lib/util/dlinklist.h" #include "lib/util/dlinklist.h"
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "lib/util/samba_util.h" #include "lib/util/samba_util.h"
#include "lib/util/sys_rw.h"
#include "lib/util/util_process.h" #include "lib/util/util_process.h"
#include "ctdb_private.h" #include "ctdb_private.h"

View File

@ -27,6 +27,7 @@
#include <libgen.h> #include <libgen.h>
#include "lib/tdb_wrap/tdb_wrap.h" #include "lib/tdb_wrap/tdb_wrap.h"
#include "lib/util/sys_rw.h"
#include "lib/util/time.h" #include "lib/util/time.h"
#include "lib/util/tevent_unix.h" #include "lib/util/tevent_unix.h"
@ -55,20 +56,6 @@ static void LOG(const char *fmt, ...)
* Utility functions * Utility functions
*/ */
static ssize_t sys_write(int fd, const void *buf, size_t count)
{
ssize_t ret;
do {
ret = write(fd, buf, count);
#if defined(EWOULDBLOCK)
} while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
#else
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
#endif
return ret;
}
static bool generic_recv(struct tevent_req *req, int *perr) static bool generic_recv(struct tevent_req *req, int *perr)
{ {
int err; int err;

View File

@ -30,6 +30,7 @@
#include "lib/util/dlinklist.h" #include "lib/util/dlinklist.h"
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "lib/util/samba_util.h" #include "lib/util/samba_util.h"
#include "lib/util/sys_rw.h"
#include "lib/util/util_process.h" #include "lib/util/util_process.h"
#include "ctdb_private.h" #include "ctdb_private.h"

View File

@ -30,6 +30,7 @@
#include "lib/util/dlinklist.h" #include "lib/util/dlinklist.h"
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "lib/util/samba_util.h" #include "lib/util/samba_util.h"
#include "lib/util/sys_rw.h"
#include "lib/util/util_process.h" #include "lib/util/util_process.h"
#include "ctdb_private.h" #include "ctdb_private.h"

View File

@ -28,6 +28,7 @@
#include "lib/tdb_wrap/tdb_wrap.h" #include "lib/tdb_wrap/tdb_wrap.h"
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "lib/util/samba_util.h" #include "lib/util/samba_util.h"
#include "lib/util/sys_rw.h"
#include "lib/util/util_process.h" #include "lib/util/util_process.h"
#include "ctdb_private.h" #include "ctdb_private.h"

View File

@ -31,13 +31,13 @@
#include "lib/util/dlinklist.h" #include "lib/util/dlinklist.h"
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "lib/util/samba_util.h" #include "lib/util/samba_util.h"
#include "lib/util/sys_rw.h"
#include "lib/util/util_process.h" #include "lib/util/util_process.h"
#include "ctdb_private.h" #include "ctdb_private.h"
#include "ctdb_client.h" #include "ctdb_client.h"
#include "common/rb_tree.h" #include "common/rb_tree.h"
#include "common/system.h"
#include "common/common.h" #include "common/common.h"
#include "common/logging.h" #include "common/logging.h"

View File

@ -31,11 +31,11 @@
#include "lib/util/dlinklist.h" #include "lib/util/dlinklist.h"
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "lib/util/samba_util.h" #include "lib/util/samba_util.h"
#include "lib/util/sys_rw.h"
#include "ctdb_private.h" #include "ctdb_private.h"
#include "common/rb_tree.h" #include "common/rb_tree.h"
#include "common/system.h"
#include "common/common.h" #include "common/common.h"
#include "common/logging.h" #include "common/logging.h"

View File

@ -32,6 +32,7 @@
#include "ctdb_version.h" #include "ctdb_version.h"
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "lib/util/samba_util.h" #include "lib/util/samba_util.h"
#include "lib/util/sys_rw.h"
#include "common/db_hash.h" #include "common/db_hash.h"
#include "common/logging.h" #include "common/logging.h"

View File

@ -412,7 +412,8 @@ def build(bld):
ctdb_update_record.c ctdb_update_record.c
ctdb_lock.c ctdb_fork.c'''), ctdb_lock.c ctdb_fork.c'''),
includes='include', includes='include',
deps='ctdb-ipalloc replace popt talloc tevent tdb talloc_report') deps='''ctdb-ipalloc replace sys_rw
popt talloc tevent tdb talloc_report''')
bld.SAMBA_BINARY('ctdbd', bld.SAMBA_BINARY('ctdbd',
source='', source='',
@ -425,7 +426,7 @@ def build(bld):
bld.SAMBA_BINARY('ctdb', bld.SAMBA_BINARY('ctdb',
source='tools/ctdb.c', source='tools/ctdb.c',
deps='''ctdb-client2 ctdb-protocol ctdb-util ctdb-system deps='''ctdb-client2 ctdb-protocol ctdb-util ctdb-system
samba-util popt''', samba-util sys_rw popt''',
install_path='${BINDIR}', install_path='${BINDIR}',
manpages='ctdb.1') manpages='ctdb.1')
@ -444,25 +445,25 @@ def build(bld):
bld.SAMBA_BINARY('ctdb_lock_helper', bld.SAMBA_BINARY('ctdb_lock_helper',
source='server/ctdb_lock_helper.c', source='server/ctdb_lock_helper.c',
deps='samba-util ctdb-system talloc tdb', deps='samba-util sys_rw ctdb-system talloc tdb',
includes='include', includes='include',
install_path='${CTDB_HELPER_BINDIR}') install_path='${CTDB_HELPER_BINDIR}')
bld.SAMBA_BINARY('ctdb_event_helper', bld.SAMBA_BINARY('ctdb_event_helper',
source='server/ctdb_event_helper.c', source='server/ctdb_event_helper.c',
includes='include', includes='include',
deps='samba-util ctdb-system replace tdb', deps='samba-util sys_rw ctdb-system replace tdb',
install_path='${CTDB_HELPER_BINDIR}') install_path='${CTDB_HELPER_BINDIR}')
bld.SAMBA_BINARY('ctdb_recovery_helper', bld.SAMBA_BINARY('ctdb_recovery_helper',
source='server/ctdb_recovery_helper.c', source='server/ctdb_recovery_helper.c',
deps='''ctdb-client2 ctdb-protocol ctdb-util deps='''ctdb-client2 ctdb-protocol ctdb-util
samba-util replace tdb''', samba-util sys_rw replace tdb''',
install_path='${CTDB_HELPER_BINDIR}') install_path='${CTDB_HELPER_BINDIR}')
bld.SAMBA_BINARY('ctdb_mutex_fcntl_helper', bld.SAMBA_BINARY('ctdb_mutex_fcntl_helper',
source='server/ctdb_mutex_fcntl_helper.c', source='server/ctdb_mutex_fcntl_helper.c',
deps='ctdb-system', deps='sys_rw ctdb-system',
includes='include', includes='include',
install_path='${CTDB_HELPER_BINDIR}') install_path='${CTDB_HELPER_BINDIR}')
@ -739,7 +740,7 @@ def build(bld):
bld.SAMBA_BINARY('ibwrapper_test', bld.SAMBA_BINARY('ibwrapper_test',
source='ib/ibwrapper_test.c', source='ib/ibwrapper_test.c',
includes='include', includes='include',
deps='replace talloc ctdb-client ctdb-common' + deps='replace talloc ctdb-client ctdb-common sys_rw' +
ib_deps, ib_deps,
install_path='${CTDB_TEST_LIBEXECDIR}') install_path='${CTDB_TEST_LIBEXECDIR}')