pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
Macros | Functions
util.h File Reference

Utility functions. More...

#include <sys/types.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <limits.h>
#include <signal.h>
#include <glib.h>
#include <crm/common/acl.h>
#include <crm/common/actions.h>
#include <crm/common/agents.h>
#include <crm/common/results.h>
#include <crm/common/scores.h>
#include <crm/common/strings.h>
#include <crm/common/nvpair.h>
#include <crm/common/util_compat.h>
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define pcmk_is_set(g, f)   pcmk_all_flags_set((g), (f))
 Convenience alias for pcmk_all_flags_set(), to check single flag. More...
 

Functions

char * pcmk_promotion_score_name (const char *rsc_id)
 Return the name of the node attribute used as a promotion score. More...
 
int crm_default_remote_port (void)
 Get the default remote connection TCP port on this host. More...
 
int compare_version (const char *version1, const char *version2)
 
void pcmk_common_cleanup (void)
 Free all memory used by libcrmcommon. More...
 
char * crm_md5sum (const char *buffer)
 
char * crm_generate_uuid (void)
 
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...
 

Detailed Description

Utility functions.

Definition in file util.h.

Macro Definition Documentation

◆ pcmk_is_set

#define pcmk_is_set (   g,
 
)    pcmk_all_flags_set((g), (f))

Convenience alias for pcmk_all_flags_set(), to check single flag.

Definition at line 80 of file util.h.

Function Documentation

◆ compare_version()

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

Definition at line 202 of file utils.c.

◆ crm_default_remote_port()

int crm_default_remote_port ( void  )

Get the default remote connection TCP port on this host.

Returns
Remote connection TCP port number

Definition at line 1008 of file remote.c.

◆ crm_generate_uuid()

char* crm_generate_uuid ( void  )

Definition at line 335 of file utils.c.

◆ crm_md5sum()

char* crm_md5sum ( const char *  buffer)

Definition at line 251 of file digest.c.

◆ crm_user_lookup()

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

Definition at line 99 of file utils.c.

◆ pcmk_common_cleanup()

void pcmk_common_cleanup ( void  )

Free all memory used by libcrmcommon.

Free all global memory allocated by the libcrmcommon library. This should be called before exiting a process that uses the library, and the process should not call any libcrmcommon or libxml2 APIs after calling this one.

Definition at line 54 of file utils.c.

◆ pcmk_daemon_user()

int pcmk_daemon_user ( uid_t *  uid,
gid_t *  gid 
)

Get user and group IDs of pacemaker daemon user.

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

Definition at line 139 of file utils.c.

◆ pcmk_promotion_score_name()

char* pcmk_promotion_score_name ( const char *  rsc_id)

Return the name of the node attribute used as a promotion score.

Parameters
[in]rsc_idResource ID that promotion score is for (or NULL to check the OCF_RESOURCE_INSTANCE environment variable)
Returns
Newly allocated string with the node attribute name (or NULL on error, including no ID or environment variable specified)
Note
It is the caller's responsibility to free() the result.

Definition at line 88 of file attrs.c.