All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/12] dbus: Kdbus message timeout_ns is absolute time
@ 2016-04-10  4:02 Andrew Zaborowski
  2016-04-10  4:02 ` [PATCH 02/12] dbus: Validate field type in get_header_field Andrew Zaborowski
                   ` (8 more replies)
  0 siblings, 9 replies; 14+ messages in thread
From: Andrew Zaborowski @ 2016-04-10  4:02 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]

It is even documented in systemd, although not very clearly, that
timeout_ns is a CLOCK_MONOTONIC_COARSE-based absolute value.
---
 ell/dbus-kernel.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/ell/dbus-kernel.c b/ell/dbus-kernel.c
index f45ec04..2b41177 100644
--- a/ell/dbus-kernel.c
+++ b/ell/dbus-kernel.c
@@ -34,6 +34,7 @@
 #include <errno.h>
 #include <sys/mman.h>
 #include <sys/ioctl.h>
+#include <time.h>
 
 #include "linux/kdbus.h"
 
@@ -392,8 +393,16 @@ int _dbus_kernel_send(int fd, size_t bloom_size, uint8_t bloom_n_hash,
 		break;
 	}
 	case DBUS_MESSAGE_TYPE_METHOD_CALL:
-		if (!l_dbus_message_get_no_reply(message))
-			kmsg->timeout_ns = 30000 * 1000000ULL;
+		if (!l_dbus_message_get_no_reply(message)) {
+			struct timespec now;
+
+			clock_gettime(CLOCK_MONOTONIC_COARSE, &now);
+
+			kmsg->timeout_ns =
+				now.tv_sec * 1000000000ULL + now.tv_nsec +
+				30000 * 1000000ULL;
+		}
+
 		break;
 	case DBUS_MESSAGE_TYPE_SIGNAL:
 		kmsg->flags |= KDBUS_MSG_SIGNAL;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-04-12  1:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-10  4:02 [PATCH 01/12] dbus: Kdbus message timeout_ns is absolute time Andrew Zaborowski
2016-04-10  4:02 ` [PATCH 02/12] dbus: Validate field type in get_header_field Andrew Zaborowski
2016-04-11 20:00   ` Denis Kenzior
2016-04-11 20:06     ` Andrzej Zaborowski
2016-04-10  4:02 ` [PATCH 03/12] dbus: Check some more return values when parsing messages Andrew Zaborowski
2016-04-11 20:11   ` Denis Kenzior
2016-04-12  1:23     ` Andrzej Zaborowski
2016-04-10  4:02 ` [PATCH 04/12] dbus: GVariant header field identifiers are 64-bit Andrew Zaborowski
2016-04-10  4:02 ` [PATCH 05/12] dbus: Fix parsing GVariant header/body information Andrew Zaborowski
2016-04-10  4:02 ` [PATCH 06/12] dbus: GVariant message cookie and reply cookie are 64-bit Andrew Zaborowski
2016-04-10  4:02 ` [PATCH 07/12] dbus: Don't rely on 1st KDBUS_ITEM_PAYLOAD_OFF being the header Andrew Zaborowski
2016-04-10  4:02 ` [PATCH 08/12] gvariant: Utility to build GVariant message out of header+body Andrew Zaborowski
2016-04-10  4:02 ` [PATCH 09/12] dbus: Fix the kdbus message encoding Andrew Zaborowski
2016-04-11 19:42 ` [PATCH 01/12] dbus: Kdbus message timeout_ns is absolute time Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.