Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
nsSigHandlers.cpp File Reference
#include <signal.h>
#include <stdio.h>
#include "prthread.h"
#include "plstr.h"
#include "prenv.h"

Go to the source code of this file.


void InstallUnixSignalHandlers (const char *ProgramName)


static char _progname [1024] = "huh?"
static unsigned int _gdb_sleep_duration = 300

Function Documentation

void InstallUnixSignalHandlers ( const char *  ProgramName)

Definition at line 159 of file nsSigHandlers.cpp.


  PL_strncpy(_progname,ProgramName, (sizeof(_progname)-1) );

  const char *gdbSleep = PR_GetEnv("MOZ_GDB_SLEEP");
  if (gdbSleep && *gdbSleep)
    unsigned int s;
    if (1 == sscanf(gdbSleep, "%u", &s)) {
      _gdb_sleep_duration = s;

#if defined(MOZ_WIDGET_PHOTON)
 /* Neutrino need this to free shared memory in case of a crash */
  signal(SIGTERM, abnormal_exit_handler);
  signal(SIGQUIT, abnormal_exit_handler);
  signal(SIGINT,  abnormal_exit_handler);
  signal(SIGHUP,  abnormal_exit_handler);
  signal(SIGSEGV, abnormal_exit_handler);
  signal(SIGILL,  abnormal_exit_handler);
  signal(SIGABRT, abnormal_exit_handler);

  signal(SIGSEGV, ah_crap_handler);
  signal(SIGILL, ah_crap_handler);
  signal(SIGABRT, ah_crap_handler);

#if defined(DEBUG) && defined(LINUX)
  char *text = PR_GetEnv("MOZ_MEM_LIMIT");
  if (text) 
    long m = atoi(text);
    m *= (1024*1024);    
    struct rlimit r;
    r.rlim_cur = m;
    r.rlim_max = m;
    setrlimit(RLIMIT_AS, &r);

#if defined(SOLARIS)

    #define NOFILES 512

    // Boost Solaris file descriptors
       struct rlimit rl;
       if (getrlimit(RLIMIT_NOFILE, &rl) == 0)

           if (rl.rlim_cur < NOFILES) {
              rl.rlim_cur = NOFILES;

              if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
                  fprintf(stderr, "Cannot exceed hard limit for open files");
#if defined(DEBUG)
              if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
                  printf("File descriptors set to %d\n", rl.rlim_cur);
#endif //DEBUG
#endif //SOLARIS

#ifdef XP_BEOS
       signal(SIGTERM, beos_signal_handler);

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

unsigned int _gdb_sleep_duration = 300 [static]

Definition at line 77 of file nsSigHandlers.cpp.

char _progname[1024] = "huh?" [static]

Definition at line 76 of file nsSigHandlers.cpp.