ctdb-common: No need to save previous scheduler priority

When calling sched_setscheduler() with SCHED_OTHER, the only valid
priority is 0.  Nice value is "restored" anyway.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-common: Do not abort if restoring scheduling policy fails

This code is only executed in child processes, so aborting does not
really achieve much.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-common: Changing scheduler policy does not require ctdb context

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-common: Drop ctdb prefix from utility functions independent of ctdb

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-common: Do not dynamically allocate memory when not necessary

Copy these values onto the stack instead.  INET6_ADDRSTRLEN is 46, so
64 is plenty for an IP address and a port number.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-common: No dynamic memory allocation in mkdir_p()

Allocate an array of size PATH_MAX on the stack instead.  To stop
unnecessary recursion, try to create the desired directory before
creating ancestors and only create ancestors on ENOENT.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-common: Separate system utilties that are ctdb independent

Routines in system_common and system_<os> are supposed to be ctdb
functions with OS specific implementations.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-common: Separate more system utilities that are independent of ctdb

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-daemon: No need to block SIGPIPE at startup

Once CTDB is daemonized, it starts ignoring SIGPIPE anyway.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-daemon: Rename block_signal to ignore_signal

This function does not block signals, but ignores them.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-common: Keep debug level related functions with logging code

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-daemon: Instead of passing ctdb context, pass valgrinding boolean

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-daemon: Rename ctdb_lockdown_memory to lockdown_memory

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-common: Move lockdown_memory to system utilities

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-daemon: Rename ctdb_mkdir_p_or_die to mkdir_p_or_die

This function does not require ctdb context.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-common: Move mkdir_p_or_die to system utilities

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-logging: Split ringbuffer handling code from ctdb_collect_log

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-logging: Move controls handling functions from common to server

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-daemon: Remove duplicate code from helper binaries

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