[maemo-commits] [maemo-commits] r11911 - in projects/haf/trunk/osso-af-startup: debian top-scripts

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon May 28 17:57:57 EEST 2007
Author: kihamala
Date: 2007-05-28 17:57:56 +0300 (Mon, 28 May 2007)
New Revision: 11911

Modified:
   projects/haf/trunk/osso-af-startup/debian/changelog
   projects/haf/trunk/osso-af-startup/top-scripts/af-services
Log:
added intelligence to OOM protection setting in af-services


Modified: projects/haf/trunk/osso-af-startup/debian/changelog
===================================================================
--- projects/haf/trunk/osso-af-startup/debian/changelog	2007-05-28 14:57:10 UTC (rev 11910)
+++ projects/haf/trunk/osso-af-startup/debian/changelog	2007-05-28 14:57:56 UTC (rev 11911)
@@ -1,3 +1,11 @@
+osso-af-startup (1.42-1) unstable; urgency=low
+
+  * UNRELEASED
+  * Setting the OOM killer protection more intelligently in af-services.
+    (Related to NB#52080.)
+
+ -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Mon, 28 May 2007 17:29:11 +0300
+
 osso-af-startup (1.41-1) unstable; urgency=low
 
   * Added sourcing of sdl.defs. (Related to NB#54725)

Modified: projects/haf/trunk/osso-af-startup/top-scripts/af-services
===================================================================
--- projects/haf/trunk/osso-af-startup/top-scripts/af-services	2007-05-28 14:57:10 UTC (rev 11910)
+++ projects/haf/trunk/osso-af-startup/top-scripts/af-services	2007-05-28 14:57:56 UTC (rev 11911)
@@ -2,7 +2,7 @@
 #
 # This file is part of osso-af-startup.
 #
-# Copyright (C) 2004-2006 Nokia Corporation. All rights reserved.
+# Copyright (C) 2004-2007 Nokia Corporation. All rights reserved.
 #
 # Contact: Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>
 #
@@ -21,9 +21,30 @@
 # 02110-1301 USA
 
 # Exclude some UIDs from memory allocation denial.
-# 30000 is messagebus, 30001 could be used by Matchbox
-echo "30000 30001 30002 30003" > /proc/sys/vm/lowmem_allowed_uids
+getuid()
+{
+  echo `cat /etc/passwd | grep "^$1" | awk -F ':' '{print $3}'`
+}
 
+# ensure these UIDs are protected for backwards compatibility
+TMP_UIDS="30000 30001 30002 30003"
+
+# ensure these users are protected
+for n in messagebus systemui haldaemon; do
+  TMP_UIDS="$TMP_UIDS `getuid $n`"
+done
+
+UIDS=""
+for n in $TMP_UIDS; do
+  echo $UIDS | grep $n > /dev/null
+  if [ $? != 0 ]; then
+    UIDS="$UIDS $n"
+  fi
+done
+
+echo "Protecting UIDs $UIDS from the memory allocation denial."
+echo $UIDS > /proc/sys/vm/lowmem_allowed_uids
+
 # activate lowmem module
 echo 92 > /proc/sys/vm/lowmem_deny_watermark
 echo 85 > /proc/sys/vm/lowmem_notify_high


More information about the maemo-commits mailing list