pacemaker  2.0.4-2deceaa
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
utils.c File Reference
#include <crm_internal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/utsname.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <pwd.h>
#include <time.h>
#include <libgen.h>
#include <signal.h>
#include <qb/qbdefs.h>
#include <crm/crm.h>
#include <crm/services.h>
#include <crm/msg_xml.h>
#include <crm/cib/internal.h>
#include <crm/common/xml.h>
#include <crm/common/util.h>
#include <crm/common/ipc.h>
#include <crm/common/iso8601.h>
#include <crm/common/mainloop.h>
#include <libxml2/libxml/relaxng.h>
#include <md5.h>
Include dependency graph for utils.c:

Go to the source code of this file.


#define _GNU_SOURCE
#define PW_BUFFER_LEN   500


int char2score (const char *score)
char * score2char_stack (int score, char *buf, size_t len)
char * score2char (int score)
char * generate_hash_key (const char *crm_msg_reference, const char *sys)
int crm_user_lookup (const char *name, uid_t *uid, gid_t *gid)
int pcmk_daemon_user (uid_t *uid, gid_t *gid)
 Get user and group IDs of pacemaker daemon user. More...
int compare_version (const char *version1, const char *version2)
guint crm_parse_interval_spec (const char *input)
 Parse milliseconds from a Pacemaker interval specification. More...
void crm_abort (const char *file, const char *function, int line, const char *assert_condition, gboolean do_core, gboolean do_fork)
void crm_make_daemon (const char *name, gboolean daemonize, const char *pidfile)
char * crm_meta_name (const char *field)
const char * crm_meta_value (GHashTable *hash, const char *field)
char * crm_generate_uuid (void)
const char * pcmk_message_name (const char *name)
 Get name to be used as identifier for cluster messages. More...
bool crm_is_daemon_name (const char *name)
 Check whether a string represents a cluster daemon name. More...
char * crm_md5sum (const char *buffer)
char * pcmk_hostname ()
 Get the local hostname. More...
bool pcmk_str_is_infinity (const char *s)
bool pcmk_str_is_minus_infinity (const char *s)


gboolean crm_config_error = FALSE
gboolean crm_config_warning = FALSE
char * crm_system_name = NULL
int pcmk__score_red = 0
int pcmk__score_green = 0
int pcmk__score_yellow = 0
bool crm_is_daemon

Macro Definition Documentation

#define _GNU_SOURCE

Definition at line 13 of file utils.c.

#define PW_BUFFER_LEN   500

Definition at line 45 of file utils.c.

Function Documentation

int char2score ( const char *  score)

Definition at line 59 of file utils.c.

int compare_version ( const char *  version1,
const char *  version2 

Definition at line 227 of file utils.c.

void crm_abort ( const char *  file,
const char *  function,
int  line,
const char *  assert_condition,
gboolean  do_core,
gboolean  do_fork 

Definition at line 341 of file utils.c.

char* crm_generate_uuid ( void  )

Definition at line 495 of file utils.c.

bool crm_is_daemon_name ( const char *  name)

Check whether a string represents a cluster daemon name.

[in]nameString to check
TRUE if name is standard client name used by daemons, FALSE otherwise

Definition at line 553 of file utils.c.

void crm_make_daemon ( const char *  name,
gboolean  daemonize,
const char *  pidfile 

Definition at line 403 of file utils.c.

char* crm_md5sum ( const char *  buffer)

Definition at line 570 of file utils.c.

char* crm_meta_name ( const char *  field)

Definition at line 454 of file utils.c.

const char* crm_meta_value ( GHashTable *  hash,
const char *  field 

Definition at line 476 of file utils.c.

guint crm_parse_interval_spec ( const char *  input)

Parse milliseconds from a Pacemaker interval specification.

[in]inputPacemaker time interval specification (a bare number of seconds, a number with a unit optionally with whitespace before and/or after the number, or an ISO 8601 duration)
Milliseconds equivalent of given specification on success (limited to the range of an unsigned integer), 0 if input is NULL, or 0 (and set errno to EINVAL) on error

Definition at line 309 of file utils.c.

int crm_user_lookup ( const char *  name,
uid_t *  uid,
gid_t *  gid 

Definition at line 131 of file utils.c.

char* generate_hash_key ( const char *  crm_msg_reference,
const char *  sys 

Definition at line 120 of file utils.c.

int pcmk_daemon_user ( uid_t *  uid,
gid_t *  gid 

Get user and group IDs of pacemaker daemon user.

[out]uidIf non-NULL, where to store daemon user ID
[out]gidIf non-NULL, where to store daemon group ID
pcmk_ok on success, -errno otherwise

Definition at line 171 of file utils.c.

char* pcmk_hostname ( void  )

Get the local hostname.

Newly allocated string with name, or NULL (and set errno) on error

Definition at line 612 of file utils.c.

const char* pcmk_message_name ( const char *  name)

Get name to be used as identifier for cluster messages.

[in]nameActual system name to check
Non-NULL cluster message identifier corresponding to name
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 517 of file utils.c.

bool pcmk_str_is_infinity ( const char *  s)

Definition at line 620 of file utils.c.

bool pcmk_str_is_minus_infinity ( const char *  s)

Definition at line 625 of file utils.c.

char* score2char ( int  score)

Definition at line 108 of file utils.c.

char* score2char_stack ( int  score,
char *  buf,
size_t  len 

Definition at line 94 of file utils.c.

Variable Documentation

gboolean crm_config_error = FALSE

Definition at line 50 of file utils.c.

gboolean crm_config_warning = FALSE

Definition at line 51 of file utils.c.

bool crm_is_daemon

Definition at line 40 of file logging.c.

char* crm_system_name = NULL

Definition at line 52 of file utils.c.

int pcmk__score_green = 0

Definition at line 55 of file utils.c.

int pcmk__score_red = 0

Definition at line 54 of file utils.c.

int pcmk__score_yellow = 0

Definition at line 56 of file utils.c.