#include "../include/ctdb_private.h"
#include "lib/util/dlinklist.h"
#include "common/reqid.h"
+#include "common/system.h"
/*
allocate a packet for use in client<->daemon communication
#include "../include/ctdb_client.h"
#include "../include/ctdb_private.h"
#include "../common/rb_tree.h"
+#include "common/system.h"
void ctdb_set_child_info(TALLOC_CTX *mem_ctx, const char *child_name_fmt, ...)
{
#include "../include/ctdb_client.h"
#include <stdarg.h>
+#include "common/system.h"
+
#define QUEUE_BUFFER_SIZE (16*1024)
/* structures for packet queueing - see common/ctdb_io.c */
#include "system/wait.h"
#include "../include/ctdb_private.h"
#include "common/reqid.h"
+#include "common/system.h"
/*
return error string for last error
--- /dev/null
+/*
+ System specific code
+
+ Copyright (C) Amitay Isaacs 2015
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __CTDB_SYSTEM_H__
+#define __CTDB_SYSTEM_H__
+
+/* From system_common.c */
+
+uint32_t uint16_checksum(uint16_t *data, size_t n);
+bool ctdb_sys_have_ip(ctdb_sock_addr *_addr);
+char *ctdb_sys_find_ifname(ctdb_sock_addr *addr);
+
+/* From system_<os>.c */
+
+int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface);
+int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
+ const ctdb_sock_addr *src,
+ uint32_t seq, uint32_t ack, int rst);
+int ctdb_sys_open_capture_socket(const char *iface, void **private_data);
+int ctdb_sys_close_capture_socket(void *private_data);
+int ctdb_sys_read_tcp_packet(int s, void *private_data,
+ ctdb_sock_addr *src, ctdb_sock_addr *dst,
+ uint32_t *ack_seq, uint32_t *seq);
+bool ctdb_sys_check_iface_exists(const char *iface);
+int ctdb_get_peer_pid(const int fd, pid_t *peer_pid);
+int ctdb_set_process_name(const char *name);
+
+/* From system_util.c */
+
+bool set_scheduler(void);
+void reset_scheduler(void);
+void set_nonblocking(int fd);
+void set_close_on_exec(int fd);
+
+bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin);
+bool parse_ip(const char *addr, const char *ifaces, unsigned port,
+ ctdb_sock_addr *saddr);
+bool parse_ip_mask(const char *str, const char *ifaces, ctdb_sock_addr *addr,
+ unsigned *mask);
+bool parse_ip_port(const char *addr, ctdb_sock_addr *saddr);
+
+void lockdown_memory(bool valgrinding);
+
+int mkdir_p(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);
+
+#endif /* __CTDB_SYSTEM_H__ */
#include <sys/kinfo.h>
#include <pcap.h>
+#include "common/system.h"
#if 0
#include "ctdb_private.h"
+#include "common/system.h"
+
/*
uint16 checksum for n bytes
*/
#include <net/if_arp.h>
#include <pcap.h>
+#include "common/system.h"
#ifndef ETHERTYPE_IP6
#define ETHERTYPE_IP6 0x86dd
#include <net/if_arp.h>
#include <pcap.h>
+#include "common/system.h"
#ifndef ETHERTYPE_IP6
#define ETHERTYPE_IP6 0x86dd
#include <net/if_arp.h>
#include <pcap.h>
+#include "common/system.h"
#ifndef ETHERTYPE_IP6
#define ETHERTYPE_IP6 0x86dd
#include <netpacket/packet.h>
#include <sys/prctl.h>
+#include "common/system.h"
+
#ifndef ETHERTYPE_IP6
#define ETHERTYPE_IP6 0x86dd
#endif
#include "ctdb_private.h"
+#include "common/system.h"
+
#if HAVE_SCHED_H
#include <sched.h>
#endif
void ctdb_node_dead(struct ctdb_node *node);
void ctdb_node_connected(struct ctdb_node *node);
bool ctdb_blocking_freeze(struct ctdb_context *ctdb);
-bool set_scheduler(void);
-void reset_scheduler(void);
struct tevent_signal *ctdb_init_sigchld(struct ctdb_context *ctdb);
void ctdb_track_child(struct ctdb_context *ctdb, pid_t pid);
TALLOC_CTX *mem_ctx,
const struct ctdb_control_iface_info *info);
-/* from takeover/system.c */
-uint32_t uint16_checksum(uint16_t *data, size_t n);
-int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface);
-bool ctdb_sys_have_ip(ctdb_sock_addr *addr);
-char *ctdb_sys_find_ifname(ctdb_sock_addr *addr);
-bool ctdb_sys_check_iface_exists(const char *iface);
-int ctdb_get_peer_pid(const int fd, pid_t *peer_pid);
-int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
- const ctdb_sock_addr *src,
- uint32_t seq, uint32_t ack, int rst);
-
/* Details of a byte range lock */
struct ctdb_lock_info {
ino_t inode;
bool read_only;
};
-int ctdb_set_process_name(const char *name);
-
typedef void (*client_async_callback)(struct ctdb_context *ctdb, uint32_t node_pnn, int32_t res, TDB_DATA outdata, void *callback_data);
int ctdb_set_public_addresses(struct ctdb_context *ctdb, bool check_addresses);
const char *fmt, ...) PRINTF_ATTRIBUTE(6,7);
void ctdb_release_all_ips(struct ctdb_context *ctdb);
-void set_nonblocking(int fd);
-void set_close_on_exec(int fd);
-
bool ctdb_recovery_have_lock(struct ctdb_context *ctdb);
bool ctdb_recovery_lock(struct ctdb_context *ctdb);
void ctdb_recovery_unlock(struct ctdb_context *ctdb);
uint32_t destnode,
struct ctdb_tunable *tunables);
-bool parse_ip_mask(const char *s, const char *iface, ctdb_sock_addr *addr, unsigned *mask);
-bool parse_ip_port(const char *s, ctdb_sock_addr *addr);
-bool parse_ip(const char *s, const char *iface, unsigned port, ctdb_sock_addr *addr);
-bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin);
-
-
-int ctdb_sys_open_capture_socket(const char *iface, void **private_data);
-int ctdb_sys_close_capture_socket(void *private_data);
-int ctdb_sys_read_tcp_packet(int s, void *private_data, ctdb_sock_addr *src, ctdb_sock_addr *dst, uint32_t *ack_seq, uint32_t *seq);
-
int ctdb_ctrl_killtcp(struct ctdb_context *ctdb,
struct timeval timeout,
uint32_t destnode,
int32_t ctdb_monitoring_mode(struct ctdb_context *ctdb);
bool ctdb_stopped_monitoring(struct ctdb_context *ctdb);
int ctdb_set_child_logging(struct ctdb_context *ctdb);
-void lockdown_memory(bool valgrinding);
struct client_async_data {
enum ctdb_controls opcode;
void (*callback)(void *, bool),
void *private_data);
-int mkdir_p(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);
-
#endif
#include "../include/ctdb_private.h"
#include "../common/rb_tree.h"
#include "common/reqid.h"
+#include "common/system.h"
struct ctdb_sticky_record {
struct ctdb_context *ctdb;
#include "../common/rb_tree.h"
#include <sys/socket.h>
#include "common/reqid.h"
+#include "common/system.h"
struct ctdb_client_pid_list {
struct ctdb_client_pid_list *next, *prev;
#include "includes.h"
#include "system/filesys.h"
#include "ctdb_private.h"
+#include "common/system.h"
static char *progname = NULL;
#include "lib/tdb_wrap/tdb_wrap.h"
#include "system/filesys.h"
#include "lib/util/dlinklist.h"
+#include "common/system.h"
/*
* Non-blocking Locking API
#include "tdb.h"
#include "system/filesys.h"
#include "ctdb_private.h"
+#include "common/system.h"
static char *progname = NULL;
#include "system/filesys.h"
#include "lib/util/debug.h"
#include "lib/util/dlinklist.h"
+#include "common/system.h"
struct ctdb_log_backend {
struct ctdb_log_backend *prev, *next;
#include "system/time.h"
#include "system/filesys.h"
#include "lib/util/time_basic.h"
+#include "common/system.h"
#define CTDB_LOG_FILE_PREFIX "file"
#include "lib/util/dlinklist.h"
#include <ctype.h>
#include "common/reqid.h"
+#include "common/system.h"
#define PERSISTENT_HEALTH_TDB "persistent_health.tdb"
#include "system/filesys.h"
#include "system/wait.h"
#include "../include/ctdb_private.h"
+#include "common/system.h"
struct ctdb_monitor_state {
uint32_t monitoring_mode;
#include "../include/ctdb_private.h"
#include "lib/util/dlinklist.h"
#include "lib/tdb_wrap/tdb_wrap.h"
-
+#include "common/system.h"
int
ctdb_control_getvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata)
#include "../include/ctdb_private.h"
#include "lib/tdb_wrap/tdb_wrap.h"
#include "lib/util/dlinklist.h"
+#include "common/system.h"
/* List of SRVID requests that need to be processed */
#include "../include/ctdb_private.h"
#include "../common/rb_tree.h"
#include "common/reqid.h"
+#include "common/system.h"
#define TAKEOVER_TIMEOUT() timeval_current_ofs(ctdb->tunable.takeover_timeout,0)
#include "../include/ctdb_private.h"
#include "lib/util/dlinklist.h"
#include "common/reqid.h"
+#include "common/system.h"
typedef void (*ctdb_traverse_fn_t)(void *private_data, TDB_DATA key, TDB_DATA data);
#include "lib/tdb_wrap/tdb_wrap.h"
#include "tdb.h"
#include "ctdb_private.h"
+#include "common/system.h"
struct ctdb_persistent_write_state {
struct ctdb_db_context *ctdb_db;
#include "lib/util/dlinklist.h"
#include "../include/ctdb_private.h"
#include "../common/rb_tree.h"
+#include "common/system.h"
#define TIMELIMIT() timeval_current_ofs(10, 0)
#include "cmdline.h"
#include "../include/ctdb_private.h"
#include "common/reqid.h"
+#include "common/system.h"
static struct {
const char *nlist;
#include "../include/ctdb_private.h"
#include "../common/rb_tree.h"
#include "lib/util/dlinklist.h"
+#include "common/system.h"
static void ctdb_event_script_timeout(struct event_context *ev, struct timed_event *te, struct timeval t, void *p);
#include "system/network.h"
#include "system/filesys.h"
#include "../include/ctdb_private.h"
+#include "common/system.h"
#include "ctdb_tcp.h"
/*
#include "system/filesys.h"
#include "popt.h"
#include "cmdline.h"
+#include "common/system.h"
static struct {
const char *socketname;
#include "../common/rb_tree.h"
#include "lib/tdb_wrap/tdb_wrap.h"
#include "lib/util/dlinklist.h"
+#include "common/system.h"
#define ERR_TIMEOUT 20 /* timed out trying to reach node */
#define ERR_NONODE 21 /* node does not exist */
#include "ctdb_private.h"
#include "ctdb_protocol.h"
#include "domain.h"
+#include "common/system.h"
/*
* CTDB PMDA