The last batch of commits break on FreeBSD 4.2-STABLE. 
$ uname -a
FreeBSD lerbsd.lerctr.org 4.2-STABLE FreeBSD 4.2-STABLE #90: Tue Nov
28 04:07:50 CST 2000
ler@lerbsd.lerctr.org:/usr/src/sys/compile/LERBSD  i386
$ 

Configure:

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

Last 50 lines of make output:
	
ranlib libplpgsql.a
/usr/libexec/elf/ld -x -shared -soname libplpgsql.so.1 -o libplpgsql.so.1 pl_parse.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o   -R/home/ler/pg-test/lib
rm -f libplpgsql.so
ln -s libplpgsql.so.1 libplpgsql.so
gmake[4]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl/plpgsql/src'
gmake[3]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl/plpgsql'
gmake[3]: Entering directory `/home/ler/pg-dev/pgsql/src/pl/tcl'
/bin/sh mkMakefile.tcldefs.sh '/usr/local/lib/tcl8.3/tclConfig.sh' 'Makefile.tcldefs'
gmake[3]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl/tcl'
gmake[3]: Entering directory `/home/ler/pg-dev/pgsql/src/pl/tcl'
cc -O -fPIC -I/usr/local/include/tcl8.3 -I/usr/local/include/tk8.3 -I../../../src/include -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DNO_VALUES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_TM_GMTOFF=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DNEED_MATHERR=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1   -c -o pltcl.o pltcl.c
ld -Bshareable -x -o pltcl.so pltcl.o -L/usr/local/lib -ltcl83 
rm pltcl.o
gmake[3]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl/tcl'
gmake[3]: Entering directory `/home/ler/pg-dev/pgsql/src/pl/plperl'
plperl_installdir='/home/ler/pg-test/lib' \
EXTRA_INCLUDES='-I/usr/local/include/tcl8.3 -I/usr/local/include/tk8.3 -I../../../src/include' \
perl Makefile.PL
Writing Makefile for plperl
gmake -f Makefile all
gmake[4]: Entering directory `/home/ler/pg-dev/pgsql/src/pl/plperl'
mkdir blib
mkdir blib/lib
mkdir blib/arch
mkdir blib/arch/auto
mkdir blib/arch/auto/plperl
mkdir blib/lib/auto
mkdir blib/lib/auto/plperl
cc -c -I/usr/local/include/tcl8.3 -I/usr/local/include/tk8.3 -I../../../src/include      -DVERSION=\"0.10\" -DXS_VERSION=\"0.10\" -DPIC -fpic -I/usr/libdata/perl/5.00503/mach/CORE  plperl.c
In file included from plperl.c:80:
/usr/libdata/perl/5.00503/mach/CORE/perl.h:1483: warning: `DEBUG' redefined
../../../src/include/utils/elog.h:22: warning: this is the location of the previous definition
In file included from /usr/include/sys/lock.h:45,
                 from /usr/include/sys/mount.h:49,
                 from /usr/libdata/perl/5.00503/mach/CORE/perl.h:376,
                 from plperl.c:80:
/usr/include/machine/lock.h:148: conflicting types for `s_lock'
../../../src/include/storage/s_lock.h:402: previous declaration of `s_lock'
gmake[4]: *** [plperl.o] Error 1
gmake[4]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl/plperl'
gmake[3]: *** [all] Error 2
gmake[3]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl/plperl'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/home/ler/pg-dev/pgsql/src'
gmake: *** [all] Error 2
$ ^D

Script done on Tue Nov 28 19:32:31 2000
BTW: this is the same configure I was using after Peter_E fixed the 
TCL / --with-includes stuff.

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

Tue, 28 Nov 2000 19:35:58 -0600
Larry Rosenman <ler@lerctr.org>
LOCK Fixes/Break on FreeBSD 4.2-STABLE
BTW, it compiles fine on UnixWare 7.1.1....
* Larry Rosenman <ler@lerctr.org> [001128 19:36]:
> The last batch of commits break on FreeBSD 4.2-STABLE. 
> $ uname -a
> FreeBSD lerbsd.lerctr.org 4.2-STABLE FreeBSD 4.2-STABLE #90: Tue Nov
> 28 04:07:50 CST 2000
> ler@lerbsd.lerctr.org:/usr/src/sys/compile/LERBSD  i386
> $ 
> 
> Configure:
> 
> ./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
> 	
> 
> Last 50 lines of make output:
> 	
> ranlib libplpgsql.a
> /usr/libexec/elf/ld -x -shared -soname libplpgsql.so.1 -o libplpgsql.so.1 pl_parse.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o   -R/home/ler/pg-test/lib
> rm -f libplpgsql.so
> ln -s libplpgsql.so.1 libplpgsql.so
> gmake[4]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl/plpgsql/src'
> gmake[3]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl/plpgsql'
> gmake[3]: Entering directory `/home/ler/pg-dev/pgsql/src/pl/tcl'
> /bin/sh mkMakefile.tcldefs.sh '/usr/local/lib/tcl8.3/tclConfig.sh' 'Makefile.tcldefs'
> gmake[3]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl/tcl'
> gmake[3]: Entering directory `/home/ler/pg-dev/pgsql/src/pl/tcl'
> cc -O -fPIC -I/usr/local/include/tcl8.3 -I/usr/local/include/tk8.3 -I../../../src/include -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DNO_VALUES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_TM_GMTOFF=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DNEED_MATHERR=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1   -c -o pltcl.o pltcl.c
> ld -Bshareable -x -o pltcl.so pltcl.o -L/usr/local/lib -ltcl83 
> rm pltcl.o
> gmake[3]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl/tcl'
> gmake[3]: Entering directory `/home/ler/pg-dev/pgsql/src/pl/plperl'
> plperl_installdir='/home/ler/pg-test/lib' \
> EXTRA_INCLUDES='-I/usr/local/include/tcl8.3 -I/usr/local/include/tk8.3 -I../../../src/include' \
> perl Makefile.PL
> Writing Makefile for plperl
> gmake -f Makefile all
> gmake[4]: Entering directory `/home/ler/pg-dev/pgsql/src/pl/plperl'
> mkdir blib
> mkdir blib/lib
> mkdir blib/arch
> mkdir blib/arch/auto
> mkdir blib/arch/auto/plperl
> mkdir blib/lib/auto
> mkdir blib/lib/auto/plperl
> cc -c -I/usr/local/include/tcl8.3 -I/usr/local/include/tk8.3 -I../../../src/include      -DVERSION=\"0.10\" -DXS_VERSION=\"0.10\" -DPIC -fpic -I/usr/libdata/perl/5.00503/mach/CORE  plperl.c
> In file included from plperl.c:80:
> /usr/libdata/perl/5.00503/mach/CORE/perl.h:1483: warning: `DEBUG' redefined
> ../../../src/include/utils/elog.h:22: warning: this is the location of the previous definition
> In file included from /usr/include/sys/lock.h:45,
>                  from /usr/include/sys/mount.h:49,
>                  from /usr/libdata/perl/5.00503/mach/CORE/perl.h:376,
>                  from plperl.c:80:
> /usr/include/machine/lock.h:148: conflicting types for `s_lock'
> ../../../src/include/storage/s_lock.h:402: previous declaration of `s_lock'
> gmake[4]: *** [plperl.o] Error 1
> gmake[4]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl/plperl'
> gmake[3]: *** [all] Error 2
> gmake[3]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl/plperl'
> gmake[2]: *** [all] Error 2
> gmake[2]: Leaving directory `/home/ler/pg-dev/pgsql/src/pl'
> gmake[1]: *** [all] Error 2
> gmake[1]: Leaving directory `/home/ler/pg-dev/pgsql/src'
> gmake: *** [all] Error 2
> $ ^D
> 
> Script done on Tue Nov 28 19:32:31 2000
> BTW: this is the same configure I was using after Peter_E fixed the 
> TCL / --with-includes stuff.
> 
> -- 
> 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
-- 
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

Tue, 28 Nov 2000 19:37:22 -0600
Larry Rosenman <ler@lerctr.org>
Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
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

Tue, 28 Nov 2000 23:31:17 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE 
* 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?
This maybe Matt Dillon's recent commit to FBSD then.  Either way, it's 
a problem on -STABLE 4.2 of FreeBSD. 

Here is the "Current" /usr/include/machine/lock.h:

/*
 * Copyright (c) 1997, by Steve Passe
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. The name of the developer may NOT be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD: src/sys/i386/include/lock.h,v 1.11.2.2 2000/09/30 02:49:34 ps Exp $
 */


#ifndef _MACHINE_LOCK_H_
#define _MACHINE_LOCK_H_


#ifdef LOCORE

#ifdef SMP

#define	MPLOCKED	lock ;

/*
 * Some handy macros to allow logical organization.
 */

#define MP_LOCK		call	_get_mplock

#define MP_TRYLOCK							\
	pushl	$_mp_lock ;			/* GIANT_LOCK */	\
	call	_MPtrylock ;			/* try to get lock */	\
	add	$4, %esp

#define MP_RELLOCK							\
	movl	$_mp_lock,%edx ;		/* GIANT_LOCK */	\
	call	_MPrellock_edx

/*
 * Protects the IO APIC and apic_imen as a critical region.
 */
#define IMASK_LOCK							\
	pushl	$_imen_lock ;			/* address of lock */	\
	call	_s_lock ;			/* MP-safe */		\
	addl	$4, %esp

#define IMASK_UNLOCK							\
	movl	$0, _imen_lock

#else  /* SMP */

#define	MPLOCKED				/* NOP */

#define MP_LOCK					/* NOP */

#endif /* SMP */

#else /* LOCORE */

#ifdef SMP

#include <machine/smptests.h>			/** xxx_LOCK */

/*
 * Locks regions protected in UP kernel via cli/sti.
 */
#ifdef USE_MPINTRLOCK
#define MPINTR_LOCK()	s_lock(&mpintr_lock)
#define MPINTR_UNLOCK()	s_unlock(&mpintr_lock)
#else
#define MPINTR_LOCK()
#define MPINTR_UNLOCK()
#endif /* USE_MPINTRLOCK */

/*
 * sio/cy lock.
 * XXX should rc (RISCom/8) use this?
 */
#ifdef USE_COMLOCK
#define COM_LOCK() 	s_lock(&com_lock)
#define COM_UNLOCK() 	s_unlock(&com_lock)
#define COM_DISABLE_INTR() \
		{ __asm __volatile("cli" : : : "memory"); COM_LOCK(); }
#define COM_ENABLE_INTR() \
		{ COM_UNLOCK(); __asm __volatile("sti"); }
#else
#define COM_LOCK()
#define COM_UNLOCK()
#define COM_DISABLE_INTR()	disable_intr()
#define COM_ENABLE_INTR()	enable_intr()
#endif /* USE_COMLOCK */

/* 
 * Clock hardware/struct lock.
 * XXX pcaudio and friends still need this lock installed.
 */
#ifdef USE_CLOCKLOCK
#define CLOCK_LOCK()	s_lock(&clock_lock)
#define CLOCK_UNLOCK()	s_unlock(&clock_lock)
#define CLOCK_DISABLE_INTR() \
		{ __asm __volatile("cli" : : : "memory"); CLOCK_LOCK(); }
#define CLOCK_ENABLE_INTR() \
		{ CLOCK_UNLOCK(); __asm __volatile("sti"); }
#else
#define CLOCK_LOCK()
#define CLOCK_UNLOCK()
#define CLOCK_DISABLE_INTR()	disable_intr()
#define CLOCK_ENABLE_INTR()	enable_intr()
#endif /* USE_CLOCKLOCK */

#else /* SMP */

#define MPINTR_LOCK()
#define MPINTR_UNLOCK()

#define COM_LOCK()
#define COM_UNLOCK()
#define CLOCK_LOCK()
#define CLOCK_UNLOCK()

#endif /* SMP */

/*
 * Simple spin lock.
 * It is an error to hold one of these locks while a process is sleeping.
 */
struct simplelock {
	volatile int	lock_data;
};

/* functions in simplelock.s */
void	s_lock_init		__P((struct simplelock *));
void	s_lock			__P((struct simplelock *));
int	s_lock_try		__P((struct simplelock *));
void	ss_lock			__P((struct simplelock *));
void	ss_unlock		__P((struct simplelock *));
void	s_lock_np		__P((struct simplelock *));
void	s_unlock_np		__P((struct simplelock *));

/* inline simplelock functions */
static __inline void
s_unlock(struct simplelock *lkp)
{
	lkp->lock_data = 0;
}

/* global data in mp_machdep.c */
extern struct simplelock	imen_lock;
extern struct simplelock	cpl_lock;
extern struct simplelock	fast_intr_lock;
extern struct simplelock	intr_lock;
extern struct simplelock	clock_lock;
extern struct simplelock	com_lock;
extern struct simplelock	mpintr_lock;
extern struct simplelock	mcount_lock;

#if !defined(SIMPLELOCK_DEBUG) && MAXCPU > 1
/*
 * This set of defines turns on the real functions in i386/isa/apic_ipl.s.
 */
#define	simple_lock_init(alp)	s_lock_init(alp)
#define	simple_lock(alp)	s_lock(alp)
#define	simple_lock_try(alp)	s_lock_try(alp)
#define	simple_unlock(alp)	s_unlock(alp)

#endif /* !SIMPLELOCK_DEBUG && MAXCPU > 1 */

#endif /* LOCORE */

#endif /* !_MACHINE_LOCK_H_ */
> 
> 			regards, tom lane
-- 
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

Tue, 28 Nov 2000 22:33:10 -0600
Larry Rosenman <ler@lerctr.org>
Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
* Larry Rosenman <ler@lerctr.org> [001128 22:33]:
> * 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?
> This maybe Matt Dillon's recent commit to FBSD then.  Either way, it's 
> a problem on -STABLE 4.2 of FreeBSD. 
Nope, I just checked, and that hadn't changed either:
$ ls -l sys/i386/include/lock.h sys/sys/lock.h      
-rw-r--r--  1 root  wheel  4981 Oct  3 21:43 sys/i386/include/lock.h
-rw-r--r--  1 root  wheel  9365 Oct  3 21:43 sys/sys/lock.h
$ ls -l /usr/include/machine/lock.h
-r--r--r--  1 root  wheel  4981 Oct  4 00:24
/usr/include/machine/lock.h
$ 


> 
> Here is the "Current" /usr/include/machine/lock.h:
> 
> /*
>  * Copyright (c) 1997, by Steve Passe
>  * All rights reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
>  * modification, are permitted provided that the following conditions
>  * are met:
>  * 1. Redistributions of source code must retain the above copyright
>  *    notice, this list of conditions and the following disclaimer.
>  * 2. The name of the developer may NOT be used to endorse or promote products
>  *    derived from this software without specific prior written permission.
>  *
>  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
>  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
>  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
>  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
>  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
>  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
>  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
>  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
>  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
>  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>  * SUCH DAMAGE.
>  *
>  * $FreeBSD: src/sys/i386/include/lock.h,v 1.11.2.2 2000/09/30 02:49:34 ps Exp $
>  */
> 
> 
> #ifndef _MACHINE_LOCK_H_
> #define _MACHINE_LOCK_H_
> 
> 
> #ifdef LOCORE
> 
> #ifdef SMP
> 
> #define	MPLOCKED	lock ;
> 
> /*
>  * Some handy macros to allow logical organization.
>  */
> 
> #define MP_LOCK		call	_get_mplock
> 
> #define MP_TRYLOCK							\
> 	pushl	$_mp_lock ;			/* GIANT_LOCK */	\
> 	call	_MPtrylock ;			/* try to get lock */	\
> 	add	$4, %esp
> 
> #define MP_RELLOCK							\
> 	movl	$_mp_lock,%edx ;		/* GIANT_LOCK */	\
> 	call	_MPrellock_edx
> 
> /*
>  * Protects the IO APIC and apic_imen as a critical region.
>  */
> #define IMASK_LOCK							\
> 	pushl	$_imen_lock ;			/* address of lock */	\
> 	call	_s_lock ;			/* MP-safe */		\
> 	addl	$4, %esp
> 
> #define IMASK_UNLOCK							\
> 	movl	$0, _imen_lock
> 
> #else  /* SMP */
> 
> #define	MPLOCKED				/* NOP */
> 
> #define MP_LOCK					/* NOP */
> 
> #endif /* SMP */
> 
> #else /* LOCORE */
> 
> #ifdef SMP
> 
> #include <machine/smptests.h>			/** xxx_LOCK */
> 
> /*
>  * Locks regions protected in UP kernel via cli/sti.
>  */
> #ifdef USE_MPINTRLOCK
> #define MPINTR_LOCK()	s_lock(&mpintr_lock)
> #define MPINTR_UNLOCK()	s_unlock(&mpintr_lock)
> #else
> #define MPINTR_LOCK()
> #define MPINTR_UNLOCK()
> #endif /* USE_MPINTRLOCK */
> 
> /*
>  * sio/cy lock.
>  * XXX should rc (RISCom/8) use this?
>  */
> #ifdef USE_COMLOCK
> #define COM_LOCK() 	s_lock(&com_lock)
> #define COM_UNLOCK() 	s_unlock(&com_lock)
> #define COM_DISABLE_INTR() \
> 		{ __asm __volatile("cli" : : : "memory"); COM_LOCK(); }
> #define COM_ENABLE_INTR() \
> 		{ COM_UNLOCK(); __asm __volatile("sti"); }
> #else
> #define COM_LOCK()
> #define COM_UNLOCK()
> #define COM_DISABLE_INTR()	disable_intr()
> #define COM_ENABLE_INTR()	enable_intr()
> #endif /* USE_COMLOCK */
> 
> /* 
>  * Clock hardware/struct lock.
>  * XXX pcaudio and friends still need this lock installed.
>  */
> #ifdef USE_CLOCKLOCK
> #define CLOCK_LOCK()	s_lock(&clock_lock)
> #define CLOCK_UNLOCK()	s_unlock(&clock_lock)
> #define CLOCK_DISABLE_INTR() \
> 		{ __asm __volatile("cli" : : : "memory"); CLOCK_LOCK(); }
> #define CLOCK_ENABLE_INTR() \
> 		{ CLOCK_UNLOCK(); __asm __volatile("sti"); }
> #else
> #define CLOCK_LOCK()
> #define CLOCK_UNLOCK()
> #define CLOCK_DISABLE_INTR()	disable_intr()
> #define CLOCK_ENABLE_INTR()	enable_intr()
> #endif /* USE_CLOCKLOCK */
> 
> #else /* SMP */
> 
> #define MPINTR_LOCK()
> #define MPINTR_UNLOCK()
> 
> #define COM_LOCK()
> #define COM_UNLOCK()
> #define CLOCK_LOCK()
> #define CLOCK_UNLOCK()
> 
> #endif /* SMP */
> 
> /*
>  * Simple spin lock.
>  * It is an error to hold one of these locks while a process is sleeping.
>  */
> struct simplelock {
> 	volatile int	lock_data;
> };
> 
> /* functions in simplelock.s */
> void	s_lock_init		__P((struct simplelock *));
> void	s_lock			__P((struct simplelock *));
> int	s_lock_try		__P((struct simplelock *));
> void	ss_lock			__P((struct simplelock *));
> void	ss_unlock		__P((struct simplelock *));
> void	s_lock_np		__P((struct simplelock *));
> void	s_unlock_np		__P((struct simplelock *));
> 
> /* inline simplelock functions */
> static __inline void
> s_unlock(struct simplelock *lkp)
> {
> 	lkp->lock_data = 0;
> }
> 
> /* global data in mp_machdep.c */
> extern struct simplelock	imen_lock;
> extern struct simplelock	cpl_lock;
> extern struct simplelock	fast_intr_lock;
> extern struct simplelock	intr_lock;
> extern struct simplelock	clock_lock;
> extern struct simplelock	com_lock;
> extern struct simplelock	mpintr_lock;
> extern struct simplelock	mcount_lock;
> 
> #if !defined(SIMPLELOCK_DEBUG) && MAXCPU > 1
> /*
>  * This set of defines turns on the real functions in i386/isa/apic_ipl.s.
>  */
> #define	simple_lock_init(alp)	s_lock_init(alp)
> #define	simple_lock(alp)	s_lock(alp)
> #define	simple_lock_try(alp)	s_lock_try(alp)
> #define	simple_unlock(alp)	s_unlock(alp)
> 
> #endif /* !SIMPLELOCK_DEBUG && MAXCPU > 1 */
> 
> #endif /* LOCORE */
> 
> #endif /* !_MACHINE_LOCK_H_ */
> > 
> > 			regards, tom lane
> -- 
> 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

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

Tue, 28 Nov 2000 22:36:29 -0600
Larry Rosenman <ler@lerctr.org>
Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
* 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....

LER

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

Tue, 28 Nov 2000 22:40:44 -0600
Larry Rosenman <ler@lerctr.org>
Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
* 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....

My signifigant other just installed a fresh copy of 4.2 last night,
unfortunetly the poor box is only a 233mhz, it'll be a while before
we build -stable on it.

However I'm confident I can have a fix within a couple of days.

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."

Tue, 28 Nov 2000 20:46:43 -0800
Alfred Perlstein <bright@wintelcom.net>
Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
My offer stands for you as well, if you'd like an account
on this P-III 600E, you are welcome to one...

LER
* Alfred Perlstein <bright@wintelcom.net> [001128 22:46]:
> * 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....
> 
> My signifigant other just installed a fresh copy of 4.2 last night,
> unfortunetly the poor box is only a 233mhz, it'll be a while before
> we build -stable on it.
> 
> However I'm confident I can have a fix within a couple of days.
> 
> -- 
> -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

Tue, 28 Nov 2000 22:48:51 -0600
Larry Rosenman <ler@lerctr.org>
Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
* Larry Rosenman <ler@lerctr.org> [001128 20:52] wrote:
> My offer stands for you as well, if you'd like an account
> on this P-III 600E, you are welcome to one...

I just remebered my laptop in the other room, it's a pretty recent 4.2.

I'll give it shot.

Yes, it's possible to forget about a computer...
   http://people.freebsd.org/~alfred/images/lab.jpg

:)

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."

Tue, 28 Nov 2000 20:55:37 -0800
Alfred Perlstein <bright@wintelcom.net>
Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
Larry Rosenman <ler@lerctr.org> writes:
>> Here is the "Current" /usr/include/machine/lock.h:
>> ...
>> void	s_lock			__P((struct simplelock *));
>> ...

Ick.  Seems like the relevant question is not so much "why did it break"
as "how did it ever manage to work"?

I have no problem with renaming our s_lock, if that's what it takes,
but I'm curious to know why there is a problem now and not before.
We've called that routine s_lock for a *long* time, so it seems
like there must be some factor involved that I don't see just yet...

			regards, tom lane

Tue, 28 Nov 2000 23:55:48 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE 
* Tom Lane <tgl@sss.pgh.pa.us> [001128 22:55]:
> Larry Rosenman <ler@lerctr.org> writes:
> >> Here is the "Current" /usr/include/machine/lock.h:
> >> ...
> >> void	s_lock			__P((struct simplelock *));
> >> ...
> 
> Ick.  Seems like the relevant question is not so much "why did it break"
> as "how did it ever manage to work"?
> 
> I have no problem with renaming our s_lock, if that's what it takes,
> but I'm curious to know why there is a problem now and not before.
> We've called that routine s_lock for a *long* time, so it seems
> like there must be some factor involved that I don't see just yet...
Didn't your commit message say something about the TAS and NON-TAS
paths being the same now? 


> 
> 			regards, tom lane
-- 
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

Tue, 28 Nov 2000 22:56:49 -0600
Larry Rosenman <ler@lerctr.org>
Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
Larry Rosenman <ler@lerctr.org> writes:
>> We've called that routine s_lock for a *long* time, so it seems
>> like there must be some factor involved that I don't see just yet...

> Didn't your commit message say something about the TAS and NON-TAS
> paths being the same now? 

Yeah, but don't tell me you were running on a non-TAS platform...
that stuff didn't work...

			regards, tom lane

Wed, 29 Nov 2000 00:02:41 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE 
* Tom Lane <tgl@sss.pgh.pa.us> [001128 23:03]:
> Larry Rosenman <ler@lerctr.org> writes:
> >> We've called that routine s_lock for a *long* time, so it seems
> >> like there must be some factor involved that I don't see just yet...
> 
> > Didn't your commit message say something about the TAS and NON-TAS
> > paths being the same now? 
> 
> Yeah, but don't tell me you were running on a non-TAS platform...
> that stuff didn't work...
The configure stuff used tas/dummy.s, so I'm not sure.... 


> 
> 			regards, tom lane
-- 
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

Tue, 28 Nov 2000 23:07:17 -0600
Larry Rosenman <ler@lerctr.org>
Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
* Alfred Perlstein <bright@wintelcom.net> [001128 22:55]:
> * Larry Rosenman <ler@lerctr.org> [001128 20:52] wrote:
> > My offer stands for you as well, if you'd like an account
> > on this P-III 600E, you are welcome to one...
> 
> I just remebered my laptop in the other room, it's a pretty recent 4.2.
> 
> I'll give it shot.
> 
> Yes, it's possible to forget about a computer...
>    http://people.freebsd.org/~alfred/images/lab.jpg
> 
> :)
I've got to go to bed now, but the offer stands.  If y'all need an 
account, peter e's got one already, and I can make more tomorrow.

Good luck, all. 

LER

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

Tue, 28 Nov 2000 23:16:34 -0600
Larry Rosenman <ler@lerctr.org>
Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
* Tom Lane <tgl@sss.pgh.pa.us> [001128 23:03]:
> Larry Rosenman <ler@lerctr.org> writes:
> >> We've called that routine s_lock for a *long* time, so it seems
> >> like there must be some factor involved that I don't see just yet...
> 
> > Didn't your commit message say something about the TAS and NON-TAS
> > paths being the same now? 
> 
> Yeah, but don't tell me you were running on a non-TAS platform...
> that stuff didn't work...
Tom's commit from tonite fixed it.  Regression running as I type... 

Thanks, Tom!

LER

> 
> 			regards, tom lane
-- 
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

Wed, 29 Nov 2000 19:53:37 -0600
Larry Rosenman <ler@lerctr.org>
Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
* Larry Rosenman <ler@lerctr.org> [001129 19:54]:
> * Tom Lane <tgl@sss.pgh.pa.us> [001128 23:03]:
> > Larry Rosenman <ler@lerctr.org> writes:
> > >> We've called that routine s_lock for a *long* time, so it seems
> > >> like there must be some factor involved that I don't see just yet...
> > 
> > > Didn't your commit message say something about the TAS and NON-TAS
> > > paths being the same now? 
> > 
> > Yeah, but don't tell me you were running on a non-TAS platform...
> > that stuff didn't work...
> Tom's commit from tonite fixed it.  Regression running as I type... 
and passed. :-) 


> 
> Thanks, Tom!
> 
> LER
> 
> > 
> > 			regards, tom lane
> -- 
> 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
-- 
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

Wed, 29 Nov 2000 19:55:19 -0600
Larry Rosenman <ler@lerctr.org>
Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
* 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.

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

Tue, 5 Dec 2000 02:00:02 -0800
Alfred Perlstein <bright@wintelcom.net>
Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
* 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

Tue, 5 Dec 2000 04:10:58 -0600
Larry Rosenman <ler@lerctr.org>
Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
Alfred Perlstein <bright@wintelcom.net> writes:
> Anyhow, to address the problem I've removed struct mount from
> userland visibility in both FreeBSD 5.x (current) and FreeBSD 4.x
> (stable).

That might fix things on your box, but we can hardly rely on it as an
answer for everyone running FreeBSD :-(.

Anyway, I've already worked around the problem by rearranging the PG
headers so that plperl doesn't need to import s_lock.h ...

			regards, tom lane

Tue, 05 Dec 2000 10:14:27 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE 
* Tom Lane <tgl@sss.pgh.pa.us> [001205 07:14] wrote:
> Alfred Perlstein <bright@wintelcom.net> writes:
> > Anyhow, to address the problem I've removed struct mount from
> > userland visibility in both FreeBSD 5.x (current) and FreeBSD 4.x
> > (stable).
> 
> That might fix things on your box, but we can hardly rely on it as an
> answer for everyone running FreeBSD :-(.
> 
> Anyway, I've already worked around the problem by rearranging the PG
> headers so that plperl doesn't need to import s_lock.h ...

Well I didn't say it was completely our fault, it's just that we
try pretty hard not to let those types of structs leak into userland
and for us to "steal" something called s_lock from userland, well
that's no good. :)

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."

Tue, 5 Dec 2000 07:16:47 -0800
Alfred Perlstein <bright@wintelcom.net>
Re: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
Actually, Alfred is a FreeBSD committer, and committed it 
to the FreeBSD source tree. 

It's for ALL at FreeBSD 4-STABLE as of today. 

LER


-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Tuesday, December 05, 2000 9:14 AM
To: Alfred Perlstein
Cc: Larry Rosenman; PostgreSQL Hackers List
Subject: Re: [HACKERS] Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE 


Alfred Perlstein <bright@wintelcom.net> writes:
> Anyhow, to address the problem I've removed struct mount from
> userland visibility in both FreeBSD 5.x (current) and FreeBSD 4.x
> (stable).

That might fix things on your box, but we can hardly rely on it as an
answer for everyone running FreeBSD :-(.

Anyway, I've already worked around the problem by rearranging the PG
headers so that plperl doesn't need to import s_lock.h ...

			regards, tom lane

Tue, 5 Dec 2000 09:23:26 -0600
"Larry Rosenman" <ler@lerctr.org>
RE: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE 