Skip to contentSkip to conversation

Make alsa asound.h header more portable.

PATCH In review Thomas Klausner 2 participants 5 messages Mar 3, 2016 – Mar 4, 2016 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make alsa asound.h header more portable.

From: Thomas Klausner <[email protected]>

This header is used as-is in the alsa-lib userland library, which is portable to other operating systems.
For this reason, include linux/types.h only on Linux systems.

Add sys/ioctl.h for _IOR/_IOW/etc. (works at least on *BSD and Solaris).

---
 include/uapi/sound/asound.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/sound/asound.h +4 -0
index a82108e..3d581b5 100644
@@ -23,7 +23,11 @@
 #ifndef _UAPI__SOUND_ASOUND_H
 #define _UAPI__SOUND_ASOUND_H
 
+#ifdef __linux__
 #include <linux/types.h>
+#else
+#include <sys/ioctl.h>
+#endif
 
 #ifndef __KERNEL__
 #include <stdlib.h>
Signature · 1 line
2.7.1
#1 lore raw
Quoted 6 lines · Thomas Klausner

From: Thomas Klausner <[email protected]>

This header is used as-is in the alsa-lib userland library, which is portable to other operating systems.
For this reason, include linux/types.h only on Linux systems.

This is needed also for building the Linux kernel. So...

Quoted 12 lines

Add sys/ioctl.h for _IOR/_IOW/etc. (works at least on *BSD and Solaris).

---
 include/uapi/sound/asound.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/sound/asound.h +0 -0
index a82108e..3d581b5 100644

include/uapi/sound/asound.h line 26

Quoted 4 lines
include/uapi/sound/asound.h +1 -0
@@ -23,7 +23,11 @@
 #ifndef _UAPI__SOUND_ASOUND_H
 #define _UAPI__SOUND_ASOUND_H
 
+#ifdef __linux__

... the following might be better.

#if defined(__KERNEL__) || defined(__linux__)

At least the same style is found in include/uapi/drm/drm.h, too.

thanks,

Takashi

#2 lore raw

PATCH 1/1 Make alsa asound.h header more portable.

From: Thomas Klausner <[email protected]>

This header is used as-is in the alsa-lib userland library, which is portable to other operating systems.
For this reason, include linux/types.h only on Linux systems.

Add sys/ioctl.h for _IOR/_IOW/etc. (works at least on *BSD and Solaris).

---
 include/uapi/sound/asound.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/sound/asound.h +4 -0
index a82108e..67bf49d 100644
@@ -23,7 +23,11 @@
 #ifndef _UAPI__SOUND_ASOUND_H
 #define _UAPI__SOUND_ASOUND_H
 
+#if defined(__KERNEL__) || defined(__linux__)
 #include <linux/types.h>
+#else
+#include <sys/ioctl.h>
+#endif
 
 #ifndef __KERNEL__
 #include <stdlib.h>
Signature · 1 line
2.7.1
Applied
#3 lore raw
Quoted 10 lines · Thomas Klausner

From: Thomas Klausner <[email protected]>

This header is used as-is in the alsa-lib userland library, which is portable to other operating systems.
For this reason, include linux/types.h only on Linux systems.

Add sys/ioctl.h for _IOR/_IOW/etc. (works at least on *BSD and Solaris).

Applied, thanks.

Takashi

Quoted 23 lines
---
 include/uapi/sound/asound.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/sound/asound.h +4 -0
index a82108e..67bf49d 100644
@@ -23,7 +23,11 @@
 #ifndef _UAPI__SOUND_ASOUND_H
 #define _UAPI__SOUND_ASOUND_H
 
+#if defined(__KERNEL__) || defined(__linux__)
 #include <linux/types.h>
+#else
+#include <sys/ioctl.h>
+#endif
 
 #ifndef __KERNEL__
 #include <stdlib.h>
Signature · 1 line
2.7.1
#4 lore raw
In reply to Takashi Iwai
Quoted 26 lines · Takashi Iwai
Quoted 6 lines · Thomas Klausner

From: Thomas Klausner <[email protected]>

This header is used as-is in the alsa-lib userland library, which is portable to other operating systems.
For this reason, include linux/types.h only on Linux systems.

This is needed also for building the Linux kernel. So...

Quoted 15 lines

Add sys/ioctl.h for _IOR/_IOW/etc. (works at least on *BSD and Solaris).

---
 include/uapi/sound/asound.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/sound/asound.h +0 -0
index a82108e..3d581b5 100644
@@ -23,7 +23,11 @@
 #ifndef _UAPI__SOUND_ASOUND_H
 #define _UAPI__SOUND_ASOUND_H
 
Quoted 7 lines

include/uapi/sound/asound.h line 26

Quoted 1 line
include/uapi/sound/asound.h +1 -0
+#ifdef __linux__

... the following might be better.

#if defined(__KERNEL__) || defined(__linux__)

At least the same style is found in include/uapi/drm/drm.h, too.

Thank you! New patch sent.
Thomas