require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_SYS_STAT_H_)) {
    eval 'sub _SYS_STAT_H_ () {1;}' unless defined(&_SYS_STAT_H_);
    require 'sys/cdefs.ph';
    require 'sys/time.ph';
    if(defined(&_KERNEL)) {
    }
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
    } else {
    }
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
    } else {
    }
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	eval 'sub st_atime () { ($st_atimespec->{tv_sec});}' unless defined(&st_atime);
	eval 'sub st_atimensec () { ($st_atimespec->{tv_nsec});}' unless defined(&st_atimensec);
	eval 'sub st_mtime () { ($st_mtimespec->{tv_sec});}' unless defined(&st_mtime);
	eval 'sub st_mtimensec () { ($st_mtimespec->{tv_nsec});}' unless defined(&st_mtimensec);
	eval 'sub st_ctime () { ($st_ctimespec->{tv_sec});}' unless defined(&st_ctime);
	eval 'sub st_ctimensec () { ($st_ctimespec->{tv_nsec});}' unless defined(&st_ctimensec);
    }
    eval 'sub S_ISUID () {0004000;}' unless defined(&S_ISUID);
    eval 'sub S_ISGID () {0002000;}' unless defined(&S_ISGID);
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	eval 'sub S_ISTXT () {0001000;}' unless defined(&S_ISTXT);
    }
    eval 'sub S_IRWXU () {0000700;}' unless defined(&S_IRWXU);
    eval 'sub S_IRUSR () {0000400;}' unless defined(&S_IRUSR);
    eval 'sub S_IWUSR () {0000200;}' unless defined(&S_IWUSR);
    eval 'sub S_IXUSR () {0000100;}' unless defined(&S_IXUSR);
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	eval 'sub S_IREAD () { &S_IRUSR;}' unless defined(&S_IREAD);
	eval 'sub S_IWRITE () { &S_IWUSR;}' unless defined(&S_IWRITE);
	eval 'sub S_IEXEC () { &S_IXUSR;}' unless defined(&S_IEXEC);
    }
    eval 'sub S_IRWXG () {0000070;}' unless defined(&S_IRWXG);
    eval 'sub S_IRGRP () {0000040;}' unless defined(&S_IRGRP);
    eval 'sub S_IWGRP () {0000020;}' unless defined(&S_IWGRP);
    eval 'sub S_IXGRP () {0000010;}' unless defined(&S_IXGRP);
    eval 'sub S_IRWXO () {0000007;}' unless defined(&S_IRWXO);
    eval 'sub S_IROTH () {0000004;}' unless defined(&S_IROTH);
    eval 'sub S_IWOTH () {0000002;}' unless defined(&S_IWOTH);
    eval 'sub S_IXOTH () {0000001;}' unless defined(&S_IXOTH);
    if((defined(&__XPG_VISIBLE) ? &__XPG_VISIBLE : 0) || (defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	eval 'sub S_IFMT () {0170000;}' unless defined(&S_IFMT);
	eval 'sub S_IFIFO () {0010000;}' unless defined(&S_IFIFO);
	eval 'sub S_IFCHR () {0020000;}' unless defined(&S_IFCHR);
	eval 'sub S_IFDIR () {0040000;}' unless defined(&S_IFDIR);
	eval 'sub S_IFBLK () {0060000;}' unless defined(&S_IFBLK);
	eval 'sub S_IFREG () {0100000;}' unless defined(&S_IFREG);
	eval 'sub S_IFLNK () {0120000;}' unless defined(&S_IFLNK);
	eval 'sub S_IFSOCK () {0140000;}' unless defined(&S_IFSOCK);
	eval 'sub S_ISVTX () {0001000;}' unless defined(&S_ISVTX);
    }
    eval 'sub S_ISDIR {
        my($m) = @_;
	    eval q((($m & 0170000) == 0040000));
    }' unless defined(&S_ISDIR);
    eval 'sub S_ISCHR {
        my($m) = @_;
	    eval q((($m & 0170000) == 0020000));
    }' unless defined(&S_ISCHR);
    eval 'sub S_ISBLK {
        my($m) = @_;
	    eval q((($m & 0170000) == 0060000));
    }' unless defined(&S_ISBLK);
    eval 'sub S_ISREG {
        my($m) = @_;
	    eval q((($m & 0170000) == 0100000));
    }' unless defined(&S_ISREG);
    eval 'sub S_ISFIFO {
        my($m) = @_;
	    eval q((($m & 0170000) == 0010000));
    }' unless defined(&S_ISFIFO);
    if((defined(&__POSIX_VISIBLE) ? &__POSIX_VISIBLE : 0) >= 200112|| (defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	eval 'sub S_ISLNK {
	    my($m) = @_;
    	    eval q((($m & 0170000) == 0120000));
	}' unless defined(&S_ISLNK);
	eval 'sub S_ISSOCK {
	    my($m) = @_;
    	    eval q((($m & 0170000) == 0140000));
	}' unless defined(&S_ISSOCK);
    }
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	eval 'sub ACCESSPERMS () {( &S_IRWXU| &S_IRWXG| &S_IRWXO);}' unless defined(&ACCESSPERMS);
	eval 'sub ALLPERMS () {( &S_ISUID| &S_ISGID| &S_ISTXT| &S_IRWXU| &S_IRWXG| &S_IRWXO);}' unless defined(&ALLPERMS);
	eval 'sub DEFFILEMODE () {( &S_IRUSR| &S_IWUSR| &S_IRGRP| &S_IWGRP| &S_IROTH| &S_IWOTH);}' unless defined(&DEFFILEMODE);
	eval 'sub S_BLKSIZE () {512;}' unless defined(&S_BLKSIZE);
	eval 'sub UF_SETTABLE () {0xffff;}' unless defined(&UF_SETTABLE);
	eval 'sub UF_NODUMP () {0x1;}' unless defined(&UF_NODUMP);
	eval 'sub UF_IMMUTABLE () {0x2;}' unless defined(&UF_IMMUTABLE);
	eval 'sub UF_APPEND () {0x4;}' unless defined(&UF_APPEND);
	eval 'sub UF_OPAQUE () {0x8;}' unless defined(&UF_OPAQUE);
	eval 'sub SF_SETTABLE () {0xffff0000;}' unless defined(&SF_SETTABLE);
	eval 'sub SF_ARCHIVED () {0x10000;}' unless defined(&SF_ARCHIVED);
	eval 'sub SF_IMMUTABLE () {0x20000;}' unless defined(&SF_IMMUTABLE);
	eval 'sub SF_APPEND () {0x40000;}' unless defined(&SF_APPEND);
	if(defined(&_KERNEL)) {
	    eval 'sub OPAQUE () {( &UF_OPAQUE);}' unless defined(&OPAQUE);
	    eval 'sub APPEND () {( &UF_APPEND |  &SF_APPEND);}' unless defined(&APPEND);
	    eval 'sub IMMUTABLE () {( &UF_IMMUTABLE |  &SF_IMMUTABLE);}' unless defined(&IMMUTABLE);
	}
    }
    unless(defined(&_KERNEL)) {
	if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	}
    }
}
1;
