[maemo-commits] [maemo-commits] r12231 - in projects/haf/trunk/hildon-desktop: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Jun 11 17:03:44 EEST 2007
Author: jobi
Date: 2007-06-11 17:03:40 +0300 (Mon, 11 Jun 2007)
New Revision: 12231

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c
Log:

2007-06-11  Johan Bilien  <johan.bilien at nokia.com>

	* src/hd-applications-menu.c:
	- unprotect spawned processes from the OOM shield.
	Fixes: NB#25830



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-06-11 12:27:30 UTC (rev 12230)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-06-11 14:03:40 UTC (rev 12231)
@@ -1,5 +1,11 @@
 2007-06-11  Johan Bilien  <johan.bilien at nokia.com>
 
+	* src/hd-applications-menu.c:
+	- unprotect spawned processes from the OOM shield.
+	Fixes: NB#25830
+
+2007-06-11  Johan Bilien  <johan.bilien at nokia.com>
+
 	* libhildonwm/hd-wm.[ch]:
 	- clean up D-Bus setup by removing unused handlers. Patch courtesy
 	of Kimmo Hämälainen

Modified: projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c	2007-06-11 12:27:30 UTC (rev 12230)
+++ projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c	2007-06-11 14:03:40 UTC (rev 12231)
@@ -30,6 +30,7 @@
 #include <errno.h>
 #include <sys/resource.h>
 #include <string.h>
+#include <fcntl.h>
 
 #include <glib.h>
 #include <glib/gstdio.h>
@@ -470,6 +471,8 @@
       {
         int priority;
         errno = 0;
+        gchar *oom_filename;
+        int fd;
 
         /* If the child process inherited desktop's high priority,
          * give child default priority */
@@ -479,6 +482,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);
+          }
+
       }
     }
     else


More information about the maemo-commits mailing list