[X2Go-Commits] [x2goclient] 12/267: unixhelper.{cpp, h}: add documentation/comments.

git-admin at x2go.org git-admin at x2go.org
Sat Dec 10 13:35:17 CET 2016


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 1a89afd87c13627f7a6884ce19d193bcc7994f11
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Mon Mar 16 22:04:19 2015 +0100

    unixhelper.{cpp,h}: add documentation/comments.
---
 debian/changelog   |    1 +
 src/unixhelper.cpp |    4 ++++
 src/unixhelper.h   |   24 ++++++++++++++++++++++++
 src/x2goclient.cpp |    2 ++
 4 files changed, 31 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 900473e..f12cd03 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -31,6 +31,7 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
     - unixhelper.h: forgot to declare type of unix_cleanup() function.
     - {unixhelper.{cpp,h},x2goclient.cpp}: unixhelper should really be a
       (module) namespace, not a class.
+    - unixhelper.{cpp,h}: add documentation/comments.
 
   [ Bernard Cafarelli ]
   * New upstream version (4.0.5.3):
diff --git a/src/unixhelper.cpp b/src/unixhelper.cpp
index b0729c6..2ad0740 100644
--- a/src/unixhelper.cpp
+++ b/src/unixhelper.cpp
@@ -30,6 +30,8 @@
 #include <cerrno>
 #include <cstdlib>
 
+/* For documentation please see unixhelper.h. */
+
 namespace unixhelper {
   void kill_pgroup (int signal) {
     if (SIGHUP == signal) {
@@ -51,6 +53,8 @@ namespace unixhelper {
     if (SIG_ERR == std::signal (SIGTERM, SIG_IGN)) {
       std::cerr << "Unable to ignore SIGTERM: " << std::strerror (errno) << std::endl;
       std::exit (1);
+
+      /* Anything here shall be unreachable. */
     }
 
     std::signal (SIGHUP, kill_pgroup);
diff --git a/src/unixhelper.h b/src/unixhelper.h
index fe86017..a00d21b 100644
--- a/src/unixhelper.h
+++ b/src/unixhelper.h
@@ -26,7 +26,31 @@
 #ifdef Q_OS_UNIX
 
 namespace unixhelper {
+  /*
+   * TODO: Unblocks all signals and
+   * installs a signal handler for SIGHUP, which calls kill_pgroup.
+   *
+   * TODO: Should signal unblocking or
+   * installing the signal handler fail, an emergency exit is performed
+   * and the whole process group killed.
+   *
+   * Loops indefinitely afterwards.
+   */
   int unix_cleanup ();
+
+  /*
+   * Kills the whole process group.
+   * First, SIGTERM is sent to the group.
+   * A 5 seconds grace period is granted to make sure
+   * processes exit cleanly on their own.
+   * Lastly, SIGKILL is sent to the group -- which also
+   * implies the demise of this program.
+   *
+   * signal may be any of:
+   *   * -1       to indicate an error leading to emergency termination
+   *   * SIGHUP   as the standard signal that is sent when the
+   *              group leeader dies
+   */
   void kill_pgroup (int signal);
 }
 
diff --git a/src/x2goclient.cpp b/src/x2goclient.cpp
index 7eb6511..e7ec69b 100644
--- a/src/x2goclient.cpp
+++ b/src/x2goclient.cpp
@@ -39,6 +39,8 @@ int fork_helper (int argc, char **argv) {
   if (0 == tmp_pid) {
     /* Starting unixhelper. */
     unixhelper::unix_cleanup ();
+
+    /* Anything here shall be unreachable. */
   }
   /* Error. */
   else if (-1 == tmp_pid) {

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list