Closed goertzenator closed 9 years ago
This is my bindgen
output:
$ cat rust_src/src/c.rs
/* automatically generated by rust-bindgen */
#[repr(C)]
pub struct ErlDrvSysInfo {
pub driver_major_version: ::libc::c_int,
pub driver_minor_version: ::libc::c_int,
pub erts_version: *mut ::libc::c_char,
pub otp_release: *mut ::libc::c_char,
pub thread_support: ::libc::c_int,
pub smp_support: ::libc::c_int,
pub async_threads: ::libc::c_int,
pub scheduler_threads: ::libc::c_int,
pub nif_major_version: ::libc::c_int,
pub nif_minor_version: ::libc::c_int,
}
#[repr(C)]
pub struct ErlDrvThreadOpts {
pub suggested_stack_size: ::libc::c_int,
}
pub type __int8_t = ::libc::c_char;
pub type __uint8_t = ::libc::c_uchar;
pub type __int16_t = ::libc::c_short;
pub type __uint16_t = ::libc::c_ushort;
pub type __int32_t = ::libc::c_int;
pub type __uint32_t = ::libc::c_uint;
pub type __int64_t = ::libc::c_longlong;
pub type __uint64_t = ::libc::c_ulonglong;
pub type __darwin_intptr_t = ::libc::c_long;
pub type __darwin_natural_t = ::libc::c_uint;
pub type __darwin_ct_rune_t = ::libc::c_int;
#[repr(C)]
pub struct __mbstate_t {
pub data: [u64, ..16u],
}
impl __mbstate_t {
pub fn __mbstate8(&mut self) -> *mut [::libc::c_char, ..128u] {
unsafe { ::std::mem::transmute(self) }
}
pub fn _mbstateL(&mut self) -> *mut ::libc::c_longlong {
unsafe { ::std::mem::transmute(self) }
}
}
pub type __darwin_mbstate_t = __mbstate_t;
pub type __darwin_ptrdiff_t = ::libc::c_long;
pub type __darwin_size_t = ::libc::c_ulong;
pub type __darwin_va_list = __builtin_va_list;
pub type __darwin_wchar_t = ::libc::c_int;
pub type __darwin_rune_t = __darwin_wchar_t;
pub type __darwin_wint_t = ::libc::c_int;
pub type __darwin_clock_t = ::libc::c_ulong;
pub type __darwin_socklen_t = __uint32_t;
pub type __darwin_ssize_t = ::libc::c_long;
pub type __darwin_time_t = ::libc::c_long;
#[repr(C)]
pub struct Struct___darwin_pthread_handler_rec {
pub __routine: ::std::option::Option<extern "C" fn
(arg1: *mut ::libc::c_void)>,
pub __arg: *mut ::libc::c_void,
pub __next: *mut Struct___darwin_pthread_handler_rec,
}
#[repr(C)]
pub struct Struct__opaque_pthread_attr_t {
pub __sig: ::libc::c_long,
pub __opaque: [::libc::c_char, ..56u],
}
#[repr(C)]
pub struct Struct__opaque_pthread_cond_t {
pub __sig: ::libc::c_long,
pub __opaque: [::libc::c_char, ..40u],
}
#[repr(C)]
pub struct Struct__opaque_pthread_condattr_t {
pub __sig: ::libc::c_long,
pub __opaque: [::libc::c_char, ..8u],
}
#[repr(C)]
pub struct Struct__opaque_pthread_mutex_t {
pub __sig: ::libc::c_long,
pub __opaque: [::libc::c_char, ..56u],
}
#[repr(C)]
pub struct Struct__opaque_pthread_mutexattr_t {
pub __sig: ::libc::c_long,
pub __opaque: [::libc::c_char, ..8u],
}
#[repr(C)]
pub struct Struct__opaque_pthread_once_t {
pub __sig: ::libc::c_long,
pub __opaque: [::libc::c_char, ..8u],
}
#[repr(C)]
pub struct Struct__opaque_pthread_rwlock_t {
pub __sig: ::libc::c_long,
pub __opaque: [::libc::c_char, ..192u],
}
#[repr(C)]
pub struct Struct__opaque_pthread_rwlockattr_t {
pub __sig: ::libc::c_long,
pub __opaque: [::libc::c_char, ..16u],
}
#[repr(C)]
pub struct Struct__opaque_pthread_t {
pub __sig: ::libc::c_long,
pub __cleanup_stack: *mut Struct___darwin_pthread_handler_rec,
pub __opaque: [::libc::c_char, ..1168u],
}
pub type __darwin_blkcnt_t = __int64_t;
pub type __darwin_blksize_t = __int32_t;
pub type __darwin_dev_t = __int32_t;
pub type __darwin_fsblkcnt_t = ::libc::c_uint;
pub type __darwin_fsfilcnt_t = ::libc::c_uint;
pub type __darwin_gid_t = __uint32_t;
pub type __darwin_id_t = __uint32_t;
pub type __darwin_ino64_t = __uint64_t;
pub type __darwin_ino_t = __darwin_ino64_t;
pub type __darwin_mach_port_name_t = __darwin_natural_t;
pub type __darwin_mach_port_t = __darwin_mach_port_name_t;
pub type __darwin_mode_t = __uint16_t;
pub type __darwin_off_t = __int64_t;
pub type __darwin_pid_t = __int32_t;
pub type __darwin_pthread_attr_t = Struct__opaque_pthread_attr_t;
pub type __darwin_pthread_cond_t = Struct__opaque_pthread_cond_t;
pub type __darwin_pthread_condattr_t = Struct__opaque_pthread_condattr_t;
pub type __darwin_pthread_key_t = ::libc::c_ulong;
pub type __darwin_pthread_mutex_t = Struct__opaque_pthread_mutex_t;
pub type __darwin_pthread_mutexattr_t = Struct__opaque_pthread_mutexattr_t;
pub type __darwin_pthread_once_t = Struct__opaque_pthread_once_t;
pub type __darwin_pthread_rwlock_t = Struct__opaque_pthread_rwlock_t;
pub type __darwin_pthread_rwlockattr_t = Struct__opaque_pthread_rwlockattr_t;
pub type __darwin_pthread_t = *mut Struct__opaque_pthread_t;
pub type __darwin_sigset_t = __uint32_t;
pub type __darwin_suseconds_t = __int32_t;
pub type __darwin_uid_t = __uint32_t;
pub type __darwin_useconds_t = __uint32_t;
pub type __darwin_uuid_t = [::libc::c_uchar, ..16u];
pub type __darwin_uuid_string_t = [::libc::c_char, ..37u];
pub type __darwin_nl_item = ::libc::c_int;
pub type __darwin_wctrans_t = ::libc::c_int;
pub type __darwin_wctype_t = __uint32_t;
pub type idtype_t = ::libc::c_uint;
pub static P_ALL: ::libc::c_uint = 0;
pub static P_PID: ::libc::c_uint = 1;
pub static P_PGID: ::libc::c_uint = 2;
pub type pid_t = __darwin_pid_t;
pub type id_t = __darwin_id_t;
pub type sig_atomic_t = ::libc::c_int;
#[repr(C)]
pub struct Struct___darwin_i386_thread_state {
pub __eax: ::libc::c_uint,
pub __ebx: ::libc::c_uint,
pub __ecx: ::libc::c_uint,
pub __edx: ::libc::c_uint,
pub __edi: ::libc::c_uint,
pub __esi: ::libc::c_uint,
pub __ebp: ::libc::c_uint,
pub __esp: ::libc::c_uint,
pub __ss: ::libc::c_uint,
pub __eflags: ::libc::c_uint,
pub __eip: ::libc::c_uint,
pub __cs: ::libc::c_uint,
pub __ds: ::libc::c_uint,
pub __es: ::libc::c_uint,
pub __fs: ::libc::c_uint,
pub __gs: ::libc::c_uint,
}
#[repr(C)]
pub struct Struct___darwin_fp_control {
pub __invalid: ::libc::c_ushort,
pub __denorm: ::libc::c_ushort,
pub __zdiv: ::libc::c_ushort,
pub __ovrfl: ::libc::c_ushort,
pub __undfl: ::libc::c_ushort,
pub __precis: ::libc::c_ushort,
pub unnamed_field1: ::libc::c_ushort,
pub __pc: ::libc::c_ushort,
pub __rc: ::libc::c_ushort,
pub unnamed_field2: ::libc::c_ushort,
pub unnamed_field3: ::libc::c_ushort,
}
pub type __darwin_fp_control_t = Struct___darwin_fp_control;
#[repr(C)]
pub struct Struct___darwin_fp_status {
pub __invalid: ::libc::c_ushort,
pub __denorm: ::libc::c_ushort,
pub __zdiv: ::libc::c_ushort,
pub __ovrfl: ::libc::c_ushort,
pub __undfl: ::libc::c_ushort,
pub __precis: ::libc::c_ushort,
pub __stkflt: ::libc::c_ushort,
pub __errsumm: ::libc::c_ushort,
pub __c0: ::libc::c_ushort,
pub __c1: ::libc::c_ushort,
pub __c2: ::libc::c_ushort,
pub __tos: ::libc::c_ushort,
pub __c3: ::libc::c_ushort,
pub __busy: ::libc::c_ushort,
}
pub type __darwin_fp_status_t = Struct___darwin_fp_status;
#[repr(C)]
pub struct Struct___darwin_mmst_reg {
pub __mmst_reg: [::libc::c_char, ..10u],
pub __mmst_rsrv: [::libc::c_char, ..6u],
}
#[repr(C)]
pub struct Struct___darwin_xmm_reg {
pub __xmm_reg: [::libc::c_char, ..16u],
}
#[repr(C)]
pub struct Struct___darwin_i386_float_state {
pub __fpu_reserved: [::libc::c_int, ..2u],
pub __fpu_fcw: Struct___darwin_fp_control,
pub __fpu_fsw: Struct___darwin_fp_status,
pub __fpu_ftw: __uint8_t,
pub __fpu_rsrv1: __uint8_t,
pub __fpu_fop: __uint16_t,
pub __fpu_ip: __uint32_t,
pub __fpu_cs: __uint16_t,
pub __fpu_rsrv2: __uint16_t,
pub __fpu_dp: __uint32_t,
pub __fpu_ds: __uint16_t,
pub __fpu_rsrv3: __uint16_t,
pub __fpu_mxcsr: __uint32_t,
pub __fpu_mxcsrmask: __uint32_t,
pub __fpu_stmm0: Struct___darwin_mmst_reg,
pub __fpu_stmm1: Struct___darwin_mmst_reg,
pub __fpu_stmm2: Struct___darwin_mmst_reg,
pub __fpu_stmm3: Struct___darwin_mmst_reg,
pub __fpu_stmm4: Struct___darwin_mmst_reg,
pub __fpu_stmm5: Struct___darwin_mmst_reg,
pub __fpu_stmm6: Struct___darwin_mmst_reg,
pub __fpu_stmm7: Struct___darwin_mmst_reg,
pub __fpu_xmm0: Struct___darwin_xmm_reg,
pub __fpu_xmm1: Struct___darwin_xmm_reg,
pub __fpu_xmm2: Struct___darwin_xmm_reg,
pub __fpu_xmm3: Struct___darwin_xmm_reg,
pub __fpu_xmm4: Struct___darwin_xmm_reg,
pub __fpu_xmm5: Struct___darwin_xmm_reg,
pub __fpu_xmm6: Struct___darwin_xmm_reg,
pub __fpu_xmm7: Struct___darwin_xmm_reg,
pub __fpu_rsrv4: [::libc::c_char, ..224u],
pub __fpu_reserved1: ::libc::c_int,
}
#[repr(C)]
pub struct Struct___darwin_i386_avx_state {
pub __fpu_reserved: [::libc::c_int, ..2u],
pub __fpu_fcw: Struct___darwin_fp_control,
pub __fpu_fsw: Struct___darwin_fp_status,
pub __fpu_ftw: __uint8_t,
pub __fpu_rsrv1: __uint8_t,
pub __fpu_fop: __uint16_t,
pub __fpu_ip: __uint32_t,
pub __fpu_cs: __uint16_t,
pub __fpu_rsrv2: __uint16_t,
pub __fpu_dp: __uint32_t,
pub __fpu_ds: __uint16_t,
pub __fpu_rsrv3: __uint16_t,
pub __fpu_mxcsr: __uint32_t,
pub __fpu_mxcsrmask: __uint32_t,
pub __fpu_stmm0: Struct___darwin_mmst_reg,
pub __fpu_stmm1: Struct___darwin_mmst_reg,
pub __fpu_stmm2: Struct___darwin_mmst_reg,
pub __fpu_stmm3: Struct___darwin_mmst_reg,
pub __fpu_stmm4: Struct___darwin_mmst_reg,
pub __fpu_stmm5: Struct___darwin_mmst_reg,
pub __fpu_stmm6: Struct___darwin_mmst_reg,
pub __fpu_stmm7: Struct___darwin_mmst_reg,
pub __fpu_xmm0: Struct___darwin_xmm_reg,
pub __fpu_xmm1: Struct___darwin_xmm_reg,
pub __fpu_xmm2: Struct___darwin_xmm_reg,
pub __fpu_xmm3: Struct___darwin_xmm_reg,
pub __fpu_xmm4: Struct___darwin_xmm_reg,
pub __fpu_xmm5: Struct___darwin_xmm_reg,
pub __fpu_xmm6: Struct___darwin_xmm_reg,
pub __fpu_xmm7: Struct___darwin_xmm_reg,
pub __fpu_rsrv4: [::libc::c_char, ..224u],
pub __fpu_reserved1: ::libc::c_int,
pub __avx_reserved1: [::libc::c_char, ..64u],
pub __fpu_ymmh0: Struct___darwin_xmm_reg,
pub __fpu_ymmh1: Struct___darwin_xmm_reg,
pub __fpu_ymmh2: Struct___darwin_xmm_reg,
pub __fpu_ymmh3: Struct___darwin_xmm_reg,
pub __fpu_ymmh4: Struct___darwin_xmm_reg,
pub __fpu_ymmh5: Struct___darwin_xmm_reg,
pub __fpu_ymmh6: Struct___darwin_xmm_reg,
pub __fpu_ymmh7: Struct___darwin_xmm_reg,
}
#[repr(C)]
pub struct Struct___darwin_i386_exception_state {
pub __trapno: __uint16_t,
pub __cpu: __uint16_t,
pub __err: __uint32_t,
pub __faultvaddr: __uint32_t,
}
#[repr(C)]
pub struct Struct___darwin_x86_debug_state32 {
pub __dr0: ::libc::c_uint,
pub __dr1: ::libc::c_uint,
pub __dr2: ::libc::c_uint,
pub __dr3: ::libc::c_uint,
pub __dr4: ::libc::c_uint,
pub __dr5: ::libc::c_uint,
pub __dr6: ::libc::c_uint,
pub __dr7: ::libc::c_uint,
}
#[repr(C)]
pub struct Struct___darwin_x86_thread_state64 {
pub __rax: __uint64_t,
pub __rbx: __uint64_t,
pub __rcx: __uint64_t,
pub __rdx: __uint64_t,
pub __rdi: __uint64_t,
pub __rsi: __uint64_t,
pub __rbp: __uint64_t,
pub __rsp: __uint64_t,
pub __r8: __uint64_t,
pub __r9: __uint64_t,
pub __r10: __uint64_t,
pub __r11: __uint64_t,
pub __r12: __uint64_t,
pub __r13: __uint64_t,
pub __r14: __uint64_t,
pub __r15: __uint64_t,
pub __rip: __uint64_t,
pub __rflags: __uint64_t,
pub __cs: __uint64_t,
pub __fs: __uint64_t,
pub __gs: __uint64_t,
}
#[repr(C)]
pub struct Struct___darwin_x86_float_state64 {
pub __fpu_reserved: [::libc::c_int, ..2u],
pub __fpu_fcw: Struct___darwin_fp_control,
pub __fpu_fsw: Struct___darwin_fp_status,
pub __fpu_ftw: __uint8_t,
pub __fpu_rsrv1: __uint8_t,
pub __fpu_fop: __uint16_t,
pub __fpu_ip: __uint32_t,
pub __fpu_cs: __uint16_t,
pub __fpu_rsrv2: __uint16_t,
pub __fpu_dp: __uint32_t,
pub __fpu_ds: __uint16_t,
pub __fpu_rsrv3: __uint16_t,
pub __fpu_mxcsr: __uint32_t,
pub __fpu_mxcsrmask: __uint32_t,
pub __fpu_stmm0: Struct___darwin_mmst_reg,
pub __fpu_stmm1: Struct___darwin_mmst_reg,
pub __fpu_stmm2: Struct___darwin_mmst_reg,
pub __fpu_stmm3: Struct___darwin_mmst_reg,
pub __fpu_stmm4: Struct___darwin_mmst_reg,
pub __fpu_stmm5: Struct___darwin_mmst_reg,
pub __fpu_stmm6: Struct___darwin_mmst_reg,
pub __fpu_stmm7: Struct___darwin_mmst_reg,
pub __fpu_xmm0: Struct___darwin_xmm_reg,
pub __fpu_xmm1: Struct___darwin_xmm_reg,
pub __fpu_xmm2: Struct___darwin_xmm_reg,
pub __fpu_xmm3: Struct___darwin_xmm_reg,
pub __fpu_xmm4: Struct___darwin_xmm_reg,
pub __fpu_xmm5: Struct___darwin_xmm_reg,
pub __fpu_xmm6: Struct___darwin_xmm_reg,
pub __fpu_xmm7: Struct___darwin_xmm_reg,
pub __fpu_xmm8: Struct___darwin_xmm_reg,
pub __fpu_xmm9: Struct___darwin_xmm_reg,
pub __fpu_xmm10: Struct___darwin_xmm_reg,
pub __fpu_xmm11: Struct___darwin_xmm_reg,
pub __fpu_xmm12: Struct___darwin_xmm_reg,
pub __fpu_xmm13: Struct___darwin_xmm_reg,
pub __fpu_xmm14: Struct___darwin_xmm_reg,
pub __fpu_xmm15: Struct___darwin_xmm_reg,
pub __fpu_rsrv4: [::libc::c_char, ..96u],
pub __fpu_reserved1: ::libc::c_int,
}
#[repr(C)]
pub struct Struct___darwin_x86_avx_state64 {
pub __fpu_reserved: [::libc::c_int, ..2u],
pub __fpu_fcw: Struct___darwin_fp_control,
pub __fpu_fsw: Struct___darwin_fp_status,
pub __fpu_ftw: __uint8_t,
pub __fpu_rsrv1: __uint8_t,
pub __fpu_fop: __uint16_t,
pub __fpu_ip: __uint32_t,
pub __fpu_cs: __uint16_t,
pub __fpu_rsrv2: __uint16_t,
pub __fpu_dp: __uint32_t,
pub __fpu_ds: __uint16_t,
pub __fpu_rsrv3: __uint16_t,
pub __fpu_mxcsr: __uint32_t,
pub __fpu_mxcsrmask: __uint32_t,
pub __fpu_stmm0: Struct___darwin_mmst_reg,
pub __fpu_stmm1: Struct___darwin_mmst_reg,
pub __fpu_stmm2: Struct___darwin_mmst_reg,
pub __fpu_stmm3: Struct___darwin_mmst_reg,
pub __fpu_stmm4: Struct___darwin_mmst_reg,
pub __fpu_stmm5: Struct___darwin_mmst_reg,
pub __fpu_stmm6: Struct___darwin_mmst_reg,
pub __fpu_stmm7: Struct___darwin_mmst_reg,
pub __fpu_xmm0: Struct___darwin_xmm_reg,
pub __fpu_xmm1: Struct___darwin_xmm_reg,
pub __fpu_xmm2: Struct___darwin_xmm_reg,
pub __fpu_xmm3: Struct___darwin_xmm_reg,
pub __fpu_xmm4: Struct___darwin_xmm_reg,
pub __fpu_xmm5: Struct___darwin_xmm_reg,
pub __fpu_xmm6: Struct___darwin_xmm_reg,
pub __fpu_xmm7: Struct___darwin_xmm_reg,
pub __fpu_xmm8: Struct___darwin_xmm_reg,
pub __fpu_xmm9: Struct___darwin_xmm_reg,
pub __fpu_xmm10: Struct___darwin_xmm_reg,
pub __fpu_xmm11: Struct___darwin_xmm_reg,
pub __fpu_xmm12: Struct___darwin_xmm_reg,
pub __fpu_xmm13: Struct___darwin_xmm_reg,
pub __fpu_xmm14: Struct___darwin_xmm_reg,
pub __fpu_xmm15: Struct___darwin_xmm_reg,
pub __fpu_rsrv4: [::libc::c_char, ..96u],
pub __fpu_reserved1: ::libc::c_int,
pub __avx_reserved1: [::libc::c_char, ..64u],
pub __fpu_ymmh0: Struct___darwin_xmm_reg,
pub __fpu_ymmh1: Struct___darwin_xmm_reg,
pub __fpu_ymmh2: Struct___darwin_xmm_reg,
pub __fpu_ymmh3: Struct___darwin_xmm_reg,
pub __fpu_ymmh4: Struct___darwin_xmm_reg,
pub __fpu_ymmh5: Struct___darwin_xmm_reg,
pub __fpu_ymmh6: Struct___darwin_xmm_reg,
pub __fpu_ymmh7: Struct___darwin_xmm_reg,
pub __fpu_ymmh8: Struct___darwin_xmm_reg,
pub __fpu_ymmh9: Struct___darwin_xmm_reg,
pub __fpu_ymmh10: Struct___darwin_xmm_reg,
pub __fpu_ymmh11: Struct___darwin_xmm_reg,
pub __fpu_ymmh12: Struct___darwin_xmm_reg,
pub __fpu_ymmh13: Struct___darwin_xmm_reg,
pub __fpu_ymmh14: Struct___darwin_xmm_reg,
pub __fpu_ymmh15: Struct___darwin_xmm_reg,
}
#[repr(C)]
pub struct Struct___darwin_x86_exception_state64 {
pub __trapno: __uint16_t,
pub __cpu: __uint16_t,
pub __err: __uint32_t,
pub __faultvaddr: __uint64_t,
}
#[repr(C)]
pub struct Struct___darwin_x86_debug_state64 {
pub __dr0: __uint64_t,
pub __dr1: __uint64_t,
pub __dr2: __uint64_t,
pub __dr3: __uint64_t,
pub __dr4: __uint64_t,
pub __dr5: __uint64_t,
pub __dr6: __uint64_t,
pub __dr7: __uint64_t,
}
#[repr(C)]
pub struct Struct___darwin_mcontext32 {
pub __es: Struct___darwin_i386_exception_state,
pub __ss: Struct___darwin_i386_thread_state,
pub __fs: Struct___darwin_i386_float_state,
}
#[repr(C)]
pub struct Struct___darwin_mcontext_avx32 {
pub __es: Struct___darwin_i386_exception_state,
pub __ss: Struct___darwin_i386_thread_state,
pub __fs: Struct___darwin_i386_avx_state,
}
#[repr(C)]
pub struct Struct___darwin_mcontext64 {
pub __es: Struct___darwin_x86_exception_state64,
pub __ss: Struct___darwin_x86_thread_state64,
pub __fs: Struct___darwin_x86_float_state64,
}
#[repr(C)]
pub struct Struct___darwin_mcontext_avx64 {
pub __es: Struct___darwin_x86_exception_state64,
pub __ss: Struct___darwin_x86_thread_state64,
pub __fs: Struct___darwin_x86_avx_state64,
}
pub type mcontext_t = *mut Struct___darwin_mcontext64;
#[repr(C)]
pub struct Struct___darwin_sigaltstack {
pub ss_sp: *mut ::libc::c_void,
pub ss_size: __darwin_size_t,
pub ss_flags: ::libc::c_int,
}
pub type stack_t = Struct___darwin_sigaltstack;
#[repr(C)]
pub struct Struct___darwin_ucontext {
pub uc_onstack: ::libc::c_int,
pub uc_sigmask: __darwin_sigset_t,
pub uc_stack: Struct___darwin_sigaltstack,
pub uc_link: *mut Struct___darwin_ucontext,
pub uc_mcsize: __darwin_size_t,
pub uc_mcontext: *mut Struct___darwin_mcontext64,
}
pub type ucontext_t = Struct___darwin_ucontext;
pub type pthread_attr_t = __darwin_pthread_attr_t;
pub type sigset_t = __darwin_sigset_t;
pub type size_t = __darwin_size_t;
pub type uid_t = __darwin_uid_t;
#[repr(C)]
pub struct Union_sigval {
pub data: [u64, ..1u],
}
impl Union_sigval {
pub fn sival_int(&mut self) -> *mut ::libc::c_int {
unsafe { ::std::mem::transmute(self) }
}
pub fn sival_ptr(&mut self) -> *mut *mut ::libc::c_void {
unsafe { ::std::mem::transmute(self) }
}
}
#[repr(C)]
pub struct Struct_sigevent {
pub sigev_notify: ::libc::c_int,
pub sigev_signo: ::libc::c_int,
pub sigev_value: Union_sigval,
pub sigev_notify_function: ::std::option::Option<extern "C" fn
(arg1:
Union_sigval)>,
pub sigev_notify_attributes: *mut pthread_attr_t,
}
#[repr(C)]
pub struct Struct___siginfo {
pub si_signo: ::libc::c_int,
pub si_errno: ::libc::c_int,
pub si_code: ::libc::c_int,
pub si_pid: pid_t,
pub si_uid: uid_t,
pub si_status: ::libc::c_int,
pub si_addr: *mut ::libc::c_void,
pub si_value: Union_sigval,
pub si_band: ::libc::c_long,
pub __pad: [::libc::c_ulong, ..7u],
}
pub type siginfo_t = Struct___siginfo;
#[repr(C)]
pub struct Union___sigaction_u {
pub data: [u64, ..1u],
}
impl Union___sigaction_u {
pub fn __sa_handler(&mut self) ->
*mut ::std::option::Option<extern "C" fn(arg1: ::libc::c_int)> {
unsafe { ::std::mem::transmute(self) }
}
pub fn __sa_sigaction(&mut self) ->
*mut ::std::option::Option<extern "C" fn
(arg1: ::libc::c_int,
arg2: *mut Struct___siginfo,
arg3: *mut ::libc::c_void)> {
unsafe { ::std::mem::transmute(self) }
}
}
#[repr(C)]
pub struct Struct___sigaction {
pub __sigaction_u: Union___sigaction_u,
pub sa_tramp: ::std::option::Option<extern "C" fn
(arg1: *mut ::libc::c_void,
arg2: ::libc::c_int,
arg3: ::libc::c_int,
arg4: *mut siginfo_t,
arg5: *mut ::libc::c_void)>,
pub sa_mask: sigset_t,
pub sa_flags: ::libc::c_int,
}
#[repr(C)]
pub struct Struct_sigaction {
pub __sigaction_u: Union___sigaction_u,
pub sa_mask: sigset_t,
pub sa_flags: ::libc::c_int,
}
pub type sig_t = ::std::option::Option<extern "C" fn(arg1: ::libc::c_int)>;
#[repr(C)]
pub struct Struct_sigvec {
pub sv_handler: ::std::option::Option<extern "C" fn(arg1: ::libc::c_int)>,
pub sv_mask: ::libc::c_int,
pub sv_flags: ::libc::c_int,
}
#[repr(C)]
pub struct Struct_sigstack {
pub ss_sp: *mut ::libc::c_char,
pub ss_onstack: ::libc::c_int,
}
pub type int8_t = ::libc::c_char;
pub type int16_t = ::libc::c_short;
pub type int32_t = ::libc::c_int;
pub type int64_t = ::libc::c_longlong;
pub type uint8_t = ::libc::c_uchar;
pub type uint16_t = ::libc::c_ushort;
pub type uint32_t = ::libc::c_uint;
pub type uint64_t = ::libc::c_ulonglong;
pub type int_least8_t = int8_t;
pub type int_least16_t = int16_t;
pub type int_least32_t = int32_t;
pub type int_least64_t = int64_t;
pub type uint_least8_t = uint8_t;
pub type uint_least16_t = uint16_t;
pub type uint_least32_t = uint32_t;
pub type uint_least64_t = uint64_t;
pub type int_fast8_t = int8_t;
pub type int_fast16_t = int16_t;
pub type int_fast32_t = int32_t;
pub type int_fast64_t = int64_t;
pub type uint_fast8_t = uint8_t;
pub type uint_fast16_t = uint16_t;
pub type uint_fast32_t = uint32_t;
pub type uint_fast64_t = uint64_t;
pub type intptr_t = __darwin_intptr_t;
pub type uintptr_t = ::libc::c_ulong;
pub type intmax_t = ::libc::c_long;
pub type uintmax_t = ::libc::c_ulong;
#[repr(C)]
pub struct Struct_timeval {
pub tv_sec: __darwin_time_t,
pub tv_usec: __darwin_suseconds_t,
}
pub type rlim_t = __uint64_t;
#[repr(C)]
pub struct Struct_rusage {
pub ru_utime: Struct_timeval,
pub ru_stime: Struct_timeval,
pub ru_maxrss: ::libc::c_long,
pub ru_ixrss: ::libc::c_long,
pub ru_idrss: ::libc::c_long,
pub ru_isrss: ::libc::c_long,
pub ru_minflt: ::libc::c_long,
pub ru_majflt: ::libc::c_long,
pub ru_nswap: ::libc::c_long,
pub ru_inblock: ::libc::c_long,
pub ru_oublock: ::libc::c_long,
pub ru_msgsnd: ::libc::c_long,
pub ru_msgrcv: ::libc::c_long,
pub ru_nsignals: ::libc::c_long,
pub ru_nvcsw: ::libc::c_long,
pub ru_nivcsw: ::libc::c_long,
}
pub type rusage_info_t = *mut ::libc::c_void;
#[repr(C)]
pub struct Struct_rusage_info_v0 {
pub ri_uuid: [uint8_t, ..16u],
pub ri_user_time: uint64_t,
pub ri_system_time: uint64_t,
pub ri_pkg_idle_wkups: uint64_t,
pub ri_interrupt_wkups: uint64_t,
pub ri_pageins: uint64_t,
pub ri_wired_size: uint64_t,
pub ri_resident_size: uint64_t,
pub ri_phys_footprint: uint64_t,
pub ri_proc_start_abstime: uint64_t,
pub ri_proc_exit_abstime: uint64_t,
}
#[repr(C)]
pub struct Struct_rusage_info_v1 {
pub ri_uuid: [uint8_t, ..16u],
pub ri_user_time: uint64_t,
pub ri_system_time: uint64_t,
pub ri_pkg_idle_wkups: uint64_t,
pub ri_interrupt_wkups: uint64_t,
pub ri_pageins: uint64_t,
pub ri_wired_size: uint64_t,
pub ri_resident_size: uint64_t,
pub ri_phys_footprint: uint64_t,
pub ri_proc_start_abstime: uint64_t,
pub ri_proc_exit_abstime: uint64_t,
pub ri_child_user_time: uint64_t,
pub ri_child_system_time: uint64_t,
pub ri_child_pkg_idle_wkups: uint64_t,
pub ri_child_interrupt_wkups: uint64_t,
pub ri_child_pageins: uint64_t,
pub ri_child_elapsed_abstime: uint64_t,
}
#[repr(C)]
pub struct Struct_rusage_info_v2 {
pub ri_uuid: [uint8_t, ..16u],
pub ri_user_time: uint64_t,
pub ri_system_time: uint64_t,
pub ri_pkg_idle_wkups: uint64_t,
pub ri_interrupt_wkups: uint64_t,
pub ri_pageins: uint64_t,
pub ri_wired_size: uint64_t,
pub ri_resident_size: uint64_t,
pub ri_phys_footprint: uint64_t,
pub ri_proc_start_abstime: uint64_t,
pub ri_proc_exit_abstime: uint64_t,
pub ri_child_user_time: uint64_t,
pub ri_child_system_time: uint64_t,
pub ri_child_pkg_idle_wkups: uint64_t,
pub ri_child_interrupt_wkups: uint64_t,
pub ri_child_pageins: uint64_t,
pub ri_child_elapsed_abstime: uint64_t,
pub ri_diskio_bytesread: uint64_t,
pub ri_diskio_byteswritten: uint64_t,
}
#[repr(C)]
pub struct Struct_rlimit {
pub rlim_cur: rlim_t,
pub rlim_max: rlim_t,
}
#[repr(C)]
pub struct Struct_proc_rlimit_control_wakeupmon {
pub wm_flags: uint32_t,
pub wm_rate: int32_t,
}
#[repr(C)]
pub struct Union_wait {
pub data: [u32, ..1u],
}
impl Union_wait {
pub fn w_status(&mut self) -> *mut ::libc::c_int {
unsafe { ::std::mem::transmute(self) }
}
pub fn w_T(&mut self) -> *mut Struct_Unnamed1 {
unsafe { ::std::mem::transmute(self) }
}
pub fn w_S(&mut self) -> *mut Struct_Unnamed2 {
unsafe { ::std::mem::transmute(self) }
}
}
#[repr(C)]
pub struct Struct_Unnamed1 {
pub w_Termsig: ::libc::c_uint,
pub w_Coredump: ::libc::c_uint,
pub w_Retcode: ::libc::c_uint,
pub w_Filler: ::libc::c_uint,
}
#[repr(C)]
pub struct Struct_Unnamed2 {
pub w_Stopval: ::libc::c_uint,
pub w_Stopsig: ::libc::c_uint,
pub w_Filler: ::libc::c_uint,
}
pub type ct_rune_t = __darwin_ct_rune_t;
pub type rune_t = __darwin_rune_t;
pub type wchar_t = __darwin_wchar_t;
#[repr(C)]
pub struct div_t {
pub quot: ::libc::c_int,
pub rem: ::libc::c_int,
}
#[repr(C)]
pub struct ldiv_t {
pub quot: ::libc::c_long,
pub rem: ::libc::c_long,
}
#[repr(C)]
pub struct lldiv_t {
pub quot: ::libc::c_longlong,
pub rem: ::libc::c_longlong,
}
pub type u_int8_t = ::libc::c_uchar;
pub type u_int16_t = ::libc::c_ushort;
pub type u_int32_t = ::libc::c_uint;
pub type u_int64_t = ::libc::c_ulonglong;
pub type register_t = int64_t;
pub type user_addr_t = u_int64_t;
pub type user_size_t = u_int64_t;
pub type user_ssize_t = int64_t;
pub type user_long_t = int64_t;
pub type user_ulong_t = u_int64_t;
pub type user_time_t = int64_t;
pub type user_off_t = int64_t;
pub type syscall_arg_t = u_int64_t;
pub type dev_t = __darwin_dev_t;
pub type mode_t = __darwin_mode_t;
pub type ErlNifUInt64 = ::libc::c_ulong;
pub type ErlNifSInt64 = ::libc::c_long;
pub type ERL_NIF_TERM = ::libc::c_ulong;
pub type ERL_NIF_UINT = ERL_NIF_TERM;
pub enum Struct_enif_environment_t { }
pub type ErlNifEnv = Struct_enif_environment_t;
#[repr(C)]
pub struct ErlNifFunc {
pub name: *const ::libc::c_char,
pub arity: ::libc::c_uint,
pub fptr: ::std::option::Option<extern "C" fn
(arg1: *mut ErlNifEnv,
arg2: ::libc::c_int,
arg3: *const ERL_NIF_TERM)
-> ERL_NIF_TERM>,
}
#[repr(C)]
pub struct Struct_enif_entry_t {
pub major: ::libc::c_int,
pub minor: ::libc::c_int,
pub name: *const ::libc::c_char,
pub num_of_funcs: ::libc::c_int,
pub funcs: *mut ErlNifFunc,
pub load: ::std::option::Option<extern "C" fn
(arg1: *mut ErlNifEnv,
arg2: *mut *mut ::libc::c_void,
arg3: ERL_NIF_TERM)
-> ::libc::c_int>,
pub reload: ::std::option::Option<extern "C" fn
(arg1: *mut ErlNifEnv,
arg2: *mut *mut ::libc::c_void,
arg3: ERL_NIF_TERM)
-> ::libc::c_int>,
pub upgrade: ::std::option::Option<extern "C" fn
(arg1: *mut ErlNifEnv,
arg2: *mut *mut ::libc::c_void,
arg3: *mut *mut ::libc::c_void,
arg4: ERL_NIF_TERM)
-> ::libc::c_int>,
pub unload: ::std::option::Option<extern "C" fn
(arg1: *mut ErlNifEnv,
arg2: *mut ::libc::c_void)>,
pub vm_variant: *const ::libc::c_char,
}
pub type ErlNifEntry = Struct_enif_entry_t;
#[repr(C)]
pub struct ErlNifBinary {
pub size: size_t,
pub data: *mut ::libc::c_uchar,
pub bin_term: ERL_NIF_TERM,
pub ref_bin: *mut ::libc::c_void,
}
pub enum Struct_enif_resource_type_t { }
pub type ErlNifResourceType = Struct_enif_resource_type_t;
pub type ErlNifResourceDtor = ::libc::c_void;
pub type ErlNifResourceFlags = ::libc::c_uint;
pub static ERL_NIF_RT_CREATE: ::libc::c_uint = 1;
pub static ERL_NIF_RT_TAKEOVER: ::libc::c_uint = 2;
pub type ErlNifCharEncoding = ::libc::c_uint;
pub static ERL_NIF_LATIN1: ::libc::c_uint = 1;
#[repr(C)]
pub struct ErlNifPid {
pub pid: ERL_NIF_TERM,
}
pub type ErlNifSysInfo = ErlDrvSysInfo;
pub enum Struct_ErlDrvTid_ { }
pub type ErlNifTid = *mut Struct_ErlDrvTid_;
pub enum Struct_ErlDrvMutex_ { }
pub type ErlNifMutex = Struct_ErlDrvMutex_;
pub enum Struct_ErlDrvCond_ { }
pub type ErlNifCond = Struct_ErlDrvCond_;
pub enum Struct_ErlDrvRWLock_ { }
pub type ErlNifRWLock = Struct_ErlDrvRWLock_;
pub type ErlNifTSDKey = ::libc::c_int;
pub type ErlNifThreadOpts = ErlDrvThreadOpts;
#[repr(C)]
pub struct ErlNifMapIterator {
pub map: ERL_NIF_TERM,
pub t_limit: ERL_NIF_UINT,
pub idx: ERL_NIF_UINT,
pub ks: *mut ERL_NIF_TERM,
pub vs: *mut ERL_NIF_TERM,
pub __spare__: [*mut ::libc::c_void, ..2u],
}
pub type ErlNifMapIteratorEntry = ::libc::c_uint;
pub static ERL_NIF_MAP_ITERATOR_HEAD: ::libc::c_uint = 1;
pub static ERL_NIF_MAP_ITERATOR_TAIL: ::libc::c_uint = 2;
extern "C" {
pub static mut __mb_cur_max: ::libc::c_int;
pub static mut suboptarg: *mut ::libc::c_char;
pub fn signal(arg1: ::libc::c_int,
arg2:
::std::option::Option<extern "C" fn
(arg1: ::libc::c_int)>) ->
::std::option::Option<extern "C" fn(arg1: ::libc::c_int)>;
pub fn getpriority(arg1: ::libc::c_int, arg2: id_t) -> ::libc::c_int;
pub fn getiopolicy_np(arg1: ::libc::c_int, arg2: ::libc::c_int) ->
::libc::c_int;
pub fn getrlimit(arg1: ::libc::c_int, arg2: *mut Struct_rlimit) ->
::libc::c_int;
pub fn getrusage(arg1: ::libc::c_int, arg2: *mut Struct_rusage) ->
::libc::c_int;
pub fn setpriority(arg1: ::libc::c_int, arg2: id_t, arg3: ::libc::c_int)
-> ::libc::c_int;
pub fn setiopolicy_np(arg1: ::libc::c_int, arg2: ::libc::c_int,
arg3: ::libc::c_int) -> ::libc::c_int;
pub fn setrlimit(arg1: ::libc::c_int, arg2: *const Struct_rlimit) ->
::libc::c_int;
pub fn wait(arg1: *mut ::libc::c_int) -> pid_t;
pub fn waitpid(arg1: pid_t, arg2: *mut ::libc::c_int, arg3: ::libc::c_int)
-> pid_t;
pub fn waitid(arg1: idtype_t, arg2: id_t, arg3: *mut siginfo_t,
arg4: ::libc::c_int) -> ::libc::c_int;
pub fn wait3(arg1: *mut ::libc::c_int, arg2: ::libc::c_int,
arg3: *mut Struct_rusage) -> pid_t;
pub fn wait4(arg1: pid_t, arg2: *mut ::libc::c_int, arg3: ::libc::c_int,
arg4: *mut Struct_rusage) -> pid_t;
pub fn alloca(arg1: size_t) -> *mut ::libc::c_void;
pub fn abort();
pub fn abs(arg1: ::libc::c_int) -> ::libc::c_int;
pub fn atexit(arg1: ::std::option::Option<extern "C" fn()>) ->
::libc::c_int;
pub fn atof(arg1: *const ::libc::c_char) -> ::libc::c_double;
pub fn atoi(arg1: *const ::libc::c_char) -> ::libc::c_int;
pub fn atol(arg1: *const ::libc::c_char) -> ::libc::c_long;
pub fn atoll(arg1: *const ::libc::c_char) -> ::libc::c_longlong;
pub fn bsearch(arg1: *const ::libc::c_void, arg2: *const ::libc::c_void,
arg3: size_t, arg4: size_t,
arg5:
::std::option::Option<extern "C" fn
(arg1: *const ::libc::c_void,
arg2: *const ::libc::c_void)
-> ::libc::c_int>) ->
*mut ::libc::c_void;
pub fn calloc(arg1: size_t, arg2: size_t) -> *mut ::libc::c_void;
pub fn div(arg1: ::libc::c_int, arg2: ::libc::c_int) -> div_t;
pub fn exit(arg1: ::libc::c_int);
pub fn free(arg1: *mut ::libc::c_void);
pub fn getenv(arg1: *const ::libc::c_char) -> *mut ::libc::c_char;
pub fn labs(arg1: ::libc::c_long) -> ::libc::c_long;
pub fn ldiv(arg1: ::libc::c_long, arg2: ::libc::c_long) -> ldiv_t;
pub fn llabs(arg1: ::libc::c_longlong) -> ::libc::c_longlong;
pub fn lldiv(arg1: ::libc::c_longlong, arg2: ::libc::c_longlong) ->
lldiv_t;
pub fn malloc(arg1: size_t) -> *mut ::libc::c_void;
pub fn mblen(arg1: *const ::libc::c_char, arg2: size_t) -> ::libc::c_int;
pub fn mbstowcs(arg1: *mut wchar_t, arg2: *const ::libc::c_char,
arg3: size_t) -> size_t;
pub fn mbtowc(arg1: *mut wchar_t, arg2: *const ::libc::c_char,
arg3: size_t) -> ::libc::c_int;
pub fn posix_memalign(arg1: *mut *mut ::libc::c_void, arg2: size_t,
arg3: size_t) -> ::libc::c_int;
pub fn qsort(arg1: *mut ::libc::c_void, arg2: size_t, arg3: size_t,
arg4:
::std::option::Option<extern "C" fn
(arg1: *const ::libc::c_void,
arg2: *const ::libc::c_void)
-> ::libc::c_int>);
pub fn rand() -> ::libc::c_int;
pub fn realloc(arg1: *mut ::libc::c_void, arg2: size_t) ->
*mut ::libc::c_void;
pub fn srand(arg1: ::libc::c_uint);
pub fn strtod(arg1: *const ::libc::c_char, arg2: *mut *mut ::libc::c_char)
-> ::libc::c_double;
pub fn strtof(arg1: *const ::libc::c_char, arg2: *mut *mut ::libc::c_char)
-> ::libc::c_float;
pub fn strtol(arg1: *const ::libc::c_char, arg2: *mut *mut ::libc::c_char,
arg3: ::libc::c_int) -> ::libc::c_long;
pub fn strtold(arg1: *const ::libc::c_char,
arg2: *mut *mut ::libc::c_char) -> ::libc::c_double;
pub fn strtoll(arg1: *const ::libc::c_char,
arg2: *mut *mut ::libc::c_char, arg3: ::libc::c_int) ->
::libc::c_longlong;
pub fn strtoul(arg1: *const ::libc::c_char,
arg2: *mut *mut ::libc::c_char, arg3: ::libc::c_int) ->
::libc::c_ulong;
pub fn strtoull(arg1: *const ::libc::c_char,
arg2: *mut *mut ::libc::c_char, arg3: ::libc::c_int) ->
::libc::c_ulonglong;
pub fn system(arg1: *const ::libc::c_char) -> ::libc::c_int;
pub fn wcstombs(arg1: *mut ::libc::c_char, arg2: *const wchar_t,
arg3: size_t) -> size_t;
pub fn wctomb(arg1: *mut ::libc::c_char, arg2: wchar_t) -> ::libc::c_int;
pub fn _Exit(arg1: ::libc::c_int);
pub fn a64l(arg1: *const ::libc::c_char) -> ::libc::c_long;
pub fn drand48() -> ::libc::c_double;
pub fn ecvt(arg1: ::libc::c_double, arg2: ::libc::c_int,
arg3: *mut ::libc::c_int, arg4: *mut ::libc::c_int) ->
*mut ::libc::c_char;
pub fn erand48(arg1: [::libc::c_ushort, ..3u]) -> ::libc::c_double;
pub fn fcvt(arg1: ::libc::c_double, arg2: ::libc::c_int,
arg3: *mut ::libc::c_int, arg4: *mut ::libc::c_int) ->
*mut ::libc::c_char;
pub fn gcvt(arg1: ::libc::c_double, arg2: ::libc::c_int,
arg3: *mut ::libc::c_char) -> *mut ::libc::c_char;
pub fn getsubopt(arg1: *mut *mut ::libc::c_char,
arg2: *const *mut ::libc::c_char,
arg3: *mut *mut ::libc::c_char) -> ::libc::c_int;
pub fn grantpt(arg1: ::libc::c_int) -> ::libc::c_int;
pub fn initstate(arg1: ::libc::c_uint, arg2: *mut ::libc::c_char,
arg3: size_t) -> *mut ::libc::c_char;
pub fn jrand48(arg1: [::libc::c_ushort, ..3u]) -> ::libc::c_long;
pub fn l64a(arg1: ::libc::c_long) -> *mut ::libc::c_char;
pub fn lcong48(arg1: [::libc::c_ushort, ..7u]);
pub fn lrand48() -> ::libc::c_long;
pub fn mktemp(arg1: *mut ::libc::c_char) -> *mut ::libc::c_char;
pub fn mkstemp(arg1: *mut ::libc::c_char) -> ::libc::c_int;
pub fn mrand48() -> ::libc::c_long;
pub fn nrand48(arg1: [::libc::c_ushort, ..3u]) -> ::libc::c_long;
pub fn posix_openpt(arg1: ::libc::c_int) -> ::libc::c_int;
pub fn ptsname(arg1: ::libc::c_int) -> *mut ::libc::c_char;
pub fn putenv(arg1: *mut ::libc::c_char) -> ::libc::c_int;
pub fn random() -> ::libc::c_long;
pub fn rand_r(arg1: *mut ::libc::c_uint) -> ::libc::c_int;
pub fn realpath(arg1: *const ::libc::c_char, arg2: *mut ::libc::c_char) ->
*mut ::libc::c_char;
pub fn seed48(arg1: [::libc::c_ushort, ..3u]) -> *mut ::libc::c_ushort;
pub fn setenv(arg1: *const ::libc::c_char, arg2: *const ::libc::c_char,
arg3: ::libc::c_int) -> ::libc::c_int;
pub fn setkey(arg1: *const ::libc::c_char);
pub fn setstate(arg1: *const ::libc::c_char) -> *mut ::libc::c_char;
pub fn srand48(arg1: ::libc::c_long);
pub fn srandom(arg1: ::libc::c_uint);
pub fn unlockpt(arg1: ::libc::c_int) -> ::libc::c_int;
pub fn unsetenv(arg1: *const ::libc::c_char) -> ::libc::c_int;
pub fn arc4random() -> u_int32_t;
pub fn arc4random_addrandom(arg1: *mut ::libc::c_uchar,
arg2: ::libc::c_int);
pub fn arc4random_buf(arg1: *mut ::libc::c_void, arg2: size_t);
pub fn arc4random_stir();
pub fn arc4random_uniform(arg1: u_int32_t) -> u_int32_t;
pub fn atexit_b(arg1: ::libc::c_void) -> ::libc::c_int;
pub fn bsearch_b(arg1: *const ::libc::c_void, arg2: *const ::libc::c_void,
arg3: size_t, arg4: size_t, arg5: ::libc::c_void) ->
*mut ::libc::c_void;
pub fn cgetcap(arg1: *mut ::libc::c_char, arg2: *const ::libc::c_char,
arg3: ::libc::c_int) -> *mut ::libc::c_char;
pub fn cgetclose() -> ::libc::c_int;
pub fn cgetent(arg1: *mut *mut ::libc::c_char,
arg2: *mut *mut ::libc::c_char,
arg3: *const ::libc::c_char) -> ::libc::c_int;
pub fn cgetfirst(arg1: *mut *mut ::libc::c_char,
arg2: *mut *mut ::libc::c_char) -> ::libc::c_int;
pub fn cgetmatch(arg1: *const ::libc::c_char, arg2: *const ::libc::c_char)
-> ::libc::c_int;
pub fn cgetnext(arg1: *mut *mut ::libc::c_char,
arg2: *mut *mut ::libc::c_char) -> ::libc::c_int;
pub fn cgetnum(arg1: *mut ::libc::c_char, arg2: *const ::libc::c_char,
arg3: *mut ::libc::c_long) -> ::libc::c_int;
pub fn cgetset(arg1: *const ::libc::c_char) -> ::libc::c_int;
pub fn cgetstr(arg1: *mut ::libc::c_char, arg2: *const ::libc::c_char,
arg3: *mut *mut ::libc::c_char) -> ::libc::c_int;
pub fn cgetustr(arg1: *mut ::libc::c_char, arg2: *const ::libc::c_char,
arg3: *mut *mut ::libc::c_char) -> ::libc::c_int;
pub fn daemon(arg1: ::libc::c_int, arg2: ::libc::c_int) -> ::libc::c_int;
pub fn devname(arg1: dev_t, arg2: mode_t) -> *mut ::libc::c_char;
pub fn devname_r(arg1: dev_t, arg2: mode_t, buf: *mut ::libc::c_char,
len: ::libc::c_int) -> *mut ::libc::c_char;
pub fn getbsize(arg1: *mut ::libc::c_int, arg2: *mut ::libc::c_long) ->
*mut ::libc::c_char;
pub fn getloadavg(arg1: *mut ::libc::c_double, arg2: ::libc::c_int) ->
::libc::c_int;
pub fn getprogname() -> *const ::libc::c_char;
pub fn heapsort(arg1: *mut ::libc::c_void, arg2: size_t, arg3: size_t,
arg4:
::std::option::Option<extern "C" fn
(arg1:
*const ::libc::c_void,
arg2:
*const ::libc::c_void)
-> ::libc::c_int>) ->
::libc::c_int;
pub fn heapsort_b(arg1: *mut ::libc::c_void, arg2: size_t, arg3: size_t,
arg4: ::libc::c_void) -> ::libc::c_int;
pub fn mergesort(arg1: *mut ::libc::c_void, arg2: size_t, arg3: size_t,
arg4:
::std::option::Option<extern "C" fn
(arg1:
*const ::libc::c_void,
arg2:
*const ::libc::c_void)
-> ::libc::c_int>) ->
::libc::c_int;
pub fn mergesort_b(arg1: *mut ::libc::c_void, arg2: size_t, arg3: size_t,
arg4: ::libc::c_void) -> ::libc::c_int;
pub fn psort(arg1: *mut ::libc::c_void, arg2: size_t, arg3: size_t,
arg4:
::std::option::Option<extern "C" fn
(arg1: *const ::libc::c_void,
arg2: *const ::libc::c_void)
-> ::libc::c_int>);
pub fn psort_b(arg1: *mut ::libc::c_void, arg2: size_t, arg3: size_t,
arg4: ::libc::c_void);
pub fn psort_r(arg1: *mut ::libc::c_void, arg2: size_t, arg3: size_t,
arg4: *mut ::libc::c_void,
arg5:
::std::option::Option<extern "C" fn
(arg1: *mut ::libc::c_void,
arg2: *const ::libc::c_void,
arg3: *const ::libc::c_void)
-> ::libc::c_int>);
pub fn qsort_b(arg1: *mut ::libc::c_void, arg2: size_t, arg3: size_t,
arg4: ::libc::c_void);
pub fn qsort_r(arg1: *mut ::libc::c_void, arg2: size_t, arg3: size_t,
arg4: *mut ::libc::c_void,
arg5:
::std::option::Option<extern "C" fn
(arg1: *mut ::libc::c_void,
arg2: *const ::libc::c_void,
arg3: *const ::libc::c_void)
-> ::libc::c_int>);
pub fn radixsort(arg1: *mut *const ::libc::c_uchar, arg2: ::libc::c_int,
arg3: *const ::libc::c_uchar, arg4: ::libc::c_uint) ->
::libc::c_int;
pub fn setprogname(arg1: *const ::libc::c_char);
pub fn sradixsort(arg1: *mut *const ::libc::c_uchar, arg2: ::libc::c_int,
arg3: *const ::libc::c_uchar, arg4: ::libc::c_uint) ->
::libc::c_int;
pub fn sranddev();
pub fn srandomdev();
pub fn reallocf(arg1: *mut ::libc::c_void, arg2: size_t) ->
*mut ::libc::c_void;
pub fn strtoq(arg1: *const ::libc::c_char, arg2: *mut *mut ::libc::c_char,
arg3: ::libc::c_int) -> ::libc::c_longlong;
pub fn strtouq(arg1: *const ::libc::c_char,
arg2: *mut *mut ::libc::c_char, arg3: ::libc::c_int) ->
::libc::c_ulonglong;
pub fn valloc(arg1: size_t) -> *mut ::libc::c_void;
pub fn enif_priv_data(arg1: *mut ErlNifEnv) -> *mut ::libc::c_void;
pub fn enif_alloc(size: size_t) -> *mut ::libc::c_void;
pub fn enif_free(ptr: *mut ::libc::c_void);
pub fn enif_is_atom(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_is_binary(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_is_ref(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_inspect_binary(arg1: *mut ErlNifEnv, bin_term: ERL_NIF_TERM,
bin: *mut ErlNifBinary) -> ::libc::c_int;
pub fn enif_alloc_binary(size: size_t, bin: *mut ErlNifBinary) ->
::libc::c_int;
pub fn enif_realloc_binary(bin: *mut ErlNifBinary, size: size_t) ->
::libc::c_int;
pub fn enif_release_binary(bin: *mut ErlNifBinary);
pub fn enif_get_int(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM,
ip: *mut ::libc::c_int) -> ::libc::c_int;
pub fn enif_get_ulong(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM,
ip: *mut ::libc::c_ulong) -> ::libc::c_int;
pub fn enif_get_double(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM,
dp: *mut ::libc::c_double) -> ::libc::c_int;
pub fn enif_get_list_cell(env: *mut ErlNifEnv, term: ERL_NIF_TERM,
head: *mut ERL_NIF_TERM,
tail: *mut ERL_NIF_TERM) -> ::libc::c_int;
pub fn enif_get_tuple(env: *mut ErlNifEnv, tpl: ERL_NIF_TERM,
arity: *mut ::libc::c_int,
array: *mut *const ERL_NIF_TERM) -> ::libc::c_int;
pub fn enif_is_identical(lhs: ERL_NIF_TERM, rhs: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_compare(lhs: ERL_NIF_TERM, rhs: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_make_binary(env: *mut ErlNifEnv, bin: *mut ErlNifBinary) ->
ERL_NIF_TERM;
pub fn enif_make_badarg(env: *mut ErlNifEnv) -> ERL_NIF_TERM;
pub fn enif_make_int(env: *mut ErlNifEnv, i: ::libc::c_int) ->
ERL_NIF_TERM;
pub fn enif_make_ulong(env: *mut ErlNifEnv, i: ::libc::c_ulong) ->
ERL_NIF_TERM;
pub fn enif_make_double(env: *mut ErlNifEnv, d: ::libc::c_double) ->
ERL_NIF_TERM;
pub fn enif_make_atom(env: *mut ErlNifEnv, name: *const ::libc::c_char) ->
ERL_NIF_TERM;
pub fn enif_make_existing_atom(env: *mut ErlNifEnv,
name: *const ::libc::c_char,
atom: *mut ERL_NIF_TERM,
arg1: ErlNifCharEncoding) -> ::libc::c_int;
pub fn enif_make_tuple(env: *mut ErlNifEnv, cnt: ::libc::c_uint, ...) ->
ERL_NIF_TERM;
pub fn enif_make_list(env: *mut ErlNifEnv, cnt: ::libc::c_uint, ...) ->
ERL_NIF_TERM;
pub fn enif_make_list_cell(env: *mut ErlNifEnv, car: ERL_NIF_TERM,
cdr: ERL_NIF_TERM) -> ERL_NIF_TERM;
pub fn enif_make_string(env: *mut ErlNifEnv,
string: *const ::libc::c_char,
arg1: ErlNifCharEncoding) -> ERL_NIF_TERM;
pub fn enif_make_ref(env: *mut ErlNifEnv) -> ERL_NIF_TERM;
pub fn enif_mutex_create(name: *mut ::libc::c_char) -> *mut ErlNifMutex;
pub fn enif_mutex_destroy(mtx: *mut ErlNifMutex);
pub fn enif_mutex_trylock(mtx: *mut ErlNifMutex) -> ::libc::c_int;
pub fn enif_mutex_lock(mtx: *mut ErlNifMutex);
pub fn enif_mutex_unlock(mtx: *mut ErlNifMutex);
pub fn enif_cond_create(name: *mut ::libc::c_char) -> *mut ErlNifCond;
pub fn enif_cond_destroy(cnd: *mut ErlNifCond);
pub fn enif_cond_signal(cnd: *mut ErlNifCond);
pub fn enif_cond_broadcast(cnd: *mut ErlNifCond);
pub fn enif_cond_wait(cnd: *mut ErlNifCond, mtx: *mut ErlNifMutex);
pub fn enif_rwlock_create(name: *mut ::libc::c_char) -> *mut ErlNifRWLock;
pub fn enif_rwlock_destroy(rwlck: *mut ErlNifRWLock);
pub fn enif_rwlock_tryrlock(rwlck: *mut ErlNifRWLock) -> ::libc::c_int;
pub fn enif_rwlock_rlock(rwlck: *mut ErlNifRWLock);
pub fn enif_rwlock_runlock(rwlck: *mut ErlNifRWLock);
pub fn enif_rwlock_tryrwlock(rwlck: *mut ErlNifRWLock) -> ::libc::c_int;
pub fn enif_rwlock_rwlock(rwlck: *mut ErlNifRWLock);
pub fn enif_rwlock_rwunlock(rwlck: *mut ErlNifRWLock);
pub fn enif_tsd_key_create(name: *mut ::libc::c_char,
key: *mut ErlNifTSDKey) -> ::libc::c_int;
pub fn enif_tsd_key_destroy(key: ErlNifTSDKey);
pub fn enif_tsd_set(key: ErlNifTSDKey, data: *mut ::libc::c_void);
pub fn enif_tsd_get(key: ErlNifTSDKey) -> *mut ::libc::c_void;
pub fn enif_thread_opts_create(name: *mut ::libc::c_char) ->
*mut ErlNifThreadOpts;
pub fn enif_thread_opts_destroy(opts: *mut ErlNifThreadOpts);
pub fn enif_thread_create(name: *mut ::libc::c_char, tid: *mut ErlNifTid,
func:
::std::option::Option<extern "C" fn
(arg1:
*mut ::libc::c_void)
->
*mut ::libc::c_void>,
args: *mut ::libc::c_void,
opts: *mut ErlNifThreadOpts) -> ::libc::c_int;
pub fn enif_thread_self() -> ErlNifTid;
pub fn enif_equal_tids(tid1: ErlNifTid, tid2: ErlNifTid) -> ::libc::c_int;
pub fn enif_thread_exit(resp: *mut ::libc::c_void);
pub fn enif_thread_join(arg1: ErlNifTid, respp: *mut *mut ::libc::c_void)
-> ::libc::c_int;
pub fn enif_realloc(ptr: *mut ::libc::c_void, size: size_t) ->
*mut ::libc::c_void;
pub fn enif_system_info(sip: *mut ErlNifSysInfo, si_size: size_t);
pub fn enif_fprintf(filep: *mut ::libc::c_void,
format: *const ::libc::c_char, ...) -> ::libc::c_int;
pub fn enif_inspect_iolist_as_binary(arg1: *mut ErlNifEnv,
term: ERL_NIF_TERM,
bin: *mut ErlNifBinary) ->
::libc::c_int;
pub fn enif_make_sub_binary(arg1: *mut ErlNifEnv, bin_term: ERL_NIF_TERM,
pos: size_t, size: size_t) -> ERL_NIF_TERM;
pub fn enif_get_string(arg1: *mut ErlNifEnv, list: ERL_NIF_TERM,
buf: *mut ::libc::c_char, len: ::libc::c_uint,
arg2: ErlNifCharEncoding) -> ::libc::c_int;
pub fn enif_get_atom(arg1: *mut ErlNifEnv, atom: ERL_NIF_TERM,
buf: *mut ::libc::c_char, len: ::libc::c_uint,
arg2: ErlNifCharEncoding) -> ::libc::c_int;
pub fn enif_is_fun(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_is_pid(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_is_port(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_get_uint(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM,
ip: *mut ::libc::c_uint) -> ::libc::c_int;
pub fn enif_get_long(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM,
ip: *mut ::libc::c_long) -> ::libc::c_int;
pub fn enif_make_uint(arg1: *mut ErlNifEnv, i: ::libc::c_uint) ->
ERL_NIF_TERM;
pub fn enif_make_long(arg1: *mut ErlNifEnv, i: ::libc::c_long) ->
ERL_NIF_TERM;
pub fn enif_make_tuple_from_array(arg1: *mut ErlNifEnv,
arr: *const ERL_NIF_TERM,
cnt: ::libc::c_uint) -> ERL_NIF_TERM;
pub fn enif_make_list_from_array(arg1: *mut ErlNifEnv,
arr: *const ERL_NIF_TERM,
cnt: ::libc::c_uint) -> ERL_NIF_TERM;
pub fn enif_is_empty_list(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_open_resource_type(arg1: *mut ErlNifEnv,
module_str: *const ::libc::c_char,
name_str: *const ::libc::c_char,
dtor:
::std::option::Option<extern "C" fn
(arg1:
*mut ErlNifEnv,
arg2:
*mut ::libc::c_void)>,
flags: ErlNifResourceFlags,
tried: *mut ErlNifResourceFlags) ->
*mut ErlNifResourceType;
pub fn enif_alloc_resource(_type: *mut ErlNifResourceType, size: size_t)
-> *mut ::libc::c_void;
pub fn enif_release_resource(obj: *mut ::libc::c_void);
pub fn enif_make_resource(arg1: *mut ErlNifEnv, obj: *mut ::libc::c_void)
-> ERL_NIF_TERM;
pub fn enif_get_resource(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM,
_type: *mut ErlNifResourceType,
objp: *mut *mut ::libc::c_void) -> ::libc::c_int;
pub fn enif_sizeof_resource(obj: *mut ::libc::c_void) -> size_t;
pub fn enif_make_new_binary(arg1: *mut ErlNifEnv, size: size_t,
termp: *mut ERL_NIF_TERM) ->
*mut ::libc::c_uchar;
pub fn enif_is_list(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_is_tuple(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_get_atom_length(arg1: *mut ErlNifEnv, atom: ERL_NIF_TERM,
len: *mut ::libc::c_uint,
arg2: ErlNifCharEncoding) -> ::libc::c_int;
pub fn enif_get_list_length(env: *mut ErlNifEnv, term: ERL_NIF_TERM,
len: *mut ::libc::c_uint) -> ::libc::c_int;
pub fn enif_make_atom_len(env: *mut ErlNifEnv,
name: *const ::libc::c_char, len: size_t) ->
ERL_NIF_TERM;
pub fn enif_make_existing_atom_len(env: *mut ErlNifEnv,
name: *const ::libc::c_char,
len: size_t, atom: *mut ERL_NIF_TERM,
arg1: ErlNifCharEncoding) ->
::libc::c_int;
pub fn enif_make_string_len(env: *mut ErlNifEnv,
string: *const ::libc::c_char, len: size_t,
arg1: ErlNifCharEncoding) -> ERL_NIF_TERM;
pub fn enif_alloc_env() -> *mut ErlNifEnv;
pub fn enif_free_env(env: *mut ErlNifEnv);
pub fn enif_clear_env(env: *mut ErlNifEnv);
pub fn enif_send(env: *mut ErlNifEnv, to_pid: *const ErlNifPid,
msg_env: *mut ErlNifEnv, msg: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_make_copy(dst_env: *mut ErlNifEnv, src_term: ERL_NIF_TERM) ->
ERL_NIF_TERM;
pub fn enif_self(caller_env: *mut ErlNifEnv, pid: *mut ErlNifPid) ->
*mut ErlNifPid;
pub fn enif_get_local_pid(env: *mut ErlNifEnv, arg1: ERL_NIF_TERM,
pid: *mut ErlNifPid) -> ::libc::c_int;
pub fn enif_keep_resource(obj: *mut ::libc::c_void);
pub fn enif_make_resource_binary(arg1: *mut ErlNifEnv,
obj: *mut ::libc::c_void,
data: *const ::libc::c_void,
size: size_t) -> ERL_NIF_TERM;
pub fn enif_is_exception(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_make_reverse_list(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM,
list: *mut ERL_NIF_TERM) -> ::libc::c_int;
pub fn enif_is_number(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_dlopen(lib: *const ::libc::c_char,
err_handler:
::std::option::Option<extern "C" fn
(arg1:
*mut ::libc::c_void,
arg2:
*const ::libc::c_char)>,
err_arg: *mut ::libc::c_void) -> *mut ::libc::c_void;
pub fn enif_dlsym(handle: *mut ::libc::c_void,
symbol: *const ::libc::c_char,
err_handler:
::std::option::Option<extern "C" fn
(arg1:
*mut ::libc::c_void,
arg2:
*const ::libc::c_char)>,
err_arg: *mut ::libc::c_void) -> *mut ::libc::c_void;
pub fn enif_consume_timeslice(arg1: *mut ErlNifEnv,
percent: ::libc::c_int) -> ::libc::c_int;
pub fn enif_is_map(env: *mut ErlNifEnv, term: ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_get_map_size(env: *mut ErlNifEnv, term: ERL_NIF_TERM,
size: *mut size_t) -> ::libc::c_int;
pub fn enif_make_new_map(env: *mut ErlNifEnv) -> ERL_NIF_TERM;
pub fn enif_make_map_put(env: *mut ErlNifEnv, map_in: ERL_NIF_TERM,
key: ERL_NIF_TERM, value: ERL_NIF_TERM,
map_out: *mut ERL_NIF_TERM) -> ::libc::c_int;
pub fn enif_get_map_value(env: *mut ErlNifEnv, map: ERL_NIF_TERM,
key: ERL_NIF_TERM, value: *mut ERL_NIF_TERM) ->
::libc::c_int;
pub fn enif_make_map_update(env: *mut ErlNifEnv, map_in: ERL_NIF_TERM,
key: ERL_NIF_TERM, value: ERL_NIF_TERM,
map_out: *mut ERL_NIF_TERM) -> ::libc::c_int;
pub fn enif_make_map_remove(env: *mut ErlNifEnv, map_in: ERL_NIF_TERM,
key: ERL_NIF_TERM, map_out: *mut ERL_NIF_TERM)
-> ::libc::c_int;
pub fn enif_map_iterator_create(env: *mut ErlNifEnv, map: ERL_NIF_TERM,
iter: *mut ErlNifMapIterator,
entry: ErlNifMapIteratorEntry) ->
::libc::c_int;
pub fn enif_map_iterator_destroy(env: *mut ErlNifEnv,
iter: *mut ErlNifMapIterator);
pub fn enif_map_iterator_is_head(env: *mut ErlNifEnv,
iter: *mut ErlNifMapIterator) ->
::libc::c_int;
pub fn enif_map_iterator_is_tail(env: *mut ErlNifEnv,
iter: *mut ErlNifMapIterator) ->
::libc::c_int;
pub fn enif_map_iterator_next(env: *mut ErlNifEnv,
iter: *mut ErlNifMapIterator) ->
::libc::c_int;
pub fn enif_map_iterator_prev(env: *mut ErlNifEnv,
iter: *mut ErlNifMapIterator) ->
::libc::c_int;
pub fn enif_map_iterator_get_pair(env: *mut ErlNifEnv,
iter: *mut ErlNifMapIterator,
key: *mut ERL_NIF_TERM,
value: *mut ERL_NIF_TERM) ->
::libc::c_int;
}
Please note this might or might not work for you, depending on versions of
the components involved -- specifically, my rustc
and bindgen
are archaic.
Here are the tools I used to generate the above output:
$ uname -a
Darwin x4.local 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
$ erl
Erlang/OTP 17 [erts-6.1] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
Eshell V6.1 (abort with ^G)
1>
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
(v)ersion (k)ill (D)b-tables (d)istribution
^C
$ DYLD_LIBRARY_PATH=/Library/Developer/CommandLineTools/usr/lib/ /Users/erszcz/work/rust-bindgen/target/bindgen --version
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
libclang: crash detected during parsing: {
'source_filename' : ''
'command_line_args' : ['--version'],
'unsaved_files' : [],
'options' : 0,
}
ERROR:bindgen: No input files given
$ rustc --version
rustc 0.12.0-pre-nightly (09abbbdaf 2014-09-11 00:05:41 +0000)
$ cargo --version
cargo 0.0.1-pre-nightly (367960b 2014-09-10 23:24:02 +0000)
If you need a different version or the same for Linux, please drop me a line and I'll try to come up with something.
That's fantastic, thanks!
I am leaning towards hand crafted bindings but was really struggling with converting C signatures into Rust. This will be an invaluable "cheat sheet."
I think it might be best to generate such a c.rs
(or erl_nif.rs
) from erl_nif.h
for each (sensible) combination of Rust release and Erlang release, check that into the repo and prepare a hand crafted higher-level binding, which would even out as much of the inconsistencies between versions as possible.
I'm just thinking out loud, though. I haven't tried that approach.
I thought I would mention that I've gotten pretty far with my own low level Rust bindings. A lot of rough edges have come off Rust to make this kind of project easier, even since January when I first started asking you about this. Anyway, thank you again for your help in getting me started with this; I wouldn't have gotten anywhere without those automatic bindings.
Wow, this is great stuff! I've added a redirect to ruster_unsafe
in this project's README. Thanks for the credit!
Hi, I'm not having much luck with bindgen (It instantly segfaults for me.) Could you throw your bindgen output into a gist or something similar so I could take a look at it?