/* automatically generated by clay-bindgen */

alias __int8_t = CChar;

alias __uint8_t = CUChar;

alias __int16_t = Short;

alias __uint16_t = UShort;

alias __int32_t = Int;

alias __uint32_t = UInt;

alias __int64_t = Int64;

alias __uint64_t = UInt64;

alias __darwin_intptr_t = CLong;

alias __darwin_natural_t = UInt;

alias __darwin_ct_rune_t = Int;

alias Union_Unnamed1 = Union[
    /* __mbstate8 */ Array[CChar, 128],
    /* _mbstateL */ Int64,
];

alias __mbstate_t = Union_Unnamed1;

alias __darwin_mbstate_t = __mbstate_t;

alias __darwin_ptrdiff_t = Int;

alias __darwin_size_t = CULong;

alias __darwin_va_list = __builtin_va_list;

alias __darwin_wchar_t = Int;

alias __darwin_rune_t = __darwin_wchar_t;

alias __darwin_wint_t = Int;

alias __darwin_clock_t = CULong;

alias __darwin_socklen_t = __uint32_t;

alias __darwin_ssize_t = CLong;

alias __darwin_time_t = CLong;

record Struct___darwin_pthread_handler_rec (
    __routine : CCodePointer[[OpaquePointer],[]],
    __arg : OpaquePointer,
    __next : Pointer[Struct___darwin_pthread_handler_rec],
);

record Struct__opaque_pthread_attr_t (
    __sig : CLong,
    __opaque : Array[CChar, 36],
);

record Struct__opaque_pthread_cond_t (
    __sig : CLong,
    __opaque : Array[CChar, 24],
);

record Struct__opaque_pthread_condattr_t (
    __sig : CLong,
    __opaque : Array[CChar, 4],
);

record Struct__opaque_pthread_mutex_t (
    __sig : CLong,
    __opaque : Array[CChar, 40],
);

record Struct__opaque_pthread_mutexattr_t (
    __sig : CLong,
    __opaque : Array[CChar, 8],
);

record Struct__opaque_pthread_once_t (
    __sig : CLong,
    __opaque : Array[CChar, 4],
);

record Struct__opaque_pthread_rwlock_t (
    __sig : CLong,
    __opaque : Array[CChar, 124],
);

record Struct__opaque_pthread_rwlockattr_t (
    __sig : CLong,
    __opaque : Array[CChar, 12],
);

record Struct__opaque_pthread_t (
    __sig : CLong,
    __cleanup_stack : Pointer[Struct___darwin_pthread_handler_rec],
    __opaque : Array[CChar, 596],
);

alias __darwin_blkcnt_t = __int64_t;

alias __darwin_blksize_t = __int32_t;

alias __darwin_dev_t = __int32_t;

alias __darwin_fsblkcnt_t = UInt;

alias __darwin_fsfilcnt_t = UInt;

alias __darwin_gid_t = __uint32_t;

alias __darwin_id_t = __uint32_t;

alias __darwin_ino64_t = __uint64_t;

alias __darwin_ino_t = __darwin_ino64_t;

alias __darwin_mach_port_name_t = __darwin_natural_t;

alias __darwin_mach_port_t = __darwin_mach_port_name_t;

alias __darwin_mode_t = __uint16_t;

alias __darwin_off_t = __int64_t;

alias __darwin_pid_t = __int32_t;

alias __darwin_pthread_attr_t = Struct__opaque_pthread_attr_t;

alias __darwin_pthread_cond_t = Struct__opaque_pthread_cond_t;

alias __darwin_pthread_condattr_t = Struct__opaque_pthread_condattr_t;

alias __darwin_pthread_key_t = CULong;

alias __darwin_pthread_mutex_t = Struct__opaque_pthread_mutex_t;

alias __darwin_pthread_mutexattr_t = Struct__opaque_pthread_mutexattr_t;

alias __darwin_pthread_once_t = Struct__opaque_pthread_once_t;

alias __darwin_pthread_rwlock_t = Struct__opaque_pthread_rwlock_t;

alias __darwin_pthread_rwlockattr_t = Struct__opaque_pthread_rwlockattr_t;

alias __darwin_pthread_t = Pointer[Struct__opaque_pthread_t];

alias __darwin_sigset_t = __uint32_t;

alias __darwin_suseconds_t = __int32_t;

alias __darwin_uid_t = __uint32_t;

alias __darwin_useconds_t = __uint32_t;

alias __darwin_uuid_t = Array[CUChar, 16];

alias __darwin_uuid_string_t = Array[CChar, 37];

alias __darwin_nl_item = Int;

alias __darwin_wctrans_t = Int;

alias __darwin_wctype_t = CULong;

record Struct_accessx_descriptor (
    ad_name_offset : UInt,
    ad_flags : Int,
    ad_pad : Array[Int, 2],
);

alias gid_t = __darwin_gid_t;

alias intptr_t = __darwin_intptr_t;

alias off_t = __darwin_off_t;

alias pid_t = __darwin_pid_t;

alias size_t = __darwin_size_t;

alias ssize_t = __darwin_ssize_t;

alias uid_t = __darwin_uid_t;

alias useconds_t = __darwin_useconds_t;

external (cdecl) _exit(arg0:Int) : ;

external (cdecl) access(arg0:Pointer[CChar], arg1:Int) : Int;

external (cdecl) alarm(arg0:UInt) : UInt;

external (cdecl) chdir(arg0:Pointer[CChar]) : Int;

external (cdecl) chown(arg0:Pointer[CChar], arg1:uid_t, arg2:gid_t) : Int;

external (cdecl, "_close") close(arg0:Int) : Int;

external (cdecl) dup(arg0:Int) : Int;

external (cdecl) dup2(arg0:Int, arg1:Int) : Int;

external (cdecl) execl(arg0:Pointer[CChar], arg1:Pointer[CChar], ..) : Int;

external (cdecl) execle(arg0:Pointer[CChar], arg1:Pointer[CChar], ..) : Int;

external (cdecl) execlp(arg0:Pointer[CChar], arg1:Pointer[CChar], ..) : Int;

external (cdecl) execv(arg0:Pointer[CChar], arg1:Pointer[Pointer[CChar]]) : Int;

external (cdecl) execve(arg0:Pointer[CChar], arg1:Pointer[Pointer[CChar]], arg2:Pointer[Pointer[CChar]]) : Int;

external (cdecl) execvp(arg0:Pointer[CChar], arg1:Pointer[Pointer[CChar]]) : Int;

external (cdecl) fork() : pid_t;

external (cdecl) fpathconf(arg0:Int, arg1:Int) : CLong;

external (cdecl) getcwd(arg0:Pointer[CChar], arg1:size_t) : Pointer[CChar];

external (cdecl) getegid() : gid_t;

external (cdecl) geteuid() : uid_t;

external (cdecl) getgid() : gid_t;

external (cdecl) getgroups(arg0:Int, arg1:Pointer[gid_t]) : Int;

external (cdecl) getlogin() : Pointer[CChar];

external (cdecl) getpgrp() : pid_t;

external (cdecl) getpid() : pid_t;

external (cdecl) getppid() : pid_t;

external (cdecl) getuid() : uid_t;

external (cdecl) isatty(arg0:Int) : Int;

external (cdecl) link(arg0:Pointer[CChar], arg1:Pointer[CChar]) : Int;

external (cdecl) lseek(arg0:Int, arg1:off_t, arg2:Int) : off_t;

external (cdecl) pathconf(arg0:Pointer[CChar], arg1:Int) : CLong;

external (cdecl, "_pause") pause() : Int;

external (cdecl) pipe(arg0:Pointer[Int]) : Int;

external (cdecl, "_read") read(arg0:Int, arg1:OpaquePointer, arg2:size_t) : ssize_t;

external (cdecl) rmdir(arg0:Pointer[CChar]) : Int;

external (cdecl) setgid(arg0:gid_t) : Int;

external (cdecl) setpgid(arg0:pid_t, arg1:pid_t) : Int;

external (cdecl) setsid() : pid_t;

external (cdecl) setuid(arg0:uid_t) : Int;

external (cdecl, "_sleep") sleep(arg0:UInt) : UInt;

external (cdecl) sysconf(arg0:Int) : CLong;

external (cdecl) tcgetpgrp(arg0:Int) : pid_t;

external (cdecl) tcsetpgrp(arg0:Int, arg1:pid_t) : Int;

external (cdecl) ttyname(arg0:Int) : Pointer[CChar];

external (cdecl, "_ttyname_r") ttyname_r(arg0:Int, arg1:Pointer[CChar], arg2:size_t) : Int;

external (cdecl) unlink(arg0:Pointer[CChar]) : Int;

external (cdecl, "_write") write(arg0:Int, arg1:OpaquePointer, arg2:size_t) : ssize_t;

external (cdecl, "_confstr") confstr(arg0:Int, arg1:Pointer[CChar], arg2:size_t) : size_t;

external (cdecl, "_getopt") getopt(arg0:Int, arg1:Pointer[Pointer[CChar]], arg2:Pointer[CChar]) : Int;

external optarg : Pointer[CChar];

external optind : Int;

external opterr : Int;

external optopt : Int;

external (cdecl) brk(arg0:OpaquePointer) : OpaquePointer;

external (cdecl) chroot(arg0:Pointer[CChar]) : Int;

external (cdecl) crypt(arg0:Pointer[CChar], arg1:Pointer[CChar]) : Pointer[CChar];

external (cdecl) ctermid(arg0:Pointer[CChar]) : Pointer[CChar];

external (cdecl, "_encrypt") encrypt(arg0:Pointer[CChar], arg1:Int) : ;

external (cdecl) fchdir(arg0:Int) : Int;

external (cdecl) gethostid() : CLong;

external (cdecl) getpgid(arg0:pid_t) : pid_t;

external (cdecl) getsid(arg0:pid_t) : pid_t;

external (cdecl) getdtablesize() : Int;

external (cdecl) getpagesize() : Int;

external (cdecl) getpass(arg0:Pointer[CChar]) : Pointer[CChar];

external (cdecl) getwd(arg0:Pointer[CChar]) : Pointer[CChar];

external (cdecl, "_lchown") lchown(arg0:Pointer[CChar], arg1:uid_t, arg2:gid_t) : Int;

external (cdecl, "_lockf") lockf(arg0:Int, arg1:Int, arg2:off_t) : Int;

external (cdecl, "_nice") nice(arg0:Int) : Int;

external (cdecl, "_pread") pread(arg0:Int, arg1:OpaquePointer, arg2:size_t, arg3:off_t) : ssize_t;

external (cdecl, "_pwrite") pwrite(arg0:Int, arg1:OpaquePointer, arg2:size_t, arg3:off_t) : ssize_t;

external (cdecl) sbrk(arg0:Int) : OpaquePointer;

external (cdecl, "_setpgrp") setpgrp() : pid_t;

external (cdecl, "_setregid") setregid(arg0:gid_t, arg1:gid_t) : Int;

external (cdecl, "_setreuid") setreuid(arg0:uid_t, arg1:uid_t) : Int;

external (cdecl) swab(arg0:OpaquePointer, arg1:OpaquePointer, arg2:ssize_t) : ;

external (cdecl) sync() : ;

external (cdecl) truncate(arg0:Pointer[CChar], arg1:off_t) : Int;

external (cdecl) ualarm(arg0:useconds_t, arg1:useconds_t) : useconds_t;

external (cdecl, "_usleep") usleep(arg0:useconds_t) : Int;

external (cdecl) vfork() : pid_t;

external (cdecl, "_fsync") fsync(arg0:Int) : Int;

external (cdecl) ftruncate(arg0:Int, arg1:off_t) : Int;

external (cdecl) getlogin_r(arg0:Pointer[CChar], arg1:size_t) : Int;

external (cdecl) fchown(arg0:Int, arg1:uid_t, arg2:gid_t) : Int;

external (cdecl) gethostname(arg0:Pointer[CChar], arg1:size_t) : Int;

external (cdecl) readlink(arg0:Pointer[CChar], arg1:Pointer[CChar], arg2:size_t) : ssize_t;

external (cdecl) setegid(arg0:gid_t) : Int;

external (cdecl) seteuid(arg0:uid_t) : Int;

external (cdecl) symlink(arg0:Pointer[CChar], arg1:Pointer[CChar]) : Int;

record Struct_timespec (
    tv_sec : __darwin_time_t,
    tv_nsec : CLong,
);

record Struct_timeval (
    tv_sec : __darwin_time_t,
    tv_usec : __darwin_suseconds_t,
);

record Struct_fd_set (
    fds_bits : Array[__int32_t, 32],
);

alias fd_set = Struct_fd_set;

external (cdecl) __darwin_fd_isset(arg0:Int, arg1:Pointer[Struct_fd_set]) : Int;

alias time_t = __darwin_time_t;

alias suseconds_t = __darwin_suseconds_t;

alias sigset_t = __darwin_sigset_t;

external (cdecl, "_pselect") pselect(arg0:Int, arg1:Pointer[fd_set], arg2:Pointer[fd_set], arg3:Pointer[fd_set], arg4:Pointer[Struct_timespec], arg5:Pointer[sigset_t]) : Int;

external (cdecl, "_select") select(arg0:Int, arg1:Pointer[fd_set], arg2:Pointer[fd_set], arg3:Pointer[fd_set], arg4:Pointer[Struct_timeval]) : Int;

alias dev_t = __darwin_dev_t;

alias mode_t = __darwin_mode_t;

alias uuid_t = __darwin_uuid_t;

external (cdecl) _Exit(arg0:Int) : ;

external (cdecl) accessx_np(arg0:Pointer[Struct_accessx_descriptor], arg1:size_t, arg2:Pointer[Int], arg3:uid_t) : Int;

external (cdecl) acct(arg0:Pointer[CChar]) : Int;

external (cdecl) add_profil(arg0:Pointer[CChar], arg1:size_t, arg2:CULong, arg3:UInt) : Int;

external (cdecl) endusershell() : ;

external (cdecl) execvP(arg0:Pointer[CChar], arg1:Pointer[CChar], arg2:Pointer[Pointer[CChar]]) : Int;

external (cdecl) fflagstostr(arg0:CULong) : Pointer[CChar];

external (cdecl) getdomainname(arg0:Pointer[CChar], arg1:Int) : Int;

external (cdecl) getgrouplist(arg0:Pointer[CChar], arg1:Int, arg2:Pointer[Int], arg3:Pointer[Int]) : Int;

external (cdecl) gethostuuid(arg0:Pointer[CUChar], arg1:Pointer[Struct_timespec]) : Int;

external (cdecl) getmode(arg0:OpaquePointer, arg1:mode_t) : mode_t;

external (cdecl) getpeereid(arg0:Int, arg1:Pointer[uid_t], arg2:Pointer[gid_t]) : Int;

external (cdecl) getsgroups_np(arg0:Pointer[Int], arg1:Pointer[CUChar]) : Int;

external (cdecl) getusershell() : Pointer[CChar];

external (cdecl) getwgroups_np(arg0:Pointer[Int], arg1:Pointer[CUChar]) : Int;

external (cdecl) initgroups(arg0:Pointer[CChar], arg1:Int) : Int;

external (cdecl) iruserok(arg0:CULong, arg1:Int, arg2:Pointer[CChar], arg3:Pointer[CChar]) : Int;

external (cdecl) iruserok_sa(arg0:OpaquePointer, arg1:Int, arg2:Int, arg3:Pointer[CChar], arg4:Pointer[CChar]) : Int;

external (cdecl) issetugid() : Int;

external (cdecl) mkdtemp(arg0:Pointer[CChar]) : Pointer[CChar];

external (cdecl) mknod(arg0:Pointer[CChar], arg1:mode_t, arg2:dev_t) : Int;

external (cdecl) mkpath_np(arg0:Pointer[CChar], arg1:mode_t) : Int;

external (cdecl) mkstemp(arg0:Pointer[CChar]) : Int;

external (cdecl) mkstemps(arg0:Pointer[CChar], arg1:Int) : Int;

external (cdecl) mktemp(arg0:Pointer[CChar]) : Pointer[CChar];

external (cdecl) nfssvc(arg0:Int, arg1:OpaquePointer) : Int;

external (cdecl) profil(arg0:Pointer[CChar], arg1:size_t, arg2:CULong, arg3:UInt) : Int;

external (cdecl) pthread_setugid_np(arg0:uid_t, arg1:gid_t) : Int;

external (cdecl) pthread_getugid_np(arg0:Pointer[uid_t], arg1:Pointer[gid_t]) : Int;

external (cdecl) rcmd(arg0:Pointer[Pointer[CChar]], arg1:Int, arg2:Pointer[CChar], arg3:Pointer[CChar], arg4:Pointer[CChar], arg5:Pointer[Int]) : Int;

external (cdecl) rcmd_af(arg0:Pointer[Pointer[CChar]], arg1:Int, arg2:Pointer[CChar], arg3:Pointer[CChar], arg4:Pointer[CChar], arg5:Pointer[Int], arg6:Int) : Int;

external (cdecl) reboot(arg0:Int) : Int;

external (cdecl) revoke(arg0:Pointer[CChar]) : Int;

external (cdecl) rresvport(arg0:Pointer[Int]) : Int;

external (cdecl) rresvport_af(arg0:Pointer[Int], arg1:Int) : Int;

external (cdecl) ruserok(arg0:Pointer[CChar], arg1:Int, arg2:Pointer[CChar], arg3:Pointer[CChar]) : Int;

external (cdecl) setdomainname(arg0:Pointer[CChar], arg1:Int) : Int;

external (cdecl) setgroups(arg0:Int, arg1:Pointer[gid_t]) : Int;

external (cdecl) sethostid(arg0:CLong) : ;

external (cdecl) sethostname(arg0:Pointer[CChar], arg1:Int) : Int;

external (cdecl, "_setkey") setkey(arg0:Pointer[CChar]) : ;

external (cdecl) setlogin(arg0:Pointer[CChar]) : Int;

external (cdecl, "_setmode") setmode(arg0:Pointer[CChar]) : OpaquePointer;

external (cdecl) setrgid(arg0:gid_t) : Int;

external (cdecl) setruid(arg0:uid_t) : Int;

external (cdecl) setsgroups_np(arg0:Int, arg1:Pointer[CUChar]) : Int;

external (cdecl) setusershell() : ;

external (cdecl) setwgroups_np(arg0:Int, arg1:Pointer[CUChar]) : Int;

external (cdecl) strtofflags(arg0:Pointer[Pointer[CChar]], arg1:Pointer[CULong], arg2:Pointer[CULong]) : Int;

external (cdecl) swapon(arg0:Pointer[CChar]) : Int;

external (cdecl) syscall(arg0:Int, ..) : Int;

external (cdecl) ttyslot() : Int;

external (cdecl) undelete(arg0:Pointer[CChar]) : Int;

external (cdecl) unwhiteout(arg0:Pointer[CChar]) : Int;

external (cdecl) valloc(arg0:size_t) : OpaquePointer;

external suboptarg : Pointer[CChar];

external (cdecl) getsubopt(arg0:Pointer[Pointer[CChar]], arg1:Pointer[Pointer[CChar]], arg2:Pointer[Pointer[CChar]]) : Int;

external (cdecl) fgetattrlist(arg0:Int, arg1:OpaquePointer, arg2:OpaquePointer, arg3:size_t, arg4:CULong) : Int;

external (cdecl) fsetattrlist(arg0:Int, arg1:OpaquePointer, arg2:OpaquePointer, arg3:size_t, arg4:CULong) : Int;

external (cdecl, "_getattrlist") getattrlist(arg0:Pointer[CChar], arg1:OpaquePointer, arg2:OpaquePointer, arg3:size_t, arg4:CULong) : Int;

external (cdecl, "_setattrlist") setattrlist(arg0:Pointer[CChar], arg1:OpaquePointer, arg2:OpaquePointer, arg3:size_t, arg4:CULong) : Int;

external (cdecl) exchangedata(arg0:Pointer[CChar], arg1:Pointer[CChar], arg2:CULong) : Int;

external (cdecl) getdirentriesattr(arg0:Int, arg1:OpaquePointer, arg2:OpaquePointer, arg3:size_t, arg4:Pointer[CULong], arg5:Pointer[CULong], arg6:Pointer[CULong], arg7:CULong) : Int;

alias Struct_fssearchblock = Opaque;

alias Struct_searchstate = Opaque;

external (cdecl) searchfs(arg0:Pointer[CChar], arg1:Pointer[Struct_fssearchblock], arg2:Pointer[CULong], arg3:UInt, arg4:UInt, arg5:Pointer[Struct_searchstate]) : Int;

external (cdecl) fsctl(arg0:Pointer[CChar], arg1:CULong, arg2:OpaquePointer, arg3:UInt) : Int;

external (cdecl) ffsctl(arg0:Int, arg1:CULong, arg2:OpaquePointer, arg3:UInt) : Int;

external optreset : Int;

external (cdecl) __error() : Pointer[Int];

record Struct_sched_param (
    sched_priority : Int,
    __opaque : Array[CChar, 4],
);

external (cdecl) sched_yield() : Int;

external (cdecl) sched_get_priority_min(arg0:Int) : Int;

external (cdecl) sched_get_priority_max(arg0:Int) : Int;

alias clock_t = __darwin_clock_t;

record Struct_tm (
    tm_sec : Int,
    tm_min : Int,
    tm_hour : Int,
    tm_mday : Int,
    tm_mon : Int,
    tm_year : Int,
    tm_wday : Int,
    tm_yday : Int,
    tm_isdst : Int,
    tm_gmtoff : CLong,
    tm_zone : Pointer[CChar],
);

external tzname : Opaque /* unknown NoDeclFound  */;

external getdate_err : Int;

external timezone : CLong;

external daylight : Int;

external (cdecl) asctime(arg0:Pointer[Struct_tm]) : Pointer[CChar];

external (cdecl, "_clock") clock() : clock_t;

external (cdecl) ctime(arg0:Pointer[time_t]) : Pointer[CChar];

external (cdecl) difftime(arg0:time_t, arg1:time_t) : Double;

external (cdecl) getdate(arg0:Pointer[CChar]) : Pointer[Struct_tm];

external (cdecl) gmtime(arg0:Pointer[time_t]) : Pointer[Struct_tm];

external (cdecl) localtime(arg0:Pointer[time_t]) : Pointer[Struct_tm];

external (cdecl, "_mktime") mktime(arg0:Pointer[Struct_tm]) : time_t;

external (cdecl, "_strftime") strftime(arg0:Pointer[CChar], arg1:size_t, arg2:Pointer[CChar], arg3:Pointer[Struct_tm]) : size_t;

external (cdecl, "_strptime") strptime(arg0:Pointer[CChar], arg1:Pointer[CChar], arg2:Pointer[Struct_tm]) : Pointer[CChar];

external (cdecl) time(arg0:Pointer[time_t]) : time_t;

external (cdecl) tzset() : ;

external (cdecl) asctime_r(arg0:Pointer[Struct_tm], arg1:Pointer[CChar]) : Pointer[CChar];

external (cdecl) ctime_r(arg0:Pointer[time_t], arg1:Pointer[CChar]) : Pointer[CChar];

external (cdecl) gmtime_r(arg0:Pointer[time_t], arg1:Pointer[Struct_tm]) : Pointer[Struct_tm];

external (cdecl) localtime_r(arg0:Pointer[time_t], arg1:Pointer[Struct_tm]) : Pointer[Struct_tm];

external (cdecl) posix2time(arg0:time_t) : time_t;

external (cdecl) tzsetwall() : ;

external (cdecl) time2posix(arg0:time_t) : time_t;

external (cdecl) timelocal(arg0:Pointer[Struct_tm]) : time_t;

external (cdecl) timegm(arg0:Pointer[Struct_tm]) : time_t;

external (cdecl, "_nanosleep") nanosleep(arg0:Pointer[Struct_timespec], arg1:Pointer[Struct_timespec]) : Int;

alias pthread_attr_t = __darwin_pthread_attr_t;

alias pthread_cond_t = __darwin_pthread_cond_t;

alias pthread_condattr_t = __darwin_pthread_condattr_t;

alias pthread_key_t = __darwin_pthread_key_t;

alias pthread_mutex_t = __darwin_pthread_mutex_t;

alias pthread_mutexattr_t = __darwin_pthread_mutexattr_t;

alias pthread_once_t = __darwin_pthread_once_t;

alias pthread_rwlock_t = __darwin_pthread_rwlock_t;

alias pthread_rwlockattr_t = __darwin_pthread_rwlockattr_t;

alias pthread_t = __darwin_pthread_t;

alias mach_port_t = __darwin_mach_port_t;

external (cdecl) pthread_atfork(arg0:CCodePointer[[],[]], arg1:CCodePointer[[],[]], arg2:CCodePointer[[],[]]) : Int;

external (cdecl) pthread_attr_destroy(arg0:Pointer[pthread_attr_t]) : Int;

external (cdecl) pthread_attr_getdetachstate(arg0:Pointer[pthread_attr_t], arg1:Pointer[Int]) : Int;

external (cdecl) pthread_attr_getguardsize(arg0:Pointer[pthread_attr_t], arg1:Pointer[size_t]) : Int;

external (cdecl) pthread_attr_getinheritsched(arg0:Pointer[pthread_attr_t], arg1:Pointer[Int]) : Int;

external (cdecl) pthread_attr_getschedparam(arg0:Pointer[pthread_attr_t], arg1:Pointer[Struct_sched_param]) : Int;

external (cdecl) pthread_attr_getschedpolicy(arg0:Pointer[pthread_attr_t], arg1:Pointer[Int]) : Int;

external (cdecl) pthread_attr_getscope(arg0:Pointer[pthread_attr_t], arg1:Pointer[Int]) : Int;

external (cdecl) pthread_attr_getstack(arg0:Pointer[pthread_attr_t], arg1:Pointer[OpaquePointer], arg2:Pointer[size_t]) : Int;

external (cdecl) pthread_attr_getstackaddr(arg0:Pointer[pthread_attr_t], arg1:Pointer[OpaquePointer]) : Int;

external (cdecl) pthread_attr_getstacksize(arg0:Pointer[pthread_attr_t], arg1:Pointer[size_t]) : Int;

external (cdecl) pthread_attr_init(arg0:Pointer[pthread_attr_t]) : Int;

external (cdecl) pthread_attr_setdetachstate(arg0:Pointer[pthread_attr_t], arg1:Int) : Int;

external (cdecl) pthread_attr_setguardsize(arg0:Pointer[pthread_attr_t], arg1:size_t) : Int;

external (cdecl) pthread_attr_setinheritsched(arg0:Pointer[pthread_attr_t], arg1:Int) : Int;

external (cdecl) pthread_attr_setschedparam(arg0:Pointer[pthread_attr_t], arg1:Pointer[Struct_sched_param]) : Int;

external (cdecl) pthread_attr_setschedpolicy(arg0:Pointer[pthread_attr_t], arg1:Int) : Int;

external (cdecl) pthread_attr_setscope(arg0:Pointer[pthread_attr_t], arg1:Int) : Int;

external (cdecl) pthread_attr_setstack(arg0:Pointer[pthread_attr_t], arg1:OpaquePointer, arg2:size_t) : Int;

external (cdecl) pthread_attr_setstackaddr(arg0:Pointer[pthread_attr_t], arg1:OpaquePointer) : Int;

external (cdecl) pthread_attr_setstacksize(arg0:Pointer[pthread_attr_t], arg1:size_t) : Int;

external (cdecl, "_pthread_cancel") pthread_cancel(arg0:pthread_t) : Int;

external (cdecl) pthread_cond_broadcast(arg0:Pointer[pthread_cond_t]) : Int;

external (cdecl) pthread_cond_destroy(arg0:Pointer[pthread_cond_t]) : Int;

external (cdecl, "_pthread_cond_init") pthread_cond_init(arg0:Pointer[pthread_cond_t], arg1:Pointer[pthread_condattr_t]) : Int;

external (cdecl) pthread_cond_signal(arg0:Pointer[pthread_cond_t]) : Int;

external (cdecl, "_pthread_cond_timedwait") pthread_cond_timedwait(arg0:Pointer[pthread_cond_t], arg1:Pointer[pthread_mutex_t], arg2:Pointer[Struct_timespec]) : Int;

external (cdecl, "_pthread_cond_wait") pthread_cond_wait(arg0:Pointer[pthread_cond_t], arg1:Pointer[pthread_mutex_t]) : Int;

external (cdecl) pthread_condattr_destroy(arg0:Pointer[pthread_condattr_t]) : Int;

external (cdecl) pthread_condattr_init(arg0:Pointer[pthread_condattr_t]) : Int;

external (cdecl) pthread_condattr_getpshared(arg0:Pointer[pthread_condattr_t], arg1:Pointer[Int]) : Int;

external (cdecl) pthread_condattr_setpshared(arg0:Pointer[pthread_condattr_t], arg1:Int) : Int;

external (cdecl) pthread_create(arg0:Pointer[pthread_t], arg1:Pointer[pthread_attr_t], arg2:CCodePointer[[OpaquePointer],[OpaquePointer]], arg3:OpaquePointer) : Int;

external (cdecl) pthread_detach(arg0:pthread_t) : Int;

external (cdecl) pthread_equal(arg0:pthread_t, arg1:pthread_t) : Int;

external (cdecl) pthread_exit(arg0:OpaquePointer) : ;

external (cdecl) pthread_getconcurrency() : Int;

external (cdecl) pthread_getschedparam(arg0:pthread_t, arg1:Pointer[Int], arg2:Pointer[Struct_sched_param]) : Int;

external (cdecl) pthread_getspecific(arg0:pthread_key_t) : OpaquePointer;

external (cdecl, "_pthread_join") pthread_join(arg0:pthread_t, arg1:Pointer[OpaquePointer]) : Int;

external (cdecl) pthread_key_create(arg0:Pointer[pthread_key_t], arg1:CCodePointer[[OpaquePointer],[]]) : Int;

external (cdecl) pthread_key_delete(arg0:pthread_key_t) : Int;

external (cdecl) pthread_mutex_destroy(arg0:Pointer[pthread_mutex_t]) : Int;

external (cdecl) pthread_mutex_getprioceiling(arg0:Pointer[pthread_mutex_t], arg1:Pointer[Int]) : Int;

external (cdecl) pthread_mutex_init(arg0:Pointer[pthread_mutex_t], arg1:Pointer[pthread_mutexattr_t]) : Int;

external (cdecl) pthread_mutex_lock(arg0:Pointer[pthread_mutex_t]) : Int;

external (cdecl) pthread_mutex_setprioceiling(arg0:Pointer[pthread_mutex_t], arg1:Int, arg2:Pointer[Int]) : Int;

external (cdecl) pthread_mutex_trylock(arg0:Pointer[pthread_mutex_t]) : Int;

external (cdecl) pthread_mutex_unlock(arg0:Pointer[pthread_mutex_t]) : Int;

external (cdecl, "_pthread_mutexattr_destroy") pthread_mutexattr_destroy(arg0:Pointer[pthread_mutexattr_t]) : Int;

external (cdecl) pthread_mutexattr_getprioceiling(arg0:Pointer[pthread_mutexattr_t], arg1:Pointer[Int]) : Int;

external (cdecl) pthread_mutexattr_getprotocol(arg0:Pointer[pthread_mutexattr_t], arg1:Pointer[Int]) : Int;

external (cdecl) pthread_mutexattr_getpshared(arg0:Pointer[pthread_mutexattr_t], arg1:Pointer[Int]) : Int;

external (cdecl) pthread_mutexattr_gettype(arg0:Pointer[pthread_mutexattr_t], arg1:Pointer[Int]) : Int;

external (cdecl) pthread_mutexattr_init(arg0:Pointer[pthread_mutexattr_t]) : Int;

external (cdecl) pthread_mutexattr_setprioceiling(arg0:Pointer[pthread_mutexattr_t], arg1:Int) : Int;

external (cdecl) pthread_mutexattr_setprotocol(arg0:Pointer[pthread_mutexattr_t], arg1:Int) : Int;

external (cdecl) pthread_mutexattr_setpshared(arg0:Pointer[pthread_mutexattr_t], arg1:Int) : Int;

external (cdecl) pthread_mutexattr_settype(arg0:Pointer[pthread_mutexattr_t], arg1:Int) : Int;

external (cdecl) pthread_once(arg0:Pointer[pthread_once_t], arg1:CCodePointer[[],[]]) : Int;

external (cdecl, "_pthread_rwlock_destroy") pthread_rwlock_destroy(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl, "_pthread_rwlock_init") pthread_rwlock_init(arg0:Pointer[pthread_rwlock_t], arg1:Pointer[pthread_rwlockattr_t]) : Int;

external (cdecl, "_pthread_rwlock_rdlock") pthread_rwlock_rdlock(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl, "_pthread_rwlock_tryrdlock") pthread_rwlock_tryrdlock(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl, "_pthread_rwlock_trywrlock") pthread_rwlock_trywrlock(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl, "_pthread_rwlock_wrlock") pthread_rwlock_wrlock(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl, "_pthread_rwlock_unlock") pthread_rwlock_unlock(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl) pthread_rwlockattr_destroy(arg0:Pointer[pthread_rwlockattr_t]) : Int;

external (cdecl) pthread_rwlockattr_getpshared(arg0:Pointer[pthread_rwlockattr_t], arg1:Pointer[Int]) : Int;

external (cdecl) pthread_rwlockattr_init(arg0:Pointer[pthread_rwlockattr_t]) : Int;

external (cdecl) pthread_rwlockattr_setpshared(arg0:Pointer[pthread_rwlockattr_t], arg1:Int) : Int;

external (cdecl) pthread_self() : pthread_t;

external (cdecl, "_pthread_setcancelstate") pthread_setcancelstate(arg0:Int, arg1:Pointer[Int]) : Int;

external (cdecl, "_pthread_setcanceltype") pthread_setcanceltype(arg0:Int, arg1:Pointer[Int]) : Int;

external (cdecl) pthread_setconcurrency(arg0:Int) : Int;

external (cdecl) pthread_setschedparam(arg0:pthread_t, arg1:Int, arg2:Pointer[Struct_sched_param]) : Int;

external (cdecl) pthread_setspecific(arg0:pthread_key_t, arg1:OpaquePointer) : Int;

external (cdecl, "_pthread_testcancel") pthread_testcancel() : ;

external (cdecl) pthread_is_threaded_np() : Int;

external (cdecl) pthread_threadid_np(arg0:pthread_t, arg1:Pointer[__uint64_t]) : Int;

external (cdecl) pthread_rwlock_longrdlock_np(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl) pthread_rwlock_yieldwrlock_np(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl) pthread_rwlock_downgrade_np(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl) pthread_rwlock_upgrade_np(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl) pthread_rwlock_tryupgrade_np(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl) pthread_rwlock_held_np(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl) pthread_rwlock_rdheld_np(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl) pthread_rwlock_wrheld_np(arg0:Pointer[pthread_rwlock_t]) : Int;

external (cdecl) pthread_getname_np(arg0:pthread_t, arg1:Pointer[CChar], arg2:size_t) : Int;

external (cdecl) pthread_setname_np(arg0:Pointer[CChar]) : Int;

external (cdecl) pthread_main_np() : Int;

external (cdecl) pthread_mach_thread_np(arg0:pthread_t) : mach_port_t;

external (cdecl) pthread_get_stacksize_np(arg0:pthread_t) : size_t;

external (cdecl) pthread_get_stackaddr_np(arg0:pthread_t) : OpaquePointer;

external (cdecl) pthread_cond_signal_thread_np(arg0:Pointer[pthread_cond_t], arg1:pthread_t) : Int;

external (cdecl) pthread_cond_timedwait_relative_np(arg0:Pointer[pthread_cond_t], arg1:Pointer[pthread_mutex_t], arg2:Pointer[Struct_timespec]) : Int;

external (cdecl) pthread_create_suspended_np(arg0:Pointer[pthread_t], arg1:Pointer[pthread_attr_t], arg2:CCodePointer[[OpaquePointer],[OpaquePointer]], arg3:OpaquePointer) : Int;

external (cdecl) pthread_kill(arg0:pthread_t, arg1:Int) : Int;

external (cdecl) pthread_from_mach_thread_np(arg0:mach_port_t) : pthread_t;

external (cdecl, "_pthread_sigmask") pthread_sigmask(arg0:Int, arg1:Pointer[sigset_t], arg2:Pointer[sigset_t]) : Int;

external (cdecl) pthread_yield_np() : ;

record Struct_flock (
    l_start : off_t,
    l_len : off_t,
    l_pid : pid_t,
    l_type : Short,
    l_whence : Short,
);

record Struct_radvisory (
    ra_offset : off_t,
    ra_count : Int,
);

record Struct_fsignatures (
    fs_file_start : off_t,
    fs_blob_start : OpaquePointer,
    fs_blob_size : size_t,
);

alias fsignatures_t = Struct_fsignatures;

record Struct_fstore (
    fst_flags : UInt,
    fst_posmode : Int,
    fst_offset : off_t,
    fst_length : off_t,
    fst_bytesalloc : off_t,
);

alias fstore_t = Struct_fstore;

record Struct_fbootstraptransfer (
    fbt_offset : off_t,
    fbt_length : size_t,
    fbt_buffer : OpaquePointer,
);

alias fbootstraptransfer_t = Struct_fbootstraptransfer;

record Struct_log2phys (
    l2p_flags : UInt,
    l2p_contigbytes : off_t,
    l2p_devoffset : off_t,
);

alias Struct__filesec = Opaque;

alias filesec_t = Pointer[Struct__filesec];

alias Enum_Unnamed2 = UInt;
alias FILESEC_OWNER = 1;
alias FILESEC_GROUP = 2;
alias FILESEC_UUID = 3;
alias FILESEC_MODE = 4;
alias FILESEC_ACL = 5;
alias FILESEC_GRPUUID = 6;
alias FILESEC_ACL_RAW = 100;
alias FILESEC_ACL_ALLOCSIZE = 101;

alias filesec_property_t = Opaque /* unknown EnumDecl  */;

external (cdecl, "_open") open(arg0:Pointer[CChar], arg1:Int, ..) : Int;

external (cdecl, "_creat") creat(arg0:Pointer[CChar], arg1:mode_t) : Int;

external (cdecl, "_fcntl") fcntl(arg0:Int, arg1:Int, ..) : Int;

external (cdecl) openx_np(arg0:Pointer[CChar], arg1:Int, arg2:filesec_t) : Int;

external (cdecl) open_dprotected_np(arg0:Pointer[CChar], arg1:Int, arg2:Int, arg3:Int, ..) : Int;

external (cdecl) flock(arg0:Int, arg1:Int) : Int;

external (cdecl) filesec_init() : filesec_t;

external (cdecl) filesec_dup(arg0:filesec_t) : filesec_t;

external (cdecl) filesec_free(arg0:filesec_t) : ;

external (cdecl) filesec_get_property(arg0:filesec_t, arg1:filesec_property_t, arg2:OpaquePointer) : Int;

external (cdecl) filesec_query_property(arg0:filesec_t, arg1:filesec_property_t, arg2:Pointer[Int]) : Int;

external (cdecl) filesec_set_property(arg0:filesec_t, arg1:filesec_property_t, arg2:OpaquePointer) : Int;

external (cdecl) filesec_unset_property(arg0:filesec_t, arg1:filesec_property_t) : Int;

alias int8_t = CChar;

alias u_int8_t = CUChar;

alias int16_t = Short;

alias u_int16_t = UShort;

alias int32_t = Int;

alias u_int32_t = UInt;

alias int64_t = Int64;

alias u_int64_t = UInt64;

alias register_t = int32_t;

alias uintptr_t = CULong;

alias user_addr_t = u_int32_t;

alias user_size_t = u_int32_t;

alias user_ssize_t = int32_t;

alias user_long_t = int32_t;

alias user_ulong_t = u_int32_t;

alias user_time_t = int32_t;

alias user_off_t = int64_t;

alias syscall_arg_t = u_int32_t;

alias uint8_t = CUChar;

alias uint16_t = UShort;

alias uint32_t = UInt;

alias uint64_t = UInt64;

alias int_least8_t = int8_t;

alias int_least16_t = int16_t;

alias int_least32_t = int32_t;

alias int_least64_t = int64_t;

alias uint_least8_t = uint8_t;

alias uint_least16_t = uint16_t;

alias uint_least32_t = uint32_t;

alias uint_least64_t = uint64_t;

alias int_fast8_t = int8_t;

alias int_fast16_t = int16_t;

alias int_fast32_t = int32_t;

alias int_fast64_t = int64_t;

alias uint_fast8_t = uint8_t;

alias uint_fast16_t = uint16_t;

alias uint_fast32_t = uint32_t;

alias uint_fast64_t = uint64_t;

alias intmax_t = Int64;

alias uintmax_t = UInt64;

external (cdecl) _OSSwapInt16(arg0:uint16_t) : uint16_t;

external (cdecl) _OSSwapInt32(arg0:uint32_t) : uint32_t;

external (cdecl) _OSSwapInt64(arg0:uint64_t) : uint64_t;

external (cdecl) OSReadSwapInt16(arg0:OpaquePointer, arg1:uintptr_t) : uint16_t;

external (cdecl) OSReadSwapInt32(arg0:OpaquePointer, arg1:uintptr_t) : uint32_t;

external (cdecl) OSReadSwapInt64(arg0:OpaquePointer, arg1:uintptr_t) : uint64_t;

external (cdecl) OSWriteSwapInt16(arg0:OpaquePointer, arg1:uintptr_t, arg2:uint16_t) : ;

external (cdecl) OSWriteSwapInt32(arg0:OpaquePointer, arg1:uintptr_t, arg2:uint32_t) : ;

external (cdecl) OSWriteSwapInt64(arg0:OpaquePointer, arg1:uintptr_t, arg2:uint64_t) : ;

alias u_char = CUChar;

alias u_short = UShort;

alias u_int = UInt;

alias u_long = CULong;

alias ushort = UShort;

alias uint = UInt;

alias u_quad_t = u_int64_t;

alias quad_t = int64_t;

alias qaddr_t = Pointer[quad_t];

alias caddr_t = Pointer[CChar];

alias daddr_t = int32_t;

alias fixpt_t = u_int32_t;

alias blkcnt_t = __darwin_blkcnt_t;

alias blksize_t = __darwin_blksize_t;

alias in_addr_t = __uint32_t;

alias in_port_t = __uint16_t;

alias ino_t = __darwin_ino_t;

alias ino64_t = __darwin_ino64_t;

alias key_t = __int32_t;

alias nlink_t = __uint16_t;

alias id_t = __darwin_id_t;

alias segsz_t = int32_t;

alias swblk_t = int32_t;

alias fd_mask = __int32_t;

alias fsblkcnt_t = __darwin_fsblkcnt_t;

alias fsfilcnt_t = __darwin_fsfilcnt_t;

record Struct_itimerval (
    it_interval : Struct_timeval,
    it_value : Struct_timeval,
);

record Struct_timezone (
    tz_minuteswest : Int,
    tz_dsttime : Int,
);

record Struct_clockinfo (
    hz : Int,
    tick : Int,
    tickadj : Int,
    stathz : Int,
    profhz : Int,
);

external (cdecl) adjtime(arg0:Pointer[Struct_timeval], arg1:Pointer[Struct_timeval]) : Int;

external (cdecl) futimes(arg0:Int, arg1:Pointer[Struct_timeval]) : Int;

external (cdecl) lutimes(arg0:Pointer[CChar], arg1:Pointer[Struct_timeval]) : Int;

external (cdecl) settimeofday(arg0:Pointer[Struct_timeval], arg1:Pointer[Struct_timezone]) : Int;

external (cdecl) getitimer(arg0:Int, arg1:Pointer[Struct_itimerval]) : Int;

external (cdecl) gettimeofday(arg0:Pointer[Struct_timeval], arg1:OpaquePointer) : Int;

external (cdecl) setitimer(arg0:Int, arg1:Pointer[Struct_itimerval], arg2:Pointer[Struct_itimerval]) : Int;

external (cdecl) utimes(arg0:Pointer[CChar], arg1:Pointer[Struct_timeval]) : Int;

record Struct_ostat (
    st_dev : __uint16_t,
    st_ino : ino_t,
    st_mode : mode_t,
    st_nlink : nlink_t,
    st_uid : __uint16_t,
    st_gid : __uint16_t,
    st_rdev : __uint16_t,
    st_size : __int32_t,
    st_atimespec : Struct_timespec,
    st_mtimespec : Struct_timespec,
    st_ctimespec : Struct_timespec,
    st_blksize : __int32_t,
    st_blocks : __int32_t,
    st_flags : __uint32_t,
    st_gen : __uint32_t,
);

record Struct_stat (
    st_dev : dev_t,
    st_mode : mode_t,
    st_nlink : nlink_t,
    st_ino : __darwin_ino64_t,
    st_uid : uid_t,
    st_gid : gid_t,
    st_rdev : dev_t,
    st_atimespec : Struct_timespec,
    st_mtimespec : Struct_timespec,
    st_ctimespec : Struct_timespec,
    st_birthtimespec : Struct_timespec,
    st_size : off_t,
    st_blocks : blkcnt_t,
    st_blksize : blksize_t,
    st_flags : __uint32_t,
    st_gen : __uint32_t,
    st_lspare : __int32_t,
    st_qspare : Array[__int64_t, 2],
);

external (cdecl, "_chmod") chmod(arg0:Pointer[CChar], arg1:mode_t) : Int;

external (cdecl, "_fchmod") fchmod(arg0:Int, arg1:mode_t) : Int;

external (cdecl, "_fstat") fstat(arg0:Int, arg1:Pointer[Struct_stat]) : Int;

external (cdecl, "_lstat") lstat(arg0:Pointer[CChar], arg1:Pointer[Struct_stat]) : Int;

external (cdecl) mkdir(arg0:Pointer[CChar], arg1:mode_t) : Int;

external (cdecl) mkfifo(arg0:Pointer[CChar], arg1:mode_t) : Int;

external (cdecl, "_stat") stat(arg0:Pointer[CChar], arg1:Pointer[Struct_stat]) : Int;

external (cdecl) umask(arg0:mode_t) : mode_t;

external (cdecl) chflags(arg0:Pointer[CChar], arg1:__uint32_t) : Int;

external (cdecl) chmodx_np(arg0:Pointer[CChar], arg1:filesec_t) : Int;

external (cdecl) fchflags(arg0:Int, arg1:__uint32_t) : Int;

external (cdecl) fchmodx_np(arg0:Int, arg1:filesec_t) : Int;

external (cdecl, "_fstatx_np") fstatx_np(arg0:Int, arg1:Pointer[Struct_stat], arg2:filesec_t) : Int;

external (cdecl) lchflags(arg0:Pointer[CChar], arg1:__uint32_t) : Int;

external (cdecl) lchmod(arg0:Pointer[CChar], arg1:mode_t) : Int;

external (cdecl, "_lstatx_np") lstatx_np(arg0:Pointer[CChar], arg1:Pointer[Struct_stat], arg2:filesec_t) : Int;

external (cdecl) mkdirx_np(arg0:Pointer[CChar], arg1:filesec_t) : Int;

external (cdecl) mkfifox_np(arg0:Pointer[CChar], arg1:filesec_t) : Int;

external (cdecl, "_statx_np") statx_np(arg0:Pointer[CChar], arg1:Pointer[Struct_stat], arg2:filesec_t) : Int;

external (cdecl) umaskx_np(arg0:filesec_t) : Int;

external (cdecl) mlockall(arg0:Int) : Int;

external (cdecl) munlockall() : Int;

external (cdecl) mlock(arg0:OpaquePointer, arg1:size_t) : Int;

external (cdecl, "_mmap") mmap(arg0:OpaquePointer, arg1:size_t, arg2:Int, arg3:Int, arg4:Int, arg5:off_t) : OpaquePointer;

external (cdecl, "_mprotect") mprotect(arg0:OpaquePointer, arg1:size_t, arg2:Int) : Int;

external (cdecl, "_msync") msync(arg0:OpaquePointer, arg1:size_t, arg2:Int) : Int;

external (cdecl) munlock(arg0:OpaquePointer, arg1:size_t) : Int;

external (cdecl, "_munmap") munmap(arg0:OpaquePointer, arg1:size_t) : Int;

external (cdecl) shm_open(arg0:Pointer[CChar], arg1:Int, ..) : Int;

external (cdecl) shm_unlink(arg0:Pointer[CChar]) : Int;

external (cdecl) posix_madvise(arg0:OpaquePointer, arg1:size_t, arg2:Int) : Int;

external (cdecl) madvise(arg0:OpaquePointer, arg1:size_t, arg2:Int) : Int;

external (cdecl) mincore(arg0:OpaquePointer, arg1:size_t, arg2:Pointer[CChar]) : Int;

external (cdecl) minherit(arg0:OpaquePointer, arg1:size_t, arg2:Int) : Int;

alias sa_family_t = __uint8_t;

alias socklen_t = __darwin_socklen_t;

record Struct_iovec (
    iov_base : OpaquePointer,
    iov_len : size_t,
);

record Struct_linger (
    l_onoff : Int,
    l_linger : Int,
);

record Struct_so_np_extensions (
    npx_flags : u_int32_t,
    npx_mask : u_int32_t,
);

record Struct_sockaddr (
    sa_len : __uint8_t,
    sa_family : sa_family_t,
    sa_data : Array[CChar, 14],
);

record Struct_sockproto (
    sp_family : __uint16_t,
    sp_protocol : __uint16_t,
);

record Struct_sockaddr_storage (
    ss_len : __uint8_t,
    ss_family : sa_family_t,
    __ss_pad1 : Array[CChar, 6],
    __ss_align : __int64_t,
    __ss_pad2 : Array[CChar, 112],
);

record Struct_msghdr (
    msg_name : OpaquePointer,
    msg_namelen : socklen_t,
    msg_iov : Pointer[Struct_iovec],
    msg_iovlen : Int,
    msg_control : OpaquePointer,
    msg_controllen : socklen_t,
    msg_flags : Int,
);

record Struct_cmsghdr (
    cmsg_len : socklen_t,
    cmsg_level : Int,
    cmsg_type : Int,
);

record Struct_sf_hdtr (
    headers : Pointer[Struct_iovec],
    hdr_cnt : Int,
    trailers : Pointer[Struct_iovec],
    trl_cnt : Int,
);

external (cdecl, "_accept") accept(arg0:Int, arg1:Pointer[Struct_sockaddr], arg2:Pointer[socklen_t]) : Int;

external (cdecl, "_bind") bind(arg0:Int, arg1:Pointer[Struct_sockaddr], arg2:socklen_t) : Int;

external (cdecl, "_connect") connect(arg0:Int, arg1:Pointer[Struct_sockaddr], arg2:socklen_t) : Int;

external (cdecl, "_getpeername") getpeername(arg0:Int, arg1:Pointer[Struct_sockaddr], arg2:Pointer[socklen_t]) : Int;

external (cdecl, "_getsockname") getsockname(arg0:Int, arg1:Pointer[Struct_sockaddr], arg2:Pointer[socklen_t]) : Int;

external (cdecl) getsockopt(arg0:Int, arg1:Int, arg2:Int, arg3:OpaquePointer, arg4:Pointer[socklen_t]) : Int;

external (cdecl, "_listen") listen(arg0:Int, arg1:Int) : Int;

external (cdecl, "_recv") recv(arg0:Int, arg1:OpaquePointer, arg2:size_t, arg3:Int) : ssize_t;

external (cdecl, "_recvfrom") recvfrom(arg0:Int, arg1:OpaquePointer, arg2:size_t, arg3:Int, arg4:Pointer[Struct_sockaddr], arg5:Pointer[socklen_t]) : ssize_t;

external (cdecl, "_recvmsg") recvmsg(arg0:Int, arg1:Pointer[Struct_msghdr], arg2:Int) : ssize_t;

external (cdecl, "_send") send(arg0:Int, arg1:OpaquePointer, arg2:size_t, arg3:Int) : ssize_t;

external (cdecl, "_sendmsg") sendmsg(arg0:Int, arg1:Pointer[Struct_msghdr], arg2:Int) : ssize_t;

external (cdecl, "_sendto") sendto(arg0:Int, arg1:OpaquePointer, arg2:size_t, arg3:Int, arg4:Pointer[Struct_sockaddr], arg5:socklen_t) : ssize_t;

external (cdecl) setsockopt(arg0:Int, arg1:Int, arg2:Int, arg3:OpaquePointer, arg4:socklen_t) : Int;

external (cdecl) shutdown(arg0:Int, arg1:Int) : Int;

external (cdecl) sockatmark(arg0:Int) : Int;

external (cdecl) socket(arg0:Int, arg1:Int, arg2:Int) : Int;

external (cdecl, "_socketpair") socketpair(arg0:Int, arg1:Int, arg2:Int, arg3:Pointer[Int]) : Int;

external (cdecl) sendfile(arg0:Int, arg1:Int, arg2:off_t, arg3:Pointer[off_t], arg4:Pointer[Struct_sf_hdtr], arg5:Int) : Int;

external (cdecl) pfctlinput(arg0:Int, arg1:Pointer[Struct_sockaddr]) : ;

alias sig_atomic_t = Int;

record Struct___darwin_arm_exception_state (
    __exception : __uint32_t,
    __fsr : __uint32_t,
    __far : __uint32_t,
);

record Struct___darwin_arm_thread_state (
    __r : Array[__uint32_t, 13],
    __sp : __uint32_t,
    __lr : __uint32_t,
    __pc : __uint32_t,
    __cpsr : __uint32_t,
);

record Struct___darwin_arm_vfp_state (
    __r : Array[__uint32_t, 64],
    __fpscr : __uint32_t,
);

record Struct___darwin_arm_debug_state (
    __bvr : Array[__uint32_t, 16],
    __bcr : Array[__uint32_t, 16],
    __wvr : Array[__uint32_t, 16],
    __wcr : Array[__uint32_t, 16],
);

record Struct___darwin_mcontext (
    __es : Struct___darwin_arm_exception_state,
    __ss : Struct___darwin_arm_thread_state,
    __fs : Struct___darwin_arm_vfp_state,
);

record Struct___darwin_sigaltstack (
    ss_sp : OpaquePointer,
    ss_size : __darwin_size_t,
    ss_flags : Int,
);

record Struct___darwin_ucontext (
    uc_onstack : Int,
    uc_sigmask : __darwin_sigset_t,
    uc_stack : Struct___darwin_sigaltstack,
    uc_link : Pointer[Struct___darwin_ucontext],
    uc_mcsize : __darwin_size_t,
    uc_mcontext : Pointer[Struct___darwin_mcontext],
);

alias stack_t = Struct___darwin_sigaltstack;

alias ucontext_t = Struct___darwin_ucontext;

alias Union_sigval = Union[
    /* sival_int */ Int,
    /* sival_ptr */ OpaquePointer,
];

record Struct_sigevent (
    sigev_notify : Int,
    sigev_signo : Int,
    sigev_value : Union_sigval,
    sigev_notify_function : CCodePointer[[Union_sigval],[]],
    sigev_notify_attributes : Pointer[pthread_attr_t],
);

record Struct___siginfo (
    si_signo : Int,
    si_errno : Int,
    si_code : Int,
    si_pid : pid_t,
    si_uid : uid_t,
    si_status : Int,
    si_addr : OpaquePointer,
    si_value : Union_sigval,
    si_band : CLong,
    __pad : Array[CULong, 7],
);

alias siginfo_t = Struct___siginfo;

alias Union___sigaction_u = Union[
    /* __sa_handler */ CCodePointer[[Int],[]],
    /* __sa_sigaction */ CCodePointer[[Int, Pointer[Struct___siginfo], OpaquePointer],[]],
];

record Struct___sigaction (
    __sigaction_u : Union___sigaction_u,
    sa_tramp : CCodePointer[[OpaquePointer, Int, Int, Pointer[siginfo_t], OpaquePointer],[]],
    sa_mask : sigset_t,
    sa_flags : Int,
);

record Struct_sigaction (
    __sigaction_u : Union___sigaction_u,
    sa_mask : sigset_t,
    sa_flags : Int,
);

alias sig_t = CCodePointer[[Int],[]];

record Struct_sigvec (
    sv_handler : CCodePointer[[Int],[]],
    sv_mask : Int,
    sv_flags : Int,
);

record Struct_sigstack (
    ss_sp : Pointer[CChar],
    ss_onstack : Int,
);

external (cdecl) signal(arg0:Int, arg1:CCodePointer[[Int],[]]) : CCodePointer[[Int],[]];

alias Enum_Unnamed3 = UInt;
alias P_ALL = 0;
alias P_PID = 1;
alias P_PGID = 2;

alias idtype_t = Opaque /* unknown EnumDecl  */;

alias rlim_t = __uint64_t;

record Struct_rusage (
    ru_utime : Struct_timeval,
    ru_stime : Struct_timeval,
    ru_maxrss : CLong,
    ru_ixrss : CLong,
    ru_idrss : CLong,
    ru_isrss : CLong,
    ru_minflt : CLong,
    ru_majflt : CLong,
    ru_nswap : CLong,
    ru_inblock : CLong,
    ru_oublock : CLong,
    ru_msgsnd : CLong,
    ru_msgrcv : CLong,
    ru_nsignals : CLong,
    ru_nvcsw : CLong,
    ru_nivcsw : CLong,
);

record Struct_rlimit (
    rlim_cur : rlim_t,
    rlim_max : rlim_t,
);

external (cdecl) getpriority(arg0:Int, arg1:id_t) : Int;

external (cdecl) getiopolicy_np(arg0:Int, arg1:Int) : Int;

external (cdecl, "_getrlimit") getrlimit(arg0:Int, arg1:Pointer[Struct_rlimit]) : Int;

external (cdecl) getrusage(arg0:Int, arg1:Pointer[Struct_rusage]) : Int;

external (cdecl) setpriority(arg0:Int, arg1:id_t, arg2:Int) : Int;

external (cdecl) setiopolicy_np(arg0:Int, arg1:Int, arg2:Int) : Int;

external (cdecl, "_setrlimit") setrlimit(arg0:Int, arg1:Pointer[Struct_rlimit]) : Int;

alias Union_wait = Union[
    /* w_status */ Int,
    /* w_T */ Struct_Unnamed4,
    /* w_S */ Struct_Unnamed5,
];

external (cdecl, "_wait") wait(arg0:Pointer[Int]) : pid_t;

external (cdecl, "_waitpid") waitpid(arg0:pid_t, arg1:Pointer[Int], arg2:Int) : pid_t;

external (cdecl, "_waitid") waitid(arg0:idtype_t, arg1:id_t, arg2:Pointer[siginfo_t], arg3:Int) : Int;

external (cdecl) wait3(arg0:Pointer[Int], arg1:Int, arg2:Pointer[Struct_rusage]) : pid_t;

external (cdecl) wait4(arg0:pid_t, arg1:Pointer[Int], arg2:Int, arg3:Pointer[Struct_rusage]) : pid_t;

record Struct_kevent (
    ident : uintptr_t,
    filter : int16_t,
    flags : uint16_t,
    fflags : uint32_t,
    data : intptr_t,
    udata : OpaquePointer,
);

record Struct_kevent64_s (
    ident : uint64_t,
    filter : int16_t,
    flags : uint16_t,
    fflags : uint32_t,
    data : int64_t,
    udata : uint64_t,
    ext : Array[uint64_t, 2],
);

alias Struct_knote = Opaque;

record Struct_klist (
    slh_first : Pointer[Struct_knote],
);

external (cdecl) kqueue() : Int;

external (cdecl) kevent(arg0:Int, arg1:Pointer[Struct_kevent], arg2:Int, arg3:Pointer[Struct_kevent], arg4:Int, arg5:Pointer[Struct_timespec]) : Int;

external (cdecl) kevent64(arg0:Int, arg1:Pointer[Struct_kevent64_s], arg2:Int, arg3:Pointer[Struct_kevent64_s], arg4:Int, arg5:UInt, arg6:Pointer[Struct_timespec]) : Int;

external sys_signame : Array[Pointer[CChar], 32];

external sys_siglist : Array[Pointer[CChar], 32];

external (cdecl) raise(arg0:Int) : Int;

external (cdecl) bsd_signal(arg0:Int, arg1:CCodePointer[[Int],[]]) : CCodePointer[[Int],[]];

external (cdecl, "_kill") kill(arg0:pid_t, arg1:Int) : Int;

external (cdecl, "_killpg") killpg(arg0:pid_t, arg1:Int) : Int;

external (cdecl) sigaction(arg0:Int, arg1:Pointer[Struct_sigaction], arg2:Pointer[Struct_sigaction]) : Int;

external (cdecl) sigaddset(arg0:Pointer[sigset_t], arg1:Int) : Int;

external (cdecl, "_sigaltstack") sigaltstack(arg0:Pointer[stack_t], arg1:Pointer[stack_t]) : Int;

external (cdecl) sigdelset(arg0:Pointer[sigset_t], arg1:Int) : Int;

external (cdecl) sigemptyset(arg0:Pointer[sigset_t]) : Int;

external (cdecl) sigfillset(arg0:Pointer[sigset_t]) : Int;

external (cdecl) sighold(arg0:Int) : Int;

external (cdecl) sigignore(arg0:Int) : Int;

external (cdecl) siginterrupt(arg0:Int, arg1:Int) : Int;

external (cdecl) sigismember(arg0:Pointer[sigset_t], arg1:Int) : Int;

external (cdecl, "_sigpause") sigpause(arg0:Int) : Int;

external (cdecl) sigpending(arg0:Pointer[sigset_t]) : Int;

external (cdecl) sigprocmask(arg0:Int, arg1:Pointer[sigset_t], arg2:Pointer[sigset_t]) : Int;

external (cdecl) sigrelse(arg0:Int) : Int;

external (cdecl) sigset(arg0:Int, arg1:CCodePointer[[Int],[]]) : CCodePointer[[Int],[]];

external (cdecl, "_sigsuspend") sigsuspend(arg0:Pointer[sigset_t]) : Int;

external (cdecl, "_sigwait") sigwait(arg0:Pointer[sigset_t], arg1:Pointer[Int]) : Int;

external (cdecl) psignal(arg0:UInt, arg1:Pointer[CChar]) : ;

external (cdecl) sigblock(arg0:Int) : Int;

external (cdecl) sigsetmask(arg0:Int) : Int;

external (cdecl) sigvec(arg0:Int, arg1:Pointer[Struct_sigvec], arg2:Pointer[Struct_sigvec]) : Int;

record Struct_dirent (
    d_ino : __uint64_t,
    d_seekoff : __uint64_t,
    d_reclen : __uint16_t,
    d_namlen : __uint16_t,
    d_type : __uint8_t,
    d_name : Array[CChar, 1024],
);

alias Struct__telldir = Opaque;

record Struct_Unnamed6 (
    __dd_fd : Int,
    __dd_loc : CLong,
    __dd_size : CLong,
    __dd_buf : Pointer[CChar],
    __dd_len : Int,
    __dd_seek : CLong,
    __dd_rewind : CLong,
    __dd_flags : Int,
    __dd_lock : __darwin_pthread_mutex_t,
    __dd_td : Pointer[Struct__telldir],
);

alias DIR = Struct_Unnamed6;

external (cdecl, "_alphasort") alphasort(arg0:OpaquePointer, arg1:OpaquePointer) : Int;

external (cdecl, "_closedir") closedir(arg0:Pointer[DIR]) : Int;

external (cdecl, "_getdirentries_is_not_available_when_64_bit_inodes_are_in_effect") getdirentries(arg0:Int, arg1:Pointer[CChar], arg2:Int, arg3:Pointer[CLong]) : Int;

external (cdecl, "_opendir") opendir(arg0:Pointer[CChar]) : Pointer[DIR];

external (cdecl, "___opendir2") __opendir2(arg0:Pointer[CChar], arg1:Int) : Pointer[DIR];

external (cdecl, "_readdir") readdir(arg0:Pointer[DIR]) : Pointer[Struct_dirent];

external (cdecl, "_readdir_r") readdir_r(arg0:Pointer[DIR], arg1:Pointer[Struct_dirent], arg2:Pointer[Pointer[Struct_dirent]]) : Int;

external (cdecl, "_rewinddir") rewinddir(arg0:Pointer[DIR]) : ;

external (cdecl, "_scandir") scandir(arg0:Pointer[CChar], arg1:Pointer[Pointer[Pointer[Struct_dirent]]], arg2:CCodePointer[[Pointer[Struct_dirent]],[Int]], arg3:CCodePointer[[OpaquePointer, OpaquePointer],[Int]]) : Int;

external (cdecl, "_scandir_b") scandir_b(arg0:Pointer[CChar], arg1:Pointer[Pointer[Pointer[Struct_dirent]]], arg2:/* unknown kind BlockPointer */ Opaque, arg3:/* unknown kind BlockPointer */ Opaque) : Int;

external (cdecl, "_seekdir") seekdir(arg0:Pointer[DIR], arg1:CLong) : ;

external (cdecl, "_telldir") telldir(arg0:Pointer[DIR]) : CLong;

record Struct_dl_info (
    dli_fname : Pointer[CChar],
    dli_fbase : OpaquePointer,
    dli_sname : Pointer[CChar],
    dli_saddr : OpaquePointer,
);

alias Dl_info = Struct_dl_info;

external (cdecl) dladdr(arg0:OpaquePointer, arg1:Pointer[Dl_info]) : Int;

external (cdecl) dlclose(arg0:OpaquePointer) : Int;

external (cdecl) dlerror() : Pointer[CChar];

external (cdecl) dlopen(arg0:Pointer[CChar], arg1:Int) : OpaquePointer;

external (cdecl) dlsym(arg0:OpaquePointer, arg1:Pointer[CChar]) : OpaquePointer;

external (cdecl) dlopen_preflight(arg0:Pointer[CChar]) : Bool;

record Struct_in_addr (
    s_addr : in_addr_t,
);

record Struct_sockaddr_in (
    sin_len : __uint8_t,
    sin_family : sa_family_t,
    sin_port : in_port_t,
    sin_addr : Struct_in_addr,
    sin_zero : Array[CChar, 8],
);

record Struct_ip_opts (
    ip_dst : Struct_in_addr,
    ip_opts : Array[CChar, 40],
);

record Struct_ip_mreq (
    imr_multiaddr : Struct_in_addr,
    imr_interface : Struct_in_addr,
);

record Struct_ip_mreqn (
    imr_multiaddr : Struct_in_addr,
    imr_address : Struct_in_addr,
    imr_ifindex : Int,
);

record Struct_ip_mreq_source (
    imr_multiaddr : Struct_in_addr,
    imr_sourceaddr : Struct_in_addr,
    imr_interface : Struct_in_addr,
);

record Struct_group_req (
    gr_interface : uint32_t,
    gr_group : Struct_sockaddr_storage,
);

record Struct_group_source_req (
    gsr_interface : uint32_t,
    gsr_group : Struct_sockaddr_storage,
    gsr_source : Struct_sockaddr_storage,
);

record Struct___msfilterreq (
    msfr_ifindex : uint32_t,
    msfr_fmode : uint32_t,
    msfr_nsrcs : uint32_t,
    __msfr_align : uint32_t,
    msfr_group : Struct_sockaddr_storage,
    msfr_srcs : Pointer[Struct_sockaddr_storage],
);

external (cdecl) setipv4sourcefilter(arg0:Int, arg1:Struct_in_addr, arg2:Struct_in_addr, arg3:uint32_t, arg4:uint32_t, arg5:Pointer[Struct_in_addr]) : Int;

external (cdecl) getipv4sourcefilter(arg0:Int, arg1:Struct_in_addr, arg2:Struct_in_addr, arg3:Pointer[uint32_t], arg4:Pointer[uint32_t], arg5:Pointer[Struct_in_addr]) : Int;

external (cdecl) setsourcefilter(arg0:Int, arg1:uint32_t, arg2:Pointer[Struct_sockaddr], arg3:socklen_t, arg4:uint32_t, arg5:uint32_t, arg6:Pointer[Struct_sockaddr_storage]) : Int;

external (cdecl) getsourcefilter(arg0:Int, arg1:uint32_t, arg2:Pointer[Struct_sockaddr], arg3:socklen_t, arg4:Pointer[uint32_t], arg5:Pointer[uint32_t], arg6:Pointer[Struct_sockaddr_storage]) : Int;

record Struct_in_pktinfo (
    ipi_ifindex : UInt,
    ipi_spec_dst : Struct_in_addr,
    ipi_addr : Struct_in_addr,
);

record Struct_in6_addr (
    __u6_addr : Union_Unnamed7,
);

record Struct_sockaddr_in6 (
    sin6_len : __uint8_t,
    sin6_family : sa_family_t,
    sin6_port : in_port_t,
    sin6_flowinfo : __uint32_t,
    sin6_addr : Struct_in6_addr,
    sin6_scope_id : __uint32_t,
);

external in6addr_any : Struct_in6_addr;

external in6addr_loopback : Struct_in6_addr;

external in6addr_nodelocal_allnodes : Struct_in6_addr;

external in6addr_linklocal_allnodes : Struct_in6_addr;

external in6addr_linklocal_allrouters : Struct_in6_addr;

external in6addr_linklocal_allv2routers : Struct_in6_addr;

record Struct_ipv6_mreq (
    ipv6mr_multiaddr : Struct_in6_addr,
    ipv6mr_interface : UInt,
);

record Struct_in6_pktinfo (
    ipi6_addr : Struct_in6_addr,
    ipi6_ifindex : UInt,
);

record Struct_ip6_mtuinfo (
    ip6m_addr : Struct_sockaddr_in6,
    ip6m_mtu : uint32_t,
);

external (cdecl) inet6_option_space(arg0:Int) : Int;

external (cdecl) inet6_option_init(arg0:OpaquePointer, arg1:Pointer[Pointer[Struct_cmsghdr]], arg2:Int) : Int;

external (cdecl) inet6_option_append(arg0:Pointer[Struct_cmsghdr], arg1:Pointer[__uint8_t], arg2:Int, arg3:Int) : Int;

external (cdecl) inet6_option_alloc(arg0:Pointer[Struct_cmsghdr], arg1:Int, arg2:Int, arg3:Int) : Pointer[__uint8_t];

external (cdecl) inet6_option_next(arg0:Pointer[Struct_cmsghdr], arg1:Pointer[Pointer[__uint8_t]]) : Int;

external (cdecl) inet6_option_find(arg0:Pointer[Struct_cmsghdr], arg1:Pointer[Pointer[__uint8_t]], arg2:Int) : Int;

external (cdecl) inet6_rthdr_space(arg0:Int, arg1:Int) : size_t;

external (cdecl) inet6_rthdr_init(arg0:OpaquePointer, arg1:Int) : Pointer[Struct_cmsghdr];

external (cdecl) inet6_rthdr_add(arg0:Pointer[Struct_cmsghdr], arg1:Pointer[Struct_in6_addr], arg2:UInt) : Int;

external (cdecl) inet6_rthdr_lasthop(arg0:Pointer[Struct_cmsghdr], arg1:UInt) : Int;

external (cdecl) inet6_rthdr_segments(arg0:Pointer[Struct_cmsghdr]) : Int;

external (cdecl) inet6_rthdr_getaddr(arg0:Pointer[Struct_cmsghdr], arg1:Int) : Pointer[Struct_in6_addr];

external (cdecl) inet6_rthdr_getflags(arg0:Pointer[Struct_cmsghdr], arg1:Int) : Int;

external (cdecl) inet6_opt_init(arg0:OpaquePointer, arg1:socklen_t) : Int;

external (cdecl) inet6_opt_append(arg0:OpaquePointer, arg1:socklen_t, arg2:Int, arg3:__uint8_t, arg4:socklen_t, arg5:__uint8_t, arg6:Pointer[OpaquePointer]) : Int;

external (cdecl) inet6_opt_finish(arg0:OpaquePointer, arg1:socklen_t, arg2:Int) : Int;

external (cdecl) inet6_opt_set_val(arg0:OpaquePointer, arg1:Int, arg2:OpaquePointer, arg3:socklen_t) : Int;

external (cdecl) inet6_opt_next(arg0:OpaquePointer, arg1:socklen_t, arg2:Int, arg3:Pointer[__uint8_t], arg4:Pointer[socklen_t], arg5:Pointer[OpaquePointer]) : Int;

external (cdecl) inet6_opt_find(arg0:OpaquePointer, arg1:socklen_t, arg2:Int, arg3:__uint8_t, arg4:Pointer[socklen_t], arg5:Pointer[OpaquePointer]) : Int;

external (cdecl) inet6_opt_get_val(arg0:OpaquePointer, arg1:Int, arg2:OpaquePointer, arg3:socklen_t) : Int;

external (cdecl) inet6_rth_space(arg0:Int, arg1:Int) : socklen_t;

external (cdecl) inet6_rth_init(arg0:OpaquePointer, arg1:socklen_t, arg2:Int, arg3:Int) : OpaquePointer;

external (cdecl) inet6_rth_add(arg0:OpaquePointer, arg1:Pointer[Struct_in6_addr]) : Int;

external (cdecl) inet6_rth_reverse(arg0:OpaquePointer, arg1:OpaquePointer) : Int;

external (cdecl) inet6_rth_segments(arg0:OpaquePointer) : Int;

external (cdecl) inet6_rth_getaddr(arg0:OpaquePointer, arg1:Int) : Pointer[Struct_in6_addr];

external (cdecl) addrsel_policy_init() : ;

external (cdecl) bindresvport(arg0:Int, arg1:Pointer[Struct_sockaddr_in]) : Int;

external (cdecl) bindresvport_sa(arg0:Int, arg1:Pointer[Struct_sockaddr]) : Int;

external h_errno : Int;

record Struct_hostent (
    h_name : Pointer[CChar],
    h_aliases : Pointer[Pointer[CChar]],
    h_addrtype : Int,
    h_length : Int,
    h_addr_list : Pointer[Pointer[CChar]],
);

record Struct_netent (
    n_name : Pointer[CChar],
    n_aliases : Pointer[Pointer[CChar]],
    n_addrtype : Int,
    n_net : uint32_t,
);

record Struct_servent (
    s_name : Pointer[CChar],
    s_aliases : Pointer[Pointer[CChar]],
    s_port : Int,
    s_proto : Pointer[CChar],
);

record Struct_protoent (
    p_name : Pointer[CChar],
    p_aliases : Pointer[Pointer[CChar]],
    p_proto : Int,
);

record Struct_addrinfo (
    ai_flags : Int,
    ai_family : Int,
    ai_socktype : Int,
    ai_protocol : Int,
    ai_addrlen : socklen_t,
    ai_canonname : Pointer[CChar],
    ai_addr : Pointer[Struct_sockaddr],
    ai_next : Pointer[Struct_addrinfo],
);

record Struct_rpcent (
    r_name : Pointer[CChar],
    r_aliases : Pointer[Pointer[CChar]],
    r_number : Int,
);

external (cdecl) endhostent() : ;

external (cdecl) endnetent() : ;

external (cdecl) endprotoent() : ;

external (cdecl) endservent() : ;

external (cdecl) freeaddrinfo(arg0:Pointer[Struct_addrinfo]) : ;

external (cdecl) gai_strerror(arg0:Int) : Pointer[CChar];

external (cdecl) getaddrinfo(arg0:Pointer[CChar], arg1:Pointer[CChar], arg2:Pointer[Struct_addrinfo], arg3:Pointer[Pointer[Struct_addrinfo]]) : Int;

external (cdecl) gethostbyaddr(arg0:OpaquePointer, arg1:socklen_t, arg2:Int) : Pointer[Struct_hostent];

external (cdecl) gethostbyname(arg0:Pointer[CChar]) : Pointer[Struct_hostent];

external (cdecl) gethostent() : Pointer[Struct_hostent];

external (cdecl) getnameinfo(arg0:Pointer[Struct_sockaddr], arg1:socklen_t, arg2:Pointer[CChar], arg3:socklen_t, arg4:Pointer[CChar], arg5:socklen_t, arg6:Int) : Int;

external (cdecl) getnetbyaddr(arg0:uint32_t, arg1:Int) : Pointer[Struct_netent];

external (cdecl) getnetbyname(arg0:Pointer[CChar]) : Pointer[Struct_netent];

external (cdecl) getnetent() : Pointer[Struct_netent];

external (cdecl) getprotobyname(arg0:Pointer[CChar]) : Pointer[Struct_protoent];

external (cdecl) getprotobynumber(arg0:Int) : Pointer[Struct_protoent];

external (cdecl) getprotoent() : Pointer[Struct_protoent];

external (cdecl) getservbyname(arg0:Pointer[CChar], arg1:Pointer[CChar]) : Pointer[Struct_servent];

external (cdecl) getservbyport(arg0:Int, arg1:Pointer[CChar]) : Pointer[Struct_servent];

external (cdecl) getservent() : Pointer[Struct_servent];

external (cdecl) sethostent(arg0:Int) : ;

external (cdecl) setnetent(arg0:Int) : ;

external (cdecl) setprotoent(arg0:Int) : ;

external (cdecl) setservent(arg0:Int) : ;

external (cdecl) freehostent(arg0:Pointer[Struct_hostent]) : ;

external (cdecl) gethostbyname2(arg0:Pointer[CChar], arg1:Int) : Pointer[Struct_hostent];

external (cdecl) getipnodebyaddr(arg0:OpaquePointer, arg1:size_t, arg2:Int, arg3:Pointer[Int]) : Pointer[Struct_hostent];

external (cdecl) getipnodebyname(arg0:Pointer[CChar], arg1:Int, arg2:Int, arg3:Pointer[Int]) : Pointer[Struct_hostent];

external (cdecl) getrpcbyname(arg0:Pointer[CChar]) : Pointer[Struct_rpcent];

external (cdecl) getrpcbynumber(arg0:CLong) : Pointer[Struct_rpcent];

external (cdecl) getrpcent() : Pointer[Struct_rpcent];

external (cdecl) setrpcent(arg0:Int) : ;

external (cdecl) endrpcent() : ;

external (cdecl) herror(arg0:Pointer[CChar]) : ;

external (cdecl) hstrerror(arg0:Int) : Pointer[CChar];

external (cdecl) innetgr(arg0:Pointer[CChar], arg1:Pointer[CChar], arg2:Pointer[CChar], arg3:Pointer[CChar]) : Int;

external (cdecl) getnetgrent(arg0:Pointer[Pointer[CChar]], arg1:Pointer[Pointer[CChar]], arg2:Pointer[Pointer[CChar]]) : Int;

external (cdecl) endnetgrent() : ;

external (cdecl) setnetgrent(arg0:Pointer[CChar]) : ;

