On Wed, 2009-06-10 at 15:36 +0200, Jérôme Flesch wrote:
> > On Wed, 2009-06-10 at 09:40 +0200, Jérôme Flesch wrote:
> >>> Jerome,
> >>>
> >>> Thanks for the work. Few comments:
> >>>
> >>> First, NAME_MAX was changed to FILENAME_MAX to match posix.  Also these
> >>> are defined in /usr/include/limits.h.  Doesn't bsd have this file? (I
> >>> recently fixed this problem for the Solaris port I did)  If it does,
> >>> then you shouldn't have to do any defining since this is now fixed in
> >>> current trunk.
> >>>
> >> I confirm, FILENAME_MAX is defined on FreeBSD (in stdio.h), so this part 
> >> of my patch is actually not required. Do you want me to prepare a new one ?
> >>
> > Yes please.  Also the PATH_MAX variable should be defined somewhere in
> > your header files and doesn't need a definition in configure.ac.
> >
> I've attached a new version of the patch to this mail. You were right, 
> PATH_MAX and NAME_MAX defines are not needed anymore. I've also tried to 
> make the -ldl part a little bit less ugly.
> 
> 
> >>> I think the LDL part needs to be in some user defined flag in the
> >>> configure.ac.  The #if BSD with defining LDL is a bit hacky.  I'm not
> >>> sure where it should go however, so perhaps Jim or Fabio could comment.
> >>> If Jim or Fabio give that part the thumbs up, then this patch should be
> >>> good to go in.
> >>>
> >>> the if defined semun wont work because unions are not defines.  That
> >>> entire code segment is wrong.  Can you try the attached patch on bsd for
> >>> me?
> >>>
> >> I think you misunderstood my problem: semun *is* already defined on 
> >> FreeBSD, but the #if !defined(semun) doesn't work on my system (probably 
> >> due to a GCC version difference ?) and the compiler ends up with a 
> >> redefinition of semun.
> >>
> >> Is there actually any system where semun is not already defined ?
> >>
> >>
> > 
> > Linux doesn't define it and Solaris doesn't even have a description of
> > the definition.  Do you have _SEM_SEMUN_UNDEFINED in your header files?
> > Or SEM_SEMUN_DEFINED?  That can be used to do an if defined test.
> > 
> I haven't found any of them in the FreeBSD headers :/
> 

I believe the proper thing to do is put the union in ifdefs around
_SEM_SEMUN_UNDEFINED and define them in configure.ac for Solaris.

Can you try this patch on your os?

Regards
-steve

> 
> > Regards
> > -steve
> > 
> > 
> > 
> > 
> > 
> plain text document attachment (patch-fix-bsd-compilation)
> diff --git a/configure.ac b/configure.ac
> index de1ac78..b0b7c87 100644
> --- configure.ac
> +++ configure.ac
> @@ -194,6 +194,7 @@ AC_ARG_WITH([socket-dir],
>  # OS detection
>  # THIS SECTION MUST DIE!
>  CP=cp
> +OS_LDL="-ldl"
>  case "$host_os" in
>       *linux*)
>               AC_DEFINE_UNQUOTED([COROSYNC_LINUX], [1],
> @@ -225,11 +226,14 @@ case "$host_os" in
>       *bsd*)
>               AC_DEFINE_UNQUOTED([COROSYNC_BSD], [1],
>                                  [Compiling for BSD platform])
> +             AC_DEFINE_UNQUOTED([MAP_ANONYMOUS], [MAP_ANON],
> +                                [Shared memory define for Darwin platform])
>               OS_CFLAGS=""
>               OS_CPPFLAGS="-I/usr/local/include"
>               OS_LDFLAGS="-L/usr/local/lib"
>               OS_DYFLAGS="-export-dynamic"
>               DARWIN_OPTS=""
> +             OS_LDL=""
>       ;;
>       *solaris*)
>               AC_DEFINE_UNQUOTED([COROSYNC_SOLARIS], [1],
> diff --git a/lib/Makefile.am b/lib/Makefile.am
> index 37afffd..31e8664 100644
> --- lib/Makefile.am
> +++ lib/Makefile.am
> @@ -114,7 +114,7 @@ libconfdb.so.$(SONAME): confdb.o sa-confdb.o 
> ../lcr/lcr_ifact.o libcoroipcc.so.$
>       $(CC) -shared -o $@ \
>               -Wl,-soname=libconfdb.so.$(SOMAJOR) \
>               -Wl,-version-script=$(srcdir)/libconfdb.versions \
> -             $^ $(LDFLAGS) $(OS_DYFLAGS) -ldl $(AM_LDFLAGS)
> +             $^ $(LDFLAGS) $(OS_DYFLAGS) $(OS_LDL) $(AM_LDFLAGS)
>       ln -sf libconfdb.so.$(SONAME) libconfdb.so
>       ln -sf libconfdb.so.$(SONAME) libconfdb.so.$(SOMAJOR)
>  
Index: exec/coroipcs.c
===================================================================
--- exec/coroipcs.c	(revision 2227)
+++ exec/coroipcs.c	(working copy)
@@ -99,12 +99,14 @@
 	size_t size;
 };
 
+#if defined(_SEM_SEMUN_UNDEFINED) 
 union semun {
 	int val;
 	struct semid_ds *buf;
 	unsigned short int *array;
 	struct seminfo *__buf;
 };
+#endif
 
 enum conn_state {
 	CONN_STATE_THREAD_INACTIVE = 0,
Index: configure.ac
===================================================================
--- configure.ac	(revision 2227)
+++ configure.ac	(working copy)
@@ -236,6 +236,8 @@
 				   [Compiling for Solaris platform])
 		AC_DEFINE_UNQUOTED([TS_CLASS], [1],
 				   [Prevent being scheduled RR])
+		AC_DEFINE_UNQUOTED([_SEM_SEMUN_UNDEFINED], [1],
+				   [The semun structure is undefined])
 		OS_CFLAGS=""
 		OS_CPPFLAGS="-D_REENTRANT"
 		OS_LDFLAGS=""
Index: lib/coroipcc.c
===================================================================
--- lib/coroipcc.c	(revision 2227)
+++ lib/coroipcc.c	(working copy)
@@ -251,7 +251,7 @@
 	return (0);
 }
 
-#if !defined(semun)
+#if defined(_SEM_SEMUN_UNDEFINED)
 union semun {
         int val;
         struct semid_ds *buf;
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to