require '_h2ph_pre.ph';

no warnings 'redefine';

require 'sys/rwlock.ph';
unless(defined(&NDFILE)) {
    sub NDFILE () {	20;}
}
unless(defined(&NDEXTENT)) {
    sub NDEXTENT () {	50;}
}
unless(defined(&NDENTRIES)) {
    sub NDENTRIES () {	32;}
}
unless(defined(&NDENTRYMASK)) {
    sub NDENTRYMASK () {	( &NDENTRIES - 1);}
}
unless(defined(&NDENTRYSHIFT)) {
    sub NDENTRYSHIFT () {	5;}
}
unless(defined(&NDREDUCE)) {
    sub NDREDUCE {
	my($x) = @_;
	eval q(((($x) +  &NDENTRIES - 1) >>  &NDENTRYSHIFT));
    }
}
unless(defined(&NDHISLOTS)) {
    sub NDHISLOTS {
	my($x) = @_;
	eval q(( &NDREDUCE( &NDREDUCE($x))));
    }
}
unless(defined(&NDLOSLOTS)) {
    sub NDLOSLOTS {
	my($x) = @_;
	eval q(( &NDHISLOTS($x) <<  &NDENTRYSHIFT));
    }
}
unless(defined(&UF_EXCLOSE)) {
    sub UF_EXCLOSE () {	0x1;}
}
unless(defined(&OFILESIZE)) {
    sub OFILESIZE () {	($sizeof{'struct file' } + $sizeof{'char'});}
}
if(defined(&_KERNEL)) {
    eval 'sub fdplock {
        my($fdp) = @_;
	    eval q( &rw_enter_write(($fdp)-> &fd_lock));
    }' unless defined(&fdplock);
    eval 'sub fdpunlock {
        my($fdp) = @_;
	    eval q( &rw_exit_write(($fdp)-> &fd_lock));
    }' unless defined(&fdpunlock);
}
1;
