History

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.

Baolin Wang committed 8 years ago

Commit a07804c1 parent fcae40c3 files · +64 −57Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/sound/asound.h+2−0
@@ -761,6 +761,7 @@ struct snd_timer_params { · 760 unmodified lines
761 unsigned char reserved[60]; /* reserved */761 unsigned char reserved[60]; /* reserved */
762};762};
763 763
764#ifndef __KERNEL__
764struct snd_timer_status {765struct snd_timer_status {
765 struct timespec tstamp; /* Timestamp - last update */766 struct timespec tstamp; /* Timestamp - last update */
766 unsigned int resolution; /* current period resolution in ns */767 unsigned int resolution; /* current period resolution in ns */
@@ -769,6 +770,7 @@ struct snd_timer_status { · 2 unmodified lines
769 unsigned int queue; /* used queue size */770 unsigned int queue; /* used queue size */
770 unsigned char reserved[64]; /* reserved */771 unsigned char reserved[64]; /* reserved */
771};772};
773#endif
772 774
773#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)775#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
774#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)776#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)