Ejemplo n.º 1
0
/**
 * g_process_finish:
 *
 * This is a public API function to be called by the user code when the
 * daemon exits after properly initialized (e.g. when it terminates because
 * of SIGTERM). This function currently only removes the PID file.
 **/
void
g_process_finish(void)
{
#ifdef SYSLOG_NG_HAVE_ENVIRON
  /**
   * There is a memory leak for **environ and elements that should be
   * freed here theoretically.
   *
   * The reason why environ is copied during g_process_set_argv_space
   * so to be able to overwrite process title in ps/top commands to
   * supervisor. In bsd there is setproctitle call which solve this,
   * but currently it is not available for linux.
   *
   * The problem is that modules can add their own env variables to the
   * list, which must not be freed here, otherwise it would result
   * double free (e.g some version of Oracle Java). One might also would
   * try to track which environment variables are added by syslog-ng,
   * and free only those. There is still a problem with this, **environ
   * itself cannot be freed in some cases. For example libcurl registers
   * an atexit function which needs an environment variable, that would
   * be freed here before at_exit is called, resulting in invalid read.
   *
   * As this leak does not cause any real problem like accumulating over
   * time, it is safe to leave it as it is.
  */
#endif

  g_process_remove_pidfile();
}
Ejemplo n.º 2
0
/**
 * g_process_finish:
 *
 * This is a public API function to be called by the user code when the
 * daemon exits after properly initialized (e.g. when it terminates because
 * of SIGTERM). This function currently only removes the PID file.
 **/
void
g_process_finish(void)
{
  g_process_remove_pidfile();
}