require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_LOCK_H_)) {
    eval 'sub _LOCK_H_ () {1;}' unless defined(&_LOCK_H_);
    if(defined(&_KERNEL)) {
	require 'machine/lock.ph';
    }
    if(defined(&_KERNEL)) {
	eval 'sub simple_lock {
	    my($lkp) = @_;
    	    eval q();
	}' unless defined(&simple_lock);
	eval 'sub simple_lock_try {
	    my($lkp) = @_;
    	    eval q((1));
	}' unless defined(&simple_lock_try);
	eval 'sub simple_unlock {
	    my($lkp) = @_;
    	    eval q();
	}' unless defined(&simple_unlock);
	eval 'sub simple_lock_assert {
	    my($lkp) = @_;
    	    eval q();
	}' unless defined(&simple_lock_assert);
	eval 'sub simple_lock_init {
	    my($lkp) = @_;
    	    eval q({ });
	}' unless defined(&simple_lock_init);
    }
    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_RELEASE () {0x6;}' unless defined(&LK_RELEASE);
    eval 'sub LK_DRAIN () {0x7;}' unless defined(&LK_DRAIN);
    eval 'sub LK_EXTFLG_MASK () {0x200070;}' unless defined(&LK_EXTFLG_MASK);
    eval 'sub LK_NOWAIT () {0x10;}' unless defined(&LK_NOWAIT);
    eval 'sub LK_CANRECURSE () {0x40;}' unless defined(&LK_CANRECURSE);
    eval 'sub LK_RECURSEFAIL () {0x200000;}' unless defined(&LK_RECURSEFAIL);
    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_RETRY () {0x20000;}' 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);
    eval 'sub LK_NOCPU () {(( &cpuid_t) -1);}' unless defined(&LK_NOCPU);
    eval 'sub LOCK_ASSERT {
        my($x) = @_;
	    eval q();
    }' unless defined(&LOCK_ASSERT);
}
1;
