Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE - Mailing list pgsql-hackers

From Larry Rosenman
Subject Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
Date
Msg-id 20001205041058.A28949@lerami.lerctr.org
Whole thread Raw
In response to Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE  (Alfred Perlstein <bright@wintelcom.net>)
List pgsql-hackers
* Alfred Perlstein <bright@wintelcom.net> [001205 04:00]:
> * Larry Rosenman <ler@lerctr.org> [001128 20:44] wrote:
> > * Tom Lane <tgl@sss.pgh.pa.us> [001128 22:31]:
> > > Larry Rosenman <ler@lerctr.org> writes:
> > > > The last batch of commits break on FreeBSD 4.2-STABLE. 
> > > > /usr/include/machine/lock.h:148: conflicting types for `s_lock'
> > > > ../../../src/include/storage/s_lock.h:402: previous declaration of `s_lock'
> > > 
> > > That's odd.  s_lock has been declared the same way right along in our
> > > code; I didn't change it.  Can you see what's changed to cause a
> > > conflict where there was none before?
> > > 
> > >             regards, tom lane
> > Other things that may be an issue:
> > 
> > 1) BINUTILS 2.10.1
> > 2) OPENSSL 0.9.6 
> > 
> > both just MFC'd into FreeBSD recently, but I believe we built until
> > tonite. 
> > 
> > I can make you an account on the box if you'd like....
> 
> Grr, couldn't find the original message.  I think you thought
> you solved your problem with building on FreeBSD, however I
> think you just forgot to compile with perl support enabled.
> 
> When I compiled with perl support it broke.  This isn't a 
> postgresql bug, nor a FreeBSD bug although the fault lies
> mostly with FreeBSD for polluting the C namespace a _lot_
> when sys/mount.h is included.
Actually, perl support was included, and Tom's fix in the
cvs DID fix it, but fixing FreeBSD doesn't hurt.  Here is
what I've been configuring with:


./configure  --prefix=/home/ler/pg-test --enable-syslog \--with-CXX --with-perl --enable-multibyte --enable-cassert
\--with-openssl\--with-includes="/usr/local/include/tcl8.3 /usr/local/include/tk8.3" \--with-tcl
\--with-tclconfig=/usr/local/lib/tcl8.3\--with-tkconfig=/usr/local/lib/tk8.3
 

> 
> What happens is the the perl code brings in perl.h which brings
> in sys/mount.h, sys/mount.h includes sys/lock.h because our
> kernel structure "mount" has a VFS lock in it, VFS locks happen
> to contain spinlocks (simplelocks) and one of our our functions
> to manipulate the simplelocks is called s_lock().  This causes
> a namespace conflict which causes the compile error.
> 
> Anyhow, to address the problem I've removed struct mount from
> userland visibility in both FreeBSD 5.x (current) and FreeBSD 4.x
> (stable).
> 
> Things should work now but let me know if you have any other
> problems.
> 
> And thanks for pointing it out and offering to help track it
> down.
> 
> here's the patch if you don't want to cvsup your machine all the
> way.
> 
> Index: sys/sys/mount.h
> ===================================================================
> RCS file: /home/ncvs/src/sys/sys/mount.h,v
> retrieving revision 1.89
> diff -u -r1.89 mount.h
> --- sys/sys/mount.h    2000/01/19 06:07:34    1.89
> +++ sys/sys/mount.h    2000/12/04 20:00:54
> @@ -46,7 +46,9 @@
>  #endif /* !_KERNEL */
>  
>  #include <sys/queue.h>
> +#ifdef _KERNEL
>  #include <sys/lock.h>
> +#endif
>  
>  typedef struct fsid { int32_t val[2]; } fsid_t;    /* file system id type */
>  
> @@ -99,6 +101,7 @@
>      long    f_spare[2];        /* unused spare */
>  };
>  
> +#ifdef _KERNEL
>  /*
>   * Structure per mounted file system.  Each mounted file system has an
>   * array of operations and an instance record.  The file systems are
> @@ -122,6 +125,7 @@
>      time_t        mnt_time;        /* last time written*/
>      u_int        mnt_iosize_max;        /* max IO request size */
>  };
> +#endif /* _KERNEL */
>  
>  /*
>   * User specifiable flags.
> Index: usr.bin/fstat/cd9660.c
> ===================================================================
> RCS file: /home/ncvs/src/usr.bin/fstat/cd9660.c,v
> retrieving revision 1.1.2.1
> diff -u -r1.1.2.1 cd9660.c
> --- usr.bin/fstat/cd9660.c    2000/07/02 10:20:24    1.1.2.1
> +++ usr.bin/fstat/cd9660.c    2000/12/04 23:35:21
> @@ -46,7 +46,9 @@
>  #include <sys/stat.h>
>  #include <sys/time.h>
>  #include <sys/vnode.h>
> +#define _KERNEL
>  #include <sys/mount.h>
> +#undef _KERNEL
>  
>  #include <isofs/cd9660/cd9660_node.h>
>  
> Index: usr.bin/fstat/fstat.c
> ===================================================================
> RCS file: /home/ncvs/src/usr.bin/fstat/fstat.c,v
> retrieving revision 1.21.2.2
> diff -u -r1.21.2.2 fstat.c
> --- usr.bin/fstat/fstat.c    2000/07/02 10:28:38    1.21.2.2
> +++ usr.bin/fstat/fstat.c    2000/12/04 20:01:08
> @@ -66,8 +66,8 @@
>  #include <sys/file.h>
>  #include <ufs/ufs/quota.h>
>  #include <ufs/ufs/inode.h>
> -#undef _KERNEL
>  #include <sys/mount.h>
> +#undef _KERNEL
>  #include <nfs/nfsproto.h>
>  #include <nfs/rpcv2.h>
>  #include <nfs/nfs.h>
> 
> -- 
> -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
> "I have the heart of a child; I keep it in a jar on my desk."
-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


pgsql-hackers by date:

Previous
From: Alfred Perlstein
Date:
Subject: Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
Next
From: Marko Kreen
Date:
Subject: Re: EAN13 for postgresql