[alsa-devel] portability patch: EBADF [was Re: feeding back pkgsrc changs]

Takashi Iwai tiwai at suse.de
Tue Feb 23 16:53:51 CET 2016


On Tue, 23 Feb 2016 15:09:06 +0100,
Thomas Klausner wrote:
> 
> Hi Takashi!
> 
> Thanks for the answer.
> 
> On Thu, Feb 18, 2016 at 04:51:15PM +0100, Takashi Iwai wrote:
> > On Thu, 18 Feb 2016 16:47:44 +0100,
> > Thomas Klausner wrote:
> > > I've just updated the pkgsrc packages for alsa-lib, alsa-utils and
> > > alsa-plugins to 1.1.0 and noticed that there are quite a number of
> > > local patches we have. I'd like to get them integrated.
> > > 
> > > When I visited the alsa-projects web page, I noticed that the link to
> > > the bug tracker is dead.
> > > 
> > > What is the recommended method to provide the patches?
> > 
> > Just submit your patches to alsa-devel ML.  That's the best way to
> > review and get merged.
> 
> I'll start with a straightforward one. Some operating systems don't
> provide an errno 'EBADFD'; let's use EBADF there instead.
> 
> This patch adds the define in all files that need it, but if you
> prefer to add it to a central place instead, please suggest one.

How about put this in include/local.h instead?  Then we need to put it
only in one place, as this is supposed to be included by all codes.


Takashi


> 
> Thanks,
>  Thomas
> >From e72e16bcb9bd2ddff2624fdb57a96fad6b3cf5bb Mon Sep 17 00:00:00 2001
> From: Thomas Klausner <wiz at NetBSD.org>
> Date: Tue, 23 Feb 2016 15:05:47 +0100
> Subject: [PATCH] Define EBADFD in terms of EBADF if it doesn't exist.
> 
> For portability on FreeBSD, NetBSD and probably others.
> ---
>  aserver/aserver.c         | 4 ++++
>  src/control/control_shm.c | 4 ++++
>  src/pcm/pcm.c             | 4 ++++
>  src/pcm/pcm_dmix.c        | 4 ++++
>  src/pcm/pcm_dshare.c      | 4 ++++
>  src/pcm/pcm_dsnoop.c      | 4 ++++
>  src/pcm/pcm_hw.c          | 4 ++++
>  src/pcm/pcm_ioplug.c      | 4 ++++
>  src/pcm/pcm_null.c        | 4 ++++
>  src/pcm/pcm_rate.c        | 4 ++++
>  src/pcm/pcm_share.c       | 4 ++++
>  src/pcm/pcm_shm.c         | 4 ++++
>  src/pcm/pcm_simple.c      | 4 ++++
>  13 files changed, 52 insertions(+)
> 
> diff --git a/aserver/aserver.c b/aserver/aserver.c
> index ac20706..88995cf 100644
> --- a/aserver/aserver.c
> +++ b/aserver/aserver.c
> @@ -35,6 +35,10 @@
>  
>  #include "aserver.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  char *command;
>  
>  #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
> diff --git a/src/control/control_shm.c b/src/control/control_shm.c
> index bd07d4a..618ef39 100644
> --- a/src/control/control_shm.c
> +++ b/src/control/control_shm.c
> @@ -35,6 +35,10 @@
>  #include <netdb.h>
>  #include "aserver.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  #ifndef PIC
>  /* entry for static linking */
>  const char *_snd_module_control_shm = "";
> diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
> index 203e7a5..6d40171 100644
> --- a/src/pcm/pcm.c
> +++ b/src/pcm/pcm.c
> @@ -639,6 +639,10 @@ playback devices.
>  #include <limits.h>
>  #include "pcm_local.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  /**
>   * \brief get identifier of PCM handle
>   * \param pcm PCM handle
> diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c
> index b26a5c7..ba65cad 100644
> --- a/src/pcm/pcm_dmix.c
> +++ b/src/pcm/pcm_dmix.c
> @@ -45,6 +45,10 @@
>  #include <sys/mman.h>
>  #include "pcm_direct.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  #ifndef PIC
>  /* entry for static linking */
>  const char *_snd_module_pcm_dmix = "";
> diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c
> index 58e47bb..2556a30 100644
> --- a/src/pcm/pcm_dshare.c
> +++ b/src/pcm/pcm_dshare.c
> @@ -45,6 +45,10 @@
>  #include <sys/mman.h>
>  #include "pcm_direct.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  #ifndef PIC
>  /* entry for static linking */
>  const char *_snd_module_pcm_dshare = "";
> diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c
> index 576c35b..26b6f5c 100644
> --- a/src/pcm/pcm_dsnoop.c
> +++ b/src/pcm/pcm_dsnoop.c
> @@ -45,6 +45,10 @@
>  #include <sys/mman.h>
>  #include "pcm_direct.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  #ifndef PIC
>  /* entry for static linking */
>  const char *_snd_module_pcm_dsnoop = "";
> diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
> index 4f4b84b..de9f9d5 100644
> --- a/src/pcm/pcm_hw.c
> +++ b/src/pcm/pcm_hw.c
> @@ -40,6 +40,10 @@
>  #include "../control/control_local.h"
>  #include "../timer/timer_local.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  //#define DEBUG_RW		/* use to debug readi/writei/readn/writen */
>  //#define DEBUG_MMAP		/* debug mmap_commit */
>  
> diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
> index 43550c0..bed1c97 100644
> --- a/src/pcm/pcm_ioplug.c
> +++ b/src/pcm/pcm_ioplug.c
> @@ -31,6 +31,10 @@
>  #include "pcm_ext_parm.h"
>  #include "pcm_generic.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  #ifndef PIC
>  /* entry for static linking */
>  const char *_snd_module_pcm_ioplug = "";
> diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c
> index 5e63caa..9fe3c82 100644
> --- a/src/pcm/pcm_null.c
> +++ b/src/pcm/pcm_null.c
> @@ -31,6 +31,10 @@
>  #include "pcm_local.h"
>  #include "pcm_plugin.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  #ifndef PIC
>  /* entry for static linking */
>  const char *_snd_module_pcm_null = "";
> diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
> index c76db25..c08a2e8 100644
> --- a/src/pcm/pcm_rate.c
> +++ b/src/pcm/pcm_rate.c
> @@ -36,6 +36,10 @@
>  
>  #include "plugin_ops.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  #if 0
>  #define DEBUG_REFINE
>  #endif
> diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c
> index 5d8aaf2..9fe8dc1 100644
> --- a/src/pcm/pcm_share.c
> +++ b/src/pcm/pcm_share.c
> @@ -38,6 +38,10 @@
>  #include <pthread.h>
>  #include "pcm_local.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  #ifndef PIC
>  /* entry for static linking */
>  const char *_snd_module_pcm_share = "";
> diff --git a/src/pcm/pcm_shm.c b/src/pcm/pcm_shm.c
> index a815ac6..242b26e 100644
> --- a/src/pcm/pcm_shm.c
> +++ b/src/pcm/pcm_shm.c
> @@ -45,6 +45,10 @@
>  #include <netdb.h>
>  #include "aserver.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  #ifndef PIC
>  /* entry for static linking */
>  const char *_snd_module_pcm_shm = "";
> diff --git a/src/pcm/pcm_simple.c b/src/pcm/pcm_simple.c
> index ce11083..99ba1c3 100644
> --- a/src/pcm/pcm_simple.c
> +++ b/src/pcm/pcm_simple.c
> @@ -25,6 +25,10 @@
>  
>  #include "pcm_local.h"
>  
> +#ifndef EBADFD
> +#define EBADFD EBADF
> +#endif
> +
>  static int set_buffer_time(snd_spcm_latency_t latency,
>  			   unsigned int *buffer_time)
>  {
> -- 
> 2.7.1
> 


More information about the Alsa-devel mailing list