corosync
3.0.3
exec
exec/util.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2002-2004 MontaVista Software, Inc.
3
* Copyright (c) 2004 Open Source Development Lab
4
* Copyright (c) 2006-2017 Red Hat, Inc.
5
*
6
* All rights reserved.
7
*
8
* Author: Steven Dake (sdake@redhat.com), Mark Haverkamp (markh@osdl.org)
9
*
10
* This software licensed under BSD license, the text of which follows:
11
*
12
* Redistribution and use in source and binary forms, with or without
13
* modification, are permitted provided that the following conditions are met:
14
*
15
* - Redistributions of source code must retain the above copyright notice,
16
* this list of conditions and the following disclaimer.
17
* - Redistributions in binary form must reproduce the above copyright notice,
18
* this list of conditions and the following disclaimer in the documentation
19
* and/or other materials provided with the distribution.
20
* - Neither the name of the MontaVista Software, Inc. nor the names of its
21
* contributors may be used to endorse or promote products derived from this
22
* software without specific prior written permission.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34
* THE POSSIBILITY OF SUCH DAMAGE.
35
*/
36
#ifndef UTIL_H_DEFINED
37
#define UTIL_H_DEFINED
38
39
#include <sys/time.h>
40
#include <
corosync/corotypes.h
>
41
45
extern
cs_time_t
clust_time_now
(
void
);
46
47
enum
e_corosync_done
{
48
COROSYNC_DONE_EXIT
= 0,
49
COROSYNC_DONE_FORK
= 4,
50
COROSYNC_DONE_LOGCONFIGREAD
= 7,
51
COROSYNC_DONE_MAINCONFIGREAD
= 8,
52
COROSYNC_DONE_LOGSETUP
= 9,
53
COROSYNC_DONE_ICMAP
= 12,
54
COROSYNC_DONE_INIT_SERVICES
= 13,
55
COROSYNC_DONE_FATAL_ERR
= 15,
56
COROSYNC_DONE_DIR_NOT_PRESENT
= 16,
57
COROSYNC_DONE_ACQUIRE_LOCK
= 17,
58
COROSYNC_DONE_ALREADY_RUNNING
= 18,
59
COROSYNC_DONE_STD_TO_NULL_REDIR
= 19,
60
COROSYNC_DONE_SERVICE_ENGINE_INIT
= 20,
61
COROSYNC_DONE_STORE_RINGID
= 21,
62
COROSYNC_DONE_STATS
= 22,
63
COROSYNC_DONE_PLOAD
= 99
64
};
65
66
#define min(a,b) ((a) < (b) ? (a) : (b))
67
71
extern
int
name_match
(
cs_name_t
*name1,
cs_name_t
*name2);
72
#define corosync_exit_error(err) _corosync_exit_error ((err), __FILE__, __LINE__)
73
extern
void
_corosync_exit_error
(
enum
e_corosync_done
err,
const
char
*file,
74
unsigned
int
line)
__attribute__
((noreturn));
75
void
_corosync_out_of_memory_error
(
void
)
__attribute__
((noreturn));
76
extern
char
*
getcs_name_t
(
cs_name_t
*name);
77
extern
void
setcs_name_t
(
cs_name_t
*name,
char
*str);
78
extern
int
cs_name_tisEqual
(
cs_name_t
*str1,
char
*str2);
82
const
char
*
short_service_name_get
(uint32_t service_id,
83
char
*buf,
size_t
buf_size);
84
85
/*
86
* Return state directory (ether icmap system.state_dir or LOCALSTATEDIR/lib/corosync)
87
*/
88
const
char
*
get_state_dir
(
void
);
89
90
#endif
/* UTIL_H_DEFINED */
getcs_name_t
char * getcs_name_t(cs_name_t *name)
Definition:
util.c:140
COROSYNC_DONE_ICMAP
Definition:
exec/util.h:53
COROSYNC_DONE_SERVICE_ENGINE_INIT
Definition:
exec/util.h:60
COROSYNC_DONE_STATS
Definition:
exec/util.h:62
_corosync_exit_error
void _corosync_exit_error(enum e_corosync_done err, const char *file, unsigned int line) __attribute__((noreturn))
Definition:
util.c:126
cs_name_t
The cs_name_t struct.
Definition:
corotypes.h:65
_corosync_out_of_memory_error
void _corosync_out_of_memory_error(void) __attribute__((noreturn))
Definition:
util.c:116
COROSYNC_DONE_INIT_SERVICES
Definition:
exec/util.h:54
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:
util.c:72
COROSYNC_DONE_ALREADY_RUNNING
Definition:
exec/util.h:58
COROSYNC_DONE_FORK
Definition:
exec/util.h:49
__attribute__
typedef __attribute__
COROSYNC_DONE_ACQUIRE_LOCK
Definition:
exec/util.h:57
COROSYNC_DONE_DIR_NOT_PRESENT
Definition:
exec/util.h:56
get_state_dir
const char * get_state_dir(void)
Definition:
util.c:172
COROSYNC_DONE_MAINCONFIGREAD
Definition:
exec/util.h:51
name_match
int name_match(cs_name_t *name1, cs_name_t *name2)
Compare two names.
Definition:
util.c:89
setcs_name_t
void setcs_name_t(cs_name_t *name, char *str)
Definition:
util.c:153
clust_time_now
cs_time_t clust_time_now(void)
Get the time of day and convert to nanoseconds.
Definition:
util.c:101
COROSYNC_DONE_LOGSETUP
Definition:
exec/util.h:52
COROSYNC_DONE_LOGCONFIGREAD
Definition:
exec/util.h:50
COROSYNC_DONE_PLOAD
Definition:
exec/util.h:63
cs_time_t
int64_t cs_time_t
cs_time_t
Definition:
corotypes.h:51
e_corosync_done
e_corosync_done
Definition:
exec/util.h:47
corotypes.h
COROSYNC_DONE_EXIT
Definition:
exec/util.h:48
COROSYNC_DONE_FATAL_ERR
Definition:
exec/util.h:55
COROSYNC_DONE_STD_TO_NULL_REDIR
Definition:
exec/util.h:59
cs_name_tisEqual
int cs_name_tisEqual(cs_name_t *str1, char *str2)
Definition:
util.c:163
COROSYNC_DONE_STORE_RINGID
Definition:
exec/util.h:61
Generated on Sat Jan 4 2020 13:07:31 for corosync by
1.8.16