pacemaker  2.0.5-ba59be712
Scalable High-Availability cluster resource manager
Macros | Functions | Variables
internal.h File Reference
#include <unistd.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <glib.h>
#include <libxml/tree.h>
#include <crm/common/util.h>
#include <crm/common/logging.h>
#include <crm/common/mainloop.h>
#include <crm/common/strings_internal.h>
Include dependency graph for internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define pcmk__config_err(fmt...)
 
#define pcmk__config_warn(fmt...)
 
#define pcmk__log_else(level, else_action)
 
#define PCMK__OP_FMT   "%s_%s_%u"
 
#define PCMK__RC_ERROR   pcmk__rc_error_quark()
 
#define PCMK__EXITC_ERROR   pcmk__exitc_error_quark()
 
#define PCMK__FAIL_COUNT_PREFIX   "fail-count"
 
#define PCMK__LAST_FAILURE_PREFIX   "last-failure"
 

Functions

char * pcmk__uid2username (uid_t uid)
 
const char * pcmk__update_acl_user (xmlNode *request, const char *field, const char *peer_user)
 
bool pcmk__verify_digest (xmlNode *input, const char *expected)
 
int pcmk__real_path (const char *path, char **resolved_path)
 
char * pcmk__series_filename (const char *directory, const char *series, int sequence, bool bzip)
 
int pcmk__read_series_sequence (const char *directory, const char *series, unsigned int *seq)
 
void pcmk__write_series_sequence (const char *directory, const char *series, unsigned int sequence, int max)
 
int pcmk__chown_series_sequence (const char *directory, const char *series, uid_t uid, gid_t gid)
 
int pcmk__build_path (const char *path_c, mode_t mode)
 
bool pcmk__daemon_can_write (const char *dir, const char *file)
 
void pcmk__sync_directory (const char *name)
 
int pcmk__file_contents (const char *filename, char **contents)
 
int pcmk__write_sync (int fd, const char *contents)
 
int pcmk__set_nonblocking (int fd)
 
const char * pcmk__get_tmpdir (void)
 
void pcmk__close_fds_in_child (bool)
 
int pcmk__add_mainloop_ipc (crm_ipc_t *ipc, int priority, void *userdata, struct ipc_client_callbacks *callbacks, mainloop_io_t **source)
 Connect to IPC and add it as a main loop source. More...
 
const char * pcmk__message_name (const char *name)
 Get name to be used as identifier for cluster messages. More...
 
pid_t pcmk__procfs_pid_of (const char *name)
 
unsigned int pcmk__procfs_num_cores (void)
 
void crm_schema_init (void)
 
void crm_schema_cleanup (void)
 
int pcmk__pid_active (pid_t pid, const char *daemon)
 
int pcmk__read_pidfile (const char *filename, pid_t *pid)
 
int pcmk__pidfile_matches (const char *filename, pid_t expected_pid, const char *expected_name, pid_t *pid)
 
int pcmk__lock_pidfile (const char *filename, const char *name)
 
char * pcmk__op_key (const char *rsc_id, const char *op_type, guint interval_ms)
 Generate an operation key (RESOURCE_ACTION_INTERVAL) More...
 
char * pcmk__notify_key (const char *rsc_id, const char *notify_type, const char *op_type)
 
char * pcmk__transition_key (int transition_id, int action_id, int target_rc, const char *node)
 
void pcmk__filter_op_for_digest (xmlNode *param_set)
 
void pcmk__daemonize (const char *name, const char *pidfile)
 
void pcmk__panic (const char *origin)
 
pid_t pcmk__locate_sbd (void)
 
GQuark pcmk__rc_error_quark (void)
 
GQuark pcmk__exitc_error_quark (void)
 
int pcmk__effective_rc (int rc)
 

Variables

int pcmk__score_red
 
int pcmk__score_green
 
int pcmk__score_yellow
 

Macro Definition Documentation

◆ pcmk__config_err

#define pcmk__config_err (   fmt...)
Value:
do { \
pcmk__config_error = true; \
crm_err(fmt); \
} while (0)

Definition at line 107 of file internal.h.

◆ pcmk__config_warn

#define pcmk__config_warn (   fmt...)
Value:
do { \
pcmk__config_warning = true; \
crm_warn(fmt); \
} while (0)

Definition at line 119 of file internal.h.

◆ PCMK__EXITC_ERROR

#define PCMK__EXITC_ERROR   pcmk__exitc_error_quark()

Definition at line 329 of file internal.h.

◆ PCMK__FAIL_COUNT_PREFIX

#define PCMK__FAIL_COUNT_PREFIX   "fail-count"

Definition at line 353 of file internal.h.

◆ PCMK__LAST_FAILURE_PREFIX

#define PCMK__LAST_FAILURE_PREFIX   "last-failure"

Definition at line 354 of file internal.h.

◆ pcmk__log_else

#define pcmk__log_else (   level,
  else_action 
)
Value:
do { \
static struct qb_log_callsite *trace_cs = NULL; \
\
if (trace_cs == NULL) { \
trace_cs = qb_log_callsite_get(__func__, __FILE__, "log_else", \
level, __LINE__, 0); \
} \
if (!crm_is_callsite_active(trace_cs, level, 0)) { \
else_action; \
} \
} while(0)
gboolean crm_is_callsite_active(struct qb_log_callsite *cs, uint8_t level, uint32_t tags)
Definition: logging.c:577

Definition at line 138 of file internal.h.

◆ PCMK__OP_FMT

#define PCMK__OP_FMT   "%s_%s_%u"

Definition at line 204 of file internal.h.

◆ PCMK__RC_ERROR

#define PCMK__RC_ERROR   pcmk__rc_error_quark()

Definition at line 328 of file internal.h.

Function Documentation

◆ crm_schema_cleanup()

void crm_schema_cleanup ( void  )

Definition at line 554 of file schemas.c.

◆ crm_schema_init()

void crm_schema_init ( void  )

Definition at line 379 of file schemas.c.

◆ pcmk__add_mainloop_ipc()

int pcmk__add_mainloop_ipc ( crm_ipc_t ipc,
int  priority,
void *  userdata,
struct ipc_client_callbacks callbacks,
mainloop_io_t **  source 
)

Connect to IPC and add it as a main loop source.

Parameters
[in]ipcIPC connection to add
[in]priorityEvent source priority to use for connection
[in]userdataData to register with callbacks
[in]callbacksDispatch and destroy callbacks for connection
[out]sourceNewly allocated event source
Returns
Standard Pacemaker return code
Note
On failure, the caller is still responsible for ipc. On success, the caller should call mainloop_del_ipc_client() when source is no longer needed, which will lead to the disconnection of the IPC later in the main loop if it is connected. However the IPC disconnects, mainloop_gio_destroy() will free ipc and source after calling the destroy callback.

Definition at line 856 of file mainloop.c.

◆ pcmk__build_path()

int pcmk__build_path ( const char *  path_c,
mode_t  mode 
)

Definition at line 45 of file io.c.

◆ pcmk__chown_series_sequence()

int pcmk__chown_series_sequence ( const char *  directory,
const char *  series,
uid_t  uid,
gid_t  gid 
)

Definition at line 256 of file io.c.

◆ pcmk__close_fds_in_child()

void pcmk__close_fds_in_child ( bool  )

Definition at line 577 of file io.c.

◆ pcmk__daemon_can_write()

bool pcmk__daemon_can_write ( const char *  dir,
const char *  file 
)

Definition at line 346 of file io.c.

◆ pcmk__daemonize()

void pcmk__daemonize ( const char *  name,
const char *  pidfile 
)

Definition at line 410 of file utils.c.

◆ pcmk__effective_rc()

int pcmk__effective_rc ( int  rc)

Definition at line 71 of file agents.c.

◆ pcmk__exitc_error_quark()

GQuark pcmk__exitc_error_quark ( void  )

◆ pcmk__file_contents()

int pcmk__file_contents ( const char *  filename,
char **  contents 
)

Definition at line 450 of file io.c.

◆ pcmk__filter_op_for_digest()

void pcmk__filter_op_for_digest ( xmlNode *  param_set)

Definition at line 371 of file operations.c.

◆ pcmk__get_tmpdir()

const char* pcmk__get_tmpdir ( void  )

Definition at line 559 of file io.c.

◆ pcmk__locate_sbd()

pid_t pcmk__locate_sbd ( void  )

Definition at line 193 of file watchdog.c.

◆ pcmk__lock_pidfile()

int pcmk__lock_pidfile ( const char *  filename,
const char *  name 
)

Definition at line 214 of file pid.c.

◆ pcmk__message_name()

const char* pcmk__message_name ( const char *  name)

Get name to be used as identifier for cluster messages.

Parameters
[in]nameActual system name to check
Returns
Non-NULL cluster message identifier corresponding to name
Note
The Pacemaker daemons were renamed in version 2.0.0, but the old names must continue to be used as the identifier for cluster messages, so that mixed-version clusters are possible during a rolling upgrade.

Definition at line 182 of file messages.c.

◆ pcmk__notify_key()

char* pcmk__notify_key ( const char *  rsc_id,
const char *  notify_type,
const char *  op_type 
)

Definition at line 228 of file operations.c.

◆ pcmk__op_key()

char* pcmk__op_key ( const char *  rsc_id,
const char *  op_type,
guint  interval_ms 
)

Generate an operation key (RESOURCE_ACTION_INTERVAL)

Parameters
[in]rsc_idID of resource being operated on
[in]op_typeOperation name
[in]interval_msOperation interval
Returns
Newly allocated memory containing operation key as string
Note
This function asserts on errors, so it will never return NULL. The caller is responsible for freeing the result with free().

Definition at line 44 of file operations.c.

◆ pcmk__panic()

void pcmk__panic ( const char *  origin)

Definition at line 156 of file watchdog.c.

◆ pcmk__pid_active()

int pcmk__pid_active ( pid_t  pid,
const char *  daemon 
)

Definition at line 23 of file pid.c.

◆ pcmk__pidfile_matches()

int pcmk__pidfile_matches ( const char *  filename,
pid_t  expected_pid,
const char *  expected_name,
pid_t *  pid 
)

Definition at line 172 of file pid.c.

◆ pcmk__procfs_num_cores()

unsigned int pcmk__procfs_num_cores ( void  )

Definition at line 145 of file procfs.c.

◆ pcmk__procfs_pid_of()

pid_t pcmk__procfs_pid_of ( const char *  name)

Definition at line 111 of file procfs.c.

◆ pcmk__rc_error_quark()

GQuark pcmk__rc_error_quark ( void  )

◆ pcmk__read_pidfile()

int pcmk__read_pidfile ( const char *  filename,
pid_t *  pid 
)

Definition at line 118 of file pid.c.

◆ pcmk__read_series_sequence()

int pcmk__read_series_sequence ( const char *  directory,
const char *  series,
unsigned int *  seq 
)

Definition at line 159 of file io.c.

◆ pcmk__real_path()

int pcmk__real_path ( const char *  path,
char **  resolved_path 
)

Definition at line 104 of file io.c.

◆ pcmk__series_filename()

char* pcmk__series_filename ( const char *  directory,
const char *  series,
int  sequence,
bool  bzip 
)

Definition at line 140 of file io.c.

◆ pcmk__set_nonblocking()

int pcmk__set_nonblocking ( int  fd)

Definition at line 536 of file io.c.

◆ pcmk__sync_directory()

void pcmk__sync_directory ( const char *  name)

Definition at line 414 of file io.c.

◆ pcmk__transition_key()

char* pcmk__transition_key ( int  transition_id,
int  action_id,
int  target_rc,
const char *  node 
)

Definition at line 295 of file operations.c.

◆ pcmk__uid2username()

char* pcmk__uid2username ( uid_t  uid)

◆ pcmk__update_acl_user()

const char* pcmk__update_acl_user ( xmlNode *  request,
const char *  field,
const char *  peer_user 
)

◆ pcmk__verify_digest()

bool pcmk__verify_digest ( xmlNode *  input,
const char *  expected 
)

Definition at line 220 of file digest.c.

◆ pcmk__write_series_sequence()

void pcmk__write_series_sequence ( const char *  directory,
const char *  series,
unsigned int  sequence,
int  max 
)

Definition at line 206 of file io.c.

◆ pcmk__write_sync()

int pcmk__write_sync ( int  fd,
const char *  contents 
)

Definition at line 506 of file io.c.

Variable Documentation

◆ pcmk__score_green

int pcmk__score_green

Definition at line 57 of file utils.c.

◆ pcmk__score_red

int pcmk__score_red

Definition at line 56 of file utils.c.

◆ pcmk__score_yellow

int pcmk__score_yellow

Definition at line 58 of file utils.c.