[maemo-commits] [maemo-commits] r9350 - in projects/haf/trunk/maemo-af-desktop: . hildon-navigator

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Jan 25 16:54:27 EET 2007
Author: jobi
Date: 2007-01-25 16:54:23 +0200 (Thu, 25 Jan 2007)
New Revision: 9350

Modified:
   projects/haf/trunk/maemo-af-desktop/ChangeLog
   projects/haf/trunk/maemo-af-desktop/hildon-navigator/hn-others-button.c
Log:

2007-01-25  Johan Bilien <johan.bilien at nokia.com>

	* hildon-navigator/hn-others-button.c: unprotect spawned
	children from OOM kernel killing. Fixes: NB#49535



Modified: projects/haf/trunk/maemo-af-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/maemo-af-desktop/ChangeLog	2007-01-25 14:49:44 UTC (rev 9349)
+++ projects/haf/trunk/maemo-af-desktop/ChangeLog	2007-01-25 14:54:23 UTC (rev 9350)
@@ -1,3 +1,8 @@
+2007-01-25  Johan Bilien <johan.bilien at nokia.com>
+
+	* hildon-navigator/hn-others-button.c: unprotect spawned
+	children from OOM kernel killing. Fixes: NB#49535
+
 2007-01-24  Johan Bilien <johan.bilien at nokia.com>
 
 	* configure.ac: 2.9.99.18

Modified: projects/haf/trunk/maemo-af-desktop/hildon-navigator/hn-others-button.c
===================================================================
--- projects/haf/trunk/maemo-af-desktop/hildon-navigator/hn-others-button.c	2007-01-25 14:49:44 UTC (rev 9349)
+++ projects/haf/trunk/maemo-af-desktop/hildon-navigator/hn-others-button.c	2007-01-25 14:54:23 UTC (rev 9350)
@@ -36,7 +36,12 @@
 #include <errno.h>
 #include <sys/resource.h>
 #include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
 
+
 /* GLib include */
 #include <glib.h>
 #include <glib/gstdio.h>
@@ -362,6 +367,8 @@
 	      {
                 int priority;
                 errno = 0;
+                gchar *oom_filename;
+                int fd;
 
                 /* If the child process inherited desktop's high priority,
                  * give child default priority */
@@ -371,6 +378,19 @@
 		  {
                     setpriority(PRIO_PROCESS, child_pid, 0);
 		  }
+
+                /* Unprotect from OOM */
+                oom_filename = g_strdup_printf ("/proc/%i/oom_adj",
+                                                child_pid);
+                fd = open (oom_filename, O_WRONLY);
+                g_free (oom_filename);
+
+                if (fd >= 0)
+                {
+                    write (fd, "0", sizeof (char));
+                    close (fd);
+                }
+
 	      }
 
 	  }


More information about the maemo-commits mailing list