[maemo-commits] [maemo-commits] r8881 - in projects/haf/maemo-branches/IT-2006/maemo-af-desktop: . hildon-navigator

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Dec 28 11:08:15 EET 2006
Author: jobi
Date: 2006-12-28 11:08:14 +0200 (Thu, 28 Dec 2006)
New Revision: 8881

Modified:
   projects/haf/maemo-branches/IT-2006/maemo-af-desktop/ChangeLog
   projects/haf/maemo-branches/IT-2006/maemo-af-desktop/hildon-navigator/others-menu.c
Log:

2006-12-28  Johan Bilien <johan.bilien at nokia.com>

	* hildon-navigator/others-menu.c: For spawned processes, unprotect
	the child from OOM. Fixes: NB#49589



Modified: projects/haf/maemo-branches/IT-2006/maemo-af-desktop/ChangeLog
===================================================================
--- projects/haf/maemo-branches/IT-2006/maemo-af-desktop/ChangeLog	2006-12-27 14:00:27 UTC (rev 8880)
+++ projects/haf/maemo-branches/IT-2006/maemo-af-desktop/ChangeLog	2006-12-28 09:08:14 UTC (rev 8881)
@@ -1,3 +1,8 @@
+2006-12-28  Johan Bilien <johan.bilien at nokia.com>
+
+	* hildon-navigator/others-menu.c: For spawned processes, unprotect
+	the child from OOM. Fixes: NB#49589
+
 2006-09-29  Karoliina Salminen <karoliina.t.salminen at nokia.com>
 	
 	* Patched NB#41097

Modified: projects/haf/maemo-branches/IT-2006/maemo-af-desktop/hildon-navigator/others-menu.c
===================================================================
--- projects/haf/maemo-branches/IT-2006/maemo-af-desktop/hildon-navigator/others-menu.c	2006-12-27 14:00:27 UTC (rev 8880)
+++ projects/haf/maemo-branches/IT-2006/maemo-af-desktop/hildon-navigator/others-menu.c	2006-12-28 09:08:14 UTC (rev 8881)
@@ -53,6 +53,11 @@
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
 
+/* libc includes */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
 #include "osso-manager.h"
 
 /* log include */
@@ -232,7 +237,8 @@
                           exec_field, error->message);
                 g_clear_error(&error);
             } else {
-                int priority;
+                int priority, fd;
+                char *oom_filename;
 
                 errno = 0;
 
@@ -242,6 +248,21 @@
                 if (!errno && priority < 0) {
                     setpriority(PRIO_PROCESS, child_pid, 0);
                 }
+
+                /* OOM unprotect the child */
+                oom_filename = g_strdup_printf ("/proc/%i/oom_adj", child_pid);
+
+                fd = open (oom_filename, O_WRONLY);
+                if (fd >= 0)
+                {
+                    if (write (fd, "0", 1) < 0)
+                        ULOG_ERR ("Could not set OOM adjustment");
+
+                    close (fd);
+                }
+
+                g_free (oom_filename);
+
             }
 
         } else {


More information about the maemo-commits mailing list