[vlc-devel] [PATCH] misc: implement vlc_poll_i11e() on OS/2

KO Myung-Hun komh78 at gmail.com
Fri Jul 31 06:13:57 CEST 2015


Ping ?

KO Myung-Hun wrote:
> 
> 
> Rémi Denis-Courmont wrote:
>> Le 2015-07-23 09:50, KO Myung-Hun a écrit :
>>> diff --git a/src/misc/interrupt.c b/src/misc/interrupt.c
>>> index 08d5d81..5bc2b50 100644
>>> --- a/src/misc/interrupt.c
>>> +++ b/src/misc/interrupt.c
>>> @@ -342,7 +342,11 @@ static int vlc_poll_i11e_inner(struct pollfd
>>> *restrict fds, unsigned nfds,
>>>          fd[1] = fd[0];
>>>      else
>>>  # endif
>>> +#ifndef __OS2__
>>>      if (vlc_pipe(fd))
>>> +#else
>>> +    if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fd))
>>> +#endif
>>
>> Either sockets are file descriptors (e.g. POSIX), or they are completely
>> separate (e.g. Winsock). I am not sure which category OS/2 fits in, but
>> this patch seems not to make sense *either* way.
>>
> 
> Socket are file descriptors like POSIX. But, select() works only on
> sockets like Winsock.
> 
>>>      {
>>>          vlc_testcancel();
>>>          errno = ENOMEM;
>>> diff --git a/src/os2/thread.c b/src/os2/thread.c
>>> index e221632..7d9673c 100644
>>> --- a/src/os2/thread.c
>>> +++ b/src/os2/thread.c
>>> @@ -785,6 +785,7 @@ int vlc_poll_os2( struct pollfd *fds, unsigned
>>> nfds, int timeout )
>>>      fd_set rdset, wrset, exset;
>>>
>>>      struct timeval tv = { 0, 0 };
>>> +    struct timeval *ptv = NULL;
>>>
>>>      int val = -1;
>>>
>>> @@ -794,6 +795,16 @@ int vlc_poll_os2( struct pollfd *fds, unsigned
>>> nfds, int timeout )
>>>      for( unsigned i = 0; i < nfds; i++ )
>>>      {
>>>          int fd = fds[ i ].fd;
>>> +
>>> +        fds[ i ].revents = 0;
>>> +        if( getsockopt( fd, SOL_SOCKET, SO_TYPE,
>>> +                        &( int ){ 0 }, &( int ){ sizeof( int )}) ==
>>> -1 &&
>>> +            ( errno == ENOTSOCK || errno == EBADF ))
>>> +        {
>>> +            fds[ i ].revents = POLLNVAL;
>>> +            continue;
>>> +        }
>>> +
>>>          if( val < fd )
>>>              val = fd;
>>>
>>> @@ -816,19 +827,26 @@ int vlc_poll_os2( struct pollfd *fds, unsigned
>>> nfds, int timeout )
>>>          div_t d    = div( timeout, 1000 );
>>>          tv.tv_sec  = d.quot;
>>>          tv.tv_usec = d.rem * 1000;
>>> +
>>> +        ptv = &tv;
>>>      }
>>>
>>> -    val = vlc_select( val + 1, &rdset, &wrset, &exset,
>>> -                      ( timeout >= 0 ) ? &tv : NULL );
>>> -    if( val == -1 )
>>> +    if( val != -1 && vlc_select( val + 1, &rdset, &wrset, &exset,
>>> ptv ) == -1 )
>>>          return -1;
>>>
>>> +    val = 0;
>>>      for( unsigned i = 0; i < nfds; i++ )
>>>      {
>>> -        int fd = fds[ i ].fd;
>>> -        fds[ i ].revents = ( FD_ISSET( fd, &rdset ) ? POLLIN  : 0 )
>>> -                         | ( FD_ISSET( fd, &wrset ) ? POLLOUT : 0 )
>>> -                         | ( FD_ISSET( fd, &exset ) ? POLLPRI : 0 );
>>> +        if( fds[ i ].revents == 0 )
>>> +        {
>>> +            int fd = fds[ i ].fd;
>>> +            fds[ i ].revents = ( FD_ISSET( fd, &rdset ) ? POLLIN  : 0 )
>>> +                             | ( FD_ISSET( fd, &wrset ) ? POLLOUT : 0 )
>>> +                             | ( FD_ISSET( fd, &exset ) ? POLLPRI : 0 );
>>> +        }
>>> +
>>> +        if( fds[ i ].revents != 0 )
>>> +            val++;
>>>      }
>>>
>>>      return val;
>>
> 

-- 
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




More information about the vlc-devel mailing list