diff mbox series

[ovs-dev,3/4] build-windows: Add check for struct timespec

Message ID 20171101171907.14588-4-aserdean@ovn.org
State Accepted
Headers show
Series windows: Add support for compiling using 2015/2017 | expand

Commit Message

Alin-Gabriel Serdean Nov. 1, 2017, 5:19 p.m. UTC
Starting from WDK 10 the structure `timespec` is defined in <time.h>.

This patch adds a check for the structure to make <pthread.h> aware of it, so
it doesn't try to redefine the structure.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
---
 m4/openvswitch.m4 | 1 +
 1 file changed, 1 insertion(+)

Comments

Ben Pfaff Nov. 3, 2017, 6:38 p.m. UTC | #1
On Wed, Nov 01, 2017 at 07:19:06PM +0200, Alin Gabriel Serdean wrote:
> Starting from WDK 10 the structure `timespec` is defined in <time.h>.
> 
> This patch adds a check for the structure to make <pthread.h> aware of it, so
> it doesn't try to redefine the structure.
> 
> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> ---
>  m4/openvswitch.m4 | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
> index 59e1352..01d2269 100644
> --- a/m4/openvswitch.m4
> +++ b/m4/openvswitch.m4
> @@ -143,6 +143,7 @@ AC_DEFUN([OVS_CHECK_WIN32],
>        )
>  
>        AC_DEFINE([WIN32], [1], [Define to 1 if building on WIN32.])
> +      AC_CHECK_TYPES([struct timespec], [], [], [[#include <time.h>]])
>        AH_BOTTOM([#ifdef WIN32
>  #include "include/windows/windefs.h"
>  #endif])

Is this something that the Windows pthread we recommend checks for?  I
don't see any checks for it in the OVS codebase itself.

If so,
Acked-by: Ben Pfaff <blp@ovn.org>

Thanks!
Alin-Gabriel Serdean Nov. 6, 2017, 11:19 a.m. UTC | #2
> -----Original Message-----
> From: Ben Pfaff [mailto:blp@ovn.org]
> Sent: Friday, November 3, 2017 8:38 PM
> To: Alin Gabriel Serdean <aserdean@ovn.org>
> Cc: dev@openvswitch.org
> Subject: Re: [ovs-dev] [PATCH 3/4] build-windows: Add check for struct
> timespec
> 
> On Wed, Nov 01, 2017 at 07:19:06PM +0200, Alin Gabriel Serdean wrote:
> > Starting from WDK 10 the structure `timespec` is defined in <time.h>.
> >
> > This patch adds a check for the structure to make <pthread.h> aware of
> > it, so it doesn't try to redefine the structure.
> >
> > Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> > ---
> >  m4/openvswitch.m4 | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index
> > 59e1352..01d2269 100644
> > --- a/m4/openvswitch.m4
> > +++ b/m4/openvswitch.m4
> > @@ -143,6 +143,7 @@ AC_DEFUN([OVS_CHECK_WIN32],
> >        )
> >
> >        AC_DEFINE([WIN32], [1], [Define to 1 if building on WIN32.])
> > +      AC_CHECK_TYPES([struct timespec], [], [], [[#include
> > + <time.h>]])
> >        AH_BOTTOM([#ifdef WIN32
> >  #include "include/windows/windefs.h"
> >  #endif])
> 
> Is this something that the Windows pthread we recommend checks for?  I
> don't see any checks for it in the OVS codebase itself.
> 
> If so,
> Acked-by: Ben Pfaff <blp@ovn.org>
> 
> Thanks!
Not necessarily (sorry for the long answer) 😊. We currently use: https://www.sourceware.org/pthreads-win32/ which looks for HAVE_STRUCT_TIMESPEC in "pthread.h" to define the struct or not.
Pthreads-win32 seems to be unmaintained and switched to pthread4w: https://sourceforge.net/p/pthreads4w/wiki/Home/. The latter has a check for VS 2015/2017 https://sourceforge.net/p/pthreads4w/code/ci/master/tree/sched.h#l87 regarding timespec. I tried reaching out to the maintainer to see which of these projects is actively maintained but unfortunately no response yet.
Ben Pfaff Nov. 6, 2017, 10:12 p.m. UTC | #3
On Mon, Nov 06, 2017 at 01:19:47PM +0200, aserdean@ovn.org wrote:
> > -----Original Message-----
> > From: Ben Pfaff [mailto:blp@ovn.org]
> > Sent: Friday, November 3, 2017 8:38 PM
> > To: Alin Gabriel Serdean <aserdean@ovn.org>
> > Cc: dev@openvswitch.org
> > Subject: Re: [ovs-dev] [PATCH 3/4] build-windows: Add check for struct
> > timespec
> > 
> > On Wed, Nov 01, 2017 at 07:19:06PM +0200, Alin Gabriel Serdean wrote:
> > > Starting from WDK 10 the structure `timespec` is defined in <time.h>.
> > >
> > > This patch adds a check for the structure to make <pthread.h> aware of
> > > it, so it doesn't try to redefine the structure.
> > >
> > > Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> > > ---
> > >  m4/openvswitch.m4 | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index
> > > 59e1352..01d2269 100644
> > > --- a/m4/openvswitch.m4
> > > +++ b/m4/openvswitch.m4
> > > @@ -143,6 +143,7 @@ AC_DEFUN([OVS_CHECK_WIN32],
> > >        )
> > >
> > >        AC_DEFINE([WIN32], [1], [Define to 1 if building on WIN32.])
> > > +      AC_CHECK_TYPES([struct timespec], [], [], [[#include
> > > + <time.h>]])
> > >        AH_BOTTOM([#ifdef WIN32
> > >  #include "include/windows/windefs.h"
> > >  #endif])
> > 
> > Is this something that the Windows pthread we recommend checks for?  I
> > don't see any checks for it in the OVS codebase itself.
> > 
> > If so,
> > Acked-by: Ben Pfaff <blp@ovn.org>
> > 
> > Thanks!
> Not necessarily (sorry for the long answer) 😊. We currently use: https://www.sourceware.org/pthreads-win32/ which looks for HAVE_STRUCT_TIMESPEC in "pthread.h" to define the struct or not.
> Pthreads-win32 seems to be unmaintained and switched to pthread4w: https://sourceforge.net/p/pthreads4w/wiki/Home/. The latter has a check for VS 2015/2017 https://sourceforge.net/p/pthreads4w/code/ci/master/tree/sched.h#l87 regarding timespec. I tried reaching out to the maintainer to see which of these projects is actively maintained but unfortunately no response yet.

OK.  At any rate it sounds like you're on top of the situation, so if
this fixes a problem then I support it.

Acked-by: Ben Pfaff <blp@ovn.org>
Anand Kumar Nov. 8, 2017, 1:16 a.m. UTC | #4
Acked-by: Anand Kumar <kumaranand@vmware.com>

Thanks,
Anand Kumar

On 11/1/17, 10:19 AM, "ovs-dev-bounces@openvswitch.org on behalf of Alin Gabriel Serdean" <ovs-dev-bounces@openvswitch.org on behalf of aserdean@ovn.org> wrote:

    Starting from WDK 10 the structure `timespec` is defined in <time.h>.
    
    This patch adds a check for the structure to make <pthread.h> aware of it, so
    it doesn't try to redefine the structure.
    
    Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
    ---
     m4/openvswitch.m4 | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
    index 59e1352..01d2269 100644
    --- a/m4/openvswitch.m4
    +++ b/m4/openvswitch.m4
    @@ -143,6 +143,7 @@ AC_DEFUN([OVS_CHECK_WIN32],
           )
     
           AC_DEFINE([WIN32], [1], [Define to 1 if building on WIN32.])
    +      AC_CHECK_TYPES([struct timespec], [], [], [[#include <time.h>]])
           AH_BOTTOM([#ifdef WIN32
     #include "include/windows/windefs.h"
     #endif])
    -- 
    2.10.2.windows.1
    
    _______________________________________________
    dev mailing list
    dev@openvswitch.org
    https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Q5z9tBe-nAOpE7LIHSPV8uy5-437agMXvkeHHMkR8Us&m=GdBPfaaFUD8pbXrME5Epp0sGJzUXA3u4N5uLubES69w&s=skamfHWdCL4EFouwbBMFa4uLdGfALlqnG0Sw3HZvumw&e=
diff mbox series

Patch

diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 59e1352..01d2269 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -143,6 +143,7 @@  AC_DEFUN([OVS_CHECK_WIN32],
       )
 
       AC_DEFINE([WIN32], [1], [Define to 1 if building on WIN32.])
+      AC_CHECK_TYPES([struct timespec], [], [], [[#include <time.h>]])
       AH_BOTTOM([#ifdef WIN32
 #include "include/windows/windefs.h"
 #endif])