예제 #1
0
파일: chibach.c 프로젝트: aigamo/trema
static void
finalize_chibach() {
  die_unless_initialized();

  debug( "Terminating chibach..." );

  maybe_finalize_openflow_switch_interface();

  finalize_messenger();
  finalize_stat();
  finalize_timer();
  chibach_started = false;
  unlink_pid( get_chibach_pid(), get_chibach_name() );

  unset_chibach_home();
  unset_chibach_tmp();

  xfree( chibach_name );
  chibach_name = NULL;

  xfree( chibach_log );
  chibach_log = NULL;

  initialized = false;
}
예제 #2
0
파일: daemon_test.c 프로젝트: kazuyas/trema
static void
test_unlink_pid_succeed() {
  will_return( mock_unlink, 0 );

  // Test if correctly unlinked.
  char path[] = "/home/yasuhito/trema/tmp/chess.pid";
  expect_string( mock_unlink, pathname, path );

  unlink_pid( "/home/yasuhito/trema/tmp", "chess" );
}
예제 #3
0
파일: daemon_test.c 프로젝트: kazuyas/trema
static void
test_unlink_pid_fail_if_unlink_fail() {
  will_return( mock_unlink, -1 );

  char path[] = "/home/yasuhito/trema/tmp/chess.pid";
  expect_string( mock_unlink, pathname, path );

  expect_string( mock_die, message, "Could not remove a PID file: /home/yasuhito/trema/tmp/chess.pid" );

  expect_assert_failure( unlink_pid( "/home/yasuhito/trema/tmp", "chess" ) );
}