Skip to content

Added compiling target Android support #982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

shadichy
Copy link

No description provided.

Created `pthread/btrfs_pthread.h` and `pthread/btrfs_pthread.c` to allow Android and bionic libc emulating `pthread_setcanceltype`, `pthread_setcancelstate`, `pthread_cancel` and some other definitions.
Since Android NDK does not support `pthread_cancel()`, this workaround method uses `pthread_kill()` instead.

Signed-off-by: Shadichy <[email protected]>
This patch is from termux/termux-packages

Signed-off-by: Shadichy <[email protected]>
…rgeting Android

Android NDK does not support `qsort_r`, this workaround first add a list of `id` to struct `compare`, and then reverse the list, and finally do the sorting stuffs using `qsort`.
This helps preserve the sorting order without `qsort_r`

Signed-off-by: Shadichy <[email protected]>
@kdave kdave force-pushed the devel branch 6 times, most recently from ef43ce6 to 3eff852 Compare May 30, 2025 14:14
@kdave
Copy link
Owner

kdave commented May 30, 2025

Thanks, this will need to be reworked so there are no standalone ifdefs just for android. Compatibility wrappers should be hidden in files, detected at build time and the implementation switched by some ifdef. I'll apply the patches without changes as this is what you've probably tested and do the updates myself.

As this will become supported config, we'll need github actions for that too.

@kdave kdave added this to the v6.15 milestone May 30, 2025
@kdave
Copy link
Owner

kdave commented May 30, 2025

The qsort_r can be emulated by providing a thread-local storage and calling qsort with a stub function that will call the comparator with the stored data. There's more qsort_r usage and likely will be in the future so we should not need to do the emulation everywhere.

pthread_cancel; /* used */
local:
*;
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? The file is not used anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants