From a65729400b6996a6b3888f716c185bd1777d4cdd Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Sat, 1 Oct 2022 12:46:50 +0100 Subject: [PATCH] native-activity: Port android_app_create/free from C to Rust A literal port for now, with the intention of re-working into more idiomatic Rust code once we have a port of all the C code. --- android-activity/generate-bindings.sh | 11 +- .../native_app_glue/android_native_app_glue.c | 54 +- .../native_app_glue/android_native_app_glue.h | 13 +- android-activity/src/game_activity/ffi.rs | 5 +- .../src/game_activity/ffi_aarch64.rs | 826 ------------------ android-activity/src/game_activity/ffi_arm.rs | 815 ----------------- .../src/game_activity/ffi_i686.rs | 815 ----------------- .../src/game_activity/ffi_x86_64.rs | 826 ------------------ android-activity/src/lib.rs | 19 + android-activity/src/native_activity/ffi.rs | 6 +- .../src/native_activity/ffi_aarch64.rs | 71 +- .../src/native_activity/ffi_arm.rs | 71 +- .../src/native_activity/ffi_i686.rs | 71 +- .../src/native_activity/ffi_x86_64.rs | 71 +- android-activity/src/native_activity/mod.rs | 101 ++- 15 files changed, 137 insertions(+), 3638 deletions(-) diff --git a/android-activity/generate-bindings.sh b/android-activity/generate-bindings.sh index b9809cd..786d60a 100644 --- a/android-activity/generate-bindings.sh +++ b/android-activity/generate-bindings.sh @@ -16,6 +16,10 @@ while read ARCH && read TARGET ; do --blocklist-item 'C?_?JNIEnv' \ --blocklist-item '_?JavaVM' \ --blocklist-item '_?j\w+' \ + --blocklist-item 'size_t' \ + --blocklist-item 'pthread_\w*' \ + --blocklist-function 'pthread_\w' \ + --blocklist-item 'ARect' \ --blocklist-item 'ALooper\w*' \ --blocklist-function 'ALooper\w*' \ --blocklist-item 'AAsset\w*' \ @@ -38,6 +42,10 @@ while read ARCH && read TARGET ; do --blocklist-item 'C?_?JNIEnv' \ --blocklist-item '_?JavaVM' \ --blocklist-item '_?j\w+' \ + --blocklist-item 'size_t' \ + --blocklist-item 'pthread_\w*' \ + --blocklist-function 'pthread_\w' \ + --blocklist-item 'ARect' \ --blocklist-item 'ALooper\w*' \ --blocklist-function 'ALooper\w*' \ --blocklist-item 'AAsset\w*' \ @@ -53,9 +61,6 @@ while read ARCH && read TARGET ; do --blocklist-item 'GameActivity_onCreate' \ --blocklist-function 'GameActivity_onCreate_C' \ --newtype-enum '\w+_(result|status)_t' \ - --blocklist-item 'pthread_mutex_t' \ - --blocklist-item 'pthread_cond_t' \ - --blocklist-item 'pthread_\w*' \ -- \ -Inative-activity-csrc \ --sysroot="$SYSROOT" --target=$TARGET diff --git a/android-activity/native-activity-csrc/native-activity/native_app_glue/android_native_app_glue.c b/android-activity/native-activity-csrc/native-activity/native_app_glue/android_native_app_glue.c index b05f750..6ec55b2 100644 --- a/android-activity/native-activity-csrc/native-activity/native_app_glue/android_native_app_glue.c +++ b/android-activity/native-activity-csrc/native-activity/native_app_glue/android_native_app_glue.c @@ -201,7 +201,7 @@ static void process_cmd(struct android_app* app, __attribute__((unused)) struct android_app_post_exec_cmd(app, cmd); } -static void* android_app_entry(void* param) { +void* android_app_entry(void* param) { struct android_app* android_app = (struct android_app*)param; android_app->config = AConfiguration_new(); @@ -233,43 +233,6 @@ static void* android_app_entry(void* param) { // Native activity interaction (called from main thread) // -------------------------------------------------------------------- -struct android_app* android_app_create(ANativeActivity* activity, - void* savedState, size_t savedStateSize) { - struct android_app* android_app = (struct android_app*)malloc(sizeof(struct android_app)); - memset(android_app, 0, sizeof(struct android_app)); - android_app->activity = activity; - - pthread_mutex_init(&android_app->mutex, NULL); - pthread_cond_init(&android_app->cond, NULL); - - if (savedState != NULL) { - android_app->savedState = malloc(savedStateSize); - android_app->savedStateSize = savedStateSize; - memcpy(android_app->savedState, savedState, savedStateSize); - } - - int msgpipe[2]; - if (pipe(msgpipe)) { - LOGE("could not create pipe: %s", strerror(errno)); - return NULL; - } - android_app->msgread = msgpipe[0]; - android_app->msgwrite = msgpipe[1]; - - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_create(&android_app->thread, &attr, android_app_entry, android_app); - - // Wait for thread to start. - pthread_mutex_lock(&android_app->mutex); - while (!android_app->running) { - pthread_cond_wait(&android_app->cond, &android_app->mutex); - } - pthread_mutex_unlock(&android_app->mutex); - - return android_app; -} void android_app_write_cmd(struct android_app* android_app, int8_t cmd) { if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd)) { @@ -309,19 +272,4 @@ void android_app_set_activity_state(struct android_app* android_app, int8_t cmd) pthread_cond_wait(&android_app->cond, &android_app->mutex); } pthread_mutex_unlock(&android_app->mutex); -} - -void android_app_free(struct android_app* android_app) { - pthread_mutex_lock(&android_app->mutex); - android_app_write_cmd(android_app, APP_CMD_DESTROY); - while (!android_app->destroyed) { - pthread_cond_wait(&android_app->cond, &android_app->mutex); - } - pthread_mutex_unlock(&android_app->mutex); - - close(android_app->msgread); - close(android_app->msgwrite); - pthread_cond_destroy(&android_app->cond); - pthread_mutex_destroy(&android_app->mutex); - free(android_app); } \ No newline at end of file diff --git a/android-activity/native-activity-csrc/native-activity/native_app_glue/android_native_app_glue.h b/android-activity/native-activity-csrc/native-activity/native_app_glue/android_native_app_glue.h index 4889769..5e7dca7 100644 --- a/android-activity/native-activity-csrc/native-activity/native_app_glue/android_native_app_glue.h +++ b/android-activity/native-activity-csrc/native-activity/native_app_glue/android_native_app_glue.h @@ -335,23 +335,12 @@ void android_app_attach_input_queue_looper(struct android_app* android_app); void android_app_detach_input_queue_looper(struct android_app* android_app); -struct android_app* android_app_create(ANativeActivity* activity, - void* savedState, size_t savedStateSize); void android_app_write_cmd(struct android_app* android_app, int8_t cmd); void android_app_set_input(struct android_app* android_app, AInputQueue* inputQueue); void android_app_set_window(struct android_app* android_app, ANativeWindow* window); void android_app_set_activity_state(struct android_app* android_app, int8_t cmd); -void android_app_free(struct android_app* android_app); -/** - * Dummy function that used to be used to prevent the linker from stripping app - * glue code. No longer necessary, since __attribute__((visibility("default"))) - * does this for us. - */ -__attribute__(( - deprecated("Calls to app_dummy are no longer necessary. See " - "https://github.com/android-ndk/ndk/issues/381."))) void -app_dummy(); +void* android_app_entry(void* param); /** * This is the function that application code must implement, representing diff --git a/android-activity/src/game_activity/ffi.rs b/android-activity/src/game_activity/ffi.rs index 56f98e9..40ecc1d 100644 --- a/android-activity/src/game_activity/ffi.rs +++ b/android-activity/src/game_activity/ffi.rs @@ -13,9 +13,8 @@ #![allow(dead_code)] use jni_sys::*; -use ndk_sys::AAssetManager; -use ndk_sys::ANativeWindow; -use ndk_sys::{AConfiguration, ALooper, ALooper_callbackFunc}; +use ndk_sys::{ARect, AConfiguration, ALooper, ALooper_callbackFunc, AAssetManager, ANativeWindow}; +use libc::{size_t, pthread_t, pthread_mutex_t, pthread_cond_t}; #[cfg(all( any(target_os = "android", feature = "test"), diff --git a/android-activity/src/game_activity/ffi_aarch64.rs b/android-activity/src/game_activity/ffi_aarch64.rs index 2c6600f..626d193 100644 --- a/android-activity/src/game_activity/ffi_aarch64.rs +++ b/android-activity/src/game_activity/ffi_aarch64.rs @@ -659,7 +659,6 @@ extern "C" { extern "C" { pub fn android_get_device_api_level() -> ::std::os::raw::c_int; } -pub type size_t = ::std::os::raw::c_ulong; pub type wchar_t = ::std::os::raw::c_uint; #[repr(C)] #[repr(align(16))] @@ -839,247 +838,6 @@ pub type __be64 = __u64; pub type __sum16 = __u16; pub type __wsum = __u32; pub type __poll_t = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_attr_t { - pub flags: u32, - pub stack_base: *mut ::std::os::raw::c_void, - pub stack_size: size_t, - pub guard_size: size_t, - pub sched_policy: i32, - pub sched_priority: i32, - pub __reserved: [::std::os::raw::c_char; 16usize], -} -#[test] -fn bindgen_test_layout_pthread_attr_t() { - assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(pthread_attr_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pthread_attr_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack_base as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(stack_base) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack_size as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(stack_size) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).guard_size as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(guard_size) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched_policy as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(sched_policy) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched_priority as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(sched_priority) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(__reserved) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_barrier_t { - pub __private: [i64; 4usize], -} -#[test] -fn bindgen_test_layout_pthread_barrier_t() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pthread_barrier_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pthread_barrier_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_barrier_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_barrierattr_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_cond_t { - pub __private: [i32; 12usize], -} -#[test] -fn bindgen_test_layout_pthread_cond_t() { - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(pthread_cond_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_cond_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_cond_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_condattr_t = ::std::os::raw::c_long; -pub type pthread_key_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_mutex_t { - pub __private: [i32; 10usize], -} -#[test] -fn bindgen_test_layout_pthread_mutex_t() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(pthread_mutex_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_mutex_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_mutex_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_mutexattr_t = ::std::os::raw::c_long; -pub type pthread_once_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_rwlock_t { - pub __private: [i32; 14usize], -} -#[test] -fn bindgen_test_layout_pthread_rwlock_t() { - assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(pthread_rwlock_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_rwlock_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_rwlock_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_rwlockattr_t = ::std::os::raw::c_long; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_spinlock_t { - pub __private: i64, -} -#[test] -fn bindgen_test_layout_pthread_spinlock_t() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pthread_spinlock_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pthread_spinlock_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_spinlock_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_t = ::std::os::raw::c_long; pub type __gid_t = __kernel_gid32_t; pub type gid_t = __gid_t; pub type __uid_t = __kernel_uid32_t; @@ -1952,67 +1710,6 @@ pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; pub type ADataSpace = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ARect { - pub left: i32, - pub top: i32, - pub right: i32, - pub bottom: i32, -} -#[test] -fn bindgen_test_layout_ARect() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(ARect)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ARect)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).left as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(left) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).top as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(top) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).right as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(right) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).bottom as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(bottom) - ) - ); -} pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: AHardwareBuffer_Format = 3; @@ -4777,7 +4474,6 @@ fn bindgen_test_layout___kernel_sigaction() { ); } #[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct sigaltstack { pub ss_sp: *mut ::std::os::raw::c_void, pub ss_flags: ::std::os::raw::c_int, @@ -6146,7 +5842,6 @@ pub type fpregset_t = user_fpsimd_struct; pub type mcontext_t = sigcontext; #[repr(C)] #[repr(align(16))] -#[derive(Copy, Clone)] pub struct ucontext { pub uc_flags: ::std::os::raw::c_ulong, pub uc_link: *mut ucontext, @@ -6430,26 +6125,6 @@ extern "C" { extern "C" { pub fn psignal(__signal: ::std::os::raw::c_int, __msg: *const ::std::os::raw::c_char); } -extern "C" { - pub fn pthread_kill( - __pthread: pthread_t, - __signal: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_sigmask( - __how: ::std::os::raw::c_int, - __new_set: *const sigset_t, - __old_set: *mut sigset_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_sigmask64( - __how: ::std::os::raw::c_int, - __new_set: *const sigset64_t, - __old_set: *mut sigset64_t, - ) -> ::std::os::raw::c_int; -} extern "C" { pub fn sigqueue( __pid: pid_t, @@ -7373,506 +7048,6 @@ pub type _bindgen_ty_22 = ::std::os::raw::c_uint; pub const PTHREAD_RWLOCK_PREFER_READER_NP: ::std::os::raw::c_uint = 0; pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: ::std::os::raw::c_uint = 1; pub type _bindgen_ty_23 = ::std::os::raw::c_uint; -extern "C" { - pub fn pthread_atfork( - __prepare: ::std::option::Option, - __parent: ::std::option::Option, - __child: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_destroy(__attr: *mut pthread_attr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getdetachstate( - __attr: *const pthread_attr_t, - __state: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getguardsize( - __attr: *const pthread_attr_t, - __size: *mut size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getinheritsched( - __attr: *const pthread_attr_t, - __flag: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getschedparam( - __attr: *const pthread_attr_t, - __param: *mut sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getschedpolicy( - __attr: *const pthread_attr_t, - __policy: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getscope( - __attr: *const pthread_attr_t, - __scope: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getstack( - __attr: *const pthread_attr_t, - __addr: *mut *mut ::std::os::raw::c_void, - __size: *mut size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getstacksize( - __attr: *const pthread_attr_t, - __size: *mut size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_init(__attr: *mut pthread_attr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setdetachstate( - __attr: *mut pthread_attr_t, - __state: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setguardsize( - __attr: *mut pthread_attr_t, - __size: size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setinheritsched( - __attr: *mut pthread_attr_t, - __flag: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setschedparam( - __attr: *mut pthread_attr_t, - __param: *const sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setschedpolicy( - __attr: *mut pthread_attr_t, - __policy: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setscope( - __attr: *mut pthread_attr_t, - __scope: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setstack( - __attr: *mut pthread_attr_t, - __addr: *mut ::std::os::raw::c_void, - __size: size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setstacksize( - __addr: *mut pthread_attr_t, - __size: size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_destroy(__attr: *mut pthread_condattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_getclock( - __attr: *const pthread_condattr_t, - __clock: *mut clockid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_getpshared( - __attr: *const pthread_condattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_init(__attr: *mut pthread_condattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_setclock( - __attr: *mut pthread_condattr_t, - __clock: clockid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_setpshared( - __attr: *mut pthread_condattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_broadcast(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_clockwait( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - __clock: clockid_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_destroy(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_init( - __cond: *mut pthread_cond_t, - __attr: *const pthread_condattr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_signal(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_timedwait( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_timedwait_monotonic_np( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_wait( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_create( - __pthread_ptr: *mut pthread_t, - __attr: *const pthread_attr_t, - __start_routine: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void, - >, - arg1: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_detach(__pthread: pthread_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_exit(__return_value: *mut ::std::os::raw::c_void); -} -extern "C" { - pub fn pthread_equal(__lhs: pthread_t, __rhs: pthread_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getattr_np( - __pthread: pthread_t, - __attr: *mut pthread_attr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getcpuclockid( - __pthread: pthread_t, - __clock: *mut clockid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getschedparam( - __pthread: pthread_t, - __policy: *mut ::std::os::raw::c_int, - __param: *mut sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getspecific(__key: pthread_key_t) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn pthread_gettid_np(__pthread: pthread_t) -> pid_t; -} -extern "C" { - pub fn pthread_join( - __pthread: pthread_t, - __return_value_ptr: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_key_create( - __key_ptr: *mut pthread_key_t, - __key_destructor: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void), - >, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_key_delete(__key: pthread_key_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_destroy(__attr: *mut pthread_mutexattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_getpshared( - __attr: *const pthread_mutexattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_gettype( - __attr: *const pthread_mutexattr_t, - __type: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_getprotocol( - __attr: *const pthread_mutexattr_t, - __protocol: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_init(__attr: *mut pthread_mutexattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_setpshared( - __attr: *mut pthread_mutexattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_settype( - __attr: *mut pthread_mutexattr_t, - __type: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_setprotocol( - __attr: *mut pthread_mutexattr_t, - __protocol: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_clocklock( - __mutex: *mut pthread_mutex_t, - __clock: clockid_t, - __abstime: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_destroy(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_init( - __mutex: *mut pthread_mutex_t, - __attr: *const pthread_mutexattr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_lock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_timedlock( - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_timedlock_monotonic_np( - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_trylock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_unlock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_once( - __once: *mut pthread_once_t, - __init_routine: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_init(__attr: *mut pthread_rwlockattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_destroy(__attr: *mut pthread_rwlockattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_getpshared( - __attr: *const pthread_rwlockattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_setpshared( - __attr: *mut pthread_rwlockattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_getkind_np( - __attr: *const pthread_rwlockattr_t, - __kind: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_setkind_np( - __attr: *mut pthread_rwlockattr_t, - __kind: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_clockrdlock( - __rwlock: *mut pthread_rwlock_t, - __clock: clockid_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_clockwrlock( - __rwlock: *mut pthread_rwlock_t, - __clock: clockid_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_destroy(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_init( - __rwlock: *mut pthread_rwlock_t, - __attr: *const pthread_rwlockattr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_rdlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedrdlock( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedrdlock_monotonic_np( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedwrlock( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedwrlock_monotonic_np( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_tryrdlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_trywrlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_unlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_wrlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_init(__attr: *mut pthread_barrierattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_destroy(__attr: *mut pthread_barrierattr_t) - -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_getpshared( - __attr: *const pthread_barrierattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_setpshared( - __attr: *mut pthread_barrierattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrier_init( - __barrier: *mut pthread_barrier_t, - __attr: *const pthread_barrierattr_t, - __count: ::std::os::raw::c_uint, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrier_destroy(__barrier: *mut pthread_barrier_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrier_wait(__barrier: *mut pthread_barrier_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_destroy(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_init( - __spinlock: *mut pthread_spinlock_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_lock(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_trylock(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_unlock(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_self() -> pthread_t; -} -extern "C" { - pub fn pthread_setname_np( - __pthread: pthread_t, - __name: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_setschedparam( - __pthread: pthread_t, - __policy: ::std::os::raw::c_int, - __param: *const sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_setschedprio( - __pthread: pthread_t, - __priority: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_setspecific( - __key: pthread_key_t, - __value: *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} pub type __pthread_cleanup_func_t = ::std::option::Option; #[repr(C)] @@ -8171,7 +7346,6 @@ pub type android_motion_event_filter = #[doc = " See the sample named \"native-activity\" that comes with the NDK with a"] #[doc = " full usage example. Also look at the documentation of GameActivity."] #[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct android_app { #[doc = " An optional pointer to application-defined state."] pub userData: *mut ::std::os::raw::c_void, diff --git a/android-activity/src/game_activity/ffi_arm.rs b/android-activity/src/game_activity/ffi_arm.rs index 7021eb4..e0f2aa2 100644 --- a/android-activity/src/game_activity/ffi_arm.rs +++ b/android-activity/src/game_activity/ffi_arm.rs @@ -691,7 +691,6 @@ extern "C" { extern "C" { pub fn android_get_device_api_level() -> ::std::os::raw::c_int; } -pub type size_t = ::std::os::raw::c_uint; pub type wchar_t = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -869,236 +868,6 @@ pub type __be64 = __u64; pub type __sum16 = __u16; pub type __wsum = __u32; pub type __poll_t = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_attr_t { - pub flags: u32, - pub stack_base: *mut ::std::os::raw::c_void, - pub stack_size: size_t, - pub guard_size: size_t, - pub sched_policy: i32, - pub sched_priority: i32, -} -#[test] -fn bindgen_test_layout_pthread_attr_t() { - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(pthread_attr_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_attr_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack_base as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(stack_base) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack_size as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(stack_size) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).guard_size as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(guard_size) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched_policy as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(sched_policy) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched_priority as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(sched_priority) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_barrier_t { - pub __private: [i32; 8usize], -} -#[test] -fn bindgen_test_layout_pthread_barrier_t() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pthread_barrier_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_barrier_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_barrier_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_barrierattr_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_cond_t { - pub __private: [i32; 1usize], -} -#[test] -fn bindgen_test_layout_pthread_cond_t() { - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(pthread_cond_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_cond_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_cond_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_condattr_t = ::std::os::raw::c_long; -pub type pthread_key_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_mutex_t { - pub __private: [i32; 1usize], -} -#[test] -fn bindgen_test_layout_pthread_mutex_t() { - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(pthread_mutex_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_mutex_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_mutex_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_mutexattr_t = ::std::os::raw::c_long; -pub type pthread_once_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_rwlock_t { - pub __private: [i32; 10usize], -} -#[test] -fn bindgen_test_layout_pthread_rwlock_t() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(pthread_rwlock_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_rwlock_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_rwlock_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_rwlockattr_t = ::std::os::raw::c_long; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_spinlock_t { - pub __private: [i32; 2usize], -} -#[test] -fn bindgen_test_layout_pthread_spinlock_t() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pthread_spinlock_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_spinlock_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_spinlock_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_t = ::std::os::raw::c_long; pub type __gid_t = __kernel_gid32_t; pub type gid_t = __gid_t; pub type __uid_t = __kernel_uid32_t; @@ -1971,67 +1740,6 @@ pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; pub type ADataSpace = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ARect { - pub left: i32, - pub top: i32, - pub right: i32, - pub bottom: i32, -} -#[test] -fn bindgen_test_layout_ARect() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(ARect)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ARect)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).left as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(left) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).top as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(top) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).right as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(right) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).bottom as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(bottom) - ) - ); -} pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: AHardwareBuffer_Format = 3; @@ -4734,7 +4442,6 @@ fn bindgen_test_layout___kernel_sigaction() { ); } #[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct sigaltstack { pub ss_sp: *mut ::std::os::raw::c_void, pub ss_flags: ::std::os::raw::c_int, @@ -6566,7 +6273,6 @@ pub type fpregset_t = user_fpregs; pub type mcontext_t = sigcontext; #[repr(C)] #[repr(align(8))] -#[derive(Copy, Clone)] pub struct ucontext { pub uc_flags: ::std::os::raw::c_ulong, pub uc_link: *mut ucontext, @@ -6899,26 +6605,6 @@ extern "C" { extern "C" { pub fn psignal(__signal: ::std::os::raw::c_int, __msg: *const ::std::os::raw::c_char); } -extern "C" { - pub fn pthread_kill( - __pthread: pthread_t, - __signal: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_sigmask( - __how: ::std::os::raw::c_int, - __new_set: *const sigset_t, - __old_set: *mut sigset_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_sigmask64( - __how: ::std::os::raw::c_int, - __new_set: *const sigset64_t, - __old_set: *mut sigset64_t, - ) -> ::std::os::raw::c_int; -} extern "C" { pub fn sigqueue( __pid: pid_t, @@ -7842,506 +7528,6 @@ pub type _bindgen_ty_23 = ::std::os::raw::c_uint; pub const PTHREAD_RWLOCK_PREFER_READER_NP: ::std::os::raw::c_uint = 0; pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: ::std::os::raw::c_uint = 1; pub type _bindgen_ty_24 = ::std::os::raw::c_uint; -extern "C" { - pub fn pthread_atfork( - __prepare: ::std::option::Option, - __parent: ::std::option::Option, - __child: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_destroy(__attr: *mut pthread_attr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getdetachstate( - __attr: *const pthread_attr_t, - __state: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getguardsize( - __attr: *const pthread_attr_t, - __size: *mut size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getinheritsched( - __attr: *const pthread_attr_t, - __flag: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getschedparam( - __attr: *const pthread_attr_t, - __param: *mut sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getschedpolicy( - __attr: *const pthread_attr_t, - __policy: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getscope( - __attr: *const pthread_attr_t, - __scope: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getstack( - __attr: *const pthread_attr_t, - __addr: *mut *mut ::std::os::raw::c_void, - __size: *mut size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getstacksize( - __attr: *const pthread_attr_t, - __size: *mut size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_init(__attr: *mut pthread_attr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setdetachstate( - __attr: *mut pthread_attr_t, - __state: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setguardsize( - __attr: *mut pthread_attr_t, - __size: size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setinheritsched( - __attr: *mut pthread_attr_t, - __flag: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setschedparam( - __attr: *mut pthread_attr_t, - __param: *const sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setschedpolicy( - __attr: *mut pthread_attr_t, - __policy: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setscope( - __attr: *mut pthread_attr_t, - __scope: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setstack( - __attr: *mut pthread_attr_t, - __addr: *mut ::std::os::raw::c_void, - __size: size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setstacksize( - __addr: *mut pthread_attr_t, - __size: size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_destroy(__attr: *mut pthread_condattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_getclock( - __attr: *const pthread_condattr_t, - __clock: *mut clockid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_getpshared( - __attr: *const pthread_condattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_init(__attr: *mut pthread_condattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_setclock( - __attr: *mut pthread_condattr_t, - __clock: clockid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_setpshared( - __attr: *mut pthread_condattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_broadcast(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_clockwait( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - __clock: clockid_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_destroy(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_init( - __cond: *mut pthread_cond_t, - __attr: *const pthread_condattr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_signal(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_timedwait( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_timedwait_monotonic_np( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_wait( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_create( - __pthread_ptr: *mut pthread_t, - __attr: *const pthread_attr_t, - __start_routine: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void, - >, - arg1: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_detach(__pthread: pthread_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_exit(__return_value: *mut ::std::os::raw::c_void); -} -extern "C" { - pub fn pthread_equal(__lhs: pthread_t, __rhs: pthread_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getattr_np( - __pthread: pthread_t, - __attr: *mut pthread_attr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getcpuclockid( - __pthread: pthread_t, - __clock: *mut clockid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getschedparam( - __pthread: pthread_t, - __policy: *mut ::std::os::raw::c_int, - __param: *mut sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getspecific(__key: pthread_key_t) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn pthread_gettid_np(__pthread: pthread_t) -> pid_t; -} -extern "C" { - pub fn pthread_join( - __pthread: pthread_t, - __return_value_ptr: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_key_create( - __key_ptr: *mut pthread_key_t, - __key_destructor: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void), - >, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_key_delete(__key: pthread_key_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_destroy(__attr: *mut pthread_mutexattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_getpshared( - __attr: *const pthread_mutexattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_gettype( - __attr: *const pthread_mutexattr_t, - __type: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_getprotocol( - __attr: *const pthread_mutexattr_t, - __protocol: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_init(__attr: *mut pthread_mutexattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_setpshared( - __attr: *mut pthread_mutexattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_settype( - __attr: *mut pthread_mutexattr_t, - __type: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_setprotocol( - __attr: *mut pthread_mutexattr_t, - __protocol: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_clocklock( - __mutex: *mut pthread_mutex_t, - __clock: clockid_t, - __abstime: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_destroy(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_init( - __mutex: *mut pthread_mutex_t, - __attr: *const pthread_mutexattr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_lock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_timedlock( - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_timedlock_monotonic_np( - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_trylock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_unlock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_once( - __once: *mut pthread_once_t, - __init_routine: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_init(__attr: *mut pthread_rwlockattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_destroy(__attr: *mut pthread_rwlockattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_getpshared( - __attr: *const pthread_rwlockattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_setpshared( - __attr: *mut pthread_rwlockattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_getkind_np( - __attr: *const pthread_rwlockattr_t, - __kind: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_setkind_np( - __attr: *mut pthread_rwlockattr_t, - __kind: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_clockrdlock( - __rwlock: *mut pthread_rwlock_t, - __clock: clockid_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_clockwrlock( - __rwlock: *mut pthread_rwlock_t, - __clock: clockid_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_destroy(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_init( - __rwlock: *mut pthread_rwlock_t, - __attr: *const pthread_rwlockattr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_rdlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedrdlock( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedrdlock_monotonic_np( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedwrlock( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedwrlock_monotonic_np( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_tryrdlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_trywrlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_unlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_wrlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_init(__attr: *mut pthread_barrierattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_destroy(__attr: *mut pthread_barrierattr_t) - -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_getpshared( - __attr: *const pthread_barrierattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_setpshared( - __attr: *mut pthread_barrierattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrier_init( - __barrier: *mut pthread_barrier_t, - __attr: *const pthread_barrierattr_t, - __count: ::std::os::raw::c_uint, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrier_destroy(__barrier: *mut pthread_barrier_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrier_wait(__barrier: *mut pthread_barrier_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_destroy(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_init( - __spinlock: *mut pthread_spinlock_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_lock(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_trylock(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_unlock(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_self() -> pthread_t; -} -extern "C" { - pub fn pthread_setname_np( - __pthread: pthread_t, - __name: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_setschedparam( - __pthread: pthread_t, - __policy: ::std::os::raw::c_int, - __param: *const sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_setschedprio( - __pthread: pthread_t, - __priority: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_setspecific( - __key: pthread_key_t, - __value: *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} pub type __pthread_cleanup_func_t = ::std::option::Option; #[repr(C)] @@ -8640,7 +7826,6 @@ pub type android_motion_event_filter = #[doc = " See the sample named \"native-activity\" that comes with the NDK with a"] #[doc = " full usage example. Also look at the documentation of GameActivity."] #[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct android_app { #[doc = " An optional pointer to application-defined state."] pub userData: *mut ::std::os::raw::c_void, diff --git a/android-activity/src/game_activity/ffi_i686.rs b/android-activity/src/game_activity/ffi_i686.rs index 31fedac..1f46419 100644 --- a/android-activity/src/game_activity/ffi_i686.rs +++ b/android-activity/src/game_activity/ffi_i686.rs @@ -611,7 +611,6 @@ extern "C" { extern "C" { pub fn android_get_device_api_level() -> ::std::os::raw::c_int; } -pub type size_t = ::std::os::raw::c_uint; pub type wchar_t = ::std::os::raw::c_int; #[repr(C)] #[repr(align(8))] @@ -790,236 +789,6 @@ pub type __be64 = __u64; pub type __sum16 = __u16; pub type __wsum = __u32; pub type __poll_t = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_attr_t { - pub flags: u32, - pub stack_base: *mut ::std::os::raw::c_void, - pub stack_size: size_t, - pub guard_size: size_t, - pub sched_policy: i32, - pub sched_priority: i32, -} -#[test] -fn bindgen_test_layout_pthread_attr_t() { - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(pthread_attr_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_attr_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack_base as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(stack_base) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack_size as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(stack_size) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).guard_size as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(guard_size) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched_policy as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(sched_policy) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched_priority as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(sched_priority) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_barrier_t { - pub __private: [i32; 8usize], -} -#[test] -fn bindgen_test_layout_pthread_barrier_t() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pthread_barrier_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_barrier_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_barrier_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_barrierattr_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_cond_t { - pub __private: [i32; 1usize], -} -#[test] -fn bindgen_test_layout_pthread_cond_t() { - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(pthread_cond_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_cond_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_cond_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_condattr_t = ::std::os::raw::c_long; -pub type pthread_key_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_mutex_t { - pub __private: [i32; 1usize], -} -#[test] -fn bindgen_test_layout_pthread_mutex_t() { - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(pthread_mutex_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_mutex_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_mutex_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_mutexattr_t = ::std::os::raw::c_long; -pub type pthread_once_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_rwlock_t { - pub __private: [i32; 10usize], -} -#[test] -fn bindgen_test_layout_pthread_rwlock_t() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(pthread_rwlock_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_rwlock_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_rwlock_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_rwlockattr_t = ::std::os::raw::c_long; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_spinlock_t { - pub __private: [i32; 2usize], -} -#[test] -fn bindgen_test_layout_pthread_spinlock_t() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pthread_spinlock_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_spinlock_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_spinlock_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_t = ::std::os::raw::c_long; pub type __gid_t = __kernel_gid32_t; pub type gid_t = __gid_t; pub type __uid_t = __kernel_uid32_t; @@ -1892,67 +1661,6 @@ pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; pub type ADataSpace = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ARect { - pub left: i32, - pub top: i32, - pub right: i32, - pub bottom: i32, -} -#[test] -fn bindgen_test_layout_ARect() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(ARect)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ARect)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).left as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(left) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).top as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(top) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).right as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(right) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).bottom as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(bottom) - ) - ); -} pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: AHardwareBuffer_Format = 3; @@ -6502,7 +6210,6 @@ fn bindgen_test_layout___kernel_sigaction() { ); } #[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct sigaltstack { pub ss_sp: *mut ::std::os::raw::c_void, pub ss_flags: ::std::os::raw::c_int, @@ -8633,7 +8340,6 @@ fn bindgen_test_layout_mcontext_t() { ); } #[repr(C)] -#[derive(Copy, Clone)] pub struct ucontext { pub uc_flags: ::std::os::raw::c_ulong, pub uc_link: *mut ucontext, @@ -8955,26 +8661,6 @@ extern "C" { extern "C" { pub fn psignal(__signal: ::std::os::raw::c_int, __msg: *const ::std::os::raw::c_char); } -extern "C" { - pub fn pthread_kill( - __pthread: pthread_t, - __signal: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_sigmask( - __how: ::std::os::raw::c_int, - __new_set: *const sigset_t, - __old_set: *mut sigset_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_sigmask64( - __how: ::std::os::raw::c_int, - __new_set: *const sigset64_t, - __old_set: *mut sigset64_t, - ) -> ::std::os::raw::c_int; -} extern "C" { pub fn sigqueue( __pid: pid_t, @@ -9587,506 +9273,6 @@ pub type _bindgen_ty_23 = ::std::os::raw::c_uint; pub const PTHREAD_RWLOCK_PREFER_READER_NP: ::std::os::raw::c_uint = 0; pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: ::std::os::raw::c_uint = 1; pub type _bindgen_ty_24 = ::std::os::raw::c_uint; -extern "C" { - pub fn pthread_atfork( - __prepare: ::std::option::Option, - __parent: ::std::option::Option, - __child: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_destroy(__attr: *mut pthread_attr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getdetachstate( - __attr: *const pthread_attr_t, - __state: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getguardsize( - __attr: *const pthread_attr_t, - __size: *mut size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getinheritsched( - __attr: *const pthread_attr_t, - __flag: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getschedparam( - __attr: *const pthread_attr_t, - __param: *mut sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getschedpolicy( - __attr: *const pthread_attr_t, - __policy: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getscope( - __attr: *const pthread_attr_t, - __scope: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getstack( - __attr: *const pthread_attr_t, - __addr: *mut *mut ::std::os::raw::c_void, - __size: *mut size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getstacksize( - __attr: *const pthread_attr_t, - __size: *mut size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_init(__attr: *mut pthread_attr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setdetachstate( - __attr: *mut pthread_attr_t, - __state: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setguardsize( - __attr: *mut pthread_attr_t, - __size: size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setinheritsched( - __attr: *mut pthread_attr_t, - __flag: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setschedparam( - __attr: *mut pthread_attr_t, - __param: *const sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setschedpolicy( - __attr: *mut pthread_attr_t, - __policy: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setscope( - __attr: *mut pthread_attr_t, - __scope: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setstack( - __attr: *mut pthread_attr_t, - __addr: *mut ::std::os::raw::c_void, - __size: size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setstacksize( - __addr: *mut pthread_attr_t, - __size: size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_destroy(__attr: *mut pthread_condattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_getclock( - __attr: *const pthread_condattr_t, - __clock: *mut clockid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_getpshared( - __attr: *const pthread_condattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_init(__attr: *mut pthread_condattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_setclock( - __attr: *mut pthread_condattr_t, - __clock: clockid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_setpshared( - __attr: *mut pthread_condattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_broadcast(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_clockwait( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - __clock: clockid_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_destroy(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_init( - __cond: *mut pthread_cond_t, - __attr: *const pthread_condattr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_signal(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_timedwait( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_timedwait_monotonic_np( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_wait( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_create( - __pthread_ptr: *mut pthread_t, - __attr: *const pthread_attr_t, - __start_routine: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void, - >, - arg1: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_detach(__pthread: pthread_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_exit(__return_value: *mut ::std::os::raw::c_void); -} -extern "C" { - pub fn pthread_equal(__lhs: pthread_t, __rhs: pthread_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getattr_np( - __pthread: pthread_t, - __attr: *mut pthread_attr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getcpuclockid( - __pthread: pthread_t, - __clock: *mut clockid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getschedparam( - __pthread: pthread_t, - __policy: *mut ::std::os::raw::c_int, - __param: *mut sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getspecific(__key: pthread_key_t) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn pthread_gettid_np(__pthread: pthread_t) -> pid_t; -} -extern "C" { - pub fn pthread_join( - __pthread: pthread_t, - __return_value_ptr: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_key_create( - __key_ptr: *mut pthread_key_t, - __key_destructor: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void), - >, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_key_delete(__key: pthread_key_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_destroy(__attr: *mut pthread_mutexattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_getpshared( - __attr: *const pthread_mutexattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_gettype( - __attr: *const pthread_mutexattr_t, - __type: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_getprotocol( - __attr: *const pthread_mutexattr_t, - __protocol: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_init(__attr: *mut pthread_mutexattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_setpshared( - __attr: *mut pthread_mutexattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_settype( - __attr: *mut pthread_mutexattr_t, - __type: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_setprotocol( - __attr: *mut pthread_mutexattr_t, - __protocol: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_clocklock( - __mutex: *mut pthread_mutex_t, - __clock: clockid_t, - __abstime: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_destroy(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_init( - __mutex: *mut pthread_mutex_t, - __attr: *const pthread_mutexattr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_lock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_timedlock( - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_timedlock_monotonic_np( - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_trylock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_unlock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_once( - __once: *mut pthread_once_t, - __init_routine: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_init(__attr: *mut pthread_rwlockattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_destroy(__attr: *mut pthread_rwlockattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_getpshared( - __attr: *const pthread_rwlockattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_setpshared( - __attr: *mut pthread_rwlockattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_getkind_np( - __attr: *const pthread_rwlockattr_t, - __kind: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_setkind_np( - __attr: *mut pthread_rwlockattr_t, - __kind: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_clockrdlock( - __rwlock: *mut pthread_rwlock_t, - __clock: clockid_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_clockwrlock( - __rwlock: *mut pthread_rwlock_t, - __clock: clockid_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_destroy(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_init( - __rwlock: *mut pthread_rwlock_t, - __attr: *const pthread_rwlockattr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_rdlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedrdlock( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedrdlock_monotonic_np( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedwrlock( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedwrlock_monotonic_np( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_tryrdlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_trywrlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_unlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_wrlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_init(__attr: *mut pthread_barrierattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_destroy(__attr: *mut pthread_barrierattr_t) - -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_getpshared( - __attr: *const pthread_barrierattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_setpshared( - __attr: *mut pthread_barrierattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrier_init( - __barrier: *mut pthread_barrier_t, - __attr: *const pthread_barrierattr_t, - __count: ::std::os::raw::c_uint, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrier_destroy(__barrier: *mut pthread_barrier_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrier_wait(__barrier: *mut pthread_barrier_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_destroy(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_init( - __spinlock: *mut pthread_spinlock_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_lock(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_trylock(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_unlock(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_self() -> pthread_t; -} -extern "C" { - pub fn pthread_setname_np( - __pthread: pthread_t, - __name: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_setschedparam( - __pthread: pthread_t, - __policy: ::std::os::raw::c_int, - __param: *const sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_setschedprio( - __pthread: pthread_t, - __priority: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_setspecific( - __key: pthread_key_t, - __value: *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} pub type __pthread_cleanup_func_t = ::std::option::Option; #[repr(C)] @@ -10385,7 +9571,6 @@ pub type android_motion_event_filter = #[doc = " See the sample named \"native-activity\" that comes with the NDK with a"] #[doc = " full usage example. Also look at the documentation of GameActivity."] #[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct android_app { #[doc = " An optional pointer to application-defined state."] pub userData: *mut ::std::os::raw::c_void, diff --git a/android-activity/src/game_activity/ffi_x86_64.rs b/android-activity/src/game_activity/ffi_x86_64.rs index 2bedc9b..29d5fbe 100644 --- a/android-activity/src/game_activity/ffi_x86_64.rs +++ b/android-activity/src/game_activity/ffi_x86_64.rs @@ -639,7 +639,6 @@ extern "C" { extern "C" { pub fn android_get_device_api_level() -> ::std::os::raw::c_int; } -pub type size_t = ::std::os::raw::c_ulong; pub type wchar_t = ::std::os::raw::c_int; #[repr(C)] #[repr(align(16))] @@ -819,247 +818,6 @@ pub type __be64 = __u64; pub type __sum16 = __u16; pub type __wsum = __u32; pub type __poll_t = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_attr_t { - pub flags: u32, - pub stack_base: *mut ::std::os::raw::c_void, - pub stack_size: size_t, - pub guard_size: size_t, - pub sched_policy: i32, - pub sched_priority: i32, - pub __reserved: [::std::os::raw::c_char; 16usize], -} -#[test] -fn bindgen_test_layout_pthread_attr_t() { - assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(pthread_attr_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pthread_attr_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack_base as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(stack_base) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack_size as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(stack_size) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).guard_size as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(guard_size) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched_policy as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(sched_policy) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched_priority as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(sched_priority) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(__reserved) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_barrier_t { - pub __private: [i64; 4usize], -} -#[test] -fn bindgen_test_layout_pthread_barrier_t() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pthread_barrier_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pthread_barrier_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_barrier_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_barrierattr_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_cond_t { - pub __private: [i32; 12usize], -} -#[test] -fn bindgen_test_layout_pthread_cond_t() { - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(pthread_cond_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_cond_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_cond_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_condattr_t = ::std::os::raw::c_long; -pub type pthread_key_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_mutex_t { - pub __private: [i32; 10usize], -} -#[test] -fn bindgen_test_layout_pthread_mutex_t() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(pthread_mutex_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_mutex_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_mutex_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_mutexattr_t = ::std::os::raw::c_long; -pub type pthread_once_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_rwlock_t { - pub __private: [i32; 14usize], -} -#[test] -fn bindgen_test_layout_pthread_rwlock_t() { - assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(pthread_rwlock_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_rwlock_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_rwlock_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_rwlockattr_t = ::std::os::raw::c_long; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pthread_spinlock_t { - pub __private: i64, -} -#[test] -fn bindgen_test_layout_pthread_spinlock_t() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pthread_spinlock_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pthread_spinlock_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_spinlock_t), - "::", - stringify!(__private) - ) - ); -} -pub type pthread_t = ::std::os::raw::c_long; pub type __gid_t = __kernel_gid32_t; pub type gid_t = __gid_t; pub type __uid_t = __kernel_uid32_t; @@ -1932,67 +1690,6 @@ pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; pub type ADataSpace = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ARect { - pub left: i32, - pub top: i32, - pub right: i32, - pub bottom: i32, -} -#[test] -fn bindgen_test_layout_ARect() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(ARect)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ARect)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).left as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(left) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).top as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(top) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).right as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(right) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).bottom as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(bottom) - ) - ); -} pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: AHardwareBuffer_Format = 3; @@ -6517,7 +6214,6 @@ fn bindgen_test_layout___kernel_sigaction() { ); } #[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct sigaltstack { pub ss_sp: *mut ::std::os::raw::c_void, pub ss_flags: ::std::os::raw::c_int, @@ -8702,7 +8398,6 @@ fn bindgen_test_layout_mcontext_t() { ); } #[repr(C)] -#[derive(Copy, Clone)] pub struct ucontext { pub uc_flags: ::std::os::raw::c_ulong, pub uc_link: *mut ucontext, @@ -8985,26 +8680,6 @@ extern "C" { extern "C" { pub fn psignal(__signal: ::std::os::raw::c_int, __msg: *const ::std::os::raw::c_char); } -extern "C" { - pub fn pthread_kill( - __pthread: pthread_t, - __signal: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_sigmask( - __how: ::std::os::raw::c_int, - __new_set: *const sigset_t, - __old_set: *mut sigset_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_sigmask64( - __how: ::std::os::raw::c_int, - __new_set: *const sigset64_t, - __old_set: *mut sigset64_t, - ) -> ::std::os::raw::c_int; -} extern "C" { pub fn sigqueue( __pid: pid_t, @@ -9616,506 +9291,6 @@ pub type _bindgen_ty_23 = ::std::os::raw::c_uint; pub const PTHREAD_RWLOCK_PREFER_READER_NP: ::std::os::raw::c_uint = 0; pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: ::std::os::raw::c_uint = 1; pub type _bindgen_ty_24 = ::std::os::raw::c_uint; -extern "C" { - pub fn pthread_atfork( - __prepare: ::std::option::Option, - __parent: ::std::option::Option, - __child: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_destroy(__attr: *mut pthread_attr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getdetachstate( - __attr: *const pthread_attr_t, - __state: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getguardsize( - __attr: *const pthread_attr_t, - __size: *mut size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getinheritsched( - __attr: *const pthread_attr_t, - __flag: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getschedparam( - __attr: *const pthread_attr_t, - __param: *mut sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getschedpolicy( - __attr: *const pthread_attr_t, - __policy: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getscope( - __attr: *const pthread_attr_t, - __scope: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getstack( - __attr: *const pthread_attr_t, - __addr: *mut *mut ::std::os::raw::c_void, - __size: *mut size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_getstacksize( - __attr: *const pthread_attr_t, - __size: *mut size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_init(__attr: *mut pthread_attr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setdetachstate( - __attr: *mut pthread_attr_t, - __state: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setguardsize( - __attr: *mut pthread_attr_t, - __size: size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setinheritsched( - __attr: *mut pthread_attr_t, - __flag: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setschedparam( - __attr: *mut pthread_attr_t, - __param: *const sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setschedpolicy( - __attr: *mut pthread_attr_t, - __policy: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setscope( - __attr: *mut pthread_attr_t, - __scope: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setstack( - __attr: *mut pthread_attr_t, - __addr: *mut ::std::os::raw::c_void, - __size: size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_attr_setstacksize( - __addr: *mut pthread_attr_t, - __size: size_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_destroy(__attr: *mut pthread_condattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_getclock( - __attr: *const pthread_condattr_t, - __clock: *mut clockid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_getpshared( - __attr: *const pthread_condattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_init(__attr: *mut pthread_condattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_setclock( - __attr: *mut pthread_condattr_t, - __clock: clockid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_condattr_setpshared( - __attr: *mut pthread_condattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_broadcast(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_clockwait( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - __clock: clockid_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_destroy(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_init( - __cond: *mut pthread_cond_t, - __attr: *const pthread_condattr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_signal(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_timedwait( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_timedwait_monotonic_np( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_cond_wait( - __cond: *mut pthread_cond_t, - __mutex: *mut pthread_mutex_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_create( - __pthread_ptr: *mut pthread_t, - __attr: *const pthread_attr_t, - __start_routine: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void, - >, - arg1: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_detach(__pthread: pthread_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_exit(__return_value: *mut ::std::os::raw::c_void); -} -extern "C" { - pub fn pthread_equal(__lhs: pthread_t, __rhs: pthread_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getattr_np( - __pthread: pthread_t, - __attr: *mut pthread_attr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getcpuclockid( - __pthread: pthread_t, - __clock: *mut clockid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getschedparam( - __pthread: pthread_t, - __policy: *mut ::std::os::raw::c_int, - __param: *mut sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_getspecific(__key: pthread_key_t) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn pthread_gettid_np(__pthread: pthread_t) -> pid_t; -} -extern "C" { - pub fn pthread_join( - __pthread: pthread_t, - __return_value_ptr: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_key_create( - __key_ptr: *mut pthread_key_t, - __key_destructor: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void), - >, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_key_delete(__key: pthread_key_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_destroy(__attr: *mut pthread_mutexattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_getpshared( - __attr: *const pthread_mutexattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_gettype( - __attr: *const pthread_mutexattr_t, - __type: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_getprotocol( - __attr: *const pthread_mutexattr_t, - __protocol: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_init(__attr: *mut pthread_mutexattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_setpshared( - __attr: *mut pthread_mutexattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_settype( - __attr: *mut pthread_mutexattr_t, - __type: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutexattr_setprotocol( - __attr: *mut pthread_mutexattr_t, - __protocol: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_clocklock( - __mutex: *mut pthread_mutex_t, - __clock: clockid_t, - __abstime: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_destroy(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_init( - __mutex: *mut pthread_mutex_t, - __attr: *const pthread_mutexattr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_lock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_timedlock( - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_timedlock_monotonic_np( - __mutex: *mut pthread_mutex_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_trylock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_mutex_unlock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_once( - __once: *mut pthread_once_t, - __init_routine: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_init(__attr: *mut pthread_rwlockattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_destroy(__attr: *mut pthread_rwlockattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_getpshared( - __attr: *const pthread_rwlockattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_setpshared( - __attr: *mut pthread_rwlockattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_getkind_np( - __attr: *const pthread_rwlockattr_t, - __kind: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlockattr_setkind_np( - __attr: *mut pthread_rwlockattr_t, - __kind: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_clockrdlock( - __rwlock: *mut pthread_rwlock_t, - __clock: clockid_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_clockwrlock( - __rwlock: *mut pthread_rwlock_t, - __clock: clockid_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_destroy(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_init( - __rwlock: *mut pthread_rwlock_t, - __attr: *const pthread_rwlockattr_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_rdlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedrdlock( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedrdlock_monotonic_np( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedwrlock( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_timedwrlock_monotonic_np( - __rwlock: *mut pthread_rwlock_t, - __timeout: *const timespec, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_tryrdlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_trywrlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_unlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_rwlock_wrlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_init(__attr: *mut pthread_barrierattr_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_destroy(__attr: *mut pthread_barrierattr_t) - -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_getpshared( - __attr: *const pthread_barrierattr_t, - __shared: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrierattr_setpshared( - __attr: *mut pthread_barrierattr_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrier_init( - __barrier: *mut pthread_barrier_t, - __attr: *const pthread_barrierattr_t, - __count: ::std::os::raw::c_uint, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrier_destroy(__barrier: *mut pthread_barrier_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_barrier_wait(__barrier: *mut pthread_barrier_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_destroy(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_init( - __spinlock: *mut pthread_spinlock_t, - __shared: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_lock(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_trylock(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_spin_unlock(__spinlock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_self() -> pthread_t; -} -extern "C" { - pub fn pthread_setname_np( - __pthread: pthread_t, - __name: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_setschedparam( - __pthread: pthread_t, - __policy: ::std::os::raw::c_int, - __param: *const sched_param, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_setschedprio( - __pthread: pthread_t, - __priority: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pthread_setspecific( - __key: pthread_key_t, - __value: *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} pub type __pthread_cleanup_func_t = ::std::option::Option; #[repr(C)] @@ -10414,7 +9589,6 @@ pub type android_motion_event_filter = #[doc = " See the sample named \"native-activity\" that comes with the NDK with a"] #[doc = " full usage example. Also look at the documentation of GameActivity."] #[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct android_app { #[doc = " An optional pointer to application-defined state."] pub userData: *mut ::std::os::raw::c_void, diff --git a/android-activity/src/lib.rs b/android-activity/src/lib.rs index ff6aeb6..787be40 100644 --- a/android-activity/src/lib.rs +++ b/android-activity/src/lib.rs @@ -69,6 +69,25 @@ pub struct Rect { pub bottom: i32, } +impl Rect { + /// An empty `Rect` with all components set to zero. + pub fn empty() -> Self { + Self { left: 0, top: 0, right: 0, bottom: 0 } + } +} + +impl Into for Rect { + fn into(self) -> ndk_sys::ARect { + ndk_sys::ARect { left: self.left, right: self.right, top: self.top, bottom: self.bottom } + } +} + +impl From for Rect { + fn from(arect: ndk_sys::ARect) -> Self { + Self { left: arect.left, right: arect.right, top: arect.top, bottom: arect.bottom } + } +} + pub type StateSaver<'a> = activity_impl::StateSaver<'a>; pub type StateLoader<'a> = activity_impl::StateLoader<'a>; diff --git a/android-activity/src/native_activity/ffi.rs b/android-activity/src/native_activity/ffi.rs index fde83f0..4b9a8de 100644 --- a/android-activity/src/native_activity/ffi.rs +++ b/android-activity/src/native_activity/ffi.rs @@ -13,10 +13,8 @@ #![allow(dead_code)] use jni_sys::*; -use ndk_sys::AAssetManager; -use ndk_sys::ANativeWindow; -use ndk_sys::{AConfiguration, AInputQueue, ALooper}; -use libc::{pthread_t, pthread_mutex_t, pthread_cond_t}; +use ndk_sys::{ARect, AConfiguration, AInputQueue, ALooper, AAssetManager, ANativeWindow}; +use libc::{size_t, pthread_t, pthread_mutex_t, pthread_cond_t}; #[cfg(all( any(target_os = "android", feature = "test"), diff --git a/android-activity/src/native_activity/ffi_aarch64.rs b/android-activity/src/native_activity/ffi_aarch64.rs index 3c9ae42..3d81790 100644 --- a/android-activity/src/native_activity/ffi_aarch64.rs +++ b/android-activity/src/native_activity/ffi_aarch64.rs @@ -699,7 +699,6 @@ fn bindgen_test_layout_pollfd() { ) ); } -pub type size_t = ::std::os::raw::c_ulong; pub type wchar_t = ::std::os::raw::c_uint; #[repr(C)] #[repr(align(16))] @@ -1362,7 +1361,6 @@ fn bindgen_test_layout___kernel_sigaction() { ); } #[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct sigaltstack { pub ss_sp: *mut ::std::os::raw::c_void, pub ss_flags: ::std::os::raw::c_int, @@ -2731,7 +2729,6 @@ pub type fpregset_t = user_fpsimd_struct; pub type mcontext_t = sigcontext; #[repr(C)] #[repr(align(16))] -#[derive(Copy, Clone)] pub struct ucontext { pub uc_flags: ::std::os::raw::c_ulong, pub uc_link: *mut ucontext, @@ -5032,67 +5029,6 @@ pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; pub type ADataSpace = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ARect { - pub left: i32, - pub top: i32, - pub right: i32, - pub bottom: i32, -} -#[test] -fn bindgen_test_layout_ARect() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(ARect)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ARect)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).left as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(left) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).top as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(top) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).right as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(right) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).bottom as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(bottom) - ) - ); -} pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: AHardwareBuffer_Format = 3; @@ -6395,7 +6331,7 @@ extern "C" { extern "C" { pub fn android_app_create( activity: *mut ANativeActivity, - savedState: *mut ::std::os::raw::c_void, + savedState: *const ::std::os::raw::c_void, savedStateSize: size_t, ) -> *mut android_app; } @@ -6415,10 +6351,7 @@ extern "C" { pub fn android_app_free(android_app: *mut android_app); } extern "C" { - #[doc = " Dummy function that used to be used to prevent the linker from stripping app"] - #[doc = " glue code. No longer necessary, since __attribute__((visibility(\"default\")))"] - #[doc = " does this for us."] - pub fn app_dummy(); + pub fn android_app_entry(param: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } extern "C" { #[doc = " This is the function that application code must implement, representing"] diff --git a/android-activity/src/native_activity/ffi_arm.rs b/android-activity/src/native_activity/ffi_arm.rs index a80f853..00063db 100644 --- a/android-activity/src/native_activity/ffi_arm.rs +++ b/android-activity/src/native_activity/ffi_arm.rs @@ -731,7 +731,6 @@ fn bindgen_test_layout_pollfd() { ) ); } -pub type size_t = ::std::os::raw::c_uint; pub type wchar_t = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -1330,7 +1329,6 @@ fn bindgen_test_layout___kernel_sigaction() { ); } #[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct sigaltstack { pub ss_sp: *mut ::std::os::raw::c_void, pub ss_flags: ::std::os::raw::c_int, @@ -3162,7 +3160,6 @@ pub type fpregset_t = user_fpregs; pub type mcontext_t = sigcontext; #[repr(C)] #[repr(align(8))] -#[derive(Copy, Clone)] pub struct ucontext { pub uc_flags: ::std::os::raw::c_ulong, pub uc_link: *mut ucontext, @@ -5512,67 +5509,6 @@ pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; pub type ADataSpace = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ARect { - pub left: i32, - pub top: i32, - pub right: i32, - pub bottom: i32, -} -#[test] -fn bindgen_test_layout_ARect() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(ARect)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ARect)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).left as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(left) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).top as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(top) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).right as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(right) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).bottom as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(bottom) - ) - ); -} pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: AHardwareBuffer_Format = 3; @@ -6875,7 +6811,7 @@ extern "C" { extern "C" { pub fn android_app_create( activity: *mut ANativeActivity, - savedState: *mut ::std::os::raw::c_void, + savedState: *const ::std::os::raw::c_void, savedStateSize: size_t, ) -> *mut android_app; } @@ -6895,10 +6831,7 @@ extern "C" { pub fn android_app_free(android_app: *mut android_app); } extern "C" { - #[doc = " Dummy function that used to be used to prevent the linker from stripping app"] - #[doc = " glue code. No longer necessary, since __attribute__((visibility(\"default\")))"] - #[doc = " does this for us."] - pub fn app_dummy(); + pub fn android_app_entry(param: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } extern "C" { #[doc = " This is the function that application code must implement, representing"] diff --git a/android-activity/src/native_activity/ffi_i686.rs b/android-activity/src/native_activity/ffi_i686.rs index febea7d..2d0df7b 100644 --- a/android-activity/src/native_activity/ffi_i686.rs +++ b/android-activity/src/native_activity/ffi_i686.rs @@ -651,7 +651,6 @@ fn bindgen_test_layout_pollfd() { ) ); } -pub type size_t = ::std::os::raw::c_uint; pub type wchar_t = ::std::os::raw::c_int; #[repr(C)] #[repr(align(8))] @@ -3098,7 +3097,6 @@ fn bindgen_test_layout___kernel_sigaction() { ); } #[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct sigaltstack { pub ss_sp: *mut ::std::os::raw::c_void, pub ss_flags: ::std::os::raw::c_int, @@ -5229,7 +5227,6 @@ fn bindgen_test_layout_mcontext_t() { ); } #[repr(C)] -#[derive(Copy, Clone)] pub struct ucontext { pub uc_flags: ::std::os::raw::c_ulong, pub uc_link: *mut ucontext, @@ -7257,67 +7254,6 @@ pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; pub type ADataSpace = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ARect { - pub left: i32, - pub top: i32, - pub right: i32, - pub bottom: i32, -} -#[test] -fn bindgen_test_layout_ARect() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(ARect)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ARect)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).left as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(left) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).top as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(top) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).right as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(right) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).bottom as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(bottom) - ) - ); -} pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: AHardwareBuffer_Format = 3; @@ -8620,7 +8556,7 @@ extern "C" { extern "C" { pub fn android_app_create( activity: *mut ANativeActivity, - savedState: *mut ::std::os::raw::c_void, + savedState: *const ::std::os::raw::c_void, savedStateSize: size_t, ) -> *mut android_app; } @@ -8640,10 +8576,7 @@ extern "C" { pub fn android_app_free(android_app: *mut android_app); } extern "C" { - #[doc = " Dummy function that used to be used to prevent the linker from stripping app"] - #[doc = " glue code. No longer necessary, since __attribute__((visibility(\"default\")))"] - #[doc = " does this for us."] - pub fn app_dummy(); + pub fn android_app_entry(param: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } extern "C" { #[doc = " This is the function that application code must implement, representing"] diff --git a/android-activity/src/native_activity/ffi_x86_64.rs b/android-activity/src/native_activity/ffi_x86_64.rs index 8ed9c94..b691ea3 100644 --- a/android-activity/src/native_activity/ffi_x86_64.rs +++ b/android-activity/src/native_activity/ffi_x86_64.rs @@ -679,7 +679,6 @@ fn bindgen_test_layout_pollfd() { ) ); } -pub type size_t = ::std::os::raw::c_ulong; pub type wchar_t = ::std::os::raw::c_int; #[repr(C)] #[repr(align(16))] @@ -3102,7 +3101,6 @@ fn bindgen_test_layout___kernel_sigaction() { ); } #[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct sigaltstack { pub ss_sp: *mut ::std::os::raw::c_void, pub ss_flags: ::std::os::raw::c_int, @@ -5287,7 +5285,6 @@ fn bindgen_test_layout_mcontext_t() { ); } #[repr(C)] -#[derive(Copy, Clone)] pub struct ucontext { pub uc_flags: ::std::os::raw::c_ulong, pub uc_link: *mut ucontext, @@ -7275,67 +7272,6 @@ pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; pub type ADataSpace = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ARect { - pub left: i32, - pub top: i32, - pub right: i32, - pub bottom: i32, -} -#[test] -fn bindgen_test_layout_ARect() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(ARect)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ARect)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).left as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(left) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).top as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(top) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).right as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(right) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).bottom as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ARect), - "::", - stringify!(bottom) - ) - ); -} pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: AHardwareBuffer_Format = 3; @@ -8638,7 +8574,7 @@ extern "C" { extern "C" { pub fn android_app_create( activity: *mut ANativeActivity, - savedState: *mut ::std::os::raw::c_void, + savedState: *const ::std::os::raw::c_void, savedStateSize: size_t, ) -> *mut android_app; } @@ -8658,10 +8594,7 @@ extern "C" { pub fn android_app_free(android_app: *mut android_app); } extern "C" { - #[doc = " Dummy function that used to be used to prevent the linker from stripping app"] - #[doc = " glue code. No longer necessary, since __attribute__((visibility(\"default\")))"] - #[doc = " does this for us."] - pub fn app_dummy(); + pub fn android_app_entry(param: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } extern "C" { #[doc = " This is the function that application code must implement, representing"] diff --git a/android-activity/src/native_activity/mod.rs b/android-activity/src/native_activity/mod.rs index 28d8bde..e7afb8c 100644 --- a/android-activity/src/native_activity/mod.rs +++ b/android-activity/src/native_activity/mod.rs @@ -479,10 +479,101 @@ impl AndroidAppInner { } } +extern "C" fn android_app_main(arg: *mut libc::c_void) -> *mut libc::c_void { + unsafe { ffi::android_app_entry(arg) as *mut _ } +} + +unsafe extern "C" fn android_app_create(activity: *mut ffi::ANativeActivity, + saved_state_in: *const libc::c_void, saved_state_size: libc::size_t) -> *mut ffi::android_app +{ + let mut msgpipe: [libc::c_int; 2] = [ -1, -1 ]; + if libc::pipe(msgpipe.as_mut_ptr()) != 0 { + panic!("could not create Rust <-> Java IPC pipe: {}", std::io::Error::last_os_error()); + } + + // For now we need to use malloc to track saved state, while the android_native_app_glue + // code will use free() to free the memory. + let mut saved_state = ptr::null_mut(); + if saved_state_in != ptr::null() && saved_state_size > 0 { + saved_state = libc::malloc(saved_state_size); + assert!(saved_state != ptr::null_mut(), "Failed to allocate {} bytes for restoring saved application state", saved_state_size); + libc::memcpy(saved_state, saved_state_in, saved_state_size); + } + + let android_app = Box::into_raw(Box::new(ffi::android_app { + userData: ptr::null_mut(), + onAppCmd: None, + onInputEvent: None, + activity, + config: ptr::null_mut(), + savedState: saved_state, + savedStateSize: saved_state_size, + looper: ptr::null_mut(), + inputQueue: ptr::null_mut(), + window: ptr::null_mut(), + contentRect: Rect::empty().into(), + activityState: 0, + destroyRequested: 0, + mutex: libc::PTHREAD_MUTEX_INITIALIZER, + cond: libc::PTHREAD_COND_INITIALIZER, + msgread: msgpipe[0], + msgwrite: msgpipe[1], + thread: 0, + cmdPollSource: ffi::android_poll_source { id: 0, app: ptr::null_mut(), process: None }, + inputPollSource: ffi::android_poll_source { id: 0, app: ptr::null_mut(), process: None }, + running: 0, + stateSaved: 0, + destroyed: 0, + redrawNeeded: 0, + pendingInputQueue: ptr::null_mut(), + pendingWindow: ptr::null_mut(), + pendingContentRect: Rect::empty().into(), + })); + + // TODO: use std::os::spawn and drop the handle to detach instead of directly + // using pthread_create + let mut attr = std::mem::MaybeUninit::::zeroed(); + libc::pthread_attr_init(attr.as_mut_ptr()); + libc::pthread_attr_setdetachstate(attr.as_mut_ptr(), libc::PTHREAD_CREATE_DETACHED); + let mut thread = std::mem::MaybeUninit::::zeroed(); + libc::pthread_create(thread.as_mut_ptr(), attr.as_mut_ptr(), android_app_main, android_app as *mut _); + let thread = thread.assume_init(); + (*android_app).thread = thread; + + // TODO: switch to std::sync::Condvar + // Wait for thread to start. + libc::pthread_mutex_lock(&mut (*android_app).mutex as *mut _); + while (*android_app).running == 0 { + libc::pthread_cond_wait(&mut (*android_app).cond as *mut _, &mut (*android_app).mutex as *mut _); + } + libc::pthread_mutex_unlock(&mut (*android_app).mutex as *mut _); + + android_app +} + +unsafe extern "C" fn android_app_drop(android_app: *mut ffi::android_app) { + libc::pthread_mutex_lock(&mut (*android_app).mutex as *mut _); + ffi::android_app_write_cmd(android_app, ffi::APP_CMD_DESTROY as i8); + while !(*android_app).destroyed == 0 { + libc::pthread_cond_wait(&mut (*android_app).cond as *mut _, &mut (*android_app).mutex as *mut _); + } + libc::pthread_mutex_unlock(&mut (*android_app).mutex as *mut _); + + libc::close((*android_app).msgread); + libc::close((*android_app).msgwrite); + libc::pthread_cond_destroy(&mut (*android_app).cond as *mut _); + libc::pthread_mutex_destroy(&mut (*android_app).mutex as *mut _); + + let _android_app = Box::from_raw(android_app); + // Box dropped here +} + unsafe extern "C" fn on_destroy(activity: *mut ffi::ANativeActivity) { log::debug!("Destroy: {:p}\n", activity); + let android_app: *mut ffi::android_app = (*activity).instance.cast(); - ffi::android_app_free(android_app); + (*activity).instance = ptr::null_mut(); + android_app_drop(android_app); } unsafe extern "C" fn on_start(activity: *mut ffi::ANativeActivity) { @@ -498,7 +589,7 @@ unsafe extern "C" fn on_resume(activity: *mut ffi::ANativeActivity) { ffi::android_app_set_activity_state(android_app, ffi::APP_CMD_RESUME as i8); } -unsafe extern "C" fn on_save_instance_state(activity: *mut ffi::ANativeActivity, out_len: *mut ffi::size_t) -> *mut libc::c_void { +unsafe extern "C" fn on_save_instance_state(activity: *mut ffi::ANativeActivity, out_len: *mut libc::size_t) -> *mut libc::c_void { let android_app: *mut ffi::android_app = (*activity).instance.cast(); let mut saved_state: *mut libc::c_void = ptr::null_mut(); @@ -580,8 +671,8 @@ unsafe extern "C" fn on_input_queue_destroyed(activity: *mut ffi::ANativeActivit #[no_mangle] unsafe extern "C" fn ANativeActivity_onCreate( activity: *mut ffi::ANativeActivity, - saved_state: *mut std::os::raw::c_void, - saved_state_size: usize, + saved_state: *const libc::c_void, + saved_state_size: libc::size_t, ) { log::debug!("Creating: {:p}", activity); @@ -599,7 +690,7 @@ unsafe extern "C" fn ANativeActivity_onCreate( (*(*activity).callbacks).onInputQueueCreated = Some(on_input_queue_created); (*(*activity).callbacks).onInputQueueDestroyed = Some(on_input_queue_destroyed); - (*activity).instance = ffi::android_app_create(activity, saved_state, saved_state_size as u64) as *mut _; + (*activity).instance = android_app_create(activity, saved_state, saved_state_size) as *mut _; } fn android_log(level: Level, tag: &CStr, msg: &CStr) {