[openib-general] Re: [PATCH] OpenSM - complib constructor cause ASSERT

Sasha Khapyorsky sashak at voltaire.com
Wed Mar 8 08:42:12 PST 2006


Hi Yael,

On 14:56 Wed 08 Mar     , Yael Kalka wrote:
> 
> Attached is a patch regarding the complib constructor ASSERT issue.
> This removes the constructor attribute from the complib_init function,
> and as a result adds an explicit call for complib_init in opensm/main.c
> and osmtest/main.c.
> Also, this patch removes #ifdef __WIN__ existing in opensm/main.c, as
> main.c is different between linux and windows stacks.

That looks fine for me.

I think it may be also good to remove complib_fini() functnion, it is
attributed as destructor and mostly duplicated by explicitely called
complib_exit().

Sasha.

> Thanks,
> Yael
> 
> Signed-off-by:  Yael Kalka <yael at mellanox.co.il>
> 
> Index: complib/cl_complib.c
> ===================================================================
> --- complib/cl_complib.c	(revision 5671)
> +++ complib/cl_complib.c	(working copy)
> @@ -62,7 +62,6 @@ __cl_timer_prov_destroy( void );
>  cl_spinlock_t cl_atomic_spinlock;
>  
>  void
> -__attribute (( constructor ))
>  complib_init(void)
>  {
>  	cl_status_t	status = CL_SUCCESS;
> Index: osmtest/main.c
> ===================================================================
> --- osmtest/main.c	(revision 5671)
> +++ osmtest/main.c	(working copy)
> @@ -593,9 +593,7 @@ main( int argc,
>     if (vendor_debug)
>         osm_vendor_set_debug(osm_test.p_vendor, vendor_debug);
>  
> -#ifdef __WIN__
>  	complib_init();
> -#endif
>  
>  	status = osmtest_init( &osm_test, &opt, ( osm_log_level_t ) log_flags );
>  	if( status != IB_SUCCESS )
> Index: opensm/main.c
> ===================================================================
> --- opensm/main.c	(revision 5671)
> +++ opensm/main.c	(working copy)
> @@ -44,10 +44,6 @@
>   *
>   * $Revision: 1.23 $
>   */
> -#ifdef __WIN__
> -#pragma warning(disable : 4996)
> -#endif
> -
>  #if HAVE_CONFIG_H
>  #  include <config.h>
>  #endif /* HAVE_CONFIG_H */
> @@ -506,9 +502,7 @@ main(
>        {  NULL,            0, NULL,  0 }  /* Required at the end of the array */
>      };
>  
> -#ifdef __WIN__
>  	complib_init();
> -#endif
>  
>    /* Make sure that the opensm and complib were compiled using 
>       same modes (debug/free) */
> 



More information about the general mailing list