GNU/Linux >> Znalost Linux >  >> Linux

na proces konfigurovatelný adresář výpisu jádra

Ne, nemůžete to nastavit pro každý proces. Soubor jádra bude uložen buď do aktuálního pracovního adresáře procesu, nebo do adresáře nastaveného v /proc/sys/kernel/core_pattern, pokud vzor obsahuje adresář.

CoreDumpDirectory v Apache je hack, apache registruje obslužné programy signálů pro všechny signály, které způsobují výpis jádra, a mění aktuální adresář ve svém obslužném programu signálu.

/* handle all varieties of core dumping signals */
static void sig_coredump(int sig)
{
    apr_filepath_set(ap_coredump_dir, pconf);
    apr_signal(sig, SIG_DFL);
#if AP_ENABLE_EXCEPTION_HOOK
    run_fatal_exception_hook(sig);
#endif
    /* linuxthreads issue calling getpid() here:
     *   This comparison won't match if the crashing thread is
     *   some module's thread that runs in the parent process.
     *   The fallout, which is limited to linuxthreads:
     *   The special log message won't be written when such a
     *   thread in the parent causes the parent to crash.
     */
    if (getpid() == parent_pid) {
        ap_log_error(APLOG_MARK, APLOG_NOTICE,
                     0, ap_server_conf,
                     "seg fault or similar nasty error detected "
                     "in the parent process");
        /* XXX we can probably add some rudimentary cleanup code here,
         * like getting rid of the pid file.  If any additional bad stuff
         * happens, we are protected from recursive errors taking down the
         * system since this function is no longer the signal handler   GLA
         */
    }
    kill(getpid(), sig);
    /* At this point we've got sig blocked, because we're still inside
     * the signal handler.  When we leave the signal handler it will
     * be unblocked, and we'll take the signal... and coredump or whatever
     * is appropriate for this particular Unix.  In addition the parent
     * will see the real signal we received -- whereas if we called
     * abort() here, the parent would only see SIGABRT.
     */
}

Linux
  1. UNIX / Linux:3 způsoby odesílání signálu do procesů

  2. Základy signálů Linuxu – část I

  3. Maximální počet vláken na proces v Linuxu?

  1. Vypsáno jádro, ale soubor jádra není v aktuálním adresáři?

  2. Jak nastavím pracovní adresář nadřazeného procesu?

  3. vytvořit pravidlo iptables pro proces/službu

  1. Linux – Jak omezit proces na jedno jádro CPU v Linuxu?

  2. Jak programově způsobit výpis jádra v C/C++

  3. Počítání otevřených souborů na proces