aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md24
-rw-r--r--singleapplication.cpp20
2 files changed, 30 insertions, 14 deletions
diff --git a/README.md b/README.md
index f677ba6..465f0e9 100644
--- a/README.md
+++ b/README.md
@@ -54,14 +54,22 @@ Implementation
--------------
The library is implemented with a QSharedMemory block which is thread safe and guarantees a race condition will not occur. It also uses a QLocalSocket to notify the main process that a new instance had been spawned and thus invoke the `showUp()` signal.
-To handle an issue on `*nix` systems, where the operating system owns the shared memory block and if the program crashes the memory remains untouched, the library binds to the following signals and closes the program with error code = `128 + signum` where signum is the number representation of the signal listed below. Handling the signal is required in order to safely delete the `QSharedMemory` block.
-
-* `SIGINT ` - `2`
-* `SIGILL ` - `4`
-* `SIGABRT` - `6`
-* `SIGFPE ` - `8`
-* `SIGSEGV` - `11`
-* `SIGTERM` - `15`
+To handle an issue on `*nix` systems, where the operating system owns the shared memory block and if the program crashes the memory remains untouched, the library binds to the following signals and closes the program with error code = `128 + signum` where signum is the number representation of the signal listed below. Handling the signal is required in order to safely delete the `QSharedMemory` block. Each of these signals are potentially lethal and will results in process termination.
+
+* `SIGHUP` - `1`, Hangup.
+* `SIGINT` - `2`, Terminal interrupt signal
+* `SIGQUIT` - `3`, Terminal quit signal.
+* `SIGILL` - `4`, Illegal instruction.
+* `SIGABRT` - `6`, Process abort signal.
+* `SIGBUS` - `7`, Access to an undefined portion of a memory object.
+* `SIGFPE` - `8`, Erroneous arithmetic operation (such as division by zero).
+* `SIGSEGV` - `11`, Invalid memory reference.
+* `SIGSYS` - `12`, Bad system call.
+* `SIGPIPE` - `13`, Write on a pipe with no one to read it.
+* `SIGALRM` - `14`, Alarm clock.
+* `SIGTERM` - `15`, Termination signal.
+* `SIGXCPU` - `24`, CPU time limit exceeded.
+* `SIGXFSZ` - `25`, File size limit exceeded.
License
diff --git a/singleapplication.cpp b/singleapplication.cpp
index 27e2bb1..34197f1 100644
--- a/singleapplication.cpp
+++ b/singleapplication.cpp
@@ -43,12 +43,20 @@ public:
}
// Handle any further termination signals to ensure the
// QSharedMemory block is deleted even if the process crashes
- signal(SIGSEGV, SingleApplicationPrivate::terminate);
- signal(SIGABRT, SingleApplicationPrivate::terminate);
- signal(SIGFPE, SingleApplicationPrivate::terminate);
- signal(SIGILL, SingleApplicationPrivate::terminate);
- signal(SIGINT, SingleApplicationPrivate::terminate);
- signal(SIGTERM, SingleApplicationPrivate::terminate);
+ signal(SIGHUP, SingleApplicationPrivate::terminate); // 1
+ signal(SIGINT, SingleApplicationPrivate::terminate); // 2
+ signal(SIGQUIT, SingleApplicationPrivate::terminate); // 3
+ signal(SIGILL, SingleApplicationPrivate::terminate); // 4
+ signal(SIGABRT, SingleApplicationPrivate::terminate); // 6
+ signal(SIGBUS, SingleApplicationPrivate::terminate); // 7
+ signal(SIGFPE, SingleApplicationPrivate::terminate); // 8
+ signal(SIGSEGV, SingleApplicationPrivate::terminate); // 11
+ signal(SIGSYS, SingleApplicationPrivate::terminate); // 12
+ signal(SIGPIPE, SingleApplicationPrivate::terminate); // 13
+ signal(SIGALRM, SingleApplicationPrivate::terminate); // 14
+ signal(SIGTERM, SingleApplicationPrivate::terminate); // 15
+ signal(SIGXCPU, SingleApplicationPrivate::terminate); // 24
+ signal(SIGXFSZ, SingleApplicationPrivate::terminate); // 25
}
static void terminate(int signum)