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/nvpair.h>
#include <crm/common/util_compat.h>
Go to the source code of this file.
|
#define | pcmk_is_set(g, f) pcmk_all_flags_set((g), (f)) |
| Convenience alias for pcmk_all_flags_set(), to check single flag. More...
|
|
|
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...
|
|
gboolean | crm_is_true (const char *s) |
|
int | crm_str_to_boolean (const char *s, int *ret) |
|
long long | crm_get_msec (const char *input) |
| Parse a time+units string and return milliseconds equivalent. More...
|
|
char * | crm_strdup_printf (char const *format,...) G_GNUC_PRINTF(1 |
|
char int | pcmk_parse_interval_spec (const char *input, guint *result_ms) |
| Parse milliseconds from a Pacemaker interval specification. More...
|
|
int | compare_version (const char *version1, const char *version2) |
|
void | crm_abort (const char *file, const char *function, int line, const char *condition, gboolean do_core, gboolean do_fork) |
|
char * | crm_md5sum (const char *buffer) |
|
char * | crm_generate_uuid (void) |
|
bool | crm_is_daemon_name (const char *name) |
| Check whether string represents a client name used by cluster daemons. More...
|
|
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...
|
|
bool | pcmk_str_is_infinity (const char *s) |
|
bool | pcmk_str_is_minus_infinity (const char *s) |
|
Utility functions.
Definition in file util.h.
◆ pcmk_is_set
#define pcmk_is_set |
( |
|
g, |
|
|
|
f |
|
) |
| pcmk_all_flags_set((g), (f)) |
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition at line 98 of file util.h.
◆ compare_version()
int compare_version |
( |
const char * |
version1, |
|
|
const char * |
version2 |
|
) |
| |
◆ crm_abort()
void crm_abort |
( |
const char * |
file, |
|
|
const char * |
function, |
|
|
int |
line, |
|
|
const char * |
condition, |
|
|
gboolean |
do_core, |
|
|
gboolean |
do_fork |
|
) |
| |
◆ 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 1274 of file remote.c.
◆ crm_generate_uuid()
char* crm_generate_uuid |
( |
void |
| ) |
|
◆ crm_get_msec()
long long crm_get_msec |
( |
const char * |
input | ) |
|
Parse a time+units string and return milliseconds equivalent.
- Parameters
-
[in] | input | String with a nonnegative number and optional unit (optionally with whitespace before and/or after the number). If missing, the unit defaults to seconds. |
- Returns
- Milliseconds corresponding to string expression, or
PCMK__PARSE_INT_DEFAULT
on error
Definition at line 356 of file strings.c.
◆ crm_is_daemon_name()
bool crm_is_daemon_name |
( |
const char * |
name | ) |
|
Check whether string represents a client name used by cluster daemons.
- Parameters
-
- Returns
- true if name is standard client name used by daemons, false otherwise
- Note
- This is provided by the client, and so cannot be used by itself as a secure means of authentication.
Definition at line 1001 of file ipc_server.c.
◆ crm_is_true()
gboolean crm_is_true |
( |
const char * |
s | ) |
|
◆ crm_md5sum()
char* crm_md5sum |
( |
const char * |
buffer | ) |
|
◆ crm_str_to_boolean()
int crm_str_to_boolean |
( |
const char * |
s, |
|
|
int * |
ret |
|
) |
| |
◆ crm_strdup_printf()
char* crm_strdup_printf |
( |
char const * |
format, |
|
|
|
... |
|
) |
| |
◆ crm_user_lookup()
int crm_user_lookup |
( |
const char * |
name, |
|
|
uid_t * |
uid, |
|
|
gid_t * |
gid |
|
) |
| |
◆ pcmk_daemon_user()
int pcmk_daemon_user |
( |
uid_t * |
uid, |
|
|
gid_t * |
gid |
|
) |
| |
Get user and group IDs of pacemaker daemon user.
- Parameters
-
[out] | uid | If non-NULL, where to store daemon user ID |
[out] | gid | If non-NULL, where to store daemon group ID |
- Returns
- pcmk_ok on success, -errno otherwise
Definition at line 125 of file utils.c.
◆ pcmk_parse_interval_spec()
char int pcmk_parse_interval_spec |
( |
const char * |
input, |
|
|
guint * |
result_ms |
|
) |
| |
Parse milliseconds from a Pacemaker interval specification.
- Parameters
-
[in] | input | Pacemaker 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) |
[out] | result_ms | Where to store milliseconds equivalent of input on success (limited to the range of an unsigned integer), or 0 if input is NULL or invalid |
- Returns
- Standard Pacemaker return code (specifically,
pcmk_rc_ok
if input
is valid or NULL
, and EINVAL
otherwise)
Definition at line 451 of file strings.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_id | Resource 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 92 of file attrs.c.
◆ pcmk_str_is_infinity()
bool pcmk_str_is_infinity |
( |
const char * |
s | ) |
|
◆ pcmk_str_is_minus_infinity()
bool pcmk_str_is_minus_infinity |
( |
const char * |
s | ) |
|