require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_SYS_FCNTL_H_)) {
    eval 'sub _SYS_FCNTL_H_ () {1;}' unless defined(&_SYS_FCNTL_H_);
    unless(defined(&_KERNEL)) {
	require 'sys/featuretest.ph';
	require 'sys/types.ph';
	if(defined(&_XOPEN_SOURCE)) {
	    require 'sys/stat.ph';
	}
    }
    eval 'sub O_RDONLY () {0x;}' unless defined(&O_RDONLY);
    eval 'sub O_WRONLY () {0x1;}' unless defined(&O_WRONLY);
    eval 'sub O_RDWR () {0x2;}' unless defined(&O_RDWR);
    eval 'sub O_ACCMODE () {0x3;}' unless defined(&O_ACCMODE);
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub FREAD () {0x1;}' unless defined(&FREAD);
	eval 'sub FWRITE () {0x2;}' unless defined(&FWRITE);
    }
    eval 'sub O_NONBLOCK () {0x4;}' unless defined(&O_NONBLOCK);
    eval 'sub O_APPEND () {0x8;}' unless defined(&O_APPEND);
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub O_SHLOCK () {0x10;}' unless defined(&O_SHLOCK);
	eval 'sub O_EXLOCK () {0x20;}' unless defined(&O_EXLOCK);
	eval 'sub O_ASYNC () {0x40;}' unless defined(&O_ASYNC);
    }
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 199309 || (defined(&_XOPEN_SOURCE)  && defined(&_XOPEN_SOURCE_EXTENDED)) || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0) >= 500|| defined(&_NETBSD_SOURCE)) {
	eval 'sub O_SYNC () {0x80;}' unless defined(&O_SYNC);
    }
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200809 || defined(&_NETBSD_SOURCE)) {
	eval 'sub O_NOFOLLOW () {0x100;}' unless defined(&O_NOFOLLOW);
    }
    eval 'sub O_CREAT () {0x200;}' unless defined(&O_CREAT);
    eval 'sub O_TRUNC () {0x400;}' unless defined(&O_TRUNC);
    eval 'sub O_EXCL () {0x800;}' unless defined(&O_EXCL);
    eval 'sub O_NOCTTY () {0x8000;}' unless defined(&O_NOCTTY);
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 199309 || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0) >= 500|| defined(&_NETBSD_SOURCE)) {
	eval 'sub O_DSYNC () {0x10000;}' unless defined(&O_DSYNC);
	eval 'sub O_RSYNC () {0x20000;}' unless defined(&O_RSYNC);
    }
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub O_ALT_IO () {0x40000;}' unless defined(&O_ALT_IO);
	eval 'sub O_DIRECT () {0x80000;}' unless defined(&O_DIRECT);
    }
    eval 'sub O_DIRECTORY () {0x200000;}' unless defined(&O_DIRECTORY);
    eval 'sub O_CLOEXEC () {0x400000;}' unless defined(&O_CLOEXEC);
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200809 || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0>= 700) || defined(&_NETBSD_SOURCE)) {
	eval 'sub O_SEARCH () {0x800000;}' unless defined(&O_SEARCH);
    }
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub O_NOSIGPIPE () {0x1000000;}' unless defined(&O_NOSIGPIPE);
	eval 'sub O_REGULAR () {0x2000000;}' unless defined(&O_REGULAR);
    }
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200809 || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0>= 700) || defined(&_NETBSD_SOURCE)) {
	eval 'sub O_EXEC () {0x4000000;}' unless defined(&O_EXEC);
    }
    if(defined(&_KERNEL)) {
	eval 'sub FFLAGS {
	    my($oflags) = @_;
    	    eval q((($oflags) + 1));
	}' unless defined(&FFLAGS);
	eval 'sub OFLAGS {
	    my($fflags) = @_;
    	    eval q((($fflags) - 1));
	}' unless defined(&OFLAGS);
	eval 'sub O_MASK () {( &O_ACCMODE| &O_NONBLOCK| &O_APPEND| &O_SHLOCK| &O_EXLOCK|  &O_ASYNC| &O_SYNC| &O_CREAT| &O_TRUNC| &O_EXCL| &O_DSYNC|  &O_RSYNC| &O_NOCTTY| &O_ALT_IO| &O_NOFOLLOW| &O_DIRECT|  &O_DIRECTORY| &O_CLOEXEC| &O_NOSIGPIPE| &O_REGULAR| &O_EXEC);}' unless defined(&O_MASK);
	eval 'sub FEXEC () { &O_EXEC;}' unless defined(&FEXEC);
	eval 'sub FMARK () {0x1000;}' unless defined(&FMARK);
	eval 'sub FDEFER () {0x2000;}' unless defined(&FDEFER);
	eval 'sub FHASLOCK () {0x4000;}' unless defined(&FHASLOCK);
	eval 'sub FSCAN () {0x100000;}' unless defined(&FSCAN);
	eval 'sub FSILENT () {0x40000000;}' unless defined(&FSILENT);
	eval 'sub FKIOCTL () {0x80000000;}' unless defined(&FKIOCTL);
	eval 'sub FCNTLFLAGS () {( &FAPPEND| &FASYNC| &FFSYNC| &FNONBLOCK| &FDSYNC| &FRSYNC| &FALTIO|  &FDIRECT| &FNOSIGPIPE);}' unless defined(&FCNTLFLAGS);
	eval 'sub FMASK () {( &FREAD| &FWRITE| &FCNTLFLAGS| &FEXEC);}' unless defined(&FMASK);
    }
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub FAPPEND () { &O_APPEND;}' unless defined(&FAPPEND);
	eval 'sub FASYNC () { &O_ASYNC;}' unless defined(&FASYNC);
	eval 'sub O_FSYNC () { &O_SYNC;}' unless defined(&O_FSYNC);
	eval 'sub FNDELAY () { &O_NONBLOCK;}' unless defined(&FNDELAY);
	eval 'sub O_NDELAY () { &O_NONBLOCK;}' unless defined(&O_NDELAY);
    }
    if(defined(&_KERNEL)) {
	eval 'sub FNOSIGPIPE () { &O_NOSIGPIPE;}' unless defined(&FNOSIGPIPE);
	eval 'sub FNONBLOCK () { &O_NONBLOCK;}' unless defined(&FNONBLOCK);
	eval 'sub FFSYNC () { &O_SYNC;}' unless defined(&FFSYNC);
	eval 'sub FDSYNC () { &O_DSYNC;}' unless defined(&FDSYNC);
	eval 'sub FRSYNC () { &O_RSYNC;}' unless defined(&FRSYNC);
	eval 'sub FALTIO () { &O_ALT_IO;}' unless defined(&FALTIO);
	eval 'sub FDIRECT () { &O_DIRECT;}' unless defined(&FDIRECT);
    }
    eval 'sub F_DUPFD () {0;}' unless defined(&F_DUPFD);
    eval 'sub F_GETFD () {1;}' unless defined(&F_GETFD);
    eval 'sub F_SETFD () {2;}' unless defined(&F_SETFD);
    eval 'sub F_GETFL () {3;}' unless defined(&F_GETFL);
    eval 'sub F_SETFL () {4;}' unless defined(&F_SETFL);
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200112 || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0) >= 500|| defined(&_NETBSD_SOURCE)) {
	eval 'sub F_GETOWN () {5;}' unless defined(&F_GETOWN);
	eval 'sub F_SETOWN () {6;}' unless defined(&F_SETOWN);
    }
    eval 'sub F_GETLK () {7;}' unless defined(&F_GETLK);
    eval 'sub F_SETLK () {8;}' unless defined(&F_SETLK);
    eval 'sub F_SETLKW () {9;}' unless defined(&F_SETLKW);
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub F_CLOSEM () {10;}' unless defined(&F_CLOSEM);
	eval 'sub F_MAXFD () {11;}' unless defined(&F_MAXFD);
    }
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200809 || defined(&_NETBSD_SOURCE)) {
	eval 'sub F_DUPFD_CLOEXEC () {12;}' unless defined(&F_DUPFD_CLOEXEC);
    }
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub F_GETNOSIGPIPE () {13;}' unless defined(&F_GETNOSIGPIPE);
	eval 'sub F_SETNOSIGPIPE () {14;}' unless defined(&F_SETNOSIGPIPE);
	eval 'sub F_GETPATH () {15;}' unless defined(&F_GETPATH);
    }
    eval 'sub FD_CLOEXEC () {1;}' unless defined(&FD_CLOEXEC);
    eval 'sub F_RDLCK () {1;}' unless defined(&F_RDLCK);
    eval 'sub F_UNLCK () {2;}' unless defined(&F_UNLCK);
    eval 'sub F_WRLCK () {3;}' unless defined(&F_WRLCK);
    if(defined(&_KERNEL)) {
	eval 'sub F_WAIT () {0x10;}' unless defined(&F_WAIT);
	eval 'sub F_FLOCK () {0x20;}' unless defined(&F_FLOCK);
	eval 'sub F_POSIX () {0x40;}' unless defined(&F_POSIX);
    }
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub F_PARAM_MASK () {0xfff;}' unless defined(&F_PARAM_MASK);
	eval 'sub F_PARAM_LEN {
	    my($x) = @_;
    	    eval q(((($x) >> 16) &  &F_PARAM_MASK));
	}' unless defined(&F_PARAM_LEN);
	eval 'sub F_PARAM_MAX () {4095;}' unless defined(&F_PARAM_MAX);
	eval 'sub F_FSCTL () {0x80000000;}' unless defined(&F_FSCTL);
	eval 'sub F_FSVOID () {0x40000000;}' unless defined(&F_FSVOID);
	eval 'sub F_FSOUT () {0x20000000;}' unless defined(&F_FSOUT);
	eval 'sub F_FSIN () {0x10000000;}' unless defined(&F_FSIN);
	eval 'sub F_FSINOUT () {( &F_FSIN |  &F_FSOUT);}' unless defined(&F_FSINOUT);
	eval 'sub F_FSDIRMASK () {0x70000000;}' unless defined(&F_FSDIRMASK);
	eval 'sub F_FSPRIV () {0x8000;}' unless defined(&F_FSPRIV);
	eval 'sub _FCN {
	    my($inout, $num, $len) = @_;
    	    eval q(( &F_FSCTL | $inout | (($len &  &F_PARAM_MASK) << 16) | ($num)));
	}' unless defined(&_FCN);
	eval 'sub _FCNO {
	    my($c) = @_;
    	    eval q( &_FCN( &F_FSVOID, ($c), 0));
	}' unless defined(&_FCNO);
	eval 'sub _FCNR {
	    my($c, $t) = @_;
    	    eval q( &_FCN( &F_FSIN, , $sizeof{$t}));
	}' unless defined(&_FCNR);
	eval 'sub _FCNW {
	    my($c, $t) = @_;
    	    eval q( &_FCN( &F_FSOUT, , $sizeof{$t}));
	}' unless defined(&_FCNW);
	eval 'sub _FCNRW {
	    my($c, $t) = @_;
    	    eval q( &_FCN( &F_FSINOUT, , $sizeof{$t}));
	}' unless defined(&_FCNRW);
	eval 'sub _FCN_FSPRIV {
	    my($inout, $fs, $num, $len) = @_;
    	    eval q(( &F_FSCTL |  &F_FSPRIV | $inout | (($len &  &F_PARAM_MASK) << 16) | ($fs) << 8| ($num)));
	}' unless defined(&_FCN_FSPRIV);
	eval 'sub _FCNO_FSPRIV {
	    my($f, $c) = @_;
    	    eval q( &_FCN_FSPRIV( &F_FSVOID, ($f), ($c), 0));
	}' unless defined(&_FCNO_FSPRIV);
	eval 'sub _FCNR_FSPRIV {
	    my($f, $c, $t) = @_;
    	    eval q( &_FCN_FSPRIV( &F_FSIN, , , $sizeof{$t}));
	}' unless defined(&_FCNR_FSPRIV);
	eval 'sub _FCNW_FSPRIV {
	    my($f, $c, $t) = @_;
    	    eval q( &_FCN_FSPRIV( &F_FSOUT, , , $sizeof{$t}));
	}' unless defined(&_FCNW_FSPRIV);
	eval 'sub _FCNRW_FSPRIV {
	    my($f, $c, $t) = @_;
    	    eval q( &_FCN_FSPRIV( &F_FSINOUT, , , $sizeof{$t}));
	}' unless defined(&_FCNRW_FSPRIV);
    }
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub LOCK_SH () {0x1;}' unless defined(&LOCK_SH);
	eval 'sub LOCK_EX () {0x2;}' unless defined(&LOCK_EX);
	eval 'sub LOCK_NB () {0x4;}' unless defined(&LOCK_NB);
	eval 'sub LOCK_UN () {0x8;}' unless defined(&LOCK_UN);
    }
    unless(defined(&SEEK_SET)) {
	eval 'sub SEEK_SET () {0;}' unless defined(&SEEK_SET);
    }
    unless(defined(&SEEK_CUR)) {
	eval 'sub SEEK_CUR () {1;}' unless defined(&SEEK_CUR);
    }
    unless(defined(&SEEK_END)) {
	eval 'sub SEEK_END () {2;}' unless defined(&SEEK_END);
    }
    eval 'sub POSIX_FADV_NORMAL () {0;}' unless defined(&POSIX_FADV_NORMAL);
    eval 'sub POSIX_FADV_RANDOM () {1;}' unless defined(&POSIX_FADV_RANDOM);
    eval 'sub POSIX_FADV_SEQUENTIAL () {2;}' unless defined(&POSIX_FADV_SEQUENTIAL);
    eval 'sub POSIX_FADV_WILLNEED () {3;}' unless defined(&POSIX_FADV_WILLNEED);
    eval 'sub POSIX_FADV_DONTNEED () {4;}' unless defined(&POSIX_FADV_DONTNEED);
    eval 'sub POSIX_FADV_NOREUSE () {5;}' unless defined(&POSIX_FADV_NOREUSE);
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200809 || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0>= 700) || defined(&_NETBSD_SOURCE)) {
	eval 'sub AT_FDCWD () {-100;}' unless defined(&AT_FDCWD);
	eval 'sub AT_EACCESS () {0x100;}' unless defined(&AT_EACCESS);
	eval 'sub AT_SYMLINK_NOFOLLOW () {0x200;}' unless defined(&AT_SYMLINK_NOFOLLOW);
	eval 'sub AT_SYMLINK_FOLLOW () {0x400;}' unless defined(&AT_SYMLINK_FOLLOW);
	eval 'sub AT_REMOVEDIR () {0x800;}' unless defined(&AT_REMOVEDIR);
    }
    unless(defined(&_KERNEL)) {
	require 'sys/cdefs.ph';
	if(defined(&_NETBSD_SOURCE)) {
	}
	if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200112 || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0) >= 600|| defined(&_NETBSD_SOURCE)) {
	}
	if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200809 || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0>= 700) || defined(&_NETBSD_SOURCE)) {
	}
    }
}
1;
