[Pkg-utopia-commits] r1505 - in /packages/unstable/dhcdbd/debian: changelog patches/50-dynamic-timeout.patch
biebl at users.alioth.debian.org
biebl at users.alioth.debian.org
Thu May 24 22:51:02 UTC 2007
Author: biebl
Date: Thu May 24 22:51:01 2007
New Revision: 1505
URL: http://svn.debian.org/wsvn/pkg-utopia/?sc=1&rev=1505
Log:
* debian/patches/50-dynamic-timeout.patch
- Prevent high frequency polling in the main loop by using a
dynamic timeout. This should allow longer periods of sleep with a
dyntick enabled kernel. (Closes: #425500, #424030)
Patch by Keith Packard.
Added:
packages/unstable/dhcdbd/debian/patches/50-dynamic-timeout.patch
Modified:
packages/unstable/dhcdbd/debian/changelog
Modified: packages/unstable/dhcdbd/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/dhcdbd/debian/changelog?rev=1505&op=diff
==============================================================================
--- packages/unstable/dhcdbd/debian/changelog (original)
+++ packages/unstable/dhcdbd/debian/changelog Thu May 24 22:51:01 2007
@@ -1,3 +1,13 @@
+dhcdbd (2.0-5) unstable; urgency=low
+
+ * debian/patches/50-dynamic-timeout.patch
+ - Prevent high frequency polling in the main loop by using a
+ dynamic timeout. This should allow longer periods of sleep with a
+ dyntick enabled kernel. (Closes: #425500, #424030)
+ Patch by Keith Packard.
+
+ -- Michael Biebl <biebl at debian.org> Tue, 22 May 2007 23:14:28 +0200
+
dhcdbd (2.0-4) unstable; urgency=low
* Install the dhcdbd start script as regular SysV init script
Added: packages/unstable/dhcdbd/debian/patches/50-dynamic-timeout.patch
URL: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/dhcdbd/debian/patches/50-dynamic-timeout.patch?rev=1505&op=file
==============================================================================
--- packages/unstable/dhcdbd/debian/patches/50-dynamic-timeout.patch (added)
+++ packages/unstable/dhcdbd/debian/patches/50-dynamic-timeout.patch Thu May 24 22:51:01 2007
@@ -1,0 +1,69 @@
+diff -ur dhcdbd-2.0.bak/src/dbus_service.c dhcdbd-2.0/src/dbus_service.c
+--- dhcdbd-2.0.bak/src/dbus_service.c 2007-05-14 20:02:41.000000000 +0100
++++ dhcdbd-2.0/src/dbus_service.c 2007-05-14 20:05:23.000000000 +0100
+@@ -976,6 +976,51 @@
+ twalk(cs->timeouts, process_timeout);
+ }
+
++static float next_timeout;
++
++static void find_timeout (const void *p, const VISIT which, const int level) {
++ DBusConnectionState *cs;
++ const void *const *tpp = p;
++ DBusConnectionTimeout *to;
++ struct timeval tv;
++ float now, then, interval, timeout;
++
++ gettimeofday(&tv, 0L);
++
++ if ((tpp != 0L) && (*tpp != 0L) && ((which == postorder) || (which == leaf))) {
++ to = (DBusConnectionTimeout *) * tpp;
++ cs = to->cs;
++
++ if (!dbus_timeout_get_enabled(to->to))
++ return;
++
++ cs = dbus_timeout_get_data(to->to);
++ then = ((float) to->tv.tv_sec) + (((float) to->tv.tv_usec) / 1000000.0);
++
++ if (then != 0.0) {
++ interval = ((float) dbus_timeout_get_interval(to->to)) / 1000.0;
++ now = ((float) tv.tv_sec) + (((float) tv.tv_usec) / 1000000.0);
++
++ timeout = then + interval - now;
++ if (timeout < 0)
++ timeout = 0;
++ if (next_timeout < 0 || timeout < next_timeout)
++ next_timeout = timeout;
++ }
++ }
++}
++
++static struct timeval *find_next_timeout (DBusConnectionState * cs, struct timeval *tv) {
++ next_timeout = 1;
++ twalk(cs->timeouts, find_timeout);
++ printf ("next timeout %f\n", next_timeout);
++ if (next_timeout == -1)
++ return NULL;
++ tv->tv_sec = next_timeout;
++ tv->tv_usec = (next_timeout - tv->tv_sec) * 1000000;
++ return tv;
++}
++
+ static void set_watch_fds(DBusWatch * watch, DBusConnectionState * cs) {
+ uint8_t flags = dbus_watch_get_flags(watch);
+ int fd = dbus_watch_get_fd(watch);
+@@ -1147,10 +1192,8 @@
+ cs->s_w_fds = cs->w_fds;
+ cs->s_e_fds = cs->e_fds;
+
+- timeout.tv_sec = 0;
+- timeout.tv_usec = 200000;
+-
+- if ((n_fds = select(cs->n, &(cs->s_r_fds), &(cs->s_w_fds), &(cs->s_e_fds), &timeout)) < 0) {
++ if ((n_fds = select(cs->n, &(cs->s_r_fds), &(cs->s_w_fds),
++ &(cs->s_e_fds), find_next_timeout (cs, &timeout))) < 0) {
+ if (errno != EINTR) {
+ if (cs->eh != 0L)
+ (*(cs->eh)) ("select failed: %d : %s", errno, strerror(errno));
+Only in dhcdbd-2.0/src: dbus_service.c.orig
More information about the Pkg-utopia-commits
mailing list