Skip to content
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

Optimize Net module for Android #4517

Merged
merged 2 commits into from Apr 2, 2024

Conversation

zhuzeitou
Copy link
Contributor

  1. Poco uses epoll_create, epoll_ctl and epoll_wait, and they are always available for NDK. So we can enable epoll for Android platform.
int epoll_create(int __size);

#if __ANDROID_API__ >= 21
int epoll_create1(int __flags) __INTRODUCED_IN(21);
#endif /* __ANDROID_API__ >= 21 */


int epoll_ctl(int __epoll_fd, int __op, int __fd, struct epoll_event* __BIONIC_COMPLICATED_NULLNESS __event);
int epoll_wait(int __epoll_fd, struct epoll_event* _Nonnull __events, int __event_count, int __timeout_ms);

#if __ANDROID_API__ >= 21
int epoll_pwait(int __epoll_fd, struct epoll_event* _Nonnull __events, int __event_count, int __timeout_ms, const sigset_t* _Nullable __mask) __INTRODUCED_IN(21);
#endif /* __ANDROID_API__ >= 21 */


#if __ANDROID_API__ >= 28
int epoll_pwait64(int __epoll_fd, struct epoll_event* _Nonnull __events, int __event_count, int __timeout_ms, const sigset64_t* _Nullable __mask) __INTRODUCED_IN(28);
#endif /* __ANDROID_API__ >= 28 */
  1. <ifaddr.h>(getifaddrs and freeifaddrs) was introduced in android-24, so we can use __ANDROID_API__ >= 24 to check if they are supported
#if __ANDROID_API__ >= 24
int getifaddrs(struct ifaddrs* _Nullable * _Nonnull __list_ptr) __INTRODUCED_IN(24);

/**
 * [freeifaddrs(3)](http://man7.org/linux/man-pages/man3/freeifaddrs.3.html) frees a linked list
 * of `struct ifaddrs` returned by getifaddrs().
 *
 * Available since API level 24.
 */
void freeifaddrs(struct ifaddrs* _Nullable __ptr) __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */

@aleks-f aleks-f added this to the Release 1.13.3 milestone Apr 2, 2024
@aleks-f aleks-f merged commit 3496e47 into pocoproject:devel Apr 2, 2024
32 checks passed
aleks-f pushed a commit that referenced this pull request Apr 2, 2024
* epoll is available on Android

* <ifaddrs.h> is introduced in android-24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants