corosync  3.1.5.15-9134
logconfig.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2005 MontaVista Software, Inc.
3  * Copyright (c) 2006-2011 Red Hat, Inc.
4  *
5  * All rights reserved.
6  *
7  * Author: Steven Dake (sdake@redhat.com)
8  * Jan Friesse (jfriesse@redhat.com)
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 
37 #include "config.h"
38 
39 #include <corosync/totem/totem.h>
40 #include <corosync/logsys.h>
41 #ifdef LOGCONFIG_USE_ICMAP
42 #include <corosync/icmap.h>
43 #define MAP_KEYNAME_MAXLEN ICMAP_KEYNAME_MAXLEN
44 #define map_get_string(key_name, value) icmap_get_string(key_name, value)
45 #else
46 #include <corosync/cmap.h>
48 static const char *main_logfile;
49 #define MAP_KEYNAME_MAXLEN CMAP_KEYNAME_MAXLEN
50 #define map_get_string(key_name, value) cmap_get_string(cmap_handle, key_name, value)
51 #endif
52 
53 #include "util.h"
54 #include "logconfig.h"
55 #include "totemknet.h"
56 
57 static char error_string_response[512];
58 
80 static int insert_into_buffer(
81  char *target_buffer,
82  size_t bufferlen,
83  const char *entry,
84  const char *after)
85 {
86  const char *current_format = NULL;
87 
88  current_format = logsys_format_get();
89 
90  /* if the entry is already in the format we don't add it again */
91  if (strstr(current_format, entry) != NULL) {
92  return -1;
93  }
94 
95  /* if there is no "after", simply prepend the requested entry
96  * otherwise go for beautiful string manipulation.... </sarcasm> */
97  if (!after) {
98  if (snprintf(target_buffer, bufferlen - 1, "%s%s",
99  entry,
100  current_format) >= bufferlen - 1) {
101  return -1;
102  }
103  } else {
104  const char *afterpos;
105  size_t afterlen;
106  size_t templen;
107 
108  /* check if after is contained in the format
109  * and afterlen has a meaning or return an error */
110  afterpos = strstr(current_format, after);
111  afterlen = strlen(after);
112  if ((!afterpos) || (!afterlen)) {
113  return -1;
114  }
115 
116  templen = afterpos - current_format + afterlen;
117  if (snprintf(target_buffer, templen + 1, "%s", current_format)
118  >= bufferlen - 1) {
119  return -1;
120  }
121  if (snprintf(target_buffer + templen, bufferlen - ( templen + 1 ),
122  "%s%s", entry, current_format + templen)
123  >= bufferlen - ( templen + 1 )) {
124  return -1;
125  }
126  }
127  return 0;
128 }
129 
130 /*
131  * format set is global specific option that
132  * doesn't apply at system/subsystem level.
133  */
134 static int corosync_main_config_format_set (
135  const char **error_string)
136 {
137  const char *error_reason;
138  char new_format_buffer[PATH_MAX];
139  char *value = NULL;
140  int err = 0;
141  char timestamp_str_to_add[8];
142 
143  if (map_get_string("logging.fileline", &value) == CS_OK) {
144  if (strcmp (value, "on") == 0) {
145  if (!insert_into_buffer(new_format_buffer,
146  sizeof(new_format_buffer),
147  " %f:%l", "g]")) {
148  err = logsys_format_set(new_format_buffer);
149  } else
150  if (!insert_into_buffer(new_format_buffer,
151  sizeof(new_format_buffer),
152  "%f:%l", NULL)) {
153  err = logsys_format_set(new_format_buffer);
154  }
155  } else
156  if (strcmp (value, "off") == 0) {
157  /* nothing to do here */
158  } else {
159  error_reason = "unknown value for fileline";
160  free(value);
161  goto parse_error;
162  }
163 
164  free(value);
165  }
166 
167  if (err) {
168  error_reason = "not enough memory to set logging format buffer";
169  goto parse_error;
170  }
171 
172  if (map_get_string("logging.function_name", &value) == CS_OK) {
173  if (strcmp (value, "on") == 0) {
174  if (!insert_into_buffer(new_format_buffer,
175  sizeof(new_format_buffer),
176  "%n:", "f:")) {
177  err = logsys_format_set(new_format_buffer);
178  } else
179  if (!insert_into_buffer(new_format_buffer,
180  sizeof(new_format_buffer),
181  " %n", "g]")) {
182  err = logsys_format_set(new_format_buffer);
183  }
184  } else
185  if (strcmp (value, "off") == 0) {
186  /* nothing to do here */
187  } else {
188  error_reason = "unknown value for function_name";
189  free(value);
190  goto parse_error;
191  }
192 
193  free(value);
194  }
195 
196  if (err) {
197  error_reason = "not enough memory to set logging format buffer";
198  goto parse_error;
199  }
200 
201  memset(timestamp_str_to_add, 0, sizeof(timestamp_str_to_add));
202 
203  if (map_get_string("logging.timestamp", &value) == CS_OK) {
204  if (strcmp (value, "on") == 0) {
205  strcpy(timestamp_str_to_add, "%t");
206 #ifdef QB_FEATURE_LOG_HIRES_TIMESTAMPS
207  } else if (strcmp (value, "hires") == 0) {
208  strcpy(timestamp_str_to_add, "%T");
209 #endif
210  } else if (strcmp (value, "off") == 0) {
211  /* nothing to do here */
212  } else {
213  error_reason = "unknown value for timestamp";
214  free(value);
215  goto parse_error;
216  }
217 
218  free(value);
219  } else {
220  /*
221  * Display hires timestamp by default, otherwise standard timestamp
222  */
223 #ifdef QB_FEATURE_LOG_HIRES_TIMESTAMPS
224  strcpy(timestamp_str_to_add, "%T");
225 #else
226  strcpy(timestamp_str_to_add, "%t");
227 #endif
228  }
229 
230  if(strcmp(timestamp_str_to_add, "") != 0) {
231  strcat(timestamp_str_to_add, " ");
232  if (insert_into_buffer(new_format_buffer, sizeof(new_format_buffer),
233  timestamp_str_to_add, NULL) == 0) {
234  err = logsys_format_set(new_format_buffer);
235  }
236  }
237 
238  if (err) {
239  error_reason = "not enough memory to set logging format buffer";
240  goto parse_error;
241  }
242 
243  return (0);
244 
245 parse_error:
246  *error_string = error_reason;
247 
248  return (-1);
249 }
250 
251 /*
252  * blackbox is another global specific option that
253  * doesn't apply at system/subsystem level.
254  */
255 static int corosync_main_config_blackbox_set (
256  const char **error_string)
257 {
258  const char *error_reason;
259  char *value = NULL;
260 
261  if (map_get_string("logging.blackbox", &value) == CS_OK) {
262  if (strcmp (value, "on") == 0) {
263  (void)logsys_blackbox_set(QB_TRUE);
264  } else if (strcmp (value, "off") == 0) {
265  (void)logsys_blackbox_set(QB_FALSE);
266  } else {
267  error_reason = "unknown value for blackbox";
268  free(value);
269  goto parse_error;
270  }
271 
272  free(value);
273  } else {
274  (void)logsys_blackbox_set(QB_TRUE);
275  }
276 
277  return (0);
278 
279 parse_error:
280  *error_string = error_reason;
281 
282  return (-1);
283 }
284 
285 static int corosync_main_config_log_destination_set (
286  const char *path,
287  const char *key,
288  const char *subsys,
289  const char **error_string,
290  unsigned int mode_mask,
291  char deprecated,
292  char default_value,
293  const char *replacement)
294 {
295  static char formatted_error_reason[128];
296  char *value = NULL;
297  unsigned int mode;
298  char key_name[MAP_KEYNAME_MAXLEN];
299 
300  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, key);
301  if (map_get_string(key_name, &value) == CS_OK) {
302  if (deprecated) {
304  "Warning: the %s config parameter has been obsoleted."
305  " See corosync.conf man page %s directive.",
306  key, replacement);
307  }
308 
309  mode = logsys_config_mode_get (subsys);
310 
311  if (strcmp (value, "yes") == 0 || strcmp (value, "on") == 0) {
312  mode |= mode_mask;
313  if (logsys_config_mode_set(subsys, mode) < 0) {
314  sprintf (formatted_error_reason, "unable to set mode %s", key);
315  goto parse_error;
316  }
317  } else
318  if (strcmp (value, "no") == 0 || strcmp (value, "off") == 0) {
319  mode &= ~mode_mask;
320  if (logsys_config_mode_set(subsys, mode) < 0) {
321  sprintf (formatted_error_reason, "unable to unset mode %s", key);
322  goto parse_error;
323  }
324  } else {
325  sprintf (formatted_error_reason, "unknown value for %s", key);
326  goto parse_error;
327  }
328  }
329  /* Set to default if we are the top-level logger */
330  else if (!subsys && !deprecated) {
331 
332  mode = logsys_config_mode_get (subsys);
333  if (default_value) {
334  mode |= mode_mask;
335  }
336  else {
337  mode &= ~mode_mask;
338  }
339  if (logsys_config_mode_set(subsys, mode) < 0) {
340  sprintf (formatted_error_reason, "unable to change mode %s", key);
341  goto parse_error;
342  }
343  }
344 
345  free(value);
346  return (0);
347 
348 parse_error:
349  *error_string = formatted_error_reason;
350  free(value);
351  return (-1);
352 }
353 
354 static int corosync_main_config_set (
355  const char *path,
356  const char *subsys,
357  const char **error_string)
358 {
359  const char *error_reason = error_string_response;
360  char *value = NULL;
361  int mode;
362  char key_name[MAP_KEYNAME_MAXLEN];
363 
364  /*
365  * this bit abuses the internal logsys exported API
366  * to guarantee that all configured subsystems are
367  * initialized too.
368  *
369  * using this approach avoids some headaches caused
370  * by IPC and TOTEM that have a special logging
371  * handling requirements
372  */
373  if (subsys != NULL) {
374  if (_logsys_subsys_create(subsys, NULL) < 0) {
375  error_reason = "unable to create new logging subsystem";
376  goto parse_error;
377  }
378  }
379 
380  mode = logsys_config_mode_get(subsys);
381  if (mode < 0) {
382  error_reason = "unable to get mode";
383  goto parse_error;
384  }
385 
386  if (corosync_main_config_log_destination_set (path, "to_stderr", subsys, &error_reason,
387  LOGSYS_MODE_OUTPUT_STDERR, 0, 1, NULL) != 0)
388  goto parse_error;
389 
390  if (corosync_main_config_log_destination_set (path, "to_syslog", subsys, &error_reason,
391  LOGSYS_MODE_OUTPUT_SYSLOG, 0, 1, NULL) != 0)
392  goto parse_error;
393 
394  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_facility");
395  if (map_get_string(key_name, &value) == CS_OK) {
396  int syslog_facility;
397 
398  syslog_facility = qb_log_facility2int(value);
399  if (syslog_facility < 0) {
400  error_reason = "unknown syslog facility specified";
401  goto parse_error;
402  }
404  syslog_facility) < 0) {
405  error_reason = "unable to set syslog facility";
406  goto parse_error;
407  }
408 
409  free(value);
410  }
411  else {
412  /* Set default here in case of a reload */
414  qb_log_facility2int("daemon")) < 0) {
415  error_reason = "unable to set syslog facility";
416  goto parse_error;
417  }
418  }
419 
420  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_level");
421  if (map_get_string(key_name, &value) == CS_OK) {
422  int syslog_priority;
423 
425  "Warning: the syslog_level config parameter has been obsoleted."
426  " See corosync.conf man page syslog_priority directive.");
427 
428  syslog_priority = logsys_priority_id_get(value);
429  free(value);
430 
431  if (syslog_priority < 0) {
432  error_reason = "unknown syslog level specified";
433  goto parse_error;
434  }
436  syslog_priority) < 0) {
437  error_reason = "unable to set syslog level";
438  goto parse_error;
439  }
440  }
441 
442  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_priority");
443  if (map_get_string(key_name, &value) == CS_OK) {
444  int syslog_priority;
445 
446  syslog_priority = logsys_priority_id_get(value);
447  free(value);
448  if (syslog_priority < 0) {
449  error_reason = "unknown syslog priority specified";
450  goto parse_error;
451  }
453  syslog_priority) < 0) {
454  error_reason = "unable to set syslog priority";
455  goto parse_error;
456  }
457  }
458  else if(strcmp(key_name, "logging.syslog_priority") == 0){
460  logsys_priority_id_get("info")) < 0) {
461  error_reason = "unable to set syslog level";
462  goto parse_error;
463  }
464  }
465 
466 #ifdef LOGCONFIG_USE_ICMAP
467  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "logfile");
468  if (map_get_string(key_name, &value) == CS_OK) {
469  if (logsys_config_file_set (subsys, &error_reason, value) < 0) {
470  goto parse_error;
471  }
472  free(value);
473  }
474 #else
475  if (!subsys) {
476  if (logsys_config_file_set (subsys, &error_reason, main_logfile) < 0) {
477  goto parse_error;
478  }
479  }
480 #endif
481 
482  if (corosync_main_config_log_destination_set (path, "to_file", subsys, &error_reason,
483  LOGSYS_MODE_OUTPUT_FILE, 1, 0, "to_logfile") != 0)
484  goto parse_error;
485 
486  if (corosync_main_config_log_destination_set (path, "to_logfile", subsys, &error_reason,
487  LOGSYS_MODE_OUTPUT_FILE, 0, 0, NULL) != 0)
488  goto parse_error;
489 
490  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "logfile_priority");
491  if (map_get_string(key_name, &value) == CS_OK) {
492  int logfile_priority;
493 
494  logfile_priority = logsys_priority_id_get(value);
495  free(value);
496  if (logfile_priority < 0) {
497  error_reason = "unknown logfile priority specified";
498  goto parse_error;
499  }
501  logfile_priority) < 0) {
502  error_reason = "unable to set logfile priority";
503  goto parse_error;
504  }
505  }
506  else if(strcmp(key_name,"logging.logfile_priority") == 0){
508  logsys_priority_id_get("info")) < 0) {
509  error_reason = "unable to set syslog level";
510  goto parse_error;
511  }
512  }
513 
514  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "debug");
515  if (map_get_string(key_name, &value) == CS_OK) {
516  if (strcmp (value, "trace") == 0) {
517  if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_TRACE) < 0) {
518  error_reason = "unable to set debug trace";
519  free(value);
520  goto parse_error;
521  }
522  } else
523  if (strcmp (value, "on") == 0) {
524  if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_ON) < 0) {
525  error_reason = "unable to set debug on";
526  free(value);
527  goto parse_error;
528  }
529  } else
530  if (strcmp (value, "off") == 0) {
531  if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_OFF) < 0) {
532  error_reason = "unable to set debug off";
533  free(value);
534  goto parse_error;
535  }
536  } else {
537  error_reason = "unknown value for debug";
538  free(value);
539  goto parse_error;
540  }
541  free(value);
542  }
543  else {
544  if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_OFF) < 0) {
545  error_reason = "unable to set debug off";
546  goto parse_error;
547  }
548  }
549 
550  return (0);
551 
552 parse_error:
553  *error_string = error_reason;
554 
555  return (-1);
556 }
557 
558 static int corosync_main_config_read_logging (
559  const char **error_string)
560 {
561  const char *error_reason;
562 #ifdef LOGCONFIG_USE_ICMAP
563  icmap_iter_t iter;
564  const char *key_name;
565 #else
566  cmap_iter_handle_t iter;
567  char key_name[CMAP_KEYNAME_MAXLEN];
568 #endif
569  char key_subsys[MAP_KEYNAME_MAXLEN];
570  char key_item[MAP_KEYNAME_MAXLEN];
571  int res;
572 
573  /* format set is supported only for toplevel */
574  if (corosync_main_config_format_set(&error_reason) < 0) {
575  goto parse_error;
576  }
577 
578  if (corosync_main_config_blackbox_set(&error_reason) < 0) {
579  goto parse_error;
580  }
581 
582  if (corosync_main_config_set ("logging", NULL, &error_reason) < 0) {
583  goto parse_error;
584  }
585 
586  /*
587  * we will need 2 of these to compensate for new logging
588  * config format
589  */
590 #ifdef LOGCONFIG_USE_ICMAP
591  iter = icmap_iter_init("logging.logger_subsys.");
592  while ((key_name = icmap_iter_next(iter, NULL, NULL)) != NULL) {
593 #else
594  cmap_iter_init(cmap_handle, "logging.logger_subsys.", &iter);
595  while ((cmap_iter_next(cmap_handle, iter, key_name, NULL, NULL)) == CS_OK) {
596 #endif
597  res = sscanf(key_name, "logging.logger_subsys.%[^.].%s", key_subsys, key_item);
598 
599  if (res != 2) {
600  continue ;
601  }
602 
603  if (strcmp(key_item, "subsys") != 0) {
604  continue ;
605  }
606 
607  if (snprintf(key_item, MAP_KEYNAME_MAXLEN, "logging.logger_subsys.%s",
608  key_subsys) >= MAP_KEYNAME_MAXLEN) {
609  /*
610  * This should never happen
611  */
612  error_reason = "Can't snprintf logger_subsys key_item";
613  goto parse_error;
614  }
615 
616  if (corosync_main_config_set(key_item, key_subsys, &error_reason) < 0) {
617  goto parse_error;
618  }
619  }
620 #ifdef LOGCONFIG_USE_ICMAP
621  icmap_iter_finalize(iter);
622 #else
624 #endif
625 
627 
628  /* Reconfigure knet logging */
630  return 0;
631 
632 parse_error:
633  *error_string = error_reason;
634 
635  return (-1);
636 }
637 
638 #ifdef LOGCONFIG_USE_ICMAP
639 static void main_logging_notify(
640  int32_t event,
641  const char *key_name,
642  struct icmap_notify_value new_val,
643  struct icmap_notify_value old_val,
644  void *user_data)
645 #else
646 static void main_logging_notify(
647  cmap_handle_t cmap_handle_unused,
648  cmap_handle_t cmap_track_handle_unused,
649  int32_t event,
650  const char *key_name,
651  struct cmap_notify_value new_val,
652  struct cmap_notify_value old_val,
653  void *user_data)
654 #endif
655 {
656  const char *error_string;
657  static int reload_in_progress = 0;
658 
659  /* If a full reload happens then suspend updates for individual keys until
660  * it's all completed
661  */
662  if (strcmp(key_name, "config.reload_in_progress") == 0) {
663  if (*(uint8_t *)new_val.data == 1) {
664  reload_in_progress = 1;
665  } else {
666  reload_in_progress = 0;
667  }
668  }
669  if (reload_in_progress) {
670  log_printf(LOGSYS_LEVEL_DEBUG, "Ignoring key change, reload in progress. %s\n", key_name);
671  return;
672  }
673 
674  /*
675  * Reload the logsys configuration
676  */
677  if (logsys_format_set(NULL) == -1) {
678  fprintf (stderr, "Unable to setup logging format.\n");
679  }
680  corosync_main_config_read_logging(&error_string);
681 }
682 
683 #ifdef LOGCONFIG_USE_ICMAP
684 static void add_logsys_config_notification(void)
685 {
686  icmap_track_t icmap_track = NULL;
687 
688  icmap_track_add("logging.",
690  main_logging_notify,
691  NULL,
692  &icmap_track);
693 
694  icmap_track_add("config.reload_in_progress",
696  main_logging_notify,
697  NULL,
698  &icmap_track);
699 }
700 #else
701 static void add_logsys_config_notification(void)
702 {
703  cmap_track_handle_t cmap_track;
704 
705  cmap_track_add(cmap_handle, "logging.",
707  main_logging_notify,
708  NULL,
709  &cmap_track);
710 
711  cmap_track_add(cmap_handle, "config.reload_in_progress",
713  main_logging_notify,
714  NULL,
715  &cmap_track);
716 }
717 #endif
718 
720 #ifndef LOGCONFIG_USE_ICMAP
721  cmap_handle_t cmap_h,
722  const char *default_logfile,
723 #endif
724  const char **error_string)
725 {
726  const char *error_reason = error_string_response;
727 
728 #ifndef LOGCONFIG_USE_ICMAP
729  if (!cmap_h) {
730  error_reason = "No cmap handle";
731  return (-1);
732  }
733  if (!default_logfile) {
734  error_reason = "No default logfile";
735  return (-1);
736  }
737  cmap_handle = cmap_h;
738  main_logfile = default_logfile;
739 #endif
740 
741  if (corosync_main_config_read_logging(error_string) < 0) {
742  error_reason = *error_string;
743  goto parse_error;
744  }
745 
746  add_logsys_config_notification();
747 
748  return 0;
749 
750 parse_error:
751  snprintf (error_string_response, sizeof(error_string_response),
752  "parse error in config: %s.\n",
753  error_reason);
754 
755  *error_string = error_string_response;
756  return (-1);
757 }
@ CS_OK
Definition: corotypes.h:99
uint32_t value
uint64_t cmap_iter_handle_t
Definition: cmap.h:59
#define CMAP_KEYNAME_MAXLEN
Definition: cmap.h:69
cs_error_t cmap_iter_next(cmap_handle_t handle, cmap_iter_handle_t iter_handle, char key_name[], size_t *value_len, cmap_value_types_t *type)
Return next item in iterator iter.
Definition: lib/cmap.c:878
cs_error_t cmap_track_add(cmap_handle_t handle, const char *key_name, int32_t track_type, cmap_notify_fn_t notify_fn, void *user_data, cmap_track_handle_t *cmap_track_handle)
Add tracking function for given key_name.
Definition: lib/cmap.c:977
uint64_t cmap_handle_t
Definition: cmap.h:54
uint64_t cmap_track_handle_t
Definition: cmap.h:64
#define CMAP_TRACK_DELETE
Definition: cmap.h:79
#define CMAP_TRACK_ADD
Definition: cmap.h:78
cs_error_t cmap_iter_finalize(cmap_handle_t handle, cmap_iter_handle_t iter_handle)
Finalize iterator.
Definition: lib/cmap.c:938
cs_error_t cmap_iter_init(cmap_handle_t handle, const char *prefix, cmap_iter_handle_t *cmap_iter_handle)
Initialize iterator with given prefix.
Definition: lib/cmap.c:823
#define CMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem....
Definition: cmap.h:87
#define CMAP_TRACK_MODIFY
Definition: cmap.h:80
#define ICMAP_TRACK_MODIFY
Definition: icmap.h:78
#define ICMAP_TRACK_DELETE
Definition: icmap.h:77
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
#define ICMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem....
Definition: icmap.h:85
icmap_iter_t icmap_iter_init(const char *prefix)
Initialize iterator with given prefix.
Definition: icmap.c:1089
const char * icmap_iter_next(icmap_iter_t iter, size_t *value_len, icmap_value_types_t *type)
Return next item in iterator iter.
Definition: icmap.c:1095
qb_map_iter_t * icmap_iter_t
Itterator type.
Definition: icmap.h:123
void icmap_iter_finalize(icmap_iter_t iter)
Finalize iterator.
Definition: icmap.c:1116
#define ICMAP_TRACK_ADD
Definition: icmap.h:76
#define MAP_KEYNAME_MAXLEN
Definition: logconfig.c:49
#define map_get_string(key_name, value)
Definition: logconfig.c:50
int corosync_log_config_read(cmap_handle_t cmap_h, const char *default_logfile, const char **error_string)
Definition: logconfig.c:719
unsigned int logsys_config_mode_get(const char *subsys)
logsys_config_mode_get
Definition: logsys.c:527
#define log_printf(level, format, args...)
Definition: logsys.h:332
int logsys_config_mode_set(const char *subsys, unsigned int mode)
logsys_config_mode_set
Definition: logsys.c:505
void logsys_blackbox_set(int enable)
Definition: logsys.c:883
#define LOGSYS_DEBUG_OFF
Definition: logsys.h:92
int logsys_config_file_set(const char *subsys, const char **error_string, const char *file)
to close a logfile, just invoke this function with a NULL file or if you want to change logfile,...
Definition: logsys.c:539
#define LOGSYS_MODE_OUTPUT_STDERR
Definition: logsys.h:61
int logsys_config_syslog_priority_set(const char *subsys, unsigned int priority)
logsys_config_syslog_priority_set
Definition: logsys.c:664
#define LOGSYS_DEBUG_TRACE
Definition: logsys.h:94
char * logsys_format_get(void)
logsys_format_get
Definition: logsys.c:652
void logsys_config_apply(void)
logsys_config_apply
Definition: logsys.c:792
int logsys_priority_id_get(const char *name)
logsys_priority_id_get
Definition: logsys.c:849
int logsys_config_logfile_priority_set(const char *subsys, unsigned int priority)
logsys_config_logfile_priority_set
Definition: logsys.c:691
#define LOGSYS_DEBUG_ON
Definition: logsys.h:93
int logsys_config_debug_set(const char *subsys, unsigned int value)
enabling debug, disable message priority filtering.
Definition: logsys.c:823
#define LOGSYS_LEVEL_WARNING
Definition: logsys.h:73
int _logsys_subsys_create(const char *subsys, const char *filename)
_logsys_subsys_create
Definition: logsys.c:435
int logsys_config_syslog_facility_set(const char *subsys, unsigned int facility)
per system/subsystem settings.
Definition: logsys.c:657
#define LOGSYS_LEVEL_DEBUG
Definition: logsys.h:76
#define LOGSYS_MODE_OUTPUT_FILE
Definition: logsys.h:60
#define LOGSYS_MODE_OUTPUT_SYSLOG
Definition: logsys.h:62
int logsys_format_set(const char *format)
configuration bits that can only be done for the whole system
Definition: logsys.c:593
void * user_data
Definition: sam.c:127
cmap_handle_t cmap_handle
Definition: sam.c:137
Structure passed as new_value and old_value in change callback.
Definition: cmap.h:117
const void * data
Definition: cmap.h:120
Structure passed as new_value and old_value in change callback.
Definition: icmap.h:91
void totemknet_configure_log_level()
Definition: totemknet.c:888