corosync  3.1.0
main.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2006 MontaVista Software, Inc.
3  * Copyright (c) 2006-2018 Red Hat, Inc.
4  *
5  * All rights reserved.
6  *
7  * Author: Steven Dake (sdake@redhat.com)
8  *
9  * This software licensed under BSD license, the text of which follows:
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  *
14  * - Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  * - Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  * - Neither the name of the MontaVista Software, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived from this
21  * software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
33  * THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
72 #include <config.h>
73 
74 #include <pthread.h>
75 #include <assert.h>
76 #include <sys/types.h>
77 #include <sys/file.h>
78 #include <sys/poll.h>
79 #include <sys/uio.h>
80 #include <sys/mman.h>
81 #include <sys/socket.h>
82 #include <sys/un.h>
83 #include <sys/time.h>
84 #include <sys/resource.h>
85 #include <sys/stat.h>
86 #include <netinet/in.h>
87 #include <arpa/inet.h>
88 #include <unistd.h>
89 #include <fcntl.h>
90 #include <stdlib.h>
91 #include <stdio.h>
92 #include <errno.h>
93 #include <signal.h>
94 #include <sched.h>
95 #include <time.h>
96 #include <semaphore.h>
97 #include <string.h>
98 
99 #ifdef HAVE_LIBSYSTEMD
100 #include <systemd/sd-daemon.h>
101 #endif
102 
103 #include <qb/qbdefs.h>
104 #include <qb/qblog.h>
105 #include <qb/qbloop.h>
106 #include <qb/qbutil.h>
107 #include <qb/qbipcs.h>
108 
109 #include <corosync/swab.h>
110 #include <corosync/corotypes.h>
111 #include <corosync/corodefs.h>
112 #include <corosync/totem/totempg.h>
113 #include <corosync/logsys.h>
114 #include <corosync/icmap.h>
115 
116 #include "quorum.h"
117 #include "totemsrp.h"
118 #include "logconfig.h"
119 #include "totemconfig.h"
120 #include "main.h"
121 #include "sync.h"
122 #include "timer.h"
123 #include "util.h"
124 #include "apidef.h"
125 #include "service.h"
126 #include "schedwrk.h"
127 #include "ipcs_stats.h"
128 #include "stats.h"
129 
130 #ifdef HAVE_SMALL_MEMORY_FOOTPRINT
131 #define IPC_LOGSYS_SIZE 1024*64
132 #else
133 #define IPC_LOGSYS_SIZE 8192*128
134 #endif
135 
136 /*
137  * LibQB adds default "*" syslog filter so we have to set syslog_priority as low
138  * as possible so filters applied later in _logsys_config_apply_per_file takes
139  * effect.
140  */
143  LOG_DAEMON,
144  LOG_EMERG);
145 
147 
148 #define SERVER_BACKLOG 5
149 
150 static int sched_priority = 0;
151 
152 static unsigned int service_count = 32;
153 
155 
156 static struct corosync_api_v1 *api = NULL;
157 
158 static int sync_in_process = 1;
159 
160 static qb_loop_t *corosync_poll_handle;
161 
162 struct sched_param global_sched_param;
163 
164 static corosync_timer_handle_t corosync_stats_timer_handle;
165 
166 static const char *corosync_lock_file = LOCALSTATEDIR"/run/corosync.pid";
167 
168 static char corosync_config_file[PATH_MAX + 1] = COROSYSCONFDIR "/corosync.conf";
169 
170 qb_loop_t *cs_poll_handle_get (void)
171 {
172  return (corosync_poll_handle);
173 }
174 
175 int cs_poll_dispatch_add (qb_loop_t * handle,
176  int fd,
177  int events,
178  void *data,
179 
180  int (*dispatch_fn) (int fd,
181  int revents,
182  void *data))
183 {
184  return qb_loop_poll_add(handle, QB_LOOP_MED, fd, events, data,
185  dispatch_fn);
186 }
187 
188 int cs_poll_dispatch_delete(qb_loop_t * handle, int fd)
189 {
190  return qb_loop_poll_del(handle, fd);
191 }
192 
194 {
195  int i;
196 
197  for (i = 0; i < SERVICES_COUNT_MAX; i++) {
198  if (corosync_service[i] && corosync_service[i]->exec_dump_fn) {
200  }
201  }
202 }
203 
204 const char *corosync_get_config_file(void)
205 {
206 
207  return (corosync_config_file);
208 }
209 
210 static void corosync_blackbox_write_to_file (void)
211 {
212  char fname[PATH_MAX];
213  char fdata_fname[PATH_MAX];
214  char time_str[PATH_MAX];
215  struct tm cur_time_tm;
216  time_t cur_time_t;
217  ssize_t res;
218 
219  cur_time_t = time(NULL);
220  localtime_r(&cur_time_t, &cur_time_tm);
221 
222  strftime(time_str, PATH_MAX, "%Y-%m-%dT%H:%M:%S", &cur_time_tm);
223  if (snprintf(fname, PATH_MAX, "%s/fdata-%s-%lld",
224  get_state_dir(),
225  time_str,
226  (long long int)getpid()) >= PATH_MAX) {
227  log_printf(LOGSYS_LEVEL_ERROR, "Can't snprintf blackbox file name");
228  return ;
229  }
230 
231  if ((res = qb_log_blackbox_write_to_file(fname)) < 0) {
232  LOGSYS_PERROR(-res, LOGSYS_LEVEL_ERROR, "Can't store blackbox file");
233  return ;
234  }
235  snprintf(fdata_fname, sizeof(fdata_fname), "%s/fdata", get_state_dir());
236  unlink(fdata_fname);
237  if (symlink(fname, fdata_fname) == -1) {
238  log_printf(LOGSYS_LEVEL_ERROR, "Can't create symlink to '%s' for corosync blackbox file '%s'",
239  fname, fdata_fname);
240  }
241 }
242 
243 static void unlink_all_completed (void)
244 {
245  api->timer_delete (corosync_stats_timer_handle);
246  qb_loop_stop (corosync_poll_handle);
247  icmap_fini();
248 }
249 
251 {
252  corosync_service_unlink_all (api, unlink_all_completed);
253 }
254 
255 static int32_t sig_diag_handler (int num, void *data)
256 {
258  return 0;
259 }
260 
261 static int32_t sig_exit_handler (int num, void *data)
262 {
263  log_printf(LOGSYS_LEVEL_NOTICE, "Node was shut down by a signal");
264  corosync_service_unlink_all (api, unlink_all_completed);
265  return 0;
266 }
267 
268 static void sigsegv_handler (int num)
269 {
270  (void)signal (num, SIG_DFL);
271  corosync_blackbox_write_to_file ();
272  qb_log_fini();
273  raise (num);
274 }
275 
276 #define LOCALHOST_IP inet_addr("127.0.0.1")
277 
278 static void *corosync_group_handle;
279 
280 static struct totempg_group corosync_group = {
281  .group = "a",
282  .group_len = 1
283 };
284 
285 static void serialize_lock (void)
286 {
287 }
288 
289 static void serialize_unlock (void)
290 {
291 }
292 
293 static void corosync_sync_completed (void)
294 {
296  "Completed service synchronization, ready to provide service.");
297  sync_in_process = 0;
298 
299  cs_ipcs_sync_state_changed(sync_in_process);
301  /*
302  * Inform totem to start using new message queue again
303  */
305 
306 #ifdef HAVE_LIBSYSTEMD
307  sd_notify (0, "READY=1");
308 #endif
309 }
310 
311 static int corosync_sync_callbacks_retrieve (
312  int service_id,
313  struct sync_callbacks *callbacks)
314 {
315  if (corosync_service[service_id] == NULL) {
316  return (-1);
317  }
318 
319  if (callbacks == NULL) {
320  return (0);
321  }
322 
323  callbacks->name = corosync_service[service_id]->name;
324 
325  callbacks->sync_init = corosync_service[service_id]->sync_init;
326  callbacks->sync_process = corosync_service[service_id]->sync_process;
327  callbacks->sync_activate = corosync_service[service_id]->sync_activate;
328  callbacks->sync_abort = corosync_service[service_id]->sync_abort;
329  return (0);
330 }
331 
332 static struct memb_ring_id corosync_ring_id;
333 
334 static void member_object_joined (unsigned int nodeid)
335 {
336  char member_ip[ICMAP_KEYNAME_MAXLEN];
337  char member_join_count[ICMAP_KEYNAME_MAXLEN];
338  char member_status[ICMAP_KEYNAME_MAXLEN];
339 
340  snprintf(member_ip, ICMAP_KEYNAME_MAXLEN,
341  "runtime.members.%u.ip", nodeid);
342  snprintf(member_join_count, ICMAP_KEYNAME_MAXLEN,
343  "runtime.members.%u.join_count", nodeid);
344  snprintf(member_status, ICMAP_KEYNAME_MAXLEN,
345  "runtime.members.%u.status", nodeid);
346 
347  if (icmap_get(member_ip, NULL, NULL, NULL) == CS_OK) {
348  icmap_inc(member_join_count);
349  icmap_set_string(member_status, "joined");
350  } else {
351  icmap_set_string(member_ip, (char*)api->totem_ifaces_print (nodeid));
352  icmap_set_uint32(member_join_count, 1);
353  icmap_set_string(member_status, "joined");
354  }
355 
357  "Member joined: %s", api->totem_ifaces_print (nodeid));
358 }
359 
360 static void member_object_left (unsigned int nodeid)
361 {
362  char member_status[ICMAP_KEYNAME_MAXLEN];
363 
364  snprintf(member_status, ICMAP_KEYNAME_MAXLEN,
365  "runtime.members.%u.status", nodeid);
366  icmap_set_string(member_status, "left");
367 
369  "Member left: %s", api->totem_ifaces_print (nodeid));
370 }
371 
372 static void confchg_fn (
373  enum totem_configuration_type configuration_type,
374  const unsigned int *member_list, size_t member_list_entries,
375  const unsigned int *left_list, size_t left_list_entries,
376  const unsigned int *joined_list, size_t joined_list_entries,
377  const struct memb_ring_id *ring_id)
378 {
379  int i;
380  int abort_activate = 0;
381 
382  if (sync_in_process == 1) {
383  abort_activate = 1;
384  }
385  sync_in_process = 1;
386  cs_ipcs_sync_state_changed(sync_in_process);
387  memcpy (&corosync_ring_id, ring_id, sizeof (struct memb_ring_id));
388 
389  for (i = 0; i < left_list_entries; i++) {
390  member_object_left (left_list[i]);
391  }
392  for (i = 0; i < joined_list_entries; i++) {
393  member_object_joined (joined_list[i]);
394  }
395  /*
396  * Call configuration change for all services
397  */
398  for (i = 0; i < service_count; i++) {
399  if (corosync_service[i] && corosync_service[i]->confchg_fn) {
400  corosync_service[i]->confchg_fn (configuration_type,
401  member_list, member_list_entries,
402  left_list, left_list_entries,
403  joined_list, joined_list_entries, ring_id);
404  }
405  }
406 
407  if (abort_activate) {
408  sync_abort ();
409  }
410  if (configuration_type == TOTEM_CONFIGURATION_TRANSITIONAL) {
411  sync_save_transitional (member_list, member_list_entries, ring_id);
412  }
413  if (configuration_type == TOTEM_CONFIGURATION_REGULAR) {
414  sync_start (member_list, member_list_entries, ring_id);
415  }
416 }
417 
418 static void priv_drop (void)
419 {
420  return; /* TODO: we are still not dropping privs */
421 }
422 
423 static void corosync_tty_detach (void)
424 {
425  int devnull;
426 
427  /*
428  * Disconnect from TTY if this is not a debug run
429  */
430 
431  switch (fork ()) {
432  case -1:
434  break;
435  case 0:
436  /*
437  * child which is disconnected, run this process
438  */
439  break;
440  default:
441  exit (0);
442  break;
443  }
444 
445  /* Create new session */
446  (void)setsid();
447 
448  /*
449  * Map stdin/out/err to /dev/null.
450  */
451  devnull = open("/dev/null", O_RDWR);
452  if (devnull == -1) {
454  }
455 
456  if (dup2(devnull, 0) < 0 || dup2(devnull, 1) < 0
457  || dup2(devnull, 2) < 0) {
458  close(devnull);
460  }
461  close(devnull);
462 }
463 
464 static void corosync_mlockall (void)
465 {
466  int res;
467  struct rlimit rlimit;
468 
469  rlimit.rlim_cur = RLIM_INFINITY;
470  rlimit.rlim_max = RLIM_INFINITY;
471 
472 #ifndef RLIMIT_MEMLOCK
473 #define RLIMIT_MEMLOCK RLIMIT_VMEM
474 #endif
475 
476  setrlimit (RLIMIT_MEMLOCK, &rlimit);
477 
478  res = mlockall (MCL_CURRENT | MCL_FUTURE);
479  if (res == -1) {
481  "Could not lock memory of service to avoid page faults");
482  };
483 }
484 
485 
486 static void corosync_totem_stats_updater (void *data)
487 {
488  totempg_stats_t * stats;
489  uint32_t total_mtt_rx_token;
490  uint32_t total_backlog_calc;
491  uint32_t total_token_holdtime;
492  int t, prev;
493  int32_t token_count;
494  const char *cstr;
495 
496  stats = api->totem_get_stats();
497 
498 
500 
501  if (stats->srp->continuous_gather > MAX_NO_CONT_GATHER ||
503  cstr = "";
504 
506  cstr = "number of multicast sendmsg failures is above threshold";
507  }
508 
509  if (stats->srp->continuous_gather > MAX_NO_CONT_GATHER) {
510  cstr = "totem is continuously in gather state";
511  }
512 
514  "Totem is unable to form a cluster because of an "
515  "operating system or network fault (reason: %s). The most common "
516  "cause of this message is that the local firewall is "
517  "configured improperly.", cstr);
519  } else {
521  }
522 
523  total_mtt_rx_token = 0;
524  total_token_holdtime = 0;
525  total_backlog_calc = 0;
526  token_count = 0;
527  t = stats->srp->latest_token;
528  while (1) {
529  if (t == 0)
530  prev = TOTEM_TOKEN_STATS_MAX - 1;
531  else
532  prev = t - 1;
533  if (prev == stats->srp->earliest_token)
534  break;
535  /* if tx == 0, then dropped token (not ours) */
536  if (stats->srp->token[t].tx != 0 ||
537  (stats->srp->token[t].rx - stats->srp->token[prev].rx) > 0 ) {
538  total_mtt_rx_token += (stats->srp->token[t].rx - stats->srp->token[prev].rx);
539  total_token_holdtime += (stats->srp->token[t].tx - stats->srp->token[t].rx);
540  total_backlog_calc += stats->srp->token[t].backlog_calc;
541  token_count++;
542  }
543  t = prev;
544  }
545  if (token_count) {
546  stats->srp->mtt_rx_token = (total_mtt_rx_token / token_count);
547  stats->srp->avg_token_workload = (total_token_holdtime / token_count);
548  stats->srp->avg_backlog_calc = (total_backlog_calc / token_count);
549  }
550 
551  stats->srp->time_since_token_last_received = qb_util_nano_current_get () / QB_TIME_NS_IN_MSEC -
552  stats->srp->token[stats->srp->latest_token].rx;
553 
555 
556  api->timer_add_duration (1500 * MILLI_2_NANO_SECONDS, NULL,
557  corosync_totem_stats_updater,
558  &corosync_stats_timer_handle);
559 }
560 
561 static void corosync_totem_stats_init (void)
562 {
563  /* start stats timer */
564  api->timer_add_duration (1500 * MILLI_2_NANO_SECONDS, NULL,
565  corosync_totem_stats_updater,
566  &corosync_stats_timer_handle);
567 }
568 
569 static void deliver_fn (
570  unsigned int nodeid,
571  const void *msg,
572  unsigned int msg_len,
573  int endian_conversion_required)
574 {
575  const struct qb_ipc_request_header *header;
576  int32_t service;
577  int32_t fn_id;
578  uint32_t id;
579 
580  header = msg;
581  if (endian_conversion_required) {
582  id = swab32 (header->id);
583  } else {
584  id = header->id;
585  }
586 
587  /*
588  * Call the proper executive handler
589  */
590  service = id >> 16;
591  fn_id = id & 0xffff;
592 
593  if (!corosync_service[service]) {
594  return;
595  }
596  if (fn_id >= corosync_service[service]->exec_engine_count) {
597  log_printf(LOGSYS_LEVEL_WARNING, "discarded unknown message %d for service %d (max id %d)",
598  fn_id, service, corosync_service[service]->exec_engine_count);
599  return;
600  }
601 
602  icmap_fast_inc(service_stats_rx[service][fn_id]);
603 
604  if (endian_conversion_required) {
605  assert(corosync_service[service]->exec_engine[fn_id].exec_endian_convert_fn != NULL);
607  ((void *)msg);
608  }
609 
611  (msg, nodeid);
612 }
613 
615  const struct iovec *iovec,
616  unsigned int iov_len,
617  unsigned int guarantee)
618 {
619  const struct qb_ipc_request_header *req = iovec->iov_base;
620  int32_t service;
621  int32_t fn_id;
622 
623  service = req->id >> 16;
624  fn_id = req->id & 0xffff;
625 
626  if (corosync_service[service]) {
627  icmap_fast_inc(service_stats_tx[service][fn_id]);
628  }
629 
630  return (totempg_groups_mcast_joined (corosync_group_handle, iovec, iov_len, guarantee));
631 }
632 
633 static void corosync_ring_id_create_or_load (
634  struct memb_ring_id *memb_ring_id,
635  unsigned int nodeid)
636 {
637  int fd;
638  int res = 0;
639  char filename[PATH_MAX];
640 
641  snprintf (filename, sizeof(filename), "%s/ringid_%u",
642  get_state_dir(), nodeid);
643  fd = open (filename, O_RDONLY, 0700);
644  /*
645  * If file can be opened and read, read the ring id
646  */
647  if (fd != -1) {
648  res = read (fd, &memb_ring_id->seq, sizeof (uint64_t));
649  close (fd);
650  }
651  /*
652  * If file could not be opened or read, create a new ring id
653  */
654  if ((fd == -1) || (res != sizeof (uint64_t))) {
655  memb_ring_id->seq = 0;
656  umask(0);
657  fd = open (filename, O_CREAT|O_RDWR, 0700);
658  if (fd != -1) {
659  res = write (fd, &memb_ring_id->seq, sizeof (uint64_t));
660  close (fd);
661  if (res == -1) {
663  "Couldn't write ringid file '%s'", filename);
664 
666  }
667  } else {
669  "Couldn't create ringid file '%s'", filename);
670 
672  }
673  }
674 
676 }
677 
678 static void corosync_ring_id_store (
679  const struct memb_ring_id *memb_ring_id,
680  unsigned int nodeid)
681 {
682  char filename[PATH_MAX];
683  int fd;
684  int res;
685 
686  snprintf (filename, sizeof(filename), "%s/ringid_%u",
687  get_state_dir(), nodeid);
688 
689  fd = open (filename, O_WRONLY, 0700);
690  if (fd == -1) {
691  fd = open (filename, O_CREAT|O_RDWR, 0700);
692  }
693  if (fd == -1) {
695  "Couldn't store new ring id " CS_PRI_RING_ID_SEQ " to stable storage",
696  memb_ring_id->seq);
697 
699  }
701  "Storing new sequence id for ring " CS_PRI_RING_ID_SEQ, memb_ring_id->seq);
702  res = write (fd, &memb_ring_id->seq, sizeof(memb_ring_id->seq));
703  close (fd);
704  if (res != sizeof(memb_ring_id->seq)) {
706  "Couldn't store new ring id " CS_PRI_RING_ID_SEQ " to stable storage",
707  memb_ring_id->seq);
708 
710  }
711 }
712 
713 static qb_loop_timer_handle recheck_the_q_level_timer;
715 {
716  totempg_check_q_level(corosync_group_handle);
718  qb_loop_timer_add(cs_poll_handle_get(), QB_LOOP_MED, 1*QB_TIME_NS_IN_MSEC,
719  NULL, corosync_recheck_the_q_level, &recheck_the_q_level_timer);
720  }
721 }
722 
725 };
726 
727 
729  unsigned int service,
730  unsigned int id,
731  const void *msg,
732  void *sending_allowed_private_data)
733 {
735  (struct sending_allowed_private_data_struct *)sending_allowed_private_data;
736  struct iovec reserve_iovec;
737  struct qb_ipc_request_header *header = (struct qb_ipc_request_header *)msg;
738  int sending_allowed;
739 
740  reserve_iovec.iov_base = (char *)header;
741  reserve_iovec.iov_len = header->size;
742 
744  corosync_group_handle,
745  &reserve_iovec, 1);
746  if (pd->reserved_msgs == -1) {
747  return -EINVAL;
748  }
749 
750  /* Message ID out of range */
751  if (id >= corosync_service[service]->lib_engine_count) {
752  return -EINVAL;
753  }
754 
755  sending_allowed = QB_FALSE;
756  if (corosync_quorum_is_quorate() == 1 ||
757  corosync_service[service]->allow_inquorate == CS_LIB_ALLOW_INQUORATE) {
758  // we are quorate
759  // now check flow control
760  if (corosync_service[service]->lib_engine[id].flow_control == CS_LIB_FLOW_CONTROL_NOT_REQUIRED) {
761  sending_allowed = QB_TRUE;
762  } else if (pd->reserved_msgs && sync_in_process == 0) {
763  sending_allowed = QB_TRUE;
764  } else if (pd->reserved_msgs == 0) {
765  return -ENOBUFS;
766  } else /* (sync_in_process) */ {
767  return -EINPROGRESS;
768  }
769  } else {
770  return -EHOSTUNREACH;
771  }
772 
773  return (sending_allowed);
774 }
775 
776 void corosync_sending_allowed_release (void *sending_allowed_private_data)
777 {
779  (struct sending_allowed_private_data_struct *)sending_allowed_private_data;
780 
781  if (pd->reserved_msgs == -1) {
782  return;
783  }
785 }
786 
788 {
789  int ret = 0;
790 
791  assert (source != NULL);
792  if (source->nodeid == totempg_my_nodeid_get ()) {
793  ret = 1;
794  }
795  return ret;
796 }
797 
799  mar_message_source_t *source,
800  void *conn)
801 {
802  assert ((source != NULL) && (conn != NULL));
803  memset (source, 0, sizeof (mar_message_source_t));
804  source->nodeid = totempg_my_nodeid_get ();
805  source->conn = conn;
806 }
807 
810  qb_loop_timer_handle handle;
811  unsigned long long tv_prev;
812  unsigned long long max_tv_diff;
813 };
814 
815 static void timer_function_scheduler_timeout (void *data)
816 {
817  struct scheduler_pause_timeout_data *timeout_data = (struct scheduler_pause_timeout_data *)data;
818  unsigned long long tv_current;
819  unsigned long long tv_diff;
820  uint64_t schedmiss_event_tstamp;
821 
822  tv_current = qb_util_nano_current_get ();
823 
824  if (timeout_data->tv_prev == 0) {
825  /*
826  * Initial call -> just pretent everything is ok
827  */
828  timeout_data->tv_prev = tv_current;
829  timeout_data->max_tv_diff = 0;
830  }
831 
832  tv_diff = tv_current - timeout_data->tv_prev;
833  timeout_data->tv_prev = tv_current;
834 
835  if (tv_diff > timeout_data->max_tv_diff) {
836  schedmiss_event_tstamp = qb_util_nano_from_epoch_get() / QB_TIME_NS_IN_MSEC;
837 
838  log_printf (LOGSYS_LEVEL_WARNING, "Corosync main process was not scheduled (@%" PRIu64 ") for %0.4f ms "
839  "(threshold is %0.4f ms). Consider token timeout increase.",
840  schedmiss_event_tstamp,
841  (float)tv_diff / QB_TIME_NS_IN_MSEC, (float)timeout_data->max_tv_diff / QB_TIME_NS_IN_MSEC);
842 
843  stats_add_schedmiss_event(schedmiss_event_tstamp, (float)tv_diff / QB_TIME_NS_IN_MSEC);
844  }
845 
846  /*
847  * Set next threshold, because token_timeout can change
848  */
849  timeout_data->max_tv_diff = timeout_data->totem_config->token_timeout * QB_TIME_NS_IN_MSEC * 0.8;
850  qb_loop_timer_add (corosync_poll_handle,
851  QB_LOOP_MED,
852  timeout_data->totem_config->token_timeout * QB_TIME_NS_IN_MSEC / 3,
853  timeout_data,
854  timer_function_scheduler_timeout,
855  &timeout_data->handle);
856 }
857 
858 
859 static int corosync_set_rr_scheduler (void)
860 {
861  int ret_val = 0;
862 
863 #if defined(HAVE_PTHREAD_SETSCHEDPARAM) && defined(HAVE_SCHED_GET_PRIORITY_MAX) && defined(HAVE_SCHED_SETSCHEDULER)
864  int res;
865 
866  sched_priority = sched_get_priority_max (SCHED_RR);
867  if (sched_priority != -1) {
868  global_sched_param.sched_priority = sched_priority;
869  res = sched_setscheduler (0, SCHED_RR, &global_sched_param);
870  if (res == -1) {
872  "Could not set SCHED_RR at priority %d",
873  global_sched_param.sched_priority);
874 
875  global_sched_param.sched_priority = 0;
876 #ifdef HAVE_QB_LOG_THREAD_PRIORITY_SET
877  qb_log_thread_priority_set (SCHED_OTHER, 0);
878 #endif
879  ret_val = -1;
880  } else {
881 
882  /*
883  * Turn on SCHED_RR in logsys system
884  */
885 #ifdef HAVE_QB_LOG_THREAD_PRIORITY_SET
886  res = qb_log_thread_priority_set (SCHED_RR, sched_priority);
887 #else
888  res = -1;
889 #endif
890  if (res == -1) {
892  "Could not set logsys thread priority."
893  " Can't continue because of priority inversions.");
895  }
896  }
897  } else {
899  "Could not get maximum scheduler priority");
900  sched_priority = 0;
901  ret_val = -1;
902  }
903 #else
905  "The Platform is missing process priority setting features. Leaving at default.");
906  ret_val = -1;
907 #endif
908 
909  return (ret_val);
910 }
911 
912 
913 /* The basename man page contains scary warnings about
914  thread-safety and portability, hence this */
915 static const char *corosync_basename(const char *file_name)
916 {
917  char *base;
918  base = strrchr (file_name, '/');
919  if (base) {
920  return base + 1;
921  }
922 
923  return file_name;
924 }
925 
926 static void
927 _logsys_log_printf(int level, int subsys,
928  const char *function_name,
929  const char *file_name,
930  int file_line,
931  const char *format,
932  ...) __attribute__((format(printf, 6, 7)));
933 
934 static void
935 _logsys_log_printf(int level, int subsys,
936  const char *function_name,
937  const char *file_name,
938  int file_line,
939  const char *format, ...)
940 {
941  va_list ap;
942 
943  va_start(ap, format);
944  qb_log_from_external_source_va(function_name, corosync_basename(file_name),
945  format, level, file_line,
946  subsys, ap);
947  va_end(ap);
948 }
949 
950 static void fplay_key_change_notify_fn (
951  int32_t event,
952  const char *key_name,
953  struct icmap_notify_value new_val,
954  struct icmap_notify_value old_val,
955  void *user_data)
956 {
957  if (strcmp(key_name, "runtime.blackbox.dump_flight_data") == 0) {
958  fprintf(stderr,"Writetofile\n");
959  corosync_blackbox_write_to_file ();
960  }
961  if (strcmp(key_name, "runtime.blackbox.dump_state") == 0) {
962  fprintf(stderr,"statefump\n");
964  }
965 }
966 
967 static void corosync_fplay_control_init (void)
968 {
969  icmap_track_t track = NULL;
970 
971  icmap_set_string("runtime.blackbox.dump_flight_data", "no");
972  icmap_set_string("runtime.blackbox.dump_state", "no");
973 
974  icmap_track_add("runtime.blackbox.dump_flight_data",
976  fplay_key_change_notify_fn,
977  NULL, &track);
978  icmap_track_add("runtime.blackbox.dump_state",
980  fplay_key_change_notify_fn,
981  NULL, &track);
982 }
983 
984 static void force_gather_notify_fn(
985  int32_t event,
986  const char *key_name,
987  struct icmap_notify_value new_val,
988  struct icmap_notify_value old_val,
989  void *user_data)
990 {
991  char *key_val;
992 
993  if (icmap_get_string(key_name, &key_val) == CS_OK && strcmp(key_val, "no") == 0)
994  goto out;
995 
996  icmap_set_string("runtime.force_gather", "no");
997 
998  if (strcmp(key_name, "runtime.force_gather") == 0) {
999  log_printf(LOGSYS_LEVEL_ERROR, "Forcing into GATHER state\n");
1001  }
1002 
1003 out:
1004  free(key_val);
1005 }
1006 
1007 static void corosync_force_gather_init (void)
1008 {
1009  icmap_track_t track = NULL;
1010 
1011  icmap_set_string("runtime.force_gather", "no");
1012 
1013  icmap_track_add("runtime.force_gather",
1015  force_gather_notify_fn,
1016  NULL, &track);
1017 }
1018 
1019 /*
1020  * Set RO flag for keys, which ether doesn't make sense to change by user (statistic)
1021  * or which when changed are not reflected by runtime (totem.crypto_cipher, ...).
1022  *
1023  * Also some RO keys cannot be determined in this stage, so they are set later in
1024  * other functions (like nodelist.local_node_pos, ...)
1025  */
1026 static void set_icmap_ro_keys_flag (void)
1027 {
1028  /*
1029  * Set RO flag for all keys of internal configuration and runtime statistics
1030  */
1031  icmap_set_ro_access("internal_configuration.", CS_TRUE, CS_TRUE);
1032  icmap_set_ro_access("runtime.services.", CS_TRUE, CS_TRUE);
1033  icmap_set_ro_access("runtime.config.", CS_TRUE, CS_TRUE);
1034  icmap_set_ro_access("runtime.totem.", CS_TRUE, CS_TRUE);
1035  icmap_set_ro_access("uidgid.config.", CS_TRUE, CS_TRUE);
1036  icmap_set_ro_access("system.", CS_TRUE, CS_TRUE);
1037  icmap_set_ro_access("nodelist.", CS_TRUE, CS_TRUE);
1038 
1039  /*
1040  * Set RO flag for constrete keys of configuration which can't be changed
1041  * during runtime
1042  */
1043  icmap_set_ro_access("totem.crypto_cipher", CS_FALSE, CS_TRUE);
1044  icmap_set_ro_access("totem.crypto_hash", CS_FALSE, CS_TRUE);
1045  icmap_set_ro_access("totem.keyfile", CS_FALSE, CS_TRUE);
1046  icmap_set_ro_access("totem.key", CS_FALSE, CS_TRUE);
1047  icmap_set_ro_access("totem.secauth", CS_FALSE, CS_TRUE);
1048  icmap_set_ro_access("totem.ip_version", CS_FALSE, CS_TRUE);
1049  icmap_set_ro_access("totem.rrp_mode", CS_FALSE, CS_TRUE);
1050  icmap_set_ro_access("totem.transport", CS_FALSE, CS_TRUE);
1051  icmap_set_ro_access("totem.cluster_name", CS_FALSE, CS_TRUE);
1052  icmap_set_ro_access("totem.netmtu", CS_FALSE, CS_TRUE);
1053  icmap_set_ro_access("totem.threads", CS_FALSE, CS_TRUE);
1054  icmap_set_ro_access("totem.version", CS_FALSE, CS_TRUE);
1055  icmap_set_ro_access("totem.nodeid", CS_FALSE, CS_TRUE);
1056  icmap_set_ro_access("totem.clear_node_high_bit", CS_FALSE, CS_TRUE);
1057  icmap_set_ro_access("config.reload_in_progress", CS_FALSE, CS_TRUE);
1058  icmap_set_ro_access("config.totemconfig_reload_in_progress", CS_FALSE, CS_TRUE);
1059 }
1060 
1061 static void main_service_ready (void)
1062 {
1063  int res;
1064 
1065  /*
1066  * This must occur after totempg is initialized because "this_ip" must be set
1067  */
1069  if (res == -1) {
1070  log_printf (LOGSYS_LEVEL_ERROR, "Could not initialize default services");
1072  }
1073  cs_ipcs_init();
1074  corosync_totem_stats_init ();
1075  corosync_fplay_control_init ();
1076  corosync_force_gather_init ();
1077 
1078  sync_init (
1079  corosync_sync_callbacks_retrieve,
1080  corosync_sync_completed);
1081 }
1082 
1083 static enum e_corosync_done corosync_flock (const char *lockfile, pid_t pid)
1084 {
1085  struct flock lock;
1086  enum e_corosync_done err;
1087  char pid_s[17];
1088  int fd_flag;
1089  int lf;
1090 
1091  err = COROSYNC_DONE_EXIT;
1092 
1093  lf = open (lockfile, O_WRONLY | O_CREAT, 0640);
1094  if (lf == -1) {
1095  log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't create lock file.");
1096  return (COROSYNC_DONE_ACQUIRE_LOCK);
1097  }
1098 
1099 retry_fcntl:
1100  lock.l_type = F_WRLCK;
1101  lock.l_start = 0;
1102  lock.l_whence = SEEK_SET;
1103  lock.l_len = 0;
1104  if (fcntl (lf, F_SETLK, &lock) == -1) {
1105  switch (errno) {
1106  case EINTR:
1107  goto retry_fcntl;
1108  break;
1109  case EAGAIN:
1110  case EACCES:
1111  log_printf (LOGSYS_LEVEL_ERROR, "Another Corosync instance is already running.");
1113  goto error_close;
1114  break;
1115  default:
1116  log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't acquire lock. Error was %s",
1117  strerror(errno));
1119  goto error_close;
1120  break;
1121  }
1122  }
1123 
1124  if (ftruncate (lf, 0) == -1) {
1125  log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't truncate lock file. Error was %s",
1126  strerror (errno));
1128  goto error_close_unlink;
1129  }
1130 
1131  memset (pid_s, 0, sizeof (pid_s));
1132  snprintf (pid_s, sizeof (pid_s) - 1, "%u\n", pid);
1133 
1134 retry_write:
1135  if (write (lf, pid_s, strlen (pid_s)) != strlen (pid_s)) {
1136  if (errno == EINTR) {
1137  goto retry_write;
1138  } else {
1139  log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't write pid to lock file. "
1140  "Error was %s", strerror (errno));
1142  goto error_close_unlink;
1143  }
1144  }
1145 
1146  if ((fd_flag = fcntl (lf, F_GETFD, 0)) == -1) {
1147  log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't get close-on-exec flag from lock file. "
1148  "Error was %s", strerror (errno));
1150  goto error_close_unlink;
1151  }
1152  fd_flag |= FD_CLOEXEC;
1153  if (fcntl (lf, F_SETFD, fd_flag) == -1) {
1154  log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't set close-on-exec flag to lock file. "
1155  "Error was %s", strerror (errno));
1157  goto error_close_unlink;
1158  }
1159 
1160  return (err);
1161 
1162 error_close_unlink:
1163  unlink (lockfile);
1164 error_close:
1165  close (lf);
1166 
1167  return (err);
1168 }
1169 
1170 static int corosync_move_to_root_cgroup(void) {
1171  FILE *f;
1172  int res = -1;
1173 
1174  /*
1175  * /sys/fs/cgroup is hardcoded, because most of Linux distributions are now
1176  * using systemd and systemd uses hardcoded path of cgroup mount point.
1177  *
1178  * This feature is expected to be removed as soon as systemd gets support
1179  * for managing RT configuration.
1180  */
1181  f = fopen("/sys/fs/cgroup/cpu/cpu.rt_runtime_us", "rt");
1182  if (f == NULL) {
1183  log_printf(LOGSYS_LEVEL_DEBUG, "cpu.rt_runtime_us doesn't exists -> "
1184  "system without cgroup or with disabled CONFIG_RT_GROUP_SCHED");
1185 
1186  res = 0;
1187  goto exit_res;
1188  }
1189  (void)fclose(f);
1190 
1191  f = fopen("/sys/fs/cgroup/cpu/tasks", "w");
1192  if (f == NULL) {
1193  log_printf(LOGSYS_LEVEL_WARNING, "Can't open cgroups tasks file for writing");
1194 
1195  goto exit_res;
1196  }
1197 
1198  if (fprintf(f, "%jd\n", (intmax_t)getpid()) <= 0) {
1199  log_printf(LOGSYS_LEVEL_WARNING, "Can't write corosync pid into cgroups tasks file");
1200 
1201  goto close_and_exit_res;
1202  }
1203 
1204 close_and_exit_res:
1205  if (fclose(f) != 0) {
1206  log_printf(LOGSYS_LEVEL_WARNING, "Can't close cgroups tasks file");
1207 
1208  goto exit_res;
1209  }
1210 
1211 exit_res:
1212  return (res);
1213 }
1214 
1215 
1216 int main (int argc, char **argv, char **envp)
1217 {
1218  const char *error_string;
1219  struct totem_config totem_config;
1220  int res, ch;
1221  int background, sched_rr, prio, testonly, move_to_root_cgroup;
1222  struct stat stat_out;
1223  enum e_corosync_done flock_err;
1224  uint64_t totem_config_warnings;
1226  long int tmpli;
1227  char *ep;
1228  char *tmp_str;
1229  int log_subsys_id_totem;
1230 
1231  /* default configuration
1232  */
1233  background = 1;
1234  testonly = 0;
1235 
1236  while ((ch = getopt (argc, argv, "c:ftv")) != EOF) {
1237 
1238  switch (ch) {
1239  case 'c':
1240  res = snprintf(corosync_config_file, sizeof(corosync_config_file), "%s", optarg);
1241  if (res >= sizeof(corosync_config_file)) {
1242  fprintf (stderr, "Config file path too long.\n");
1243  syslog (LOGSYS_LEVEL_ERROR, "Config file path too long.");
1244 
1246  return EXIT_FAILURE;
1247  }
1248  break;
1249  case 'f':
1250  background = 0;
1251  break;
1252  case 't':
1253  testonly = 1;
1254  break;
1255  case 'v':
1256  printf ("Corosync Cluster Engine, version '%s'\n", VERSION);
1257  printf ("Copyright (c) 2006-2018 Red Hat, Inc.\n");
1259  return EXIT_SUCCESS;
1260 
1261  break;
1262  default:
1263  fprintf(stderr, \
1264  "usage:\n"\
1265  " -c : Corosync config file path.\n"\
1266  " -f : Start application in foreground.\n"\
1267  " -t : Test configuration and exit.\n"\
1268  " -v : Display version and SVN revision of Corosync and exit.\n");
1270  return EXIT_FAILURE;
1271  }
1272  }
1273 
1274 
1275  /*
1276  * Other signals are registered later via qb_loop_signal_add
1277  */
1278  (void)signal (SIGSEGV, sigsegv_handler);
1279  (void)signal (SIGABRT, sigsegv_handler);
1280 #if MSG_NOSIGNAL != 0
1281  (void)signal (SIGPIPE, SIG_IGN);
1282 #endif
1283 
1284  if (icmap_init() != CS_OK) {
1285  fprintf (stderr, "Corosync Executive couldn't initialize configuration component.\n");
1286  syslog (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't initialize configuration component.");
1288  }
1289  set_icmap_ro_keys_flag();
1290 
1291  /*
1292  * Initialize the corosync_api_v1 definition
1293  */
1294  api = apidef_get ();
1295 
1296  res = coroparse_configparse(icmap_get_global_map(), &error_string);
1297  if (res == -1) {
1298  /*
1299  * Logsys can't log properly at this early stage, and we need to get this message out
1300  *
1301  */
1302  fprintf (stderr, "%s\n", error_string);
1303  syslog (LOGSYS_LEVEL_ERROR, "%s", error_string);
1305  }
1306 
1307  if (stats_map_init(api) != CS_OK) {
1308  fprintf (stderr, "Corosync Executive couldn't initialize statistics component.\n");
1309  syslog (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't initialize statistics component.");
1311  }
1312 
1313  res = corosync_log_config_read (&error_string);
1314  if (res == -1) {
1315  /*
1316  * if we are here, we _must_ flush the logsys queue
1317  * and try to inform that we couldn't read the config.
1318  * this is a desperate attempt before certain death
1319  * and there is no guarantee that we can print to stderr
1320  * nor that logsys is sending the messages where we expect.
1321  */
1322  log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string);
1323  fprintf(stderr, "%s", error_string);
1324  syslog (LOGSYS_LEVEL_ERROR, "%s", error_string);
1326  }
1327 
1328  if (!testonly) {
1329  log_printf (LOGSYS_LEVEL_NOTICE, "Corosync Cluster Engine %s starting up", VERSION);
1330  log_printf (LOGSYS_LEVEL_INFO, "Corosync built-in features:" PACKAGE_FEATURES "");
1331  }
1332 
1333  /*
1334  * Create totem logsys subsys before totem_config_read so log functions can be used
1335  */
1336  log_subsys_id_totem = _logsys_subsys_create("TOTEM", "totem,"
1337  "totemip.c,totemconfig.c,totemcrypto.c,totemsrp.c,"
1338  "totempg.c,totemudp.c,totemudpu.c,totemnet.c,totemknet.c");
1339 
1340  /*
1341  * Make sure required directory is present
1342  */
1343  res = stat (get_state_dir(), &stat_out);
1344  if ((res == -1) || (res == 0 && !S_ISDIR(stat_out.st_mode))) {
1345  log_printf (LOGSYS_LEVEL_ERROR, "State directory %s not present. Please create it.", get_state_dir());
1347  }
1348 
1349  res = chdir(get_state_dir());
1350  if (res == -1) {
1351  log_printf (LOGSYS_LEVEL_ERROR, "Cannot chdir to state directory %s. "
1352  "Please make sure it has correct context and rights.", get_state_dir());
1354  }
1355 
1356  res = totem_config_read (&totem_config, &error_string, &totem_config_warnings);
1357  if (res == -1) {
1358  log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string);
1360  }
1361 
1362  if (totem_config_warnings & TOTEM_CONFIG_WARNING_MEMBERS_IGNORED) {
1363  log_printf (LOGSYS_LEVEL_WARNING, "member section is used together with nodelist. Members ignored.");
1364  }
1365 
1366  if (totem_config_warnings & TOTEM_CONFIG_WARNING_MEMBERS_DEPRECATED) {
1367  log_printf (LOGSYS_LEVEL_WARNING, "member section is deprecated.");
1368  }
1369 
1370  if (totem_config_warnings & TOTEM_CONFIG_WARNING_TOTEM_NODEID_IGNORED) {
1371  log_printf (LOGSYS_LEVEL_WARNING, "nodeid appears both in totem section and nodelist. Nodelist one is used.");
1372  }
1373 
1374  if (totem_config_warnings & TOTEM_CONFIG_BINDNETADDR_NODELIST_SET) {
1375  log_printf (LOGSYS_LEVEL_WARNING, "interface section bindnetaddr is used together with nodelist. "
1376  "Nodelist one is going to be used.");
1377  }
1378 
1379  if (totem_config_warnings != 0) {
1380  log_printf (LOGSYS_LEVEL_WARNING, "Please migrate config file to nodelist.");
1381  }
1382 
1383  res = totem_config_validate (&totem_config, &error_string);
1384  if (res == -1) {
1385  log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string);
1387  }
1388 
1389  if (testonly) {
1391  }
1392 
1393 
1394  move_to_root_cgroup = 1;
1395  if (icmap_get_string("system.move_to_root_cgroup", &tmp_str) == CS_OK) {
1396  if (strcmp(tmp_str, "yes") != 0) {
1397  move_to_root_cgroup = 0;
1398  }
1399  free(tmp_str);
1400  }
1401 
1402  /*
1403  * Try to move corosync into root cpu cgroup. Failure is not fatal and
1404  * error is deliberately ignored.
1405  */
1406  if (move_to_root_cgroup) {
1407  (void)corosync_move_to_root_cgroup();
1408  }
1409 
1410  sched_rr = 1;
1411  if (icmap_get_string("system.sched_rr", &tmp_str) == CS_OK) {
1412  if (strcmp(tmp_str, "yes") != 0) {
1413  sched_rr = 0;
1414  }
1415  free(tmp_str);
1416  }
1417 
1418  prio = 0;
1419  if (icmap_get_string("system.priority", &tmp_str) == CS_OK) {
1420  if (strcmp(tmp_str, "max") == 0) {
1421  prio = INT_MIN;
1422  } else if (strcmp(tmp_str, "min") == 0) {
1423  prio = INT_MAX;
1424  } else {
1425  errno = 0;
1426 
1427  tmpli = strtol(tmp_str, &ep, 10);
1428  if (errno != 0 || *ep != '\0' || tmpli > INT_MAX || tmpli < INT_MIN) {
1429  log_printf (LOGSYS_LEVEL_ERROR, "Priority value %s is invalid", tmp_str);
1431  }
1432 
1433  prio = tmpli;
1434  }
1435 
1436  free(tmp_str);
1437  }
1438 
1439  /*
1440  * Set round robin realtime scheduling with priority 99
1441  */
1442  if (sched_rr) {
1443  if (corosync_set_rr_scheduler () != 0) {
1444  prio = INT_MIN;
1445  } else {
1446  prio = 0;
1447  }
1448  }
1449 
1450  if (prio != 0) {
1451  if (setpriority(PRIO_PGRP, 0, prio) != 0) {
1453  "Could not set priority %d", prio);
1454  }
1455  }
1456 
1457  totem_config.totem_memb_ring_id_create_or_load = corosync_ring_id_create_or_load;
1458  totem_config.totem_memb_ring_id_store = corosync_ring_id_store;
1459 
1462 
1470 
1472 
1473  /*
1474  * Now we are fully initialized.
1475  */
1476  if (background) {
1478 
1479  corosync_tty_detach ();
1480 
1482 
1483  log_printf (LOGSYS_LEVEL_DEBUG, "Corosync TTY detached");
1484  }
1485 
1486  /*
1487  * Lock all memory to avoid page faults which may interrupt
1488  * application healthchecking
1489  */
1490  corosync_mlockall ();
1491 
1492  corosync_poll_handle = qb_loop_create ();
1493 
1496  timer_function_scheduler_timeout (&scheduler_pause_timeout_data);
1497 
1498  qb_loop_signal_add(corosync_poll_handle, QB_LOOP_LOW,
1499  SIGUSR2, NULL, sig_diag_handler, NULL);
1500  qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
1501  SIGINT, NULL, sig_exit_handler, NULL);
1502  qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
1503  SIGQUIT, NULL, sig_exit_handler, NULL);
1504  qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
1505  SIGTERM, NULL, sig_exit_handler, NULL);
1506 
1507  if (logsys_thread_start() != 0) {
1508  log_printf (LOGSYS_LEVEL_ERROR, "Can't initialize log thread");
1510  }
1511 
1512  if ((flock_err = corosync_flock (corosync_lock_file, getpid ())) != COROSYNC_DONE_EXIT) {
1513  corosync_exit_error (flock_err);
1514  }
1515 
1516  /*
1517  * if totempg_initialize doesn't have root priveleges, it cannot
1518  * bind to a specific interface. This only matters if
1519  * there is more then one interface in a system, so
1520  * in this case, only a warning is printed
1521  */
1522  /*
1523  * Join multicast group and setup delivery
1524  * and configuration change functions
1525  */
1526  if (totempg_initialize (
1527  corosync_poll_handle,
1528  &totem_config) != 0) {
1529 
1530  log_printf (LOGSYS_LEVEL_ERROR, "Can't initialize TOTEM layer");
1532  }
1533 
1535  main_service_ready);
1536 
1538  &corosync_group_handle,
1539  deliver_fn,
1540  confchg_fn);
1541 
1543  corosync_group_handle,
1544  &corosync_group,
1545  1);
1546 
1547  /*
1548  * Drop root privleges to user 'corosync'
1549  * TODO: Don't really need full root capabilities;
1550  * needed capabilities are:
1551  * CAP_NET_RAW (bindtodevice)
1552  * CAP_SYS_NICE (setscheduler)
1553  * CAP_IPC_LOCK (mlockall)
1554  */
1555  priv_drop ();
1556 
1557  schedwrk_init (
1558  serialize_lock,
1559  serialize_unlock);
1560 
1561  /*
1562  * Start main processing loop
1563  */
1564  qb_loop_run (corosync_poll_handle);
1565 
1566  /*
1567  * Exit was requested
1568  */
1569  totempg_finalize ();
1570 
1571  /*
1572  * free the loop resources
1573  */
1574  qb_loop_destroy (corosync_poll_handle);
1575 
1576  /*
1577  * free up the icmap
1578  */
1579 
1580  /*
1581  * Remove pid lock file
1582  */
1583  unlink (corosync_lock_file);
1584 
1586 
1587  return EXIT_SUCCESS;
1588 }
swab32
#define swab32(x)
The swab32 macro.
Definition: swab.h:51
corosync_api_v1
The corosync_api_v1 struct.
Definition: coroapi.h:225
apidef.h
corosync_sending_allowed_release
void corosync_sending_allowed_release(void *sending_allowed_private_data)
Definition: main.c:776
TOTEM_CONFIGURATION_REGULAR
@ TOTEM_CONFIGURATION_REGULAR
Definition: coroapi.h:133
totempg_groups_join
int totempg_groups_join(void *instance, const struct totempg_group *groups, size_t group_cnt)
Definition: totempg.c:1182
totem_logging_configuration::log_level_error
int log_level_error
Definition: totem.h:111
sync_callbacks
Definition: sync.h:38
scheduler_pause_timeout_data::max_tv_diff
unsigned long long max_tv_diff
Definition: main.c:812
stats_map_init
cs_error_t stats_map_init(const struct corosync_api_v1 *corosync_api)
Definition: stats.c:278
totemsrp_stats_t::mtt_rx_token
uint32_t mtt_rx_token
Definition: totemstats.h:83
corosync_quorum_is_quorate
int corosync_quorum_is_quorate(void)
Definition: exec/quorum.c:65
CS_LIB_ALLOW_INQUORATE
@ CS_LIB_ALLOW_INQUORATE
Definition: coroapi.h:164
COROSYNC_DONE_ICMAP
@ COROSYNC_DONE_ICMAP
Definition: exec/util.h:53
totemsrp_stats_t::continuous_sendmsg_failures
uint32_t continuous_sendmsg_failures
Definition: totemstats.h:79
main_mcast
int main_mcast(const struct iovec *iovec, unsigned int iov_len, unsigned int guarantee)
Definition: main.c:614
global_sched_param
struct sched_param global_sched_param
Definition: main.c:162
totem_configuration_type
totem_configuration_type
The totem_configuration_type enum.
Definition: coroapi.h:132
totempg_stats_t::srp
totemsrp_stats_t * srp
Definition: totemstats.h:96
log_printf
#define log_printf(level, format, args...)
Definition: logsys.h:323
message_source_is_local
int message_source_is_local(const mar_message_source_t *source)
Definition: main.c:787
icmap_init
cs_error_t icmap_init(void)
Initialize global icmap.
Definition: icmap.c:208
totempg_finalize
void totempg_finalize(void)
Definition: totempg.c:855
corosync_state_dump
void corosync_state_dump(void)
Definition: main.c:193
totem_logging_configuration::log_level_trace
int log_level_trace
Definition: totem.h:115
totem_config_read
int totem_config_read(struct totem_config *totem_config, const char **error_string, uint64_t *warnings)
Definition: totemconfig.c:1733
totempg.h
Totem Single Ring Protocol.
sending_allowed_private_data_struct
Definition: main.c:723
cs_poll_dispatch_add
int cs_poll_dispatch_add(qb_loop_t *handle, int fd, int events, void *data, int(*dispatch_fn)(int fd, int revents, void *data))
Definition: main.c:175
logsys_config_apply
void logsys_config_apply(void)
logsys_config_apply
Definition: logsys.c:790
service.h
ipcs_stats.h
LOGSYS_MODE_OUTPUT_SYSLOG
#define LOGSYS_MODE_OUTPUT_SYSLOG
Definition: logsys.h:62
sync.h
TOTEM_TOKEN_STATS_MAX
#define TOTEM_TOKEN_STATS_MAX
Definition: totemstats.h:89
scheduler_pause_timeout_data::totem_config
struct totem_config * totem_config
Definition: main.c:809
LOGSYS_LEVEL_ERROR
#define LOGSYS_LEVEL_ERROR
Definition: logsys.h:72
COROSYNC_DONE_STATS
@ COROSYNC_DONE_STATS
Definition: exec/util.h:62
schedwrk_init
void schedwrk_init(void(*serialize_lock_fn)(void), void(*serialize_unlock_fn)(void))
Definition: schedwrk.c:83
totempg_groups_joined_release
int totempg_groups_joined_release(int msg_count)
Definition: totempg.c:1346
totemsrp_stats_t::latest_token
int latest_token
Definition: totemstats.h:88
corosync_exit_error
#define corosync_exit_error(err)
Definition: exec/util.h:72
icmap_set_ro_access
cs_error_t icmap_set_ro_access(const char *key_name, int prefix, int ro_access)
Set read-only access for given key (key_name) or prefix, If prefix is set.
Definition: icmap.c:1225
scheduler_pause_timeout_data::tv_prev
unsigned long long tv_prev
Definition: main.c:811
cs_ipcs_q_level_get
int32_t cs_ipcs_q_level_get(void)
Definition: ipc_glue.c:601
corosync_service_defaults_link_and_init
unsigned int corosync_service_defaults_link_and_init(struct corosync_api_v1 *corosync_api)
Load all of the default services.
Definition: service.c:339
totem_config::totem_memb_ring_id_store
void(* totem_memb_ring_id_store)(const struct memb_ring_id *memb_ring_id, unsigned int nodeid)
Definition: totem.h:251
icmap_get_global_map
icmap_map_t icmap_get_global_map(void)
Return global icmap.
Definition: icmap.c:264
memb_ring_id::rep
unsigned int rep
Definition: totem.h:150
corosync_service_engine::sync_abort
void(* sync_abort)(void)
Definition: coroapi.h:523
LOGSYS_LEVEL_DEBUG
#define LOGSYS_LEVEL_DEBUG
Definition: logsys.h:76
totem_logging_configuration::log_level_debug
int log_level_debug
Definition: totem.h:114
stats_trigger_trackers
void stats_trigger_trackers()
Definition: stats.c:544
corosync_service_engine::exec_engine
struct corosync_exec_handler * exec_engine
Definition: coroapi.h:506
sync_callbacks::sync_activate
void(* sync_activate)(void)
Definition: sync.h:46
totemsrp.h
Totem Single Ring Protocol.
totem_logging_configuration::log_level_notice
int log_level_notice
Definition: totem.h:113
totemsrp_stats_t::earliest_token
int earliest_token
Definition: totemstats.h:87
totemsrp_token_stats_t::rx
uint32_t rx
Definition: totemstats.h:48
totempg_groups_initialize
int totempg_groups_initialize(void **instance, void(*deliver_fn)(unsigned int nodeid, const void *msg, unsigned int msg_len, int endian_conversion_required), void(*confchg_fn)(enum totem_configuration_type configuration_type, const unsigned int *member_list, size_t member_list_entries, const unsigned int *left_list, size_t left_list_entries, const unsigned int *joined_list, size_t joined_list_entries, const struct memb_ring_id *ring_id))
Initialize a groups instance.
Definition: totempg.c:1134
corosync_service
struct corosync_service_engine * corosync_service[SERVICES_COUNT_MAX]
Definition: service.c:110
corosync_service_engine::sync_process
int(* sync_process)(void)
Definition: coroapi.h:521
sync_callbacks::name
const char * name
Definition: sync.h:48
scheduler_pause_timeout_data
Definition: main.c:808
totemsrp_token_stats_t::tx
uint32_t tx
Definition: totemstats.h:49
scheduler_pause_timeout_data::handle
qb_loop_timer_handle handle
Definition: main.c:810
sync_save_transitional
void sync_save_transitional(const unsigned int *member_list, size_t member_list_entries, const struct memb_ring_id *ring_id)
Definition: sync.c:524
icmap_get
cs_error_t icmap_get(const char *key_name, void *value, size_t *value_len, icmap_value_types_t *type)
Retrieve value of key key_name and store it in user preallocated value pointer.
Definition: icmap.c:725
totemsrp_stats_t::avg_token_workload
uint32_t avg_token_workload
Definition: totemstats.h:84
totempg_stats_t
Definition: totemstats.h:94
corosync_get_config_file
const char * corosync_get_config_file(void)
Definition: main.c:204
COROSYNC_DONE_INIT_SERVICES
@ COROSYNC_DONE_INIT_SERVICES
Definition: exec/util.h:54
sync_callbacks::sync_init
void(* sync_init)(const unsigned int *trans_list, size_t trans_list_entries, const unsigned int *member_list, size_t member_list_entries, const struct memb_ring_id *ring_id)
Definition: sync.h:39
swab.h
totem_config::token_timeout
unsigned int token_timeout
Definition: totem.h:181
coroparse_configparse
int coroparse_configparse(icmap_map_t config_map, const char **error_string)
Definition: coroparse.c:258
COROSYNC_DONE_ALREADY_RUNNING
@ COROSYNC_DONE_ALREADY_RUNNING
Definition: exec/util.h:58
cs_poll_handle_get
qb_loop_t * cs_poll_handle_get(void)
Definition: main.c:170
totemsrp_token_stats_t::backlog_calc
int backlog_calc
Definition: totemstats.h:50
CS_LIB_FLOW_CONTROL_NOT_REQUIRED
@ CS_LIB_FLOW_CONTROL_NOT_REQUIRED
Definition: coroapi.h:153
CS_TRUE
#define CS_TRUE
Definition: corotypes.h:54
COROSYNC_DONE_FORK
@ COROSYNC_DONE_FORK
Definition: exec/util.h:49
totempg_groups_joined_reserve
int totempg_groups_joined_reserve(void *instance, const struct iovec *iovec, unsigned int iov_len)
Definition: totempg.c:1302
ICMAP_TRACK_ADD
#define ICMAP_TRACK_ADD
Definition: icmap.h:76
icmap.h
icmap_set_string
cs_error_t icmap_set_string(const char *key_name, const char *value)
Definition: icmap.c:627
header
struct totem_message_header header
Definition: totemsrp.c:0
mar_message_source_t
The mar_message_source_t struct.
Definition: coroapi.h:50
totempg_groups_mcast_joined
int totempg_groups_mcast_joined(void *instance, const struct iovec *iovec, unsigned int iov_len, int guarantee)
Definition: totempg.c:1232
TOTEM_CONFIG_WARNING_MEMBERS_IGNORED
#define TOTEM_CONFIG_WARNING_MEMBERS_IGNORED
Definition: totemconfig.h:45
CS_PRI_RING_ID_SEQ
#define CS_PRI_RING_ID_SEQ
Definition: corotypes.h:60
sync_init
int sync_init(int(*sync_callbacks_retrieve)(int service_id, struct sync_callbacks *callbacks), void(*synchronization_completed)(void))
Definition: sync.c:158
corosync_api_v1::totem_get_stats
void *(* totem_get_stats)(void)
Definition: coroapi.h:435
__attribute__
typedef __attribute__
icmap_set_uint32
cs_error_t icmap_set_uint32(const char *key_name, uint32_t value)
Definition: icmap.c:597
stats.h
sync_abort
void sync_abort(void)
Definition: sync.c:535
CS_OK
@ CS_OK
Definition: corotypes.h:98
totempg_service_ready_register
void totempg_service_ready_register(void(*totem_service_ready)(void))
Definition: totempg.c:1534
LOGSYS_LEVEL_INFO
#define LOGSYS_LEVEL_INFO
Definition: logsys.h:75
corosync_service_unlink_all
void corosync_service_unlink_all(struct corosync_api_v1 *api, void(*unlink_all_complete)(void))
Unlink and exit all corosync services.
Definition: service.c:394
LOGSYS_LEVEL_TRACE
#define LOGSYS_LEVEL_TRACE
Definition: logsys.h:77
totempg_force_gather
void totempg_force_gather(void)
Definition: totempg.c:1589
ICMAP_KEYNAME_MAXLEN
#define ICMAP_KEYNAME_MAXLEN
Maximum length of key in icmap.
Definition: icmap.h:48
corosync_service_engine::sync_activate
void(* sync_activate)(void)
Definition: coroapi.h:522
timer.h
corosync_exec_handler::exec_handler_fn
void(* exec_handler_fn)(const void *msg, unsigned int nodeid)
Definition: coroapi.h:476
TOTEM_Q_LEVEL_CRITICAL
@ TOTEM_Q_LEVEL_CRITICAL
Definition: totempg.h:181
message_source_set
void message_source_set(mar_message_source_t *source, void *conn)
Definition: main.c:798
COROSYSCONFDIR
#define COROSYSCONFDIR
Definition: config.h:11
sync_start
void sync_start(const unsigned int *member_list, size_t member_list_entries, const struct memb_ring_id *ring_id)
Definition: sync.c:512
lock
pthread_mutex_t lock
Definition: sam.c:131
COROSYNC_DONE_ACQUIRE_LOCK
@ COROSYNC_DONE_ACQUIRE_LOCK
Definition: exec/util.h:57
corosync_api_v1::timer_add_duration
int(* timer_add_duration)(unsigned long long nanoseconds_in_future, void *data, void(*timer_nf)(void *data), corosync_timer_handle_t *handle)
Definition: coroapi.h:229
icmap_track_add
cs_error_t icmap_track_add(const char *key_name, int32_t track_type, icmap_notify_fn_t notify_fn, void *user_data, icmap_track_t *icmap_track)
Add tracking function for given key_name.
Definition: icmap.c:1159
corosync_service_engine::exec_dump_fn
void(* exec_dump_fn)(void)
Definition: coroapi.h:501
get_state_dir
const char * get_state_dir(void)
Definition: util.c:172
RLIMIT_MEMLOCK
#define RLIMIT_MEMLOCK
totempg_check_q_level
void totempg_check_q_level(void *instance)
Definition: totempg.c:1294
schedwrk.h
totem_logging_configuration::log_subsys_id
int log_subsys_id
Definition: totem.h:116
cs_poll_dispatch_delete
int cs_poll_dispatch_delete(qb_loop_t *handle, int fd)
Definition: main.c:188
TOTEM_CONFIG_WARNING_MEMBERS_DEPRECATED
#define TOTEM_CONFIG_WARNING_MEMBERS_DEPRECATED
Definition: totemconfig.h:46
cs_ipc_allow_connections
void cs_ipc_allow_connections(int32_t allow)
Definition: ipc_glue.c:159
corosync_api_v1::totem_ifaces_print
const char *(* totem_ifaces_print)(unsigned int nodeid)
Definition: coroapi.h:290
totem_config
Definition: totem.h:159
MILLI_2_NANO_SECONDS
#define MILLI_2_NANO_SECONDS
Definition: coroapi.h:105
LOGSYS_LEVEL_NOTICE
#define LOGSYS_LEVEL_NOTICE
Definition: logsys.h:74
LOCALSTATEDIR
#define LOCALSTATEDIR
Definition: config.h:373
service_stats_tx
const char * service_stats_tx[SERVICES_COUNT_MAX][SERVICE_HANDLER_MAXIMUM_COUNT]
Definition: service.c:113
totemsrp_stats_t::time_since_token_last_received
uint64_t time_since_token_last_received
Definition: totemstats.h:80
COROSYNC_DONE_DIR_NOT_PRESENT
@ COROSYNC_DONE_DIR_NOT_PRESENT
Definition: exec/util.h:56
totempg_group
Definition: totempg.h:55
corosync_shutdown_request
void corosync_shutdown_request(void)
Definition: main.c:250
LOGSYS_MODE_OUTPUT_STDERR
#define LOGSYS_MODE_OUTPUT_STDERR
Definition: logsys.h:61
totempg_my_nodeid_get
unsigned int totempg_my_nodeid_get(void)
Definition: totempg.c:1525
totem_config_validate
int totem_config_validate(struct totem_config *totem_config, const char **error_string)
Definition: totemconfig.c:1948
corosync_sending_allowed
int corosync_sending_allowed(unsigned int service, unsigned int id, const void *msg, void *sending_allowed_private_data)
Definition: main.c:728
main
int main(int argc, char **argv, char **envp)
Definition: main.c:1216
memb_ring_id
The memb_ring_id struct.
Definition: coroapi.h:122
COROSYNC_DONE_MAINCONFIGREAD
@ COROSYNC_DONE_MAINCONFIGREAD
Definition: exec/util.h:51
_logsys_subsys_create
int _logsys_subsys_create(const char *subsys, const char *filename)
_logsys_subsys_create
Definition: logsys.c:433
totemsrp_stats_t::continuous_gather
uint32_t continuous_gather
Definition: totemstats.h:78
totemsrp_stats_t::firewall_enabled_or_nic_failure
uint8_t firewall_enabled_or_nic_failure
Definition: totemstats.h:82
TOTEM_CONFIG_BINDNETADDR_NODELIST_SET
#define TOTEM_CONFIG_BINDNETADDR_NODELIST_SET
Definition: totemconfig.h:48
ICMAP_TRACK_DELETE
#define ICMAP_TRACK_DELETE
Definition: icmap.h:77
totemconfig.h
user_data
void * user_data
Definition: sam.c:127
ICMAP_TRACK_MODIFY
#define ICMAP_TRACK_MODIFY
Definition: icmap.h:78
totem_logging_configuration::log_level_warning
int log_level_warning
Definition: totem.h:112
totem_logging_configuration::log_level_security
void(*) in log_level_security)
Definition: totem.h:108
cs_ipcs_init
void cs_ipcs_init(void)
Definition: ipc_glue.c:818
totemsrp_stats_t::token
totemsrp_token_stats_t token[TOTEM_TOKEN_STATS_MAX]
Definition: totemstats.h:90
icmap_inc
cs_error_t icmap_inc(const char *key_name)
Increase stored value by one.
Definition: icmap.c:1049
icmap_get_string
cs_error_t icmap_get_string(const char *key_name, char **str)
Shortcut for icmap_get for string type.
Definition: icmap.c:856
quorum.h
sending_allowed_private_data_struct::reserved_msgs
int reserved_msgs
Definition: main.c:724
corosync_service_engine::confchg_fn
void(* confchg_fn)(enum totem_configuration_type configuration_type, const unsigned int *member_list, size_t member_list_entries, const unsigned int *left_list, size_t left_list_entries, const unsigned int *joined_list, size_t joined_list_entries, const struct memb_ring_id *ring_id)
Definition: coroapi.h:509
SERVICES_COUNT_MAX
#define SERVICES_COUNT_MAX
Definition: coroapi.h:462
main.h
util.h
icmap_fast_inc
cs_error_t icmap_fast_inc(const char *key_name)
Increase stored value by one.
Definition: icmap.c:1069
COROSYNC_DONE_LOGSETUP
@ COROSYNC_DONE_LOGSETUP
Definition: exec/util.h:52
COROSYNC_DONE_LOGCONFIGREAD
@ COROSYNC_DONE_LOGCONFIGREAD
Definition: exec/util.h:50
logsys_system_fini
void logsys_system_fini(void)
logsys_system_fini
Definition: logsys.c:286
PACKAGE_FEATURES
#define PACKAGE_FEATURES
Definition: config.h:388
cs_ipcs_sync_state_changed
void cs_ipcs_sync_state_changed(int32_t sync_in_process)
Definition: ipc_glue.c:664
corosync_log_config_read
int corosync_log_config_read(cmap_handle_t cmap_h, const char *default_logfile, const char **error_string)
Definition: logconfig.c:715
service_stats_rx
const char * service_stats_rx[SERVICES_COUNT_MAX][SERVICE_HANDLER_MAXIMUM_COUNT]
Definition: service.c:112
CS_FALSE
#define CS_FALSE
Definition: corotypes.h:53
LOGSYS_DECLARE_SYSTEM
LOGSYS_DECLARE_SYSTEM("corosync", LOGSYS_MODE_OUTPUT_STDERR|LOGSYS_MODE_OUTPUT_SYSLOG, LOG_DAEMON, LOG_EMERG)
nodeid
unsigned int nodeid
Definition: coroapi.h:0
corosync_service_engine::name
const char * name
Definition: coroapi.h:491
totem_config::totem_memb_ring_id_create_or_load
void(* totem_memb_ring_id_create_or_load)(struct memb_ring_id *memb_ring_id, unsigned int nodeid)
Definition: totem.h:247
logsys_blackbox_prefork
void logsys_blackbox_prefork(void)
Definition: logsys.c:878
memb_ring_id::seq
unsigned long long seq
Definition: coroapi.h:124
ring_id
struct memb_ring_id ring_id
Definition: totemsrp.c:4
stats_add_schedmiss_event
void stats_add_schedmiss_event(uint64_t timestamp, float delay)
Definition: stats.c:430
config.h
VERSION
#define VERSION
Definition: config.h:448
e_corosync_done
e_corosync_done
Definition: exec/util.h:47
logconfig.h
totempg_group::group
const void * group
Definition: totempg.h:56
logsys_blackbox_postfork
void logsys_blackbox_postfork(void)
Definition: logsys.c:884
logsys.h
LOGSYS_DECLARE_SUBSYS
LOGSYS_DECLARE_SUBSYS("MAIN")
totem_logging_configuration::log_printf
void(* log_printf)(int level, int subsys, const char *function_name, const char *file_name, int file_line, const char *format,...) __attribute__((format(printf
Definition: totem.h:101
corotypes.h
LOGSYS_LEVEL_WARNING
#define LOGSYS_LEVEL_WARNING
Definition: logsys.h:73
icmap_track
Definition: icmap.c:61
apidef_get
struct corosync_api_v1 * apidef_get(void)
Definition: apidef.c:146
corosync_recheck_the_q_level
void corosync_recheck_the_q_level(void *data)
Definition: main.c:714
corosync_timer_handle_t
qb_loop_timer_handle corosync_timer_handle_t
corosync_timer_handle_t
Definition: coroapi.h:74
totem_logging_configuration
Definition: totem.h:100
COROSYNC_DONE_EXIT
@ COROSYNC_DONE_EXIT
Definition: exec/util.h:48
TOTEM_CONFIGURATION_TRANSITIONAL
@ TOTEM_CONFIGURATION_TRANSITIONAL
Definition: coroapi.h:134
icmap_notify_value
Structure passed as new_value and old_value in change callback.
Definition: icmap.h:91
totemsrp_stats_t::avg_backlog_calc
uint32_t avg_backlog_calc
Definition: totemstats.h:85
corosync_service_engine::sync_init
void(* sync_init)(const unsigned int *trans_list, size_t trans_list_entries, const unsigned int *member_list, size_t member_list_entries, const struct memb_ring_id *ring_id)
Definition: coroapi.h:515
totempg_trans_ack
void totempg_trans_ack(void)
Definition: totempg.c:1584
sync_callbacks::sync_process
int(* sync_process)(void)
Definition: sync.h:45
logsys_thread_start
int logsys_thread_start(void)
logsys_thread_start
Definition: logsys.c:842
corosync_api_v1::timer_delete
void(* timer_delete)(corosync_timer_handle_t timer_handle)
Definition: coroapi.h:241
TOTEM_CONFIG_WARNING_TOTEM_NODEID_IGNORED
#define TOTEM_CONFIG_WARNING_TOTEM_NODEID_IGNORED
Definition: totemconfig.h:47
guarantee
int guarantee
Definition: totemsrp.c:6
totempg_initialize
int totempg_initialize(qb_loop_t *poll_handle, struct totem_config *totem_config)
Initialize the totem process groups abstraction.
Definition: totempg.c:802
LOGSYS_PERROR
#define LOGSYS_PERROR(err_num, level, fmt, args...)
The LOGSYS_PERROR macro.
Definition: logsys.h:317
COROSYNC_DONE_FATAL_ERR
@ COROSYNC_DONE_FATAL_ERR
Definition: exec/util.h:55
icmap_fini
void icmap_fini(void)
Finalize global icmap.
Definition: icmap.c:247
MAX_NO_CONT_GATHER
#define MAX_NO_CONT_GATHER
Maximum number of continuous gather states.
Definition: totem.h:76
COROSYNC_DONE_STD_TO_NULL_REDIR
@ COROSYNC_DONE_STD_TO_NULL_REDIR
Definition: exec/util.h:59
sync_callbacks::sync_abort
void(* sync_abort)(void)
Definition: sync.h:47
MAX_NO_CONT_SENDMSG_FAILURES
#define MAX_NO_CONT_SENDMSG_FAILURES
Definition: totem.h:80
corosync_exec_handler::exec_endian_convert_fn
void(* exec_endian_convert_fn)(void *msg)
Definition: coroapi.h:477
corodefs.h
totem_config::totem_logging_configuration
struct totem_logging_configuration totem_logging_configuration
Definition: totem.h:207
COROSYNC_DONE_STORE_RINGID
@ COROSYNC_DONE_STORE_RINGID
Definition: exec/util.h:61