Re: [FFmpeg-devel] [PATCH] OS/2:Support linking against libcx

2020-06-14 Thread KO Myung-Hun
Hi/2.

Dave Yeo wrote:
> On 06/13/20 07:03 AM, KO Myung-Hun wrote:
>> Hi/2.
>>
>> Dave Yeo wrote:
>>> On 06/11/20 10:26 AM, Michael Niedermayer wrote:
>>>> On Wed, Jun 10, 2020 at 09:24:51PM -0700, Dave Yeo wrote:
>>>>> On 06/10/20 02:09 PM, Michael Niedermayer wrote:
>>>>>> On Tue, Jun 09, 2020 at 11:11:48PM -0700, Dave Yeo wrote:
>>>>>>> Hi, could I get this pushed to trunk and the 4.3 branch? Fixes a
>>>>>>> build break
>>>>>>> in libavformat/ip.c (implicit declaration of function
>>>>>>> 'getaddrinfo') and
>>>>>>> also need the prototype.
>>>>>>> Thanks,
>>>>>>> Dave
>>>>>> it seems this breaks build on linux
>>>>>
>>>>> Sorry about that, I'll test on Linux in the future.
>>>>> Here's a better patch as it doesn't touch configure.
>>>>> Thanks,
>>>>> Dave
>>>>
>>>> I can confirm this does not break build anymore, but iam not OS/2
>>>> maintainer nor do i have such box so ill leave review / application
>>>> to someone better suited for this
>>>>
>>>> thx
>>>> [...]
>>>
>>> Fair enough, I'll CC KOMH
>>
>> I have no problems at all with gcc 9.1.0 because FFmpeg already has
>> replacements for missing functions such as getaddrinfo().
>>
>> What is your build environment ? Maybe is libcx linked by default ?
>>
> 
> The problem only occurs if I link in libcx, LIBS=-lcx.
> Note that with libcx, the build system finds its getaddrinfo() and later
> fails due to no prototype and will also fail as part of the addrinfo
> struct uses a different type (char vs int IIRC). Without LIBS=-lcx, the
> build falls back to FFmpeg's builtin getaddrinfo().
> One of the main reasons to link to libcx is for the exceptq support.
> Also as it is recommended, others are likely to do the same thing.

Ok, then it would be be better to elaborate commit message.

> From f9fbdaaf6cdb6f886cbdf31c1983e452567cd857 Mon Sep 17 00:00:00 2001
> From: Dave Yeo 
> Date: Tue, 9 Jun 2020 22:51:53 -0700
> Subject: [PATCH] OS/2:Support linking against libcx
> 
> Libcx contains extensions to libc such as getaddrinfo(), mmap() and poll(). 
> While recommended to link against, it is optional
> 
> Signed-off-by: Dave Yeo 
> ---
>  configure| 1 +
>  libavformat/os_support.h | 3 +++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/configure b/configure
> index 8569a60bf8..24ad990b52 100755
> --- a/configure
> +++ b/configure
> @@ -5997,6 +5997,7 @@ if ! disabled network; then
>  check_func inet_aton $network_extralibs
>  
>  check_type netdb.h "struct addrinfo"
> +check_type libcx/net.h "struct addrinfo"

Check libcx/net.h first like:

if check_headers libcx/net.h ; then
check_type libcx/net.h "struct addrinfo"
fi

Otherwise, platforms without libcx/net.h are treated as not having
`struct addrinfo' even if they have actually. I think, this is the cause
of build failure on linux.

>  check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
>  check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
>  check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
> diff --git a/libavformat/os_support.h b/libavformat/os_support.h
> index 5e6b32d2dc..1904fc8d5d 100644
> --- a/libavformat/os_support.h
> +++ b/libavformat/os_support.h
> @@ -56,6 +56,9 @@
>  #  define fstat(f,s) _fstati64((f), (s))
>  #endif /* defined(_WIN32) */
>  
> +#if defined (__OS2__) && defined (HAVE_GETADDRINFO)
> +#include 
> +#endif
>

HAVE_GETADDRINFO does not guarantee libcx/net.h. Use

  #if HAVE_LIBCX_NET_H

guard. If you prefer, it's ok to check __OS2__ definition additionally.

FYI, HAVE_GETADDRINFO is always defined to either 0 or 1. So checking it
with `defined' is always true.

For HAVE_LIBCX_NET_H, you should add `libcx_net_h' to HEADERS_LIST.

Thanks.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v6.1.10 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] OS/2:Support linking against libcx

2020-06-13 Thread KO Myung-Hun
Hi/2.

Dave Yeo wrote:
> On 06/11/20 10:26 AM, Michael Niedermayer wrote:
>> On Wed, Jun 10, 2020 at 09:24:51PM -0700, Dave Yeo wrote:
>>> On 06/10/20 02:09 PM, Michael Niedermayer wrote:
>>>> On Tue, Jun 09, 2020 at 11:11:48PM -0700, Dave Yeo wrote:
>>>>> Hi, could I get this pushed to trunk and the 4.3 branch? Fixes a
>>>>> build break
>>>>> in libavformat/ip.c (implicit declaration of function
>>>>> 'getaddrinfo') and
>>>>> also need the prototype.
>>>>> Thanks,
>>>>> Dave
>>>> it seems this breaks build on linux
>>>
>>> Sorry about that, I'll test on Linux in the future.
>>> Here's a better patch as it doesn't touch configure.
>>> Thanks,
>>> Dave
>>
>> I can confirm this does not break build anymore, but iam not OS/2
>> maintainer nor do i have such box so ill leave review / application
>> to someone better suited for this
>>
>> thx
>> [...]
> 
> Fair enough, I'll CC KOMH

I have no problems at all with gcc 9.1.0 because FFmpeg already has
replacements for missing functions such as getaddrinfo().

What is your build environment ? Maybe is libcx linked by default ?

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v6.1.10 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] compat/os2threads: support static mutexes

2018-01-06 Thread KO Myung-Hun
Ping ?

KO Myung-Hun wrote:
> ---
>  compat/os2threads.h | 14 --
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/compat/os2threads.h b/compat/os2threads.h
> index 40a119ffe1..2177a033ec 100644
> --- a/compat/os2threads.h
> +++ b/compat/os2threads.h
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2011 KO Myung-Hun <k...@chollian.net>
> + * Copyright (c) 2011-2017 KO Myung-Hun <k...@chollian.net>
>   *
>   * This file is part of FFmpeg.
>   *
> @@ -46,9 +46,11 @@ typedef struct {
>  
>  typedef void pthread_attr_t;
>  
> -typedef HMTX pthread_mutex_t;
> +typedef _fmutex pthread_mutex_t;
>  typedef void pthread_mutexattr_t;
>  
> +#define PTHREAD_MUTEX_INITIALIZER _FMUTEX_INITIALIZER
> +
>  typedef struct {
>  HEV event_sem;
>  HEV ack_sem;
> @@ -98,28 +100,28 @@ static av_always_inline int pthread_join(pthread_t 
> thread, void **value_ptr)
>  static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex,
> const pthread_mutexattr_t 
> *attr)
>  {
> -DosCreateMutexSem(NULL, (PHMTX)mutex, 0, FALSE);
> +_fmutex_create(mutex, 0);
>  
>  return 0;
>  }
>  
>  static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
>  {
> -DosCloseMutexSem(*(PHMTX)mutex);
> +_fmutex_close(mutex);
>  
>  return 0;
>  }
>  
>  static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
>  {
> -DosRequestMutexSem(*(PHMTX)mutex, SEM_INDEFINITE_WAIT);
> +_fmutex_request(mutex, 0);
>  
>  return 0;
>  }
>  
>  static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
>  {
> -DosReleaseMutexSem(*(PHMTX)mutex);
> +_fmutex_release(mutex);
>  
>  return 0;
>  }

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: check SDL2 function with a header

2018-01-06 Thread KO Myung-Hun
Ping ?

KO Myung-Hun wrote:
> Hi/2.
> 
> Derek Buitenhuis wrote:
>> On 12/29/2017 6:36 AM, KO Myung-Hun wrote:
>>> Sorry about that.
>>>
>>> SDL2 uses SDLCALL to specify a calling convention. On OS/2, it's defined
>>> to `_System' which is similar to `_cdecl' but does not prepend '_'.
>>>
>>> After all, without a header, a function is used without `_System'. And
>>> linker will try to `_func' but fail because the function is `func' not
>>> `_func'.
>>
>> Thanks for the explanation. Patch LGTM with this added to the commit message.
>>
> 
> Updated.
> 
> 
> 
> 
> ___________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: check SDL2 function with a header

2018-01-01 Thread KO Myung-Hun
Hi/2.

Derek Buitenhuis wrote:
> On 12/29/2017 6:36 AM, KO Myung-Hun wrote:
>> Sorry about that.
>>
>> SDL2 uses SDLCALL to specify a calling convention. On OS/2, it's defined
>> to `_System' which is similar to `_cdecl' but does not prepend '_'.
>>
>> After all, without a header, a function is used without `_System'. And
>> linker will try to `_func' but fail because the function is `func' not
>> `_func'.
> 
> Thanks for the explanation. Patch LGTM with this added to the commit message.
> 

Updated.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

From 7703c6f9cd8d4982f406f473ea57b092a19c92ee Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
Date: Thu, 28 Dec 2017 23:41:30 +0900
Subject: [PATCH] configure: check SDL2 function with a header

SDL2 uses SDLCALL to specify a calling convention. On OS/2, it's defined
to `_System' which is similar to `_cdecl' but does not prepend '_'.

After all, without a header, a function is used without `_System'. And
linker will try to `_func' but fail because the function is `func' not
`_func'.
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 70de780f82..f937ddf2be 100755
--- a/configure
+++ b/configure
@@ -6019,14 +6019,14 @@ fi
 if enabled sdl2; then
 SDL2_CONFIG="${cross_prefix}sdl2-config"
 if test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent; then
-check_func SDL_Init $sdl2_extralibs $sdl2_cflags ||
+check_func_headers SDL.h SDL_Init $sdl2_extralibs $sdl2_cflags ||
 disable sdl2
 elif "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
 sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
 sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
-check_func SDL_Init $sdl2_extralibs $sdl2_cflags &&
+check_func_headers SDL.h SDL_Init $sdl2_extralibs $sdl2_cflags &&
 enable sdl2
 fi
 if test $target_os = "mingw32"; then
-- 
2.13.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: check SDL2 function with a header

2017-12-28 Thread KO Myung-Hun
Hi/2.

Derek Buitenhuis wrote:
> On 12/28/2017 2:44 PM, KO Myung-Hun wrote:
>> On OS/2, '_' is not prepended to a function name.
>> ---
>>  configure | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> It's not immediately clear to be how checking a header instead relates
> to function name mangling (or lack thereof)?

Sorry about that.

SDL2 uses SDLCALL to specify a calling convention. On OS/2, it's defined
to `_System' which is similar to `_cdecl' but does not prepend '_'.

After all, without a header, a function is used without `_System'. And
linker will try to `_func' but fail because the function is `func' not
`_func'.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] compat/os2threads: support static mutexes

2017-12-28 Thread KO Myung-Hun
Hi/2.

wm4 wrote:
> On Thu, 28 Dec 2017 22:03:56 +0900
> KO Myung-Hun <kom...@gmail.com> wrote:
> 
>> ---
>>  compat/os2threads.h | 14 --
>>  1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/compat/os2threads.h b/compat/os2threads.h
>> index 40a119ffe1..2177a033ec 100644
>> --- a/compat/os2threads.h
>> +++ b/compat/os2threads.h
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2011 KO Myung-Hun <k...@chollian.net>
>> + * Copyright (c) 2011-2017 KO Myung-Hun <k...@chollian.net>
>>   *
>>   * This file is part of FFmpeg.
>>   *
>> @@ -46,9 +46,11 @@ typedef struct {
>>  
>>  typedef void pthread_attr_t;
>>  
>> -typedef HMTX pthread_mutex_t;
>> +typedef _fmutex pthread_mutex_t;
>>  typedef void pthread_mutexattr_t;
>>  
>> +#define PTHREAD_MUTEX_INITIALIZER _FMUTEX_INITIALIZER
>> +
>>  typedef struct {
>>  HEV event_sem;
>>  HEV ack_sem;
>> @@ -98,28 +100,28 @@ static av_always_inline int pthread_join(pthread_t 
>> thread, void **value_ptr)
>>  static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex,
>> const pthread_mutexattr_t 
>> *attr)
>>  {
>> -DosCreateMutexSem(NULL, (PHMTX)mutex, 0, FALSE);
>> +_fmutex_create(mutex, 0);
>>  
>>  return 0;
>>  }
>>  
>>  static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
>>  {
>> -DosCloseMutexSem(*(PHMTX)mutex);
>> +_fmutex_close(mutex);
>>  
>>  return 0;
>>  }
>>  
>>  static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
>>  {
>> -DosRequestMutexSem(*(PHMTX)mutex, SEM_INDEFINITE_WAIT);
>> +_fmutex_request(mutex, 0);
>>  
>>  return 0;
>>  }
>>  
>>  static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
>>  {
>> -DosReleaseMutexSem(*(PHMTX)mutex);
>> +_fmutex_release(mutex);
>>  
>>  return 0;
>>  }
> 
> LGTM. Does this actually switch to futex-like light weight mutexes? (I
> don't know anything about OS/2, but it does sound like PHMTX was the
> equivalent of a win32 HANDLE mutex kernel object, that required kernel
> entry on each lock/unlock, while _fmutex is possibly like Vista+ SRWs.)

_fmutex is not futex-like light-weight mutex. Unlike HMTX, however,
_fmutex supports static mutexes.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] configure: check SDL2 function with a header

2017-12-28 Thread KO Myung-Hun
On OS/2, '_' is not prepended to a function name.
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 70de780f82..f937ddf2be 100755
--- a/configure
+++ b/configure
@@ -6019,14 +6019,14 @@ fi
 if enabled sdl2; then
 SDL2_CONFIG="${cross_prefix}sdl2-config"
 if test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h 
SDL_PollEvent; then
-check_func SDL_Init $sdl2_extralibs $sdl2_cflags ||
+check_func_headers SDL.h SDL_Init $sdl2_extralibs $sdl2_cflags ||
 disable sdl2
 elif "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
 sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
 sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | 
SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | 
SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
-check_func SDL_Init $sdl2_extralibs $sdl2_cflags &&
+check_func_headers SDL.h SDL_Init $sdl2_extralibs $sdl2_cflags &&
 enable sdl2
 fi
 if test $target_os = "mingw32"; then
-- 
2.13.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] compat/os2threads: support static mutexes

2017-12-28 Thread KO Myung-Hun
---
 compat/os2threads.h | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/compat/os2threads.h b/compat/os2threads.h
index 40a119ffe1..2177a033ec 100644
--- a/compat/os2threads.h
+++ b/compat/os2threads.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 KO Myung-Hun <k...@chollian.net>
+ * Copyright (c) 2011-2017 KO Myung-Hun <k...@chollian.net>
  *
  * This file is part of FFmpeg.
  *
@@ -46,9 +46,11 @@ typedef struct {
 
 typedef void pthread_attr_t;
 
-typedef HMTX pthread_mutex_t;
+typedef _fmutex pthread_mutex_t;
 typedef void pthread_mutexattr_t;
 
+#define PTHREAD_MUTEX_INITIALIZER _FMUTEX_INITIALIZER
+
 typedef struct {
 HEV event_sem;
 HEV ack_sem;
@@ -98,28 +100,28 @@ static av_always_inline int pthread_join(pthread_t thread, 
void **value_ptr)
 static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex,
const pthread_mutexattr_t *attr)
 {
-DosCreateMutexSem(NULL, (PHMTX)mutex, 0, FALSE);
+_fmutex_create(mutex, 0);
 
 return 0;
 }
 
 static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
 {
-DosCloseMutexSem(*(PHMTX)mutex);
+_fmutex_close(mutex);
 
 return 0;
 }
 
 static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
 {
-DosRequestMutexSem(*(PHMTX)mutex, SEM_INDEFINITE_WAIT);
+_fmutex_request(mutex, 0);
 
 return 0;
 }
 
 static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
 {
-DosReleaseMutexSem(*(PHMTX)mutex);
+_fmutex_release(mutex);
 
 return 0;
 }
-- 
2.13.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] configure: Remove -Wredundant-decls on OS/2 to suppress noise.

2016-04-28 Thread KO Myung-Hun


Dmitriy Kuminov wrote:
> On 2016-04-21 06:46:38 +, Reimar Döffinger said:
> 
>> Have something that results in adding -I/usr/include to the compile
>> options or to C_INCLUDE_PATH? Probably your compiler is misconfigured
>> to not consider that a system include path.
>> Adding -isystem /usr/include should fix it.
> 
> I finally had some time to research. No, our compiler (at least the RPM
> releases from BWW) is not misconfigured, /@unixroot/usr/include is the
> system include path and a simple `gcc -Zomf -Wredundant-decls -c
> hello.c` works well. However, when building FFmpeg stuff,
> -I/@unxroot/usr/include indeed ends up in CFLAGS multiple times and all
> these come from .pc files (namely, fontconfig.pc and vpx.pc). And from
> what I see in the sources, -I${includedir} a very common thing which is
> often used in Cflags: in .pc.in, including fontconfig.pc.in (and
> {includedir} is normally /usr/include or such). So all other platforms
> should be suffering from -Wredundant-decls as well (unless their libc
> headers are very clean and don't contain duplicate decls).
> 

Then, it may be a problem of pkg-config. pkg-config does not output
system header directories such as /usr/include unless
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS is set. However, pkg-config seems not to
think of /@unixroot/usr/include as a system header directory.

As a result, the correct way is to fix pkg-config itself to understand
/@unixroot notation. Or remove /@unixroot prefix from .pc files as a
workaround.

> So unless I miss something else, we should still apply this patch (as
> fixing OS/2 libc headers won't happen any time soon).
> 

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] configure: Do not create/install versioned DLLs on OS/2.

2016-04-26 Thread KO Myung-Hun


Dave Yeo wrote:
> On 04/24/16 05:53 PM, Michael Niedermayer wrote:
>> On Sun, Apr 24, 2016 at 11:55:06AM -0700, Dave Yeo wrote:
>>> On 04/23/16 12:53 PM, Michael Niedermayer wrote:
>>>> On Wed, Apr 20, 2016 at 11:15:39PM -0700, Dave Yeo wrote:
>>>>>> On 04/20/16 03:48 PM, Dmitriy Kuminov wrote:
>>>>>>>> I do care about consistency, collaboration and prevention of
>>>>>>>> artificial
>>>>>>>> entropy growth.
>>>>>>
>>>>>> One option is to make ln_s a configure option, something like the
>>>>>> attached, which is a work in progress as out of tree builds are
>>>>>> broken when using cp -p. Almost seems a failure in the code that
>>>>>> decides whether symlinks work.
>>>>>> Dave
>>>>>>
>>>> this seems not working
>>>>
>>>> ./configure
>>>> ./configure: 4790: ./configure: /tmp/dest_sJUY97zC: Permission denied
>>>> rm: cannot remove `/tmp/name_cM7p9K1e': No such file or directory
>>>>
>>>
>>> It's the correct output (I get similar even before this patch) when
>>> $ln_s="cp -p" as it tries to touch a file in a symlinked directory
>>> and correctly fails.
>>
>> there are no error messages before here, also the ln_s and ln_s_default
>> are not connected i think
>> set_default or similar is missing
> 
> OK, thanks, that's what I missed.
> 
>>
>>
>>> Did you run make && make install after configuring?
>>> Here's the version I'll post later in a new thread, please test.
>>
>> this seems to apply only "in reverse"
> 
> Strange, wonder how I did that.
> New patch which I think along with Dmitriys could be applied if KOMH has
> no objections

Thanks, Dave.

However, ln_s is always set to 'cp -f' on OS/2. Please remove ln_s
overriding codes as well.


-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] configure: Do not create/install versioned DLLs on OS/2.

2016-04-19 Thread KO Myung-Hun
Hi/2.

Dmitriy Kuminov wrote:
> On 2016-04-18 11:52:15 +0000, KO Myung-Hun said:
> 
>> Strange conclusion. Anyway not important.
> 
> In Dave's case the symlink functionality check fails because it is
> performed in TMPDIR which is located on ramfs.ifs (which fails to use
> symlinks). But I believe his real build directory is not on ramfs.ifs
> and symlinks are in fact supported there (and can be used). But this
> problem is not OS/2-specific, it may happen on any platform where TMPDIR
> is on a volume that doesn't support symlinks for sojme reason. I think
> the FFmpeg guys should fix this check to make it performed inside the
> build directory, not in TMPDIR.
> 
>> Good to know that. I wish to see the latest bash for OS/2 soon.
> 
> Well, in fact, having bash would be not bad indeed, but since it has
> little impact on end users, this is postponed for later. Your
> contribution is (as always) welcome.
> 
>> I meant those who don't use ln at all for compatibility with other OS/2
>> programs not built with kLIBC, like me.
> 
> Okay, but still. I don't think ongoing OS/2 development should be
> chained by people like you :) (nothing personal, of course). For
> instance, you won't be able to build the latest Firefox if your system
> doesn't support symlinks (at least because of python's virtualenv). And
> I'm not going to invest time in making it work in such a case, not at
> all (it's a pure waste). This is clearly offtopic for this mailing list
> though, so let's continue this conversation in private if you want.
> 
>> My "correction" is not removing ln_s overriding. I don't want to use ln
>> -s on OS/2.
> 
> Sorry but I really doubt things affecting other people should happen or
> not happen just because you want it or not. We are all here to
> collaborate. I added what I needed and what I think is the best. You
> don't agree, that's OK, so I offered you a compromise - write your own
> patch that will make it work for you the way you want it w/o breaking
> what I need. You refuse to do so and I don't find it collaborative. It's
> upto FFmpeg maintainers to decide what to do here, but I won't accept
> symlink usage removal in our repositiries. I will, however, accept your
> patch that will allow to go both ways (with the symlink usage being the
> default choice if supported by the underlying IFS).
> 

I don't understand why you insist on using symlink. Even if without it,
current FFmpeg works well, maybe better in according to Dave. I don't
know what is the benefit from using symlink.

And it is you who would be affecting other people due to a personal
favor. I just don't feel to do support symlink on OS/2 because it has no
additional benefits. In addition, symlink is not a must-feature, unlike
python's virtualenv.

I doubt that refusing to write codes for unnecessary features is not
collaborative.

Finally, ln_s part is not related to the other parts. Split this patch
into ln_s part and others, and re-send newly versioned patches, please.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] configure: Do not create/install versioned DLLs on OS/2.

2016-04-18 Thread KO Myung-Hun


Dmitriy Kuminov wrote:
> On 2016-04-17 05:21:31 +0000, KO Myung-Hun said:
> 
>> Even if it's a bug of ramfs.ifs, its bug should be considered when using
>> ln -s.
> 
> Yes, and in this particular case configure handles it safely. It results
> into a false fallback though because the symlink dir check is performed
> in TMPDIR which in fact may be on a different FS than the directory used
> for the shadow build. But this is a bug in configure not related to OS/2
> at all.
> 

Strange conclusion. Anyway not important.

>> However, some shells such as bash and pdksh using EMX does not support a
>> symbolic link.
> 
> This is a valid point per se. But I believe there is little sense in
> putting any afforts to support some dead software from 90s for which we
> have a better and somewhat supported alternative. Both bash and pdksh
> can be rebuilt with kLIBC if really needed (not top priprity for BWW atm
> as there are much more improtant things to do).
> 

Good to know that. I wish to see the latest bash for OS/2 soon.

>>  In addition, there are people not using ln -s for
>> compatibility. So if possible, it would be better to avoid a symbolic
>> link.
> 
> Well some people may still use FAT with OS/2 for compatibility. I don't
> think ongoing development should be chained by them...
> 

I meant those who don't use ln at all for compatibility with other OS/2
programs not built with kLIBC, like me.

>> Anyway, test if ln -s really works and override ln_s if it fails.
> 
> To that I agree, it's the best solution. Can you provide your correction
> to this patch that prefrorms such a check in the "os/2" case at least? I
> guess you use EMX bash/pdksh so you can test it right away.
> 

My "correction" is not removing ln_s overriding. I don't want to use ln
-s on OS/2.


-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] configure: Do not create/install versioned DLLs on OS/2.

2016-04-16 Thread KO Myung-Hun


Dmitriy Kuminov wrote:
> On 2016-04-16 17:24:12 +, Dave Yeo said:
> 
>> Actually I now get this at the beginning of the configure run, using a
>> ramfs.ifs volume for $TMPDIR,
>>
>> [K:\usr\local\src\ffmpeg.obj]sh ../ffmpeg/configure --enable-gpl
>> --disable-doc --samples=/usr/local/share/fate-suite --cpu=i686
>> --extra-libs=-lpoll --prefix='r:/tmp/ffmpeg' --disable-static
>> --enable-shared
>> ln: failed to create symbolic link `R:/tmp/name_VJhuEZNf': Operation not
>> supported on socket
> 
> Hmm, interesting use case. I bet this is because ramfs.ifs has some
> problems with EAs (which are needed for proper symlink support on OS/2).
> Looks like a ramfs.ifs bug to me.
> 

Even if it's a bug of ramfs.ifs, its bug should be considered when using
ln -s.

> And yes, it seems that the master branch uses ln_s not only in DLL
> creation but also to symlink to src in the shadow build tree (I was
> checking against the 2.8 branch before where it was not used). It,
> however, contains a fallback code that should cover the failure in your
> case (if I read it right). So I still think we should remove ln_s
> redefinition via cp on OS/2 in FFmpeg. In case of a proper IFS (I have
> JFS here but HPFS is also fine) symlinking src works like a charm
> (performed a full build).
> 

However, some shells such as bash and pdksh using EMX does not support a
symbolic link. In addition, there are people not using ln -s for
compatibility. So if possible, it would be better to avoid a symbolic link.

Anyway, test if ln -s really works and override ln_s if it fails.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] configure: Support backslashes in TMPDIR on OS/2.

2016-04-16 Thread KO Myung-Hun


Dmitriy Kuminov wrote:
> On 2016-04-16 04:39:44 +0000, KO Myung-Hun said:
> 
>>> diff --git a/configure b/configure
>>> index 0ff1b9d..ff80aee 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -734,7 +734,12 @@ check_deps(){
>>>
>>> print_config(){
>>> pfx=$1
>>> -files=$2
>>> +if test "$host_os" = "os/2"; then
>>> +# awk treats \ as escape chars, convert them to / in paths
>>> +files=`echo "$2" | tr '\\\' /`
>>
>> echoing back-slashes with echo is not portable. For example, on
>> ksh-compatible shells such as pdksh and mksh, back-slashes are escaped
>> by echo. Please use expr.
> 
> Ok, I checked that. Indeed, ksh and friends do escaping for the echo
> built-in by default (while e.g. ash and bash, as well as the external
> echo command don't). Expr looks like a nice alternative to echo but it's
> an external command... There is a way to avoid expr by doing something like
> 
>files=$(tr  / < $2
> EOF
> )
> 
> but that looks like a mouthful.
> 
> After some more thinking, I think this patch should be discarded at all.
> Backslases in paths in the Unix-like environment is a generic problem on
> OS/2. I'm pretty sure FFmpeg configure contains more places that use
> echo for path-like strings and therefore will produce incorrect results
> for paths with backslashes. I think that a proper solution is to patch
> shells to replace backslashes in path-like environment variables at the
> very beginnig of their execution. I will do that for ash and dash (that
> I maintain, see http://trac.netlabs.org/ports/ticket/104 for details).
> 

Good decision. This was done already in latest pdksh and mksh.

> As a temporary solution, one may do this in their enviroment before
> starting configure:
> 
> for v in PATH TEMP TMPDIR ; do
>  eval "export $v=\$(expr \"\$$v\" | tr '\\\' /)"
> done
> 

TEMP is not needed, I think.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] configure: Do not create/install versioned DLLs on OS/2.

2016-04-15 Thread KO Myung-Hun
Hi/2.

Dave Yeo wrote:
> On 04/14/16 07:29 PM, Dave Yeo wrote:
>>> From fbff28a583cc9fd7144dd4f9dc37b7b5f8aa Mon Sep 17 00:00:00 2001
>> From: Dmitriy Kuminov <cod...@dmik.org>
>> Date: Thu, 14 Apr 2016 01:45:01 +0400
>> Subject: [PATCH 2/3] configure: Do not create/install versioned DLLs on
>> OS/2.
> 
> Attached
> Dave> From fbff28a583cc9fd7144dd4f9dc37b7b5f8aa Mon Sep 17 00:00:00 2001
> From: Dmitriy Kuminov <cod...@dmik.org>
> Date: Thu, 14 Apr 2016 01:45:01 +0400
> Subject: [PATCH 2/3] configure: Do not create/install versioned DLLs on OS/2.
> 
> Only one DLL for each module must be present on OS/2: SLIBNAME_WITH_MAJOR
> (the same as on Windows). Creating other DLLs makes no sense as they can't
> be used.
> 
> Signed-off-by: Dave Yeo <daver...@telus.net>
> ---
>  configure | 23 ---
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/configure b/configure
> index ff80aee..36a23f4 100755
> --- a/configure
> +++ b/configure
> @@ -4716,7 +4716,6 @@ case $target_os in
>  ;;
>  os/2*)
>  strip="lxlite -CS"
> -ln_s="cp -f"

Please do not remove this. Copying is more compatible than a symbolic
link on OS/2.

>  objformat="aout"
>  add_cppflags -D_GNU_SOURCE
>  add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
> @@ -4724,16 +4723,18 @@ case $target_os in
>  LIBSUF="_s.a"
>  SLIBPREF=""
>  SLIBSUF=".dll"
> -SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
> -SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut 
> -c1-6)$(LIBMAJOR)$(SLIBSUF)'
> -SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) 
> INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
> -echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
> -echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> 
> $(SUBDIR)$(NAME).def; \
> -echo EXPORTS >> $(SUBDIR)$(NAME).def; \
> -emxexp $(OBJS) >> $(SUBDIR)$(NAME).def'
> -SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a 
> $(SUBDIR)$(NAME).def; \
> -emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib 
> $(SUBDIR)$(NAME).def;'
> -SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a 
> $(LIBPREF)$(NAME)_dll.lib'
> +
> SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
> +SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(FULLNAME) | cut 
> -c1-6)$(LIBMAJOR)$(SLIBSUF)'
> +SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=) 
> INITINSTANCE TERMINSTANCE > $(SUBDIR)$(FULLNAME).def; \
> +echo CODE PRELOAD MOVEABLE DISCARDABLE >> 
> $(SUBDIR)$(FULLNAME).def; \
> +echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> 
> $(SUBDIR)$(FULLNAME).def; \
> +echo EXPORTS >> $(SUBDIR)$(FULLNAME).def; \
> +emxexp $(OBJS) >> $(SUBDIR)$(FULLNAME).def'
> +SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.a 
> $(SUBDIR)$(FULLNAME).def; \
> +emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.lib 
> $(SUBDIR)$(FULLNAME).def;'
> +SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
> +SLIB_INSTALL_LINKS=
> +SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(FULLNAME)_dll.a 
> $(LIBPREF)$(FULLNAME)_dll.lib'
>  enable dos_paths
>  enable_weak os2threads
>  ;;
> -- 
> 2.0.0
> 

> 
> 



-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] configure: Support backslashes in TMPDIR on OS/2.

2016-04-15 Thread KO Myung-Hun
Hi/2.

Dave Yeo wrote:
> From b322802ecc6d87fae3afb17fbca8217993d8d0c7 Mon Sep 17 00:00:00 2001
> From: Dmitriy Kuminov <cod...@dmik.org>
> Date: Thu, 14 Apr 2016 01:41:30 +0400
> Subject: [PATCH 1/3] configure: Support backslashes in TMPDIR on OS/2.
> 
> Signed-off-by: Dave Yeo <daver...@telus.net>
> ---
>  configure | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/configure b/configure
> index 0ff1b9d..ff80aee 100755
> --- a/configure
> +++ b/configure
> @@ -734,7 +734,12 @@ check_deps(){
>  
>  print_config(){
>  pfx=$1
> -files=$2
> +if test "$host_os" = "os/2"; then
> +# awk treats \ as escape chars, convert them to / in paths
> +files=`echo "$2" | tr '\\\' /`

echoing back-slashes with echo is not portable. For example, on
ksh-compatible shells such as pdksh and mksh, back-slashes are escaped
by echo. Please use expr.

> +else
> +files=$2
> +fi
>  shift 2
>  map 'eval echo "$v \${$v:-no}"' "$@" |
>  awk "BEGIN { split(\"$files\", files) }
> @@ -3550,10 +3555,10 @@ fi
>  
>  tmpfile(){
>  tmp=$(mktemp -u "${TMPDIR}/ffconf.")$2 &&
> -(set -C; exec > $tmp) 2>/dev/null ||
> +(set -C; exec > "$tmp") 2>/dev/null ||
>  die "Unable to create temporary file in $TMPDIR."
> -append TMPFILES $tmp
> -eval $1=$tmp
> +append TMPFILES "$tmp"
> +eval $1=\"$tmp\"
>  }
>  
>  trap 'rm -f -- $TMPFILES' EXIT

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 2/3] compat/os2threads: support the return value of joined thread

2016-02-14 Thread KO Myung-Hun


Michael Niedermayer wrote:
> On Mon, Feb 15, 2016 at 12:20:34AM +0900, KO Myung-Hun wrote:
>> ---
>>  compat/os2threads.h | 39 ++-
>>  1 file changed, 18 insertions(+), 21 deletions(-)
> 
> applied
> 
> btw, you should add yourself to the MAINTAINERS file i think, as
> you de facto maintain this code ...
> 

Ok. I attached the patch.


-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

From f8705b23eaae1171d2d68ead110623bac1dab7a5 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
Date: Mon, 15 Feb 2016 13:16:23 +0900
Subject: [PATCH] MAINTAINERS: add myself as an OS/2 maintainer

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index d4873d7..dc2fa79 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -563,6 +563,7 @@ Windows ICL Matthew Oliver
 ADI/Blackfin DSPMarc Hoffman
 Sparc   Roman Shaposhnik
 x86 Michael Niedermayer
+OS/2    KO Myung-Hun
 
 
 Releases
-- 
2.7.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2 2/3] compat/os2threads: support the return value of joined thread

2016-02-14 Thread KO Myung-Hun
---
 compat/os2threads.h | 39 ++-
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/compat/os2threads.h b/compat/os2threads.h
index 12cb7b0..3b289df 100644
--- a/compat/os2threads.h
+++ b/compat/os2threads.h
@@ -35,9 +35,15 @@
 #include 
 #include 
 
-#include "libavutil/mem.h"
+#include "libavutil/attributes.h"
+
+typedef struct {
+TID tid;
+void *(*start_routine)(void *);
+void *arg;
+void *result;
+} pthread_t;
 
-typedef TID  pthread_t;
 typedef void pthread_attr_t;
 
 typedef HMTX pthread_mutex_t;
@@ -58,39 +64,30 @@ typedef struct {
 
 #define PTHREAD_ONCE_INIT {0, _FMUTEX_INITIALIZER}
 
-struct thread_arg {
-void *(*start_routine)(void *);
-void *arg;
-};
-
 static void thread_entry(void *arg)
 {
-struct thread_arg *thread_arg = arg;
-
-thread_arg->start_routine(thread_arg->arg);
+pthread_t *thread = arg;
 
-av_free(thread_arg);
+thread->result = thread->start_routine(thread->arg);
 }
 
 static av_always_inline int pthread_create(pthread_t *thread, const 
pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
 {
-struct thread_arg *thread_arg;
-
-thread_arg = av_mallocz(sizeof(struct thread_arg));
-if (!thread_arg)
-return ENOMEM;
+thread->start_routine = start_routine;
+thread->arg = arg;
+thread->result = NULL;
 
-thread_arg->start_routine = start_routine;
-thread_arg->arg = arg;
-
-*thread = _beginthread(thread_entry, NULL, 256 * 1024, thread_arg);
+thread->tid = _beginthread(thread_entry, NULL, 1024 * 1024, thread);
 
 return 0;
 }
 
 static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
 {
-DosWaitThread((PTID), DCWW_WAIT);
+DosWaitThread(, DCWW_WAIT);
+
+if (value_ptr)
+*value_ptr = thread.result;
 
 return 0;
 }
-- 
2.7.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2 3/3] compat/os2threads: split long lines

2016-02-14 Thread KO Myung-Hun
---
 compat/os2threads.h | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/compat/os2threads.h b/compat/os2threads.h
index 3b289df..40a119f 100644
--- a/compat/os2threads.h
+++ b/compat/os2threads.h
@@ -71,7 +71,10 @@ static void thread_entry(void *arg)
 thread->result = thread->start_routine(thread->arg);
 }
 
-static av_always_inline int pthread_create(pthread_t *thread, const 
pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
+static av_always_inline int pthread_create(pthread_t *thread,
+   const pthread_attr_t *attr,
+   void *(*start_routine)(void*),
+   void *arg)
 {
 thread->start_routine = start_routine;
 thread->arg = arg;
@@ -92,7 +95,8 @@ static av_always_inline int pthread_join(pthread_t thread, 
void **value_ptr)
 return 0;
 }
 
-static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const 
pthread_mutexattr_t *attr)
+static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex,
+   const pthread_mutexattr_t *attr)
 {
 DosCreateMutexSem(NULL, (PHMTX)mutex, 0, FALSE);
 
@@ -120,7 +124,8 @@ static av_always_inline int 
pthread_mutex_unlock(pthread_mutex_t *mutex)
 return 0;
 }
 
-static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const 
pthread_condattr_t *attr)
+static av_always_inline int pthread_cond_init(pthread_cond_t *cond,
+  const pthread_condattr_t *attr)
 {
 DosCreateEventSem(NULL, >event_sem, DCE_POSTONE, FALSE);
 DosCreateEventSem(NULL, >ack_sem, DCE_POSTONE, FALSE);
@@ -156,7 +161,8 @@ static av_always_inline int 
pthread_cond_broadcast(pthread_cond_t *cond)
 return 0;
 }
 
-static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, 
pthread_mutex_t *mutex)
+static av_always_inline int pthread_cond_wait(pthread_cond_t *cond,
+  pthread_mutex_t *mutex)
 {
 __atomic_increment(>wait_count);
 
@@ -173,7 +179,8 @@ static av_always_inline int 
pthread_cond_wait(pthread_cond_t *cond, pthread_mute
 return 0;
 }
 
-static av_always_inline int pthread_once(pthread_once_t *once_control, void 
(*init_routine)(void))
+static av_always_inline int pthread_once(pthread_once_t *once_control,
+ void (*init_routine)(void))
 {
 if (!once_control->done)
 {
-- 
2.7.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2 0/3] Improve os2threads

2016-02-14 Thread KO Myung-Hun
Hi/2.

These are v2 patches for os2threads.

Replaced spin-locks with an event semaphore.

[PATCH v2 1/3] compat/os2threads: Improve pthread_cond_xxx()
[PATCH v2 2/3] compat/os2threads: support the return value of joined
[PATCH v2 3/3] compat/os2threads: split long lines
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2 1/3] compat/os2threads: Improve pthread_cond_xxx() functions

2016-02-14 Thread KO Myung-Hun
1. Manipulate waiting count in pthread_cond_wait()
2. Use builtin atomic functions to manipulate waiting count
---
 compat/os2threads.h | 26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/compat/os2threads.h b/compat/os2threads.h
index 7c0fe13..12cb7b0 100644
--- a/compat/os2threads.h
+++ b/compat/os2threads.h
@@ -32,6 +32,7 @@
 #undef __STRICT_ANSI__  /* for _beginthread() */
 #include 
 
+#include 
 #include 
 
 #include "libavutil/mem.h"
@@ -43,8 +44,9 @@ typedef HMTX pthread_mutex_t;
 typedef void pthread_mutexattr_t;
 
 typedef struct {
-HEV  event_sem;
-int  wait_count;
+HEV event_sem;
+HEV ack_sem;
+volatile unsigned  wait_count;
 } pthread_cond_t;
 
 typedef void pthread_condattr_t;
@@ -124,6 +126,7 @@ static av_always_inline int 
pthread_mutex_unlock(pthread_mutex_t *mutex)
 static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const 
pthread_condattr_t *attr)
 {
 DosCreateEventSem(NULL, >event_sem, DCE_POSTONE, FALSE);
+DosCreateEventSem(NULL, >ack_sem, DCE_POSTONE, FALSE);
 
 cond->wait_count = 0;
 
@@ -133,16 +136,16 @@ static av_always_inline int 
pthread_cond_init(pthread_cond_t *cond, const pthrea
 static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
 {
 DosCloseEventSem(cond->event_sem);
+DosCloseEventSem(cond->ack_sem);
 
 return 0;
 }
 
 static av_always_inline int pthread_cond_signal(pthread_cond_t *cond)
 {
-if (cond->wait_count > 0) {
+if (!__atomic_cmpxchg32(>wait_count, 0, 0)) {
 DosPostEventSem(cond->event_sem);
-
-cond->wait_count--;
+DosWaitEventSem(cond->ack_sem, SEM_INDEFINITE_WAIT);
 }
 
 return 0;
@@ -150,23 +153,24 @@ static av_always_inline int 
pthread_cond_signal(pthread_cond_t *cond)
 
 static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
 {
-while (cond->wait_count > 0) {
-DosPostEventSem(cond->event_sem);
-
-cond->wait_count--;
-}
+while (!__atomic_cmpxchg32(>wait_count, 0, 0))
+pthread_cond_signal(cond);
 
 return 0;
 }
 
 static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, 
pthread_mutex_t *mutex)
 {
-cond->wait_count++;
+__atomic_increment(>wait_count);
 
 pthread_mutex_unlock(mutex);
 
 DosWaitEventSem(cond->event_sem, SEM_INDEFINITE_WAIT);
 
+__atomic_decrement(>wait_count);
+
+DosPostEventSem(cond->ack_sem);
+
 pthread_mutex_lock(mutex);
 
 return 0;
-- 
2.7.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Improve os2threads

2016-02-13 Thread KO Myung-Hun
Hi/2.

These are patches to improve os2threads.

Review, please...

[PATCH 1/3] compat/os2threads: Improve pthread_cond_xxx() functions
[PATCH 2/3] compat/os2threads: support the return value of joined
[PATCH 3/3] compat/os2threads: split long lines
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/3] compat/os2threads: Improve pthread_cond_xxx() functions

2016-02-13 Thread KO Myung-Hun
1. Manipulate waiting count in pthread_cond_wait()
2. Use builtin atomic functions to manipulate waiting count
---
 compat/os2threads.h | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/compat/os2threads.h b/compat/os2threads.h
index 7c0fe13..b461f83 100644
--- a/compat/os2threads.h
+++ b/compat/os2threads.h
@@ -32,6 +32,7 @@
 #undef __STRICT_ANSI__  /* for _beginthread() */
 #include 
 
+#include 
 #include 
 
 #include "libavutil/mem.h"
@@ -44,7 +45,7 @@ typedef void pthread_mutexattr_t;
 
 typedef struct {
 HEV  event_sem;
-int  wait_count;
+volatile unsigned  wait_count;
 } pthread_cond_t;
 
 typedef void pthread_condattr_t;
@@ -139,21 +140,17 @@ static av_always_inline int 
pthread_cond_destroy(pthread_cond_t *cond)
 
 static av_always_inline int pthread_cond_signal(pthread_cond_t *cond)
 {
-if (cond->wait_count > 0) {
+if (!__atomic_cmpxchg32(>wait_count, 0, 0))
 DosPostEventSem(cond->event_sem);
 
-cond->wait_count--;
-}
-
 return 0;
 }
 
 static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
 {
-while (cond->wait_count > 0) {
-DosPostEventSem(cond->event_sem);
-
-cond->wait_count--;
+while (!__atomic_cmpxchg32(>wait_count, 0, 0)) {
+if (DosPostEventSem(cond->event_sem))
+DosSleep(1);
 }
 
 return 0;
@@ -161,12 +158,14 @@ static av_always_inline int 
pthread_cond_broadcast(pthread_cond_t *cond)
 
 static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, 
pthread_mutex_t *mutex)
 {
-cond->wait_count++;
+__atomic_increment(>wait_count);
 
 pthread_mutex_unlock(mutex);
 
 DosWaitEventSem(cond->event_sem, SEM_INDEFINITE_WAIT);
 
+__atomic_decrement(>wait_count);
+
 pthread_mutex_lock(mutex);
 
 return 0;
-- 
2.7.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/3] compat/os2threads: split long lines

2016-02-13 Thread KO Myung-Hun
---
 compat/os2threads.h | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/compat/os2threads.h b/compat/os2threads.h
index f2e5d9f..5767190 100644
--- a/compat/os2threads.h
+++ b/compat/os2threads.h
@@ -70,7 +70,10 @@ static void thread_entry(void *arg)
 thread->result = thread->start_routine(thread->arg);
 }
 
-static av_always_inline int pthread_create(pthread_t *thread, const 
pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
+static av_always_inline int pthread_create(pthread_t *thread,
+   const pthread_attr_t *attr,
+   void *(*start_routine)(void*),
+   void *arg)
 {
 thread->start_routine = start_routine;
 thread->arg = arg;
@@ -91,7 +94,8 @@ static av_always_inline int pthread_join(pthread_t thread, 
void **value_ptr)
 return 0;
 }
 
-static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const 
pthread_mutexattr_t *attr)
+static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex,
+   const pthread_mutexattr_t *attr)
 {
 DosCreateMutexSem(NULL, (PHMTX)mutex, 0, FALSE);
 
@@ -119,7 +123,8 @@ static av_always_inline int 
pthread_mutex_unlock(pthread_mutex_t *mutex)
 return 0;
 }
 
-static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const 
pthread_condattr_t *attr)
+static av_always_inline int pthread_cond_init(pthread_cond_t *cond,
+  const pthread_condattr_t *attr)
 {
 DosCreateEventSem(NULL, >event_sem, DCE_POSTONE, FALSE);
 
@@ -153,7 +158,8 @@ static av_always_inline int 
pthread_cond_broadcast(pthread_cond_t *cond)
 return 0;
 }
 
-static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, 
pthread_mutex_t *mutex)
+static av_always_inline int pthread_cond_wait(pthread_cond_t *cond,
+  pthread_mutex_t *mutex)
 {
 __atomic_increment(>wait_count);
 
@@ -168,7 +174,8 @@ static av_always_inline int 
pthread_cond_wait(pthread_cond_t *cond, pthread_mute
 return 0;
 }
 
-static av_always_inline int pthread_once(pthread_once_t *once_control, void 
(*init_routine)(void))
+static av_always_inline int pthread_once(pthread_once_t *once_control,
+ void (*init_routine)(void))
 {
 if (!once_control->done)
 {
-- 
2.7.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/3] compat/os2threads: support the return value of joined thread

2016-02-13 Thread KO Myung-Hun
---
 compat/os2threads.h | 39 ++-
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/compat/os2threads.h b/compat/os2threads.h
index b461f83..f2e5d9f 100644
--- a/compat/os2threads.h
+++ b/compat/os2threads.h
@@ -35,9 +35,15 @@
 #include 
 #include 
 
-#include "libavutil/mem.h"
+#include "libavutil/attributes.h"
+
+typedef struct {
+TID tid;
+void *(*start_routine)(void *);
+void *arg;
+void *result;
+} pthread_t;
 
-typedef TID  pthread_t;
 typedef void pthread_attr_t;
 
 typedef HMTX pthread_mutex_t;
@@ -57,39 +63,30 @@ typedef struct {
 
 #define PTHREAD_ONCE_INIT {0, _FMUTEX_INITIALIZER}
 
-struct thread_arg {
-void *(*start_routine)(void *);
-void *arg;
-};
-
 static void thread_entry(void *arg)
 {
-struct thread_arg *thread_arg = arg;
-
-thread_arg->start_routine(thread_arg->arg);
+pthread_t *thread = arg;
 
-av_free(thread_arg);
+thread->result = thread->start_routine(thread->arg);
 }
 
 static av_always_inline int pthread_create(pthread_t *thread, const 
pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
 {
-struct thread_arg *thread_arg;
-
-thread_arg = av_mallocz(sizeof(struct thread_arg));
-if (!thread_arg)
-return ENOMEM;
+thread->start_routine = start_routine;
+thread->arg = arg;
+thread->result = NULL;
 
-thread_arg->start_routine = start_routine;
-thread_arg->arg = arg;
-
-*thread = _beginthread(thread_entry, NULL, 256 * 1024, thread_arg);
+thread->tid = _beginthread(thread_entry, NULL, 1024 * 1024, thread);
 
 return 0;
 }
 
 static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
 {
-DosWaitThread((PTID), DCWW_WAIT);
+DosWaitThread(, DCWW_WAIT);
+
+if (value_ptr)
+*value_ptr = thread.result;
 
 return 0;
 }
-- 
2.7.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] os2threads: Add pthread_once()

2015-11-11 Thread KO Myung-Hun
---
 compat/os2threads.h | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/compat/os2threads.h b/compat/os2threads.h
index 5b6ca55..f8fb2c8 100644
--- a/compat/os2threads.h
+++ b/compat/os2threads.h
@@ -32,6 +32,8 @@
 #undef __STRICT_ANSI__  /* for _beginthread() */
 #include 
 
+#include 
+
 #include "libavutil/mem.h"
 
 typedef TID  pthread_t;
@@ -47,6 +49,13 @@ typedef struct {
 
 typedef void pthread_condattr_t;
 
+typedef struct {
+volatile int done;
+_fmutex mtx;
+} pthread_once_t;
+
+#define PTHREAD_ONCE_INIT {0, _FMUTEX_INITIALIZER}
+
 struct thread_arg {
 void *(*start_routine)(void *);
 void *arg;
@@ -163,4 +172,22 @@ static av_always_inline int 
pthread_cond_wait(pthread_cond_t *cond, pthread_mute
 return 0;
 }
 
+static av_always_inline int pthread_once(pthread_once_t *once_control, void 
(*init_routine)(void))
+{
+if (!once_control->done)
+{
+_fmutex_request(_control->mtx, 0);
+
+if (!once_control->done)
+{
+init_routine();
+
+once_control->done = 1;
+}
+
+_fmutex_release(_control->mtx);
+}
+
+return 0;
+}
 #endif /* AVCODEC_OS2PTHREADS_H */
-- 
2.6.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel