require '_h2ph_pre.ph';

unless(defined(&_LOCK_H_)) {
    eval 'sub _LOCK_H_ () {1;}' unless defined(&_LOCK_H_);
    require 'sys/simplelock.ph';
    eval 'sub LK_TYPE_MASK () {0xf;}' unless defined(&LK_TYPE_MASK);
    eval 'sub LK_SHARED () {0x1;}' unless defined(&LK_SHARED);
    eval 'sub LK_EXCLUSIVE () {0x2;}' unless defined(&LK_EXCLUSIVE);
    eval 'sub LK_UPGRADE () {0x3;}' unless defined(&LK_UPGRADE);
    eval 'sub LK_EXCLUPGRADE () {0x4;}' unless defined(&LK_EXCLUPGRADE);
    eval 'sub LK_DOWNGRADE () {0x5;}' unless defined(&LK_DOWNGRADE);
    eval 'sub LK_RELEASE () {0x6;}' unless defined(&LK_RELEASE);
    eval 'sub LK_DRAIN () {0x7;}' unless defined(&LK_DRAIN);
    eval 'sub LK_EXTFLG_MASK () {0x770;}' unless defined(&LK_EXTFLG_MASK);
    eval 'sub LK_NOWAIT () {0x10;}' unless defined(&LK_NOWAIT);
    eval 'sub LK_SLEEPFAIL () {0x20;}' unless defined(&LK_SLEEPFAIL);
    eval 'sub LK_CANRECURSE () {0x40;}' unless defined(&LK_CANRECURSE);
    eval 'sub LK_REENABLE () {0x80;}' unless defined(&LK_REENABLE);
    eval 'sub LK_RECURSEFAIL () {0x100;}' unless defined(&LK_RECURSEFAIL);
    eval 'sub LK_WANT_UPGRADE () {0x1000;}' unless defined(&LK_WANT_UPGRADE);
    eval 'sub LK_WANT_EXCL () {0x2000;}' unless defined(&LK_WANT_EXCL);
    eval 'sub LK_HAVE_EXCL () {0x4000;}' unless defined(&LK_HAVE_EXCL);
    eval 'sub LK_WAITDRAIN () {0x8000;}' unless defined(&LK_WAITDRAIN);
    eval 'sub LK_DRAINING () {0x40000;}' unless defined(&LK_DRAINING);
    eval 'sub LK_DRAINED () {0x80000;}' unless defined(&LK_DRAINED);
    eval 'sub LK_INTERLOCK () {0x100000;}' unless defined(&LK_INTERLOCK);
    eval 'sub LK_RETRY () {0x200000;}' unless defined(&LK_RETRY);
    eval 'sub LK_KERNPROC () {(( &pid_t) -2);}' unless defined(&LK_KERNPROC);
    eval 'sub LK_NOPROC () {(( &pid_t) -1);}' unless defined(&LK_NOPROC);
    if(defined(&LOCKDEBUG)) {
	eval 'sub LOCK_ASSERT {
	    local($x) = @_;
    	    eval q( &KASSERT($x));
	}' unless defined(&LOCK_ASSERT);
    } else {
	eval 'sub LOCK_ASSERT {
	    local($x) = @_;
    	    eval q();
	}' unless defined(&LOCK_ASSERT);
    }
}
1;
