diff options
author | thegeorg <thegeorg@yandex-team.com> | 2023-09-04 18:02:10 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2023-09-04 18:17:48 +0300 |
commit | 78d24dcefc7f0c0174e9287c7769bab54cae370a (patch) | |
tree | 415a9f6d80d88e0dcc1ae657543c9bbfeb365a3e | |
parent | 6150a5181282cea17949009ca6517b609c29c6f7 (diff) | |
download | ydb-78d24dcefc7f0c0174e9287c7769bab54cae370a.tar.gz |
Provide getrandom for Android too
-rw-r--r-- | contrib/libs/libc_compat/random/getentropy.c | 4 | ||||
-rw-r--r-- | contrib/libs/libc_compat/ya.make | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/contrib/libs/libc_compat/random/getentropy.c b/contrib/libs/libc_compat/random/getentropy.c index 651ea95f14..50e9c2fae2 100644 --- a/contrib/libs/libc_compat/random/getentropy.c +++ b/contrib/libs/libc_compat/random/getentropy.c @@ -14,7 +14,9 @@ int getentropy(void *buffer, size_t len) return -1; } +#if defined(__linux__) && !defined(__ANDROID__) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); +#endif while (len) { ret = getrandom(pos, len, 0); @@ -27,7 +29,9 @@ int getentropy(void *buffer, size_t len) ret = 0; } +#if defined(__linux__) && !defined(__ANDROID__) pthread_setcancelstate(cs, 0); +#endif return ret; } diff --git a/contrib/libs/libc_compat/ya.make b/contrib/libs/libc_compat/ya.make index 44ebf490b0..8865d284d9 100644 --- a/contrib/libs/libc_compat/ya.make +++ b/contrib/libs/libc_compat/ya.make @@ -33,10 +33,12 @@ IF (OS_ANDROID) strlcat.c strlcpy.c ) + IF (ANDROID_API < 28) SRCS( glob.c ) + ENABLE(PROVIDE_GETRANDOM_GETENTROPY) ENABLE(PROVIDE_REALLOCARRAY) ENDIF() IF (ANDROID_API < 24) |