diff options
author | pg <pg@yandex-team.com> | 2024-07-23 08:34:33 +0300 |
---|---|---|
committer | pg <pg@yandex-team.com> | 2024-07-23 08:44:00 +0300 |
commit | 88fe33ed4ed2ef71fc340e101b56fffca1d43e0a (patch) | |
tree | 8219215a7b65835007a8b0cbc3a3b0283d4ff66a | |
parent | 54d215ab1866647be27afadededdb8f1713b5c8f (diff) | |
download | ydb-88fe33ed4ed2ef71fc340e101b56fffca1d43e0a.tar.gz |
dedaf1ec1008e987c6bb5d57ef7d4707c5103d11
-rwxr-xr-x | build/ymake_conf.py | 2 | ||||
-rw-r--r-- | contrib/libs/libc_compat/ubuntu_14/aligned_alloc.c | 6 | ||||
-rw-r--r-- | contrib/libs/libc_compat/ubuntu_14/c16rtomb.c | 35 | ||||
-rw-r--r-- | contrib/libs/libc_compat/ubuntu_14/c32rtomb.c | 7 | ||||
-rw-r--r-- | contrib/libs/libc_compat/ubuntu_14/features.h | 5 | ||||
-rw-r--r-- | contrib/libs/libc_compat/ubuntu_14/getauxval.cpp | 10 | ||||
-rw-r--r-- | contrib/libs/libc_compat/ubuntu_14/glibc.cpp | 111 | ||||
-rw-r--r-- | contrib/libs/libc_compat/ubuntu_14/glibc.h | 20 | ||||
-rw-r--r-- | contrib/libs/libc_compat/ubuntu_14/mbrtoc16.c | 30 | ||||
-rw-r--r-- | contrib/libs/libc_compat/ubuntu_14/mbrtoc32.c | 13 | ||||
-rw-r--r-- | contrib/libs/libc_compat/ubuntu_14/secure_getenv.cpp | 12 | ||||
-rw-r--r-- | contrib/libs/libc_compat/ubuntu_14/timespec_get.c | 10 |
12 files changed, 1 insertions, 260 deletions
diff --git a/build/ymake_conf.py b/build/ymake_conf.py index a34c6f9a9d..1db5338b42 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -41,7 +41,7 @@ class WindowsVersion(object): ANDROID_API_DEFAULT = 21 # This is default Linux SDK unless `-DOS_SDK` is specified in cmdline -LINUX_SDK_DEFAULT = "ubuntu-14" +LINUX_SDK_DEFAULT = "ubuntu-16" MACOS_VERSION_MIN = "11.0" MACOS_VERSION_MIN_AS_INT = "110000" diff --git a/contrib/libs/libc_compat/ubuntu_14/aligned_alloc.c b/contrib/libs/libc_compat/ubuntu_14/aligned_alloc.c deleted file mode 100644 index c4a1378624..0000000000 --- a/contrib/libs/libc_compat/ubuntu_14/aligned_alloc.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <malloc.h> -#include <stdlib.h> - -__attribute__((weak)) void* aligned_alloc(size_t alignment, size_t size) { - return memalign(alignment, size); -} diff --git a/contrib/libs/libc_compat/ubuntu_14/c16rtomb.c b/contrib/libs/libc_compat/ubuntu_14/c16rtomb.c deleted file mode 100644 index 39ca3758fa..0000000000 --- a/contrib/libs/libc_compat/ubuntu_14/c16rtomb.c +++ /dev/null @@ -1,35 +0,0 @@ -#include <uchar.h> -#include <errno.h> -#include <wchar.h> - -size_t c16rtomb(char *restrict s, char16_t c16, mbstate_t *restrict ps) -{ - static unsigned internal_state; - if (!ps) ps = (void *)&internal_state; - unsigned *x = (unsigned *)ps; - wchar_t wc; - - if (!s) { - if (*x) goto ilseq; - return 1; - } - - if (!*x && c16 - 0xd800u < 0x400) { - *x = c16 - 0xd7c0 << 10; - return 0; - } - - if (*x) { - if (c16 - 0xdc00u >= 0x400) goto ilseq; - else wc = *x + c16 - 0xdc00; - *x = 0; - } else { - wc = c16; - } - return wcrtomb(s, wc, 0); - -ilseq: - *x = 0; - errno = EILSEQ; - return -1; -} diff --git a/contrib/libs/libc_compat/ubuntu_14/c32rtomb.c b/contrib/libs/libc_compat/ubuntu_14/c32rtomb.c deleted file mode 100644 index 67851328e8..0000000000 --- a/contrib/libs/libc_compat/ubuntu_14/c32rtomb.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <uchar.h> -#include <wchar.h> - -size_t c32rtomb(char *restrict s, char32_t c32, mbstate_t *restrict ps) -{ - return wcrtomb(s, c32, ps); -} diff --git a/contrib/libs/libc_compat/ubuntu_14/features.h b/contrib/libs/libc_compat/ubuntu_14/features.h deleted file mode 100644 index 9fbab45ab5..0000000000 --- a/contrib/libs/libc_compat/ubuntu_14/features.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#define weak __attribute__((__weak__)) -#define weak_alias(old, new) \ - extern __typeof(old) new __attribute__((__weak__, __alias__(#old))) diff --git a/contrib/libs/libc_compat/ubuntu_14/getauxval.cpp b/contrib/libs/libc_compat/ubuntu_14/getauxval.cpp deleted file mode 100644 index 9f20dd0195..0000000000 --- a/contrib/libs/libc_compat/ubuntu_14/getauxval.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include <sys/auxv.h> - -#include "glibc.h" -#include "features.h" - -extern "C" { - unsigned long getauxval(unsigned long item) noexcept { - return NUbuntuCompat::GetGlibc().GetAuxVal(item); - } -} diff --git a/contrib/libs/libc_compat/ubuntu_14/glibc.cpp b/contrib/libs/libc_compat/ubuntu_14/glibc.cpp deleted file mode 100644 index 1cc444bce1..0000000000 --- a/contrib/libs/libc_compat/ubuntu_14/glibc.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#include <elf.h> -#include <errno.h> -#include <fcntl.h> -#include <stdlib.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> - -#include "glibc.h" -#include "features.h" - -namespace { - void ReadAuxVector(Elf64_auxv_t** begin, Elf64_auxv_t** end) noexcept { - int fd = open("/proc/self/auxv", O_RDONLY | O_CLOEXEC); - if (fd == -1) { - return; - } - - constexpr size_t item_size = sizeof(Elf64_auxv_t); - constexpr size_t block_size = item_size * 32; - - size_t bytes_read = 0; - size_t size = 0; - - struct TBuffer { - ~TBuffer() { - free(Pointer); - } - char* Pointer = nullptr; - } buffer; - - while (true) { - size_t bytes_left = size - bytes_read; - - if (!bytes_left) { - size += block_size; - char* new_buffer = (char*)realloc(buffer.Pointer, size); - if (!new_buffer) { - return; - } - buffer.Pointer = new_buffer; - continue; - } - - ssize_t r = read(fd, buffer.Pointer + bytes_read, bytes_left); - if (!r) { - break; - } else if (r < 0) { - if (errno == EINTR) { - continue; - } else { - return; - } - } - - bytes_read += r; - } - - size_t item_count = bytes_read / item_size; - *begin = (Elf64_auxv_t*)buffer.Pointer; - *end = (Elf64_auxv_t*)(buffer.Pointer + item_count * item_size); - buffer.Pointer = nullptr; - } -} - -extern "C" { - weak unsigned long __getauxval(unsigned long item); -} - -namespace NUbuntuCompat { - - TGlibc::TGlibc() noexcept - : AuxVectorBegin(nullptr) - , AuxVectorEnd(nullptr) - { - if (!__getauxval) { - ReadAuxVector((Elf64_auxv_t**)&AuxVectorBegin, (Elf64_auxv_t**)&AuxVectorEnd); - } - - Secure = (bool)GetAuxVal(AT_SECURE); - } - - TGlibc::~TGlibc() noexcept { - free(AuxVectorBegin); - } - - unsigned long TGlibc::GetAuxVal(unsigned long item) noexcept { - if (__getauxval) { - return __getauxval(item); - } - - for (Elf64_auxv_t* p = (Elf64_auxv_t*)AuxVectorBegin; p < (Elf64_auxv_t*)AuxVectorEnd; ++p) { - if (p->a_type == item) { - return p->a_un.a_val; - } - } - - errno = ENOENT; - return 0; - } - - bool TGlibc::IsSecure() noexcept { - return Secure; - } - - static TGlibc __attribute__((__init_priority__(101))) GlibcInstance; - - TGlibc& GetGlibc() noexcept { - return GlibcInstance; - } -} diff --git a/contrib/libs/libc_compat/ubuntu_14/glibc.h b/contrib/libs/libc_compat/ubuntu_14/glibc.h deleted file mode 100644 index fdabcb0158..0000000000 --- a/contrib/libs/libc_compat/ubuntu_14/glibc.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -typedef unsigned long (*TGetAuxVal)(unsigned long); - -namespace NUbuntuCompat { - class TGlibc { - public: - TGlibc() noexcept; - ~TGlibc() noexcept; - unsigned long GetAuxVal(unsigned long item) noexcept; - bool IsSecure() noexcept; - - private: - void* AuxVectorBegin; - void* AuxVectorEnd; - bool Secure; - }; - - TGlibc& GetGlibc() noexcept; -} diff --git a/contrib/libs/libc_compat/ubuntu_14/mbrtoc16.c b/contrib/libs/libc_compat/ubuntu_14/mbrtoc16.c deleted file mode 100644 index 765ff9037c..0000000000 --- a/contrib/libs/libc_compat/ubuntu_14/mbrtoc16.c +++ /dev/null @@ -1,30 +0,0 @@ -#include <uchar.h> -#include <wchar.h> - -size_t mbrtoc16(char16_t *restrict pc16, const char *restrict s, size_t n, mbstate_t *restrict ps) -{ - static unsigned internal_state; - if (!ps) ps = (void *)&internal_state; - unsigned *pending = (unsigned *)ps; - - if (!s) return mbrtoc16(0, "", 1, ps); - - /* mbrtowc states for partial UTF-8 characters have the high bit set; - * we use nonzero states without high bit for pending surrogates. */ - if ((int)*pending > 0) { - if (pc16) *pc16 = *pending; - *pending = 0; - return -3; - } - - wchar_t wc; - size_t ret = mbrtowc(&wc, s, n, ps); - if (ret <= 4) { - if (wc >= 0x10000) { - *pending = (wc & 0x3ff) + 0xdc00; - wc = 0xd7c0 + (wc >> 10); - } - if (pc16) *pc16 = wc; - } - return ret; -} diff --git a/contrib/libs/libc_compat/ubuntu_14/mbrtoc32.c b/contrib/libs/libc_compat/ubuntu_14/mbrtoc32.c deleted file mode 100644 index 9b6b236739..0000000000 --- a/contrib/libs/libc_compat/ubuntu_14/mbrtoc32.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <uchar.h> -#include <wchar.h> - -size_t mbrtoc32(char32_t *restrict pc32, const char *restrict s, size_t n, mbstate_t *restrict ps) -{ - static unsigned internal_state; - if (!ps) ps = (void *)&internal_state; - if (!s) return mbrtoc32(0, "", 1, ps); - wchar_t wc; - size_t ret = mbrtowc(&wc, s, n, ps); - if (ret <= 4 && pc32) *pc32 = wc; - return ret; -} diff --git a/contrib/libs/libc_compat/ubuntu_14/secure_getenv.cpp b/contrib/libs/libc_compat/ubuntu_14/secure_getenv.cpp deleted file mode 100644 index 14e3e90906..0000000000 --- a/contrib/libs/libc_compat/ubuntu_14/secure_getenv.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include <stdlib.h> - -#include "glibc.h" - -extern "C" { - char *secure_getenv(const char *name) noexcept { - if (NUbuntuCompat::GetGlibc().IsSecure()) { - return nullptr; - } - return getenv(name); - } -} diff --git a/contrib/libs/libc_compat/ubuntu_14/timespec_get.c b/contrib/libs/libc_compat/ubuntu_14/timespec_get.c deleted file mode 100644 index 742b62ec84..0000000000 --- a/contrib/libs/libc_compat/ubuntu_14/timespec_get.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <time.h> - -/* There is no other implemented value than TIME_UTC; all other values - * are considered erroneous. */ -int timespec_get(struct timespec * ts, int base) -{ - if (base != TIME_UTC) return 0; - int ret = clock_gettime(CLOCK_REALTIME, ts); - return ret < 0 ? 0 : base; -} |