blob: e5dff007d45a33c2696030139ad106eae99f3fa4 [file] [log] [blame]
Andrew Geisslerb7d28612020-07-24 16:15:54 -05001Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@arm.com>
3
4From a7e49fefde18ea8d5bada8096d32f23bcfb5a6dc Mon Sep 17 00:00:00 2001
5From: "Federico G. Schwindt" <fgsch@openbsd.org>
6Date: Mon, 17 Feb 2014 15:48:12 +0100
7Subject: [PATCH 1/3] Fix crash on 32bit architectures where time_t is 64 bit
8
9This is an ABI change on platforms where sizeof(time_t) doesn't equal
10sizeof(long). For most platforms this change shouldn't make a difference
11at present. OpenBSD recently switched to 64bit time_t on all architectures
12to avoid time_t overflow in 2038 on 32bit machines.
13
14This fix extends to consumers of startup-notification, for instance
15the window manager of XFCE, which is how I got involved in this.
16See http://mail.xfce.org/pipermail/xfce4-dev/2014-February/030611.html
17and follow-ups. The XFCE devs pointed out that my patch to fix a
18crash in XFCE's window manager depends on this startup-notification patch.
19
20Signed-off-by: Julien Danjou <julien@danjou.info>
21---
22 libsn/sn-monitor.c | 8 ++++----
23 libsn/sn-monitor.h | 8 ++++----
24 2 files changed, 8 insertions(+), 8 deletions(-)
25
26diff --git a/libsn/sn-monitor.c b/libsn/sn-monitor.c
27index 2a9ad16..f419bc1 100644
28--- a/libsn/sn-monitor.c
29+++ b/libsn/sn-monitor.c
30@@ -364,8 +364,8 @@ sn_startup_sequence_get_screen (SnStartupSequence *sequence)
31 **/
32 void
33 sn_startup_sequence_get_initiated_time (SnStartupSequence *sequence,
34- long *tv_sec,
35- long *tv_usec)
36+ time_t *tv_sec,
37+ suseconds_t *tv_usec)
38 {
39 if (tv_sec)
40 *tv_sec = sequence->initiation_time.tv_sec;
41@@ -386,8 +386,8 @@ sn_startup_sequence_get_initiated_time (SnStartupSequence *sequence,
42 **/
43 void
44 sn_startup_sequence_get_last_active_time (SnStartupSequence *sequence,
45- long *tv_sec,
46- long *tv_usec)
47+ time_t *tv_sec,
48+ suseconds_t *tv_usec)
49 {
50 /* for now the same as get_initiated_time */
51 if (tv_sec)
52diff --git a/libsn/sn-monitor.h b/libsn/sn-monitor.h
53index b58581f..2f639df 100644
54--- a/libsn/sn-monitor.h
55+++ b/libsn/sn-monitor.h
56@@ -77,11 +77,11 @@ const char* sn_startup_sequence_get_application_id (SnStartupSequence *se
57 int sn_startup_sequence_get_screen (SnStartupSequence *sequence);
58
59 void sn_startup_sequence_get_initiated_time (SnStartupSequence *sequence,
60- long *tv_sec,
61- long *tv_usec);
62+ time_t *tv_sec,
63+ suseconds_t *tv_usec);
64 void sn_startup_sequence_get_last_active_time (SnStartupSequence *sequence,
65- long *tv_sec,
66- long *tv_usec);
67+ time_t *tv_sec,
68+ suseconds_t *tv_usec);
69
70 void sn_startup_sequence_complete (SnStartupSequence *sequence);
71
72--
732.26.2
74
75From ea9f7e4cc6fd8c08d175ed7774ed2c5bd11c8ef0 Mon Sep 17 00:00:00 2001
76From: Colin Walters <walters@verbum.org>
77Date: Mon, 17 Feb 2014 14:37:09 -0500
78Subject: [PATCH 2/3] Add include of <sys/select.h> for previous patch
79
80Unfortunately while the standard says that <sys/types.h> is the
81correct header to get suseconds_t, at least with glibc, that requires
82-DXOPEN_SOURCE. Which is problematic for a public header, because
83then all *users* of startup-notification will be required to define
84that.
85
86Poking around a bit, it looks like at least with glibc, <sys/select.h>
87will give us an unconditional define.
88
89Signed-off-by: Julien Danjou <julien@danjou.info>
90---
91 libsn/sn-monitor.h | 1 +
92 1 file changed, 1 insertion(+)
93
94diff --git a/libsn/sn-monitor.h b/libsn/sn-monitor.h
95index 2f639df..cea4e12 100644
96--- a/libsn/sn-monitor.h
97+++ b/libsn/sn-monitor.h
98@@ -28,6 +28,7 @@
99 #define __SN_MONITOR_H__
100
101 #include <libsn/sn-common.h>
102+#include <sys/select.h>
103
104 SN_BEGIN_DECLS
105
106--
1072.26.2
108