require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_SYS_FILEDESC_H_)) {
    eval 'sub _SYS_FILEDESC_H_ () {1;}' unless defined(&_SYS_FILEDESC_H_);
    require 'sys/param.ph';
    require 'sys/queue.ph';
    require 'sys/mutex.ph';
    require 'sys/rwlock.ph';
    require 'sys/condvar.ph';
    eval 'sub NDFILE () {20;}' unless defined(&NDFILE);
    eval 'sub NDEXTENT () {50;}' unless defined(&NDEXTENT);
    eval 'sub NDENTRIES () {32;}' unless defined(&NDENTRIES);
    eval 'sub NDENTRYMASK () {( &NDENTRIES - 1);}' unless defined(&NDENTRYMASK);
    eval 'sub NDENTRYSHIFT () {5;}' unless defined(&NDENTRYSHIFT);
    eval 'sub NDLOSLOTS {
        my($x) = @_;
	    eval q(((($x) +  &NDENTRIES - 1) >>  &NDENTRYSHIFT));
    }' unless defined(&NDLOSLOTS);
    eval 'sub NDHISLOTS {
        my($x) = @_;
	    eval q((( &NDLOSLOTS($x) +  &NDENTRIES - 1) >>  &NDENTRYSHIFT));
    }' unless defined(&NDHISLOTS);
    eval 'sub NDFDFILE () {6;}' unless defined(&NDFDFILE);
    eval 'sub FDFILE_SIZE () {(($sizeof{ &fdfile_t}+ &CACHE_LINE_SIZE-1)/ &CACHE_LINE_SIZE* &CACHE_LINE_SIZE);}' unless defined(&FDFILE_SIZE);
    eval 'sub FR_CLOSING () {(0x80000000);}' unless defined(&FR_CLOSING);
    eval 'sub FR_MASK () {(~ &FR_CLOSING);}' unless defined(&FR_MASK);
    eval 'sub fd_startzero () { &fd_dhimap;}' unless defined(&fd_startzero);
    if(defined(&_KERNEL)) {
	eval 'sub GETCWD_CHECK_ACCESS () {0x1;}' unless defined(&GETCWD_CHECK_ACCESS);
    }
}
1;
