require '_h2ph_pre.ph';

unless(defined(&_SYS_POOL_H_)) {
    eval 'sub _SYS_POOL_H_ () {1;}' unless defined(&_SYS_POOL_H_);
    eval 'sub KERN_POOL_NPOOLS () {1;}' unless defined(&KERN_POOL_NPOOLS);
    eval 'sub KERN_POOL_NAME () {2;}' unless defined(&KERN_POOL_NAME);
    eval 'sub KERN_POOL_POOL () {3;}' unless defined(&KERN_POOL_POOL);
    if(defined(&_KERNEL)) {
	eval 'sub __POOL_EXPOSE () {1;}' unless defined(&__POOL_EXPOSE);
    }
    if(defined( &_KERNEL_OPT)) {
	require 'opt_pool.ph';
    }
    if(defined(&__POOL_EXPOSE)) {
	require 'sys/lock.ph';
	require 'sys/queue.ph';
	require 'sys/time.ph';
    }
    eval 'sub PR_HASHTABSIZE () {8;}' unless defined(&PR_HASHTABSIZE);
    if(defined(&__POOL_EXPOSE)) {
	eval 'sub PR_MALLOCOK () {1;}' unless defined(&PR_MALLOCOK);
	eval 'sub PR_NOWAIT () {0;}' unless defined(&PR_NOWAIT);
	eval 'sub PR_WAITOK () {2;}' unless defined(&PR_WAITOK);
	eval 'sub PR_WANTED () {4;}' unless defined(&PR_WANTED);
	eval 'sub PR_STATIC () {8;}' unless defined(&PR_STATIC);
	eval 'sub PR_FREEHEADER () {16;}' unless defined(&PR_FREEHEADER);
	eval 'sub PR_URGENT () {32;}' unless defined(&PR_URGENT);
	eval 'sub PR_PHINPAGE () {64;}' unless defined(&PR_PHINPAGE);
	eval 'sub PR_LOGGING () {128;}' unless defined(&PR_LOGGING);
	eval 'sub PR_LIMITFAIL () {256;}' unless defined(&PR_LIMITFAIL);
    }
    if(defined(&_KERNEL)) {
	if(defined(&POOL_DIAGNOSTIC)) {
	    eval 'sub pool_get {
	        local($h, $f) = @_;
    		eval q( &_pool_get(($h), ($f),  &__FILE__,  &__LINE__));
	    }' unless defined(&pool_get);
	    eval 'sub pool_put {
	        local($h, $v) = @_;
    		eval q( &_pool_put(($h), ($v),  &__FILE__,  &__LINE__));
	    }' unless defined(&pool_put);
	    eval 'sub pool_reclaim {
	        local($h) = @_;
    		eval q( &_pool_reclaim(($h),  &__FILE__,  &__LINE__));
	    }' unless defined(&pool_reclaim);
	}
    }
}
1;
