summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '5.4/01_all_backport-5.6-alsa-timespec64-p1.patch')
-rw-r--r--5.4/01_all_backport-5.6-alsa-timespec64-p1.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/5.4/01_all_backport-5.6-alsa-timespec64-p1.patch b/5.4/01_all_backport-5.6-alsa-timespec64-p1.patch
new file mode 100644
index 0000000..1195ca2
--- /dev/null
+++ b/5.4/01_all_backport-5.6-alsa-timespec64-p1.patch
@@ -0,0 +1,49 @@
+From a07804cc7472d8aa5db03ea5d75f3d8d80abb687 Mon Sep 17 00:00:00 2001
+From: Baolin Wang <baolin.wang@linaro.org>
+Date: Tue, 24 Apr 2018 20:06:09 +0800
+Subject: [PATCH] ALSA: Avoid using timespec for struct snd_timer_status
+
+struct snd_timer_status uses 'timespec' type variables to record
+timestamp, which will be changed to an incompatible layout with
+updated user space using 64-bit time_t.
+
+To handle both the old and the new layout on 32-bit architectures,
+this patch introduces 'struct snd_timer_status32' and 'struct snd_timer_status64'
+to handle 32bit time_t and 64bit time_t in native mode and compat mode,
+which replaces timespec with s64 type.
+
+When glibc changes time_t to 64-bit, any recompiled program will issue
+ioctl commands that the kernel does not understand without this patch.
+
+In the public uapi header, snd_timer_status is now guarded by
+an #ifndef __KERNEL__ to avoid referencing 'struct timespec'.
+The timespec definition will be removed from the kernel to prevent
+new y2038 bugs and to avoid the conflict with an incompatible libc
+type of the same name.
+
+Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+---
+ include/uapi/sound/asound.h | 2 ++
+
+--- a/include/uapi/sound/asound.h
++++ b/include/uapi/sound/asound.h
+@@ -761,6 +761,7 @@ struct snd_timer_params {
+ unsigned char reserved[60]; /* reserved */
+ };
+
++#ifndef __KERNEL__
+ struct snd_timer_status {
+ struct timespec tstamp; /* Timestamp - last update */
+ unsigned int resolution; /* current period resolution in ns */
+@@ -769,6 +770,7 @@ struct snd_timer_status {
+ unsigned int queue; /* used queue size */
+ unsigned char reserved[64]; /* reserved */
+ };
++#endif
+
+ #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
+ #define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
+--
+2.26.2
+