[vlc-devel] [PATCH 07/41] Implement select()-able pipes for OS/2

Rémi Denis-Courmont remi at remlab.net
Mon Oct 10 16:40:07 CEST 2011


Le lundi 10 octobre 2011 14:43:46 KO Myung-Hun, vous avez écrit :
> ---
>  src/misc/objects.c |   22 ++++++++++++++++------
>  1 files changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/src/misc/objects.c b/src/misc/objects.c
> index fa36923..fe7186d 100644
> --- a/src/misc/objects.c
> +++ b/src/misc/objects.c
> @@ -52,10 +52,17 @@
>  # include <search.h>
>  #endif
> 
> -#ifndef WIN32
> -# include <vlc_fs.h>
> -# include <unistd.h>
> -#else
> +#ifdef __OS2__
> +# include <sys/socket.h>
> +# include <netinet/in.h>
> +
> +typedef int SOCKET;
> +typedef struct sockaddr_in SOCKADDR_IN;
> +typedef struct sockaddr *PSOCKADDR;
> +
> +# define closesocket    soclose
> +# define INVALID_SOCKET -1

Hmmph. Yeah right :-) I would rather have rewritten the code below to not be 
Windows-specific, than defined Winsock types on OS/2.

Is it so that OS/2 does not have pipes?

> +#elif defined(WIN32)
>  # include <io.h>
>  # include <winsock2.h>
>  # include <ws2tcpip.h>
> @@ -65,6 +72,9 @@
>  # define write( a, b, c ) send (a, b, c, 0)
>  # undef  close
>  # define close( a )       closesocket (a)
> +#else
> +# include <vlc_fs.h>
> +# include <unistd.h>
>  #endif
> 
>  #include <limits.h>
> @@ -287,7 +297,7 @@ static void vlc_object_destroy( vlc_object_t *p_this )
>  }
> 
> 
> -#ifdef WIN32
> +#if defined(WIN32) || defined(__OS2__)
>  /**
>   * select()-able pipes emulated using Winsock
>   */
> @@ -329,7 +339,7 @@ error:
>          closesocket (c);
>      return -1;
>  }
> -#endif /* WIN32 */
> +#endif /* WIN32 || __OS2__ */
> 
>  static vlc_mutex_t pipe_lock = VLC_STATIC_MUTEX;


-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis



More information about the vlc-devel mailing list