util.c File Reference
`#include <config.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include <stdlib.h>`
`#include <errno.h>`
`#include <sys/time.h>`
`#include <assert.h>`
`#include <sys/socket.h>`
`#include <libknet.h>`
`#include <corosync/corotypes.h>`
`#include <corosync/corodefs.h>`
`#include <corosync/icmap.h>`
`#include <corosync/logsys.h>`
`#include "util.h"`
Include dependency graph for util.c:

Go to the source code of this file.

## Data Structures

struct | service_names

## Functions

| LOGSYS_DECLARE_SUBSYS ("MAIN")
const char * | short_service_name_get (uint32_t service_id, char *buf, size_t buf_size)
| Get the short name of a service from the service_id.
int | name_match (cs_name_t *name1, cs_name_t *name2)
| Compare two names.
cs_time_t | clust_time_now (void)
| Get the time of day and convert to nanoseconds.
void | _corosync_out_of_memory_error (void)
void | _corosync_exit_error (enum e_corosync_done err, const char *file, unsigned int line) __attribute__((noreturn))
char * | getcs_name_t (cs_name_t *name)
void | setcs_name_t (cs_name_t *name, char *str)
int | cs_name_tisEqual (cs_name_t *str1, char *str2)
const char * | get_state_dir (void)
int | util_is_valid_knet_crypto_model (const char *val, const char **list_str, int machine_parseable_str, const char *error_string_prefix, const char **error_string)
int | util_is_valid_knet_compress_model (const char *val, const char **list_str, int machine_parseable_str, const char *error_string_prefix, const char **error_string)
int | set_socket_dscp (int socket, unsigned char dscp)

## Function Documentation

## _corosync_exit_error()

void _corosync_exit_error | ( | enum e_corosync_done | err,
|  | const char * | file,
|  | unsigned int | line )

Definition at line 129 of file util.c.

References COROSYNC_DONE_EXIT, log_printf, LOGSYS_LEVEL_ERROR, LOGSYS_LEVEL_NOTICE, and logsys_system_fini().

## _corosync_out_of_memory_error()

void _corosync_out_of_memory_error | ( | void |  | ) |

Definition at line 119 of file util.c.

## clust_time_now()

cs_time_t clust_time_now | ( | void |  | ) |

Get the time of day and convert to nanoseconds.

Definition at line 104 of file util.c.

## cs_name_tisEqual()

int cs_name_tisEqual | ( | cs_name_t * | str1,
|  | char * | str2 )

Definition at line 166 of file util.c.

References cs_name_t::length, and cs_name_t::value.

## get_state_dir()

const char * get_state_dir | ( | void |  | ) |

Definition at line 175 of file util.c.

References CS_OK, icmap_get_string(), and LOCALSTATEDIR.

Referenced by main().

## getcs_name_t()

char * getcs_name_t | ( | cs_name_t * | name | ) |

Definition at line 143 of file util.c.

References CS_MAX_NAME_LENGTH, cs_name_t::length, min, and cs_name_t::value.

## LOGSYS_DECLARE_SUBSYS()

LOGSYS_DECLARE_SUBSYS | ( | "MAIN" |  | ) |

## name_match()

int name_match | ( | cs_name_t * | name1,
|  | cs_name_t * | name2 )

Compare two names.

returns non-zero on match.

Definition at line 92 of file util.c.

References cs_name_t::length, and cs_name_t::value.

## set_socket_dscp()

int set_socket_dscp | ( | int | socket,
|  | unsigned char | dscp )

Definition at line 358 of file util.c.

## setcs_name_t()

void setcs_name_t | ( | cs_name_t * | name,
|  | char * | str )

Definition at line 156 of file util.c.

References CS_MAX_NAME_LENGTH, cs_name_t::length, and cs_name_t::value.

## short_service_name_get()

const char * short_service_name_get | ( | uint32_t | service_id,
|  | char * | buf,
|  | size_t | buf_size )

Get the short name of a service from the service_id.

Definition at line 75 of file util.c.

References service_names::c_name, and service_names::c_val.

## util_is_valid_knet_compress_model()

int util_is_valid_knet_compress_model | ( | const char * | val,
|  | const char ** | list_str,
|  | int | machine_parseable_str,
|  | const char * | error_string_prefix,
|  | const char ** | error_string )

Definition at line 291 of file util.c.

## util_is_valid_knet_crypto_model()

int util_is_valid_knet_crypto_model | ( | const char * | val,
|  | const char ** | list_str,
|  | int | machine_parseable_str,
|  | const char * | error_string_prefix,
|  | const char ** | error_string )

Definition at line 225 of file util.c.