Andrew Geissler | b7d2861 | 2020-07-24 16:15:54 -0500 | [diff] [blame^] | 1 | Upstream-Status: Backport |
| 2 | Signed-off-by: Ross Burton <ross.burton@arm.com> |
| 3 | |
| 4 | From a7e49fefde18ea8d5bada8096d32f23bcfb5a6dc Mon Sep 17 00:00:00 2001 |
| 5 | From: "Federico G. Schwindt" <fgsch@openbsd.org> |
| 6 | Date: Mon, 17 Feb 2014 15:48:12 +0100 |
| 7 | Subject: [PATCH 1/3] Fix crash on 32bit architectures where time_t is 64 bit |
| 8 | |
| 9 | This is an ABI change on platforms where sizeof(time_t) doesn't equal |
| 10 | sizeof(long). For most platforms this change shouldn't make a difference |
| 11 | at present. OpenBSD recently switched to 64bit time_t on all architectures |
| 12 | to avoid time_t overflow in 2038 on 32bit machines. |
| 13 | |
| 14 | This fix extends to consumers of startup-notification, for instance |
| 15 | the window manager of XFCE, which is how I got involved in this. |
| 16 | See http://mail.xfce.org/pipermail/xfce4-dev/2014-February/030611.html |
| 17 | and follow-ups. The XFCE devs pointed out that my patch to fix a |
| 18 | crash in XFCE's window manager depends on this startup-notification patch. |
| 19 | |
| 20 | Signed-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 | |
| 26 | diff --git a/libsn/sn-monitor.c b/libsn/sn-monitor.c |
| 27 | index 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) |
| 52 | diff --git a/libsn/sn-monitor.h b/libsn/sn-monitor.h |
| 53 | index 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 | -- |
| 73 | 2.26.2 |
| 74 | |
| 75 | From ea9f7e4cc6fd8c08d175ed7774ed2c5bd11c8ef0 Mon Sep 17 00:00:00 2001 |
| 76 | From: Colin Walters <walters@verbum.org> |
| 77 | Date: Mon, 17 Feb 2014 14:37:09 -0500 |
| 78 | Subject: [PATCH 2/3] Add include of <sys/select.h> for previous patch |
| 79 | |
| 80 | Unfortunately while the standard says that <sys/types.h> is the |
| 81 | correct header to get suseconds_t, at least with glibc, that requires |
| 82 | -DXOPEN_SOURCE. Which is problematic for a public header, because |
| 83 | then all *users* of startup-notification will be required to define |
| 84 | that. |
| 85 | |
| 86 | Poking around a bit, it looks like at least with glibc, <sys/select.h> |
| 87 | will give us an unconditional define. |
| 88 | |
| 89 | Signed-off-by: Julien Danjou <julien@danjou.info> |
| 90 | --- |
| 91 | libsn/sn-monitor.h | 1 + |
| 92 | 1 file changed, 1 insertion(+) |
| 93 | |
| 94 | diff --git a/libsn/sn-monitor.h b/libsn/sn-monitor.h |
| 95 | index 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 | -- |
| 107 | 2.26.2 |
| 108 | |