/* 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 __clock_t = CULong;

alias __cpumask_t = UInt;

alias __critical_t = __int32_t;

alias __double_t = LongDouble;

alias __float_t = LongDouble;

alias __intfptr_t = __int32_t;

alias __intmax_t = __int64_t;

alias __intptr_t = __int32_t;

alias __int_fast8_t = __int32_t;

alias __int_fast16_t = __int32_t;

alias __int_fast32_t = __int32_t;

alias __int_fast64_t = __int64_t;

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 __ptrdiff_t = __int32_t;

alias __register_t = __int32_t;

alias __segsz_t = __int32_t;

alias __size_t = __uint32_t;

alias __ssize_t = __int32_t;

alias __time_t = __int32_t;

alias __uintfptr_t = __uint32_t;

alias __uintmax_t = __uint64_t;

alias __uintptr_t = __uint32_t;

alias __uint_fast8_t = __uint32_t;

alias __uint_fast16_t = __uint32_t;

alias __uint_fast32_t = __uint32_t;

alias __uint_fast64_t = __uint64_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 __u_register_t = __uint32_t;

alias __vm_offset_t = __uint32_t;

alias __vm_ooffset_t = __int64_t;

alias __vm_paddr_t = __uint32_t;

alias __vm_pindex_t = __uint64_t;

alias __vm_size_t = __uint32_t;

alias __va_list = __builtin_va_list;

alias __gnuc_va_list = __va_list;

alias __blksize_t = __uint32_t;

alias __blkcnt_t = __int64_t;

alias __clockid_t = __int32_t;

alias __fflags_t = __uint32_t;

alias __fsblkcnt_t = __uint64_t;

alias __fsfilcnt_t = __uint64_t;

alias __gid_t = __uint32_t;

alias __id_t = __int64_t;

alias __ino_t = __uint32_t;

alias __key_t = CLong;

alias __lwpid_t = __int32_t;

alias __mode_t = __uint16_t;

alias __accmode_t = Int;

alias __nl_item = Int;

alias __nlink_t = __uint16_t;

alias __off_t = __int64_t;

alias __pid_t = __int32_t;

alias __rlim_t = __int64_t;

alias __sa_family_t = __uint8_t;

alias __socklen_t = __uint32_t;

alias __suseconds_t = CLong;

alias Struct___timer = Opaque;

alias __timer_t = Pointer[Struct___timer];

alias Struct___mq = Opaque;

alias __mqd_t = Pointer[Struct___mq];

alias __uid_t = __uint32_t;

alias __useconds_t = UInt;

alias __cpuwhich_t = Int;

alias __cpulevel_t = Int;

alias __cpusetid_t = Int;

alias __ct_rune_t = Int;

alias __rune_t = __ct_rune_t;

alias __wchar_t = __ct_rune_t;

alias __wint_t = __ct_rune_t;

alias __dev_t = __uint32_t;

alias __fixpt_t = __uint32_t;

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

alias __mbstate_t = Union_Unnamed1;

external (cdecl) __bswap64(arg0:__uint64_t) : __uint64_t;

external (cdecl) __bswap32(arg0:__uint32_t) : __uint32_t;

external (cdecl) __bswap16(arg0:__uint16_t) : __uint16_t;

alias Struct_pthread = Opaque;

alias Struct_pthread_attr = Opaque;

alias Struct_pthread_cond = Opaque;

alias Struct_pthread_cond_attr = Opaque;

alias Struct_pthread_mutex = Opaque;

alias Struct_pthread_mutex_attr = Opaque;

alias Struct_pthread_rwlock = Opaque;

alias Struct_pthread_rwlockattr = Opaque;

alias Struct_pthread_barrier = Opaque;

alias Struct_pthread_barrier_attr = Opaque;

alias Struct_pthread_spinlock = Opaque;

alias pthread_t = Pointer[Struct_pthread];

alias pthread_attr_t = Pointer[Struct_pthread_attr];

alias pthread_mutex_t = Pointer[Struct_pthread_mutex];

alias pthread_mutexattr_t = Pointer[Struct_pthread_mutex_attr];

alias pthread_cond_t = Pointer[Struct_pthread_cond];

alias pthread_condattr_t = Pointer[Struct_pthread_cond_attr];

alias pthread_key_t = Int;

alias pthread_once_t = Struct_pthread_once;

alias pthread_rwlock_t = Pointer[Struct_pthread_rwlock];

alias pthread_rwlockattr_t = Pointer[Struct_pthread_rwlockattr];

alias pthread_barrier_t = Pointer[Struct_pthread_barrier];

alias Struct_pthread_barrierattr = Opaque;

alias pthread_barrierattr_t = Pointer[Struct_pthread_barrierattr];

alias pthread_spinlock_t = Pointer[Struct_pthread_spinlock];

alias pthread_addr_t = OpaquePointer;

alias pthread_startroutine_t = CCodePointer[[OpaquePointer],[OpaquePointer]];

record Struct_pthread_once (
    state : Int,
    mutex : pthread_mutex_t,
);

alias u_char = CUChar;

alias u_short = UShort;

alias u_int = UInt;

alias u_long = CULong;

alias ushort = UShort;

alias uint = UInt;

alias int8_t = __int8_t;

alias int16_t = __int16_t;

alias int32_t = __int32_t;

alias int64_t = __int64_t;

alias uint8_t = __uint8_t;

alias uint16_t = __uint16_t;

alias uint32_t = __uint32_t;

alias uint64_t = __uint64_t;

alias intptr_t = __intptr_t;

alias uintptr_t = __uintptr_t;

alias u_int8_t = __uint8_t;

alias u_int16_t = __uint16_t;

alias u_int32_t = __uint32_t;

alias u_int64_t = __uint64_t;

alias u_quad_t = __uint64_t;

alias quad_t = __int64_t;

alias qaddr_t = Pointer[quad_t];

alias caddr_t = Pointer[CChar];

alias c_caddr_t = Pointer[CChar];

alias v_caddr_t = Pointer[CChar];

alias blksize_t = __blksize_t;

alias cpuwhich_t = __cpuwhich_t;

alias cpulevel_t = __cpulevel_t;

alias cpusetid_t = __cpusetid_t;

alias blkcnt_t = __blkcnt_t;

alias clock_t = __clock_t;

alias clockid_t = __clockid_t;

alias cpumask_t = __cpumask_t;

alias critical_t = __critical_t;

alias daddr_t = __int64_t;

alias dev_t = __dev_t;

alias fflags_t = __fflags_t;

alias fixpt_t = __fixpt_t;

alias fsblkcnt_t = __fsblkcnt_t;

alias fsfilcnt_t = __fsfilcnt_t;

alias gid_t = __gid_t;

alias in_addr_t = __uint32_t;

alias in_port_t = __uint16_t;

alias id_t = __id_t;

alias ino_t = __ino_t;

alias key_t = __key_t;

alias lwpid_t = __lwpid_t;

alias mode_t = __mode_t;

alias accmode_t = __accmode_t;

alias nlink_t = __nlink_t;

alias off_t = __off_t;

alias pid_t = __pid_t;

alias register_t = __register_t;

alias rlim_t = __rlim_t;

alias segsz_t = __segsz_t;

alias size_t = __size_t;

alias ssize_t = __ssize_t;

alias suseconds_t = __suseconds_t;

alias time_t = __time_t;

alias timer_t = __timer_t;

alias mqd_t = __mqd_t;

alias u_register_t = __u_register_t;

alias uid_t = __uid_t;

alias useconds_t = __useconds_t;

alias vm_offset_t = __vm_offset_t;

alias vm_ooffset_t = __vm_ooffset_t;

alias vm_paddr_t = __vm_paddr_t;

alias vm_pindex_t = __vm_pindex_t;

alias vm_size_t = __vm_size_t;

record Struct___sigset (
    __bits : Array[__uint32_t, 4],
);

alias __sigset_t = Struct___sigset;

record Struct_timeval (
    tv_sec : time_t,
    tv_usec : suseconds_t,
);

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

record Struct_itimerspec (
    it_interval : Struct_timespec,
    it_value : Struct_timespec,
);

alias __fd_mask = CULong;

alias fd_mask = __fd_mask;

alias sigset_t = __sigset_t;

record Struct_fd_set (
    __fds_bits : Array[__fd_mask, 32],
);

alias fd_set = Struct_fd_set;

external (cdecl) 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(arg0:Int, arg1:Pointer[fd_set], arg2:Pointer[fd_set], arg3:Pointer[fd_set], arg4:Pointer[Struct_timeval]) : Int;

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

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

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

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

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(arg0:Int) : Int;

external (cdecl) closefrom(arg0: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) pathconf(arg0:Pointer[CChar], arg1:Int) : CLong;

external (cdecl) pause() : Int;

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

external (cdecl) 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(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(arg0:Int, arg1:Pointer[CChar], arg2:size_t) : Int;

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

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

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

external (cdecl) 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) fsync(arg0:Int) : Int;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

external (cdecl) gethostid() : CLong;

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

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

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

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

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

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

external (cdecl) sync() : ;

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

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

external (cdecl) getdtablesize() : Int;

external (cdecl) getpagesize() : Int;

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

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

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

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

external (cdecl) usleep(arg0:useconds_t) : Int;

external (cdecl) vfork() : pid_t;

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

external (cdecl) async_daemon() : Int;

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

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

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

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

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

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

external (cdecl) endusershell() : ;

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

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

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

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

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

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

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

external (cdecl) getosreldate() : Int;

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

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

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

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

external (cdecl) initgroups(arg0:Pointer[CChar], arg1:gid_t) : 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) lpathconf(arg0:Pointer[CChar], arg1:Int) : CLong;

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

external (cdecl) mknod(arg0:Pointer[CChar], arg1:mode_t, arg2:dev_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:vm_offset_t, arg3:Int) : 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) rcmdsh(arg0:Pointer[Pointer[CChar]], arg1:Int, arg2:Pointer[CChar], arg3:Pointer[CChar], arg4:Pointer[CChar], arg5:Pointer[CChar]) : Int;

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

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

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

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

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

external (cdecl) rfork_thread(arg0:Int, arg1:OpaquePointer, arg2:CCodePointer[[OpaquePointer],[Int]], arg3:OpaquePointer) : pid_t;

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(arg0:Pointer[CChar]) : Int;

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

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

external (cdecl) setproctitle(arg0:Pointer[CChar], ..) : ;

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

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

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

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

external (cdecl) setusershell() : ;

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

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

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

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

external (cdecl) __syscall(arg0:quad_t, ..) : off_t;

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 optreset : Int;

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

record Struct_sched_param (
    sched_priority : Int,
);

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

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

external (cdecl) sched_getparam(arg0:pid_t, arg1:Pointer[Struct_sched_param]) : Int;

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

external (cdecl) sched_rr_get_interval(arg0:pid_t, arg1:Pointer[Struct_timespec]) : Int;

external (cdecl) sched_setparam(arg0:pid_t, arg1:Pointer[Struct_sched_param]) : Int;

external (cdecl) sched_setscheduler(arg0:pid_t, arg1:Int, arg2:Pointer[Struct_sched_param]) : Int;

external (cdecl) sched_yield() : Int;

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 (cdecl) asctime(arg0:Pointer[Struct_tm]) : Pointer[CChar];

external (cdecl) clock() : clock_t;

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

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

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

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

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

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

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

external (cdecl) timer_create(arg0:clockid_t, arg1:Pointer[Struct_sigevent], arg2:Pointer[timer_t]) : Int;

external (cdecl) timer_delete(arg0:timer_t) : Int;

external (cdecl) timer_gettime(arg0:timer_t, arg1:Pointer[Struct_itimerspec]) : Int;

external (cdecl) timer_getoverrun(arg0:timer_t) : Int;

external (cdecl) timer_settime(arg0:timer_t, arg1:Int, arg2:Pointer[Struct_itimerspec], arg3:Pointer[Struct_itimerspec]) : Int;

external (cdecl) tzset() : ;

external (cdecl) clock_getres(arg0:clockid_t, arg1:Pointer[Struct_timespec]) : Int;

external (cdecl) clock_gettime(arg0:clockid_t, arg1:Pointer[Struct_timespec]) : Int;

external (cdecl) clock_settime(arg0:clockid_t, arg1:Pointer[Struct_timespec]) : Int;

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

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) strptime(arg0:Pointer[CChar], arg1:Pointer[CChar], arg2:Pointer[Struct_tm]) : Pointer[CChar];

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

external (cdecl) tzsetwall() : ;

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

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

alias Enum_pthread_mutextype = UInt;
alias PTHREAD_MUTEX_ERRORCHECK = 1;
alias PTHREAD_MUTEX_RECURSIVE = 2;
alias PTHREAD_MUTEX_NORMAL = 3;
alias PTHREAD_MUTEX_ADAPTIVE_NP = 4;
alias PTHREAD_MUTEX_TYPE_MAX = 5;

record Struct__pthread_cleanup_info (
    pthread_cleanup_pad : Array[__uintptr_t, 8],
);

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_getstack(arg0:Pointer[pthread_attr_t], arg1:Pointer[OpaquePointer], arg2:Pointer[size_t]) : Int;

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

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

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

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

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

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

external (cdecl) pthread_attr_setguardsize(arg0:Pointer[pthread_attr_t], arg1:size_t) : 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_setdetachstate(arg0:Pointer[pthread_attr_t], arg1:Int) : Int;

external (cdecl) pthread_barrier_destroy(arg0:Pointer[pthread_barrier_t]) : Int;

external (cdecl) pthread_barrier_init(arg0:Pointer[pthread_barrier_t], arg1:Pointer[pthread_barrierattr_t], arg2:UInt) : Int;

external (cdecl) pthread_barrier_wait(arg0:Pointer[pthread_barrier_t]) : Int;

external (cdecl) pthread_barrierattr_destroy(arg0:Pointer[pthread_barrierattr_t]) : Int;

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

external (cdecl) pthread_barrierattr_init(arg0:Pointer[pthread_barrierattr_t]) : Int;

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

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

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

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

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

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

external (cdecl) pthread_condattr_setpshared(arg0:Pointer[pthread_condattr_t], arg1:Int) : 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(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(arg0:Pointer[pthread_cond_t], arg1:Pointer[pthread_mutex_t], arg2:Pointer[Struct_timespec]) : Int;

external (cdecl) pthread_cond_wait(arg0:Pointer[pthread_cond_t], arg1:Pointer[pthread_mutex_t]) : 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_getspecific(arg0:pthread_key_t) : OpaquePointer;

external (cdecl) pthread_getcpuclockid(arg0:pthread_t, arg1:Pointer[clockid_t]) : Int;

external (cdecl) 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_mutexattr_init(arg0:Pointer[pthread_mutexattr_t]) : Int;

external (cdecl) pthread_mutexattr_destroy(arg0:Pointer[pthread_mutexattr_t]) : 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_settype(arg0:Pointer[pthread_mutexattr_t], arg1:Int) : Int;

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

external (cdecl) pthread_mutex_destroy(arg0:Pointer[pthread_mutex_t]) : 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_trylock(arg0:Pointer[pthread_mutex_t]) : Int;

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

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

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

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

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

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

external (cdecl) pthread_rwlock_timedrdlock(arg0:Pointer[pthread_rwlock_t], arg1:Pointer[Struct_timespec]) : Int;

external (cdecl) pthread_rwlock_timedwrlock(arg0:Pointer[pthread_rwlock_t], arg1:Pointer[Struct_timespec]) : Int;

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

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

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

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

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

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

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

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

external (cdecl) pthread_self() : pthread_t;

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

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

external (cdecl) pthread_spin_destroy(arg0:Pointer[pthread_spinlock_t]) : Int;

external (cdecl) pthread_spin_lock(arg0:Pointer[pthread_spinlock_t]) : Int;

external (cdecl) pthread_spin_trylock(arg0:Pointer[pthread_spinlock_t]) : Int;

external (cdecl) pthread_spin_unlock(arg0:Pointer[pthread_spinlock_t]) : Int;

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

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

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

external (cdecl) pthread_testcancel() : ;

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

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

external (cdecl) pthread_yield() : ;

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

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

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

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

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

external (cdecl) pthread_mutexattr_setprotocol(arg0:Pointer[pthread_mutexattr_t], arg1:Int) : 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_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_getschedparam(arg0:pthread_t, arg1:Pointer[Int], arg2:Pointer[Struct_sched_param]) : Int;

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

external (cdecl) pthread_getconcurrency() : Int;

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

external (cdecl) __pthread_cleanup_push_imp(arg0:CCodePointer[[OpaquePointer],[]], arg1:OpaquePointer, arg2:Pointer[Struct__pthread_cleanup_info]) : ;

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

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

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

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

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

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

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

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

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

record Struct_bintime (
    sec : time_t,
    frac : uint64_t,
);

external (cdecl) bintime_addx(arg0:Pointer[Struct_bintime], arg1:uint64_t) : ;

external (cdecl) bintime_add(arg0:Pointer[Struct_bintime], arg1:Pointer[Struct_bintime]) : ;

external (cdecl) bintime_sub(arg0:Pointer[Struct_bintime], arg1:Pointer[Struct_bintime]) : ;

external (cdecl) bintime2timespec(arg0:Pointer[Struct_bintime], arg1:Pointer[Struct_timespec]) : ;

external (cdecl) timespec2bintime(arg0:Pointer[Struct_timespec], arg1:Pointer[Struct_bintime]) : ;

external (cdecl) bintime2timeval(arg0:Pointer[Struct_bintime], arg1:Pointer[Struct_timeval]) : ;

external (cdecl) timeval2bintime(arg0:Pointer[Struct_timeval], arg1:Pointer[Struct_bintime]) : ;

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

record Struct_clockinfo (
    hz : Int,
    tick : Int,
    spare : Int,
    stathz : Int,
    profhz : 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;

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

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

external (cdecl) futimesat(arg0:Int, arg1:Pointer[CChar], arg2: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:Pointer[Struct_timezone]) : 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 : fflags_t,
    st_gen : __uint32_t,
);

record Struct_stat (
    st_dev : __dev_t,
    st_ino : ino_t,
    st_mode : mode_t,
    st_nlink : nlink_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_size : off_t,
    st_blocks : blkcnt_t,
    st_blksize : blksize_t,
    st_flags : fflags_t,
    st_gen : __uint32_t,
    st_lspare : __int32_t,
    st_birthtimespec : Struct_timespec,
    ?padding0 : UInt,
    ?padding1 : UInt,
);

record Struct_nstat (
    st_dev : __dev_t,
    st_ino : ino_t,
    st_mode : __uint32_t,
    st_nlink : __uint32_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_size : off_t,
    st_blocks : blkcnt_t,
    st_blksize : blksize_t,
    st_flags : fflags_t,
    st_gen : __uint32_t,
    st_birthtimespec : Struct_timespec,
    ?padding0 : UInt,
    ?padding1 : UInt,
);

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

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

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

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

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

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

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

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

external (cdecl) 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(arg0:Pointer[CChar], arg1:Pointer[Struct_stat]) : Int;

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

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

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

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

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

external (cdecl) getpagesizes(arg0:Pointer[size_t], arg1: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;

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

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

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

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

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

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

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

external (cdecl) munlockall() : Int;

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

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

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

alias sa_family_t = __sa_family_t;

alias socklen_t = __socklen_t;

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

record Struct_accept_filter_arg (
    af_name : Array[CChar, 16],
    af_arg : Array[CChar, 240],
);

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

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

record Struct_sockaddr_storage (
    ss_len : CUChar,
    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_cmsgcred (
    cmcred_pid : pid_t,
    cmcred_uid : uid_t,
    cmcred_euid : uid_t,
    cmcred_gid : gid_t,
    cmcred_ngroups : Short,
    cmcred_groups : Array[gid_t, 16],
);

record Struct_sockcred (
    sc_uid : uid_t,
    sc_euid : uid_t,
    sc_gid : gid_t,
    sc_egid : gid_t,
    sc_ngroups : Int,
    sc_groups : Array[gid_t, 1],
);

record Struct_osockaddr (
    sa_family : UShort,
    sa_data : Array[CChar, 14],
);

record Struct_omsghdr (
    msg_name : Pointer[CChar],
    msg_namelen : Int,
    msg_iov : Pointer[Struct_iovec],
    msg_iovlen : Int,
    msg_accrights : Pointer[CChar],
    msg_accrightslen : Int,
);

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

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

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

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

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

external (cdecl) 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(arg0:Int, arg1:Int) : Int;

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

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

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

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

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

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

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

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

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(arg0:Int, arg1:Int, arg2:Int, arg3:Pointer[Int]) : Int;

alias sig_atomic_t = Int;

record Struct_sigcontext (
    sc_mask : Struct___sigset,
    sc_onstack : Int,
    sc_gs : Int,
    sc_fs : Int,
    sc_es : Int,
    sc_ds : Int,
    sc_edi : Int,
    sc_esi : Int,
    sc_ebp : Int,
    sc_isp : Int,
    sc_ebx : Int,
    sc_edx : Int,
    sc_ecx : Int,
    sc_eax : Int,
    sc_trapno : Int,
    sc_err : Int,
    sc_eip : Int,
    sc_cs : Int,
    sc_efl : Int,
    sc_esp : Int,
    sc_ss : Int,
    sc_len : Int,
    sc_fpformat : Int,
    sc_ownedfp : Int,
    sc_spare1 : Array[Int, 1],
    sc_fpstate : Array[Int, 128],
    sc_fsbase : Int,
    sc_gsbase : Int,
    sc_spare2 : Array[Int, 6],
);

alias __sighandler_t = /* unknown kind FunctionProto */ Opaque;

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

record Struct_sigevent (
    sigev_notify : Int,
    sigev_signo : Int,
    sigev_value : Union_sigval,
    _sigev_un : Union_Unnamed2,
);

alias Union_Unnamed2 = Union[
    /* _threadid */ __lwpid_t,
    /* _sigev_thread */ Struct_Unnamed3,
    /* __spare__ */ Array[CLong, 8],
];

record Struct_Unnamed3 (
    _function : CCodePointer[[Union_sigval],[]],
    _attribute : OpaquePointer,
);

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,
    _reason : Union_Unnamed4,
);

alias Union_Unnamed4 = Union[
    /* _fault */ Struct_Unnamed5,
    /* _timer */ Struct_Unnamed6,
    /* _mesgq */ Struct_Unnamed7,
    /* _poll */ Struct_Unnamed8,
    /* __spare__ */ Struct_Unnamed9,
];

record Struct_Unnamed5 (
    _trapno : Int,
);

record Struct_Unnamed6 (
    _timerid : Int,
    _overrun : Int,
);

record Struct_Unnamed7 (
    _mqd : Int,
);

record Struct_Unnamed8 (
    _band : CLong,
);

record Struct_Unnamed9 (
    __spare1__ : CLong,
    __spare2__ : Array[Int, 7],
);

alias siginfo_t = Struct___siginfo;

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

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

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

alias __siginfohandler_t = /* unknown kind FunctionProto */ Opaque;

record Struct_sigaltstack (
    ss_sp : Pointer[CChar],
    ss_size : __size_t,
    ss_flags : Int,
);

alias stack_t = Struct_sigaltstack;

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],[]];

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

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

alias Struct_rusage = Opaque;

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 : Short,
    flags : u_short,
    fflags : u_int,
    data : intptr_t,
    udata : OpaquePointer,
);

alias Struct_knote = Opaque;

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

alias Struct_kqueue = Opaque;

record Struct_kqlist (
    slh_first : Pointer[Struct_kqueue],
);

record Struct_knlist (
    kl_list : Struct_klist,
    kl_lock : CCodePointer[[OpaquePointer],[]],
    kl_unlock : CCodePointer[[OpaquePointer],[]],
    kl_assert_locked : CCodePointer[[OpaquePointer],[]],
    kl_assert_unlocked : CCodePointer[[OpaquePointer],[]],
    kl_lockarg : OpaquePointer,
);

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 sys_signame : Array[Pointer[CChar], 32];

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

external sys_nsig : Int;

alias __pthread_t = Pointer[Struct_pthread];

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

external (cdecl) kill(arg0:__pid_t, arg1:Int) : Int;

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

external (cdecl) pthread_sigmask(arg0:Int, arg1:Pointer[__sigset_t], arg2:Pointer[__sigset_t]) : 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) 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) sigismember(arg0:Pointer[sigset_t], arg1: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) sigsuspend(arg0:Pointer[sigset_t]) : Int;

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

external (cdecl) sigqueue(arg0:__pid_t, arg1:Int, arg2:Union_sigval) : Int;

external (cdecl) sigtimedwait(arg0:Pointer[sigset_t], arg1:Pointer[siginfo_t], arg2:Pointer[Struct_timespec]) : Int;

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

external (cdecl) killpg(arg0:__pid_t, arg1:Int) : Int;

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

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

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

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

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

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

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

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

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

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

alias Struct___ucontext = Opaque;

external (cdecl) sigreturn(arg0:Pointer[Struct___ucontext]) : Int;

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

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

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

record Struct_dirent (
    d_fileno : __uint32_t,
    d_reclen : __uint16_t,
    d_type : __uint8_t,
    d_namlen : __uint8_t,
    d_name : Array[CChar, 256],
);

alias Struct__telldir = Opaque;

record Struct__dirdesc (
    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 : Pointer[Struct_pthread_mutex],
    dd_td : Pointer[Struct__telldir],
);

alias DIR = Struct__dirdesc;

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

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

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

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

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

external (cdecl) fdopendir(arg0:Int) : Pointer[DIR];

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

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

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

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

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

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

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

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

alias Dl_info = Struct_dl_info;

record Struct___dlfunc_arg (
    __dlfunc_dummy : Int,
);

alias dlfunc_t = CCodePointer[[Struct___dlfunc_arg],[]];

record Struct_dl_serpath (
    dls_name : Pointer[CChar],
    dls_flags : UInt,
);

alias Dl_serpath = Struct_dl_serpath;

record Struct_dl_serinfo (
    dls_size : size_t,
    dls_cnt : UInt,
    dls_serpath : Array[Dl_serpath, 1],
);

alias Dl_serinfo = Struct_dl_serinfo;

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) dladdr(arg0:OpaquePointer, arg1:Pointer[Dl_info]) : Int;

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

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

external (cdecl) dllockinit(arg0:OpaquePointer, arg1:CCodePointer[[OpaquePointer],[OpaquePointer]], arg2:CCodePointer[[OpaquePointer],[]], arg3:CCodePointer[[OpaquePointer],[]], arg4:CCodePointer[[OpaquePointer],[]], arg5:CCodePointer[[OpaquePointer],[]], arg6:CCodePointer[[OpaquePointer],[]]) : ;

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

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],
);

external (cdecl) endhostent() : ;

external (cdecl) endnetent() : ;

external (cdecl) endprotoent() : ;

external (cdecl) endservent() : ;

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) 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) getaddrinfo(arg0:Pointer[CChar], arg1:Pointer[CChar], arg2:Pointer[Struct_addrinfo], arg3:Pointer[Pointer[Struct_addrinfo]]) : Int;

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

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

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

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

external (cdecl) endnetgrent() : ;

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

external (cdecl) gethostbyaddr_r(arg0:OpaquePointer, arg1:socklen_t, arg2:Int, arg3:Pointer[Struct_hostent], arg4:Pointer[CChar], arg5:size_t, arg6:Pointer[Pointer[Struct_hostent]], arg7:Pointer[Int]) : Int;

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

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

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

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

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) getnetbyaddr_r(arg0:uint32_t, arg1:Int, arg2:Pointer[Struct_netent], arg3:Pointer[CChar], arg4:size_t, arg5:Pointer[Pointer[Struct_netent]], arg6:Pointer[Int]) : Int;

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

external (cdecl) getnetent_r(arg0:Pointer[Struct_netent], arg1:Pointer[CChar], arg2:size_t, arg3:Pointer[Pointer[Struct_netent]], arg4:Pointer[Int]) : Int;

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

external (cdecl) getprotobyname_r(arg0:Pointer[CChar], arg1:Pointer[Struct_protoent], arg2:Pointer[CChar], arg3:size_t, arg4:Pointer[Pointer[Struct_protoent]]) : Int;

external (cdecl) getprotobynumber_r(arg0:Int, arg1:Pointer[Struct_protoent], arg2:Pointer[CChar], arg3:size_t, arg4:Pointer[Pointer[Struct_protoent]]) : Int;

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

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

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

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

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) setnetgrent(arg0:Pointer[CChar]) : ;

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

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],
);

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

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

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

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

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_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_in6_addr (
    __u6_addr : Union_Unnamed11,
);

alias Union_Unnamed11 = Union[
    /* __u6_addr8 */ Array[uint8_t, 16],
    /* __u6_addr16 */ Array[uint16_t, 8],
    /* __u6_addr32 */ Array[uint32_t, 4],
];

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_route_in6 (
    ro_rt : Pointer[Struct_rtentry],
    ro_lle : Pointer[Struct_llentry],
    ro_dst : Struct_sockaddr_in6,
);

alias Struct_rtentry = Opaque;

alias Struct_llentry = Opaque;

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];

