コード例 #1
0
static void
_init_cfg_with_persist_file(const gchar *persist_file)
{
  main_thread_handle = get_thread_id();
  cfg = cfg_new_snippet();
  cfg->threaded = FALSE;
  cfg->state = persist_state_new(persist_file);
  cfg->keep_hostname = TRUE;
  persist_state_start(cfg->state);
}
コード例 #2
0
ファイル: test_hostid.c プロジェクト: lmesz/syslog-ng
static PersistState *
create_persist_state(const gchar *persist_file)
{
  PersistState *state;

  state = persist_state_new(persist_file);

  assert_true(persist_state_start(state) == TRUE,
              "Error starting persist state object [%s]\n",
              persist_file);
  return state;
}
コード例 #3
0
ファイル: persist_lib.c プロジェクト: Achint08/syslog-ng
PersistState *
create_persist_state_for_test(const gchar *name)
{
  PersistState *state = persist_state_new(name);
  if (!persist_state_start(state))
    {
      fprintf(stderr, "Error starting persist_state object\n");
      exit(1);
    }

  return state;
};
コード例 #4
0
void
test_persist_state_open_success_on_invalid_file(void)
{
    PersistState *state;
    int fd;
    unlink("test_invalid_magic.persist");

    fd = open("test_invalid_magic.persist", O_CREAT | O_RDWR, 0777);
    write(fd, "aaa", 3);
    close(fd);

    state = persist_state_new("test_invalid_magic.persist");
    assert_true(persist_state_start(state), "persist_state_start returned with false!");

    cancel_and_destroy_persist_state(state);
}
コード例 #5
0
int
main(int argc, char **argv)
{
  app_startup();
  main_thread_handle =  get_thread_id();
  configuration = cfg_new(0x306);
  configuration->threaded = FALSE;
  configuration->state = persist_state_new("test_systemd_journal.persist");
  configuration->keep_hostname = TRUE;
  persist_state_start(configuration->state);
  JOURNALD_TESTCASE(test_journald_mock);
  JOURNALD_TESTCASE(test_journald_helper);
  JOURNALD_TESTCASE(test_journal_reader);
  persist_state_cancel(configuration->state);
  unlink("test_systemd_journal.persist");
  app_shutdown();
  return 0;
}
コード例 #6
0
ファイル: mainloop.c プロジェクト: Cytrian/syslog-ng
/* called when syslog-ng first starts up */
gboolean
main_loop_initialize_state(GlobalConfig *cfg, const gchar *persist_filename)
{
  gboolean success;

  cfg->state = persist_state_new(persist_filename);
  if (!persist_state_start(cfg->state))
    return FALSE;

  run_id_init(cfg->state);
  host_id_init(cfg->state);
  success = cfg_init(cfg);

  if (success)
    persist_state_commit(cfg->state);
  else
    persist_state_cancel(cfg->state);
  return success;
}