aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libc_compat
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.ru>2022-02-10 16:45:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:08 +0300
commit4e839db24a3bbc9f1c610c43d6faaaa99824dcca (patch)
tree506dac10f5df94fab310584ee51b24fc5a081c22 /contrib/libs/libc_compat
parent2d37894b1b037cf24231090eda8589bbb44fb6fc (diff)
downloadydb-4e839db24a3bbc9f1c610c43d6faaaa99824dcca.tar.gz
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/libc_compat')
-rw-r--r--contrib/libs/libc_compat/README.md48
-rw-r--r--contrib/libs/libc_compat/getrandom.c14
-rw-r--r--contrib/libs/libc_compat/include/random/sys/random.h40
-rw-r--r--contrib/libs/libc_compat/include/readpassphrase/readpassphrase.h36
-rw-r--r--contrib/libs/libc_compat/memfd_create.c4
-rw-r--r--contrib/libs/libc_compat/readpassphrase.c28
-rw-r--r--contrib/libs/libc_compat/reallocarray.c8
-rw-r--r--contrib/libs/libc_compat/string.h28
-rw-r--r--contrib/libs/libc_compat/strlcat.c56
-rw-r--r--contrib/libs/libc_compat/strlcpy.c70
-rw-r--r--contrib/libs/libc_compat/ubuntu_14/ya.make2
-rwxr-xr-xcontrib/libs/libc_compat/update.sh70
-rw-r--r--contrib/libs/libc_compat/ya.make158
13 files changed, 281 insertions, 281 deletions
diff --git a/contrib/libs/libc_compat/README.md b/contrib/libs/libc_compat/README.md
index fe7a22fbb1..c590ec1585 100644
--- a/contrib/libs/libc_compat/README.md
+++ b/contrib/libs/libc_compat/README.md
@@ -1,24 +1,24 @@
-This library implements a compatibility layer between various libc implementations.
-
-The rationale for the library implementation is described in https://st.yandex-team.ru/IGNIETFERRO-1439.
-
-The code is taken from multiple sources, thus both LICENSE() and VERSION() tags are not very representative.
-
-
-During development one can make use of the following mapping of `OS_SDK` into glibc version.
-
-| Ubuntu | glibc |
-| ------ | ----- |
-| 20.04 | 2.30 |
-| 18.04 | 2.27 |
-| 16.04 | 2.23 |
-| 14.04 | 2.18 |
-| 12.04 | 2.15 |
-| 10.04 | 2.11 |
-
-Use the following commands to update the table above:
-
-1. `ya make util -DOS_SDK=ubuntu-xx -G | grep OS_SDK_ROOT | head -n 1`
-2. `cd ~/.ya/tools/v4/$RESOURCE_ID`
-3. `readelf -V $(find . -name 'libc.so.6')`
-4. Take the latest version from `.gnu.version_d` section prior to `GLIBC_PRIVATE`
+This library implements a compatibility layer between various libc implementations.
+
+The rationale for the library implementation is described in https://st.yandex-team.ru/IGNIETFERRO-1439.
+
+The code is taken from multiple sources, thus both LICENSE() and VERSION() tags are not very representative.
+
+
+During development one can make use of the following mapping of `OS_SDK` into glibc version.
+
+| Ubuntu | glibc |
+| ------ | ----- |
+| 20.04 | 2.30 |
+| 18.04 | 2.27 |
+| 16.04 | 2.23 |
+| 14.04 | 2.18 |
+| 12.04 | 2.15 |
+| 10.04 | 2.11 |
+
+Use the following commands to update the table above:
+
+1. `ya make util -DOS_SDK=ubuntu-xx -G | grep OS_SDK_ROOT | head -n 1`
+2. `cd ~/.ya/tools/v4/$RESOURCE_ID`
+3. `readelf -V $(find . -name 'libc.so.6')`
+4. Take the latest version from `.gnu.version_d` section prior to `GLIBC_PRIVATE`
diff --git a/contrib/libs/libc_compat/getrandom.c b/contrib/libs/libc_compat/getrandom.c
index 2184fad710..f180f89fc3 100644
--- a/contrib/libs/libc_compat/getrandom.c
+++ b/contrib/libs/libc_compat/getrandom.c
@@ -1,7 +1,7 @@
-#include <sys/random.h>
-#include "syscall.h"
-
-ssize_t getrandom(void *buf, size_t buflen, unsigned flags)
-{
- return syscall(SYS_getrandom, buf, buflen, flags);
-}
+#include <sys/random.h>
+#include "syscall.h"
+
+ssize_t getrandom(void *buf, size_t buflen, unsigned flags)
+{
+ return syscall(SYS_getrandom, buf, buflen, flags);
+}
diff --git a/contrib/libs/libc_compat/include/random/sys/random.h b/contrib/libs/libc_compat/include/random/sys/random.h
index 8c13837f72..f1d4b83f5d 100644
--- a/contrib/libs/libc_compat/include/random/sys/random.h
+++ b/contrib/libs/libc_compat/include/random/sys/random.h
@@ -1,20 +1,20 @@
-#ifndef _SYS_RANDOM_H
-#define _SYS_RANDOM_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/types.h>
-
-#define SYS_getrandom 318
-
-#define GRND_NONBLOCK 0x0001
-#define GRND_RANDOM 0x0002
-#define GRND_INSECURE 0x0004
-
-ssize_t getrandom(void *, size_t, unsigned);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
+#ifndef _SYS_RANDOM_H
+#define _SYS_RANDOM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+#define SYS_getrandom 318
+
+#define GRND_NONBLOCK 0x0001
+#define GRND_RANDOM 0x0002
+#define GRND_INSECURE 0x0004
+
+ssize_t getrandom(void *, size_t, unsigned);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/contrib/libs/libc_compat/include/readpassphrase/readpassphrase.h b/contrib/libs/libc_compat/include/readpassphrase/readpassphrase.h
index ba1ee14ef1..b4000af6ad 100644
--- a/contrib/libs/libc_compat/include/readpassphrase/readpassphrase.h
+++ b/contrib/libs/libc_compat/include/readpassphrase/readpassphrase.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: readpassphrase.h,v 1.6 2019/01/25 00:19:25 millert Exp $ */
+/* $OpenBSD: readpassphrase.h,v 1.6 2019/01/25 00:19:25 millert Exp $ */
/*
- * Copyright (c) 2000, 2002 Todd C. Miller <millert@openbsd.org>
+ * Copyright (c) 2000, 2002 Todd C. Miller <millert@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -20,25 +20,25 @@
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
*/
-#ifndef _READPASSPHRASE_H_
-#define _READPASSPHRASE_H_
+#ifndef _READPASSPHRASE_H_
+#define _READPASSPHRASE_H_
-#define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */
-#define RPP_ECHO_ON 0x01 /* Leave echo on. */
-#define RPP_REQUIRE_TTY 0x02 /* Fail if there is no tty. */
-#define RPP_FORCELOWER 0x04 /* Force input to lower case. */
-#define RPP_FORCEUPPER 0x08 /* Force input to upper case. */
-#define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */
-#define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */
+#define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */
+#define RPP_ECHO_ON 0x01 /* Leave echo on. */
+#define RPP_REQUIRE_TTY 0x02 /* Fail if there is no tty. */
+#define RPP_FORCELOWER 0x04 /* Force input to lower case. */
+#define RPP_FORCEUPPER 0x08 /* Force input to upper case. */
+#define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */
+#define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */
-#include <sys/cdefs.h>
-
-#ifdef __cplusplus
+#include <sys/cdefs.h>
+
+#ifdef __cplusplus
extern "C" {
#endif
char * readpassphrase(const char *, char *, size_t, int);
-#ifdef __cplusplus
-} // extern "C"
-#endif
+#ifdef __cplusplus
+} // extern "C"
+#endif
-#endif /* !_READPASSPHRASE_H_ */
+#endif /* !_READPASSPHRASE_H_ */
diff --git a/contrib/libs/libc_compat/memfd_create.c b/contrib/libs/libc_compat/memfd_create.c
index 6805d807d6..b20a766fbf 100644
--- a/contrib/libs/libc_compat/memfd_create.c
+++ b/contrib/libs/libc_compat/memfd_create.c
@@ -1,9 +1,9 @@
#define _GNU_SOURCE 1
#include <sys/mman.h>
#include "syscall.h"
-#include <linux/unistd.h>
+#include <linux/unistd.h>
int memfd_create(const char *name, unsigned flags)
{
- return syscall(__NR_memfd_create, name, flags);
+ return syscall(__NR_memfd_create, name, flags);
}
diff --git a/contrib/libs/libc_compat/readpassphrase.c b/contrib/libs/libc_compat/readpassphrase.c
index df677e9ca5..d83d71dcb3 100644
--- a/contrib/libs/libc_compat/readpassphrase.c
+++ b/contrib/libs/libc_compat/readpassphrase.c
@@ -1,8 +1,8 @@
-/* $OpenBSD: readpassphrase.c,v 1.27 2019/01/25 00:19:25 millert Exp $ */
+/* $OpenBSD: readpassphrase.c,v 1.27 2019/01/25 00:19:25 millert Exp $ */
/*
* Copyright (c) 2000-2002, 2007, 2010
- * Todd C. Miller <millert@openbsd.org>
+ * Todd C. Miller <millert@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -22,15 +22,15 @@
*/
#include <ctype.h>
-#include <errno.h>
+#include <errno.h>
#include <fcntl.h>
-#include <paths.h>
-#include <pwd.h>
-#include <signal.h>
+#include <paths.h>
+#include <pwd.h>
+#include <signal.h>
#include <string.h>
-#include <termios.h>
+#include <termios.h>
#include <unistd.h>
-#include <readpassphrase.h>
+#include <readpassphrase.h>
#ifndef TCSASOFT
/* If we don't have TCSASOFT define it so that ORing it it below is a no-op. */
@@ -42,7 +42,7 @@
# define _POSIX_VDISABLE VDISABLE
#endif
-static volatile sig_atomic_t signo[_NSIG];
+static volatile sig_atomic_t signo[_NSIG];
static void handler(int);
@@ -63,7 +63,7 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
}
restart:
- for (i = 0; i < _NSIG; i++)
+ for (i = 0; i < _NSIG; i++)
signo[i] = 0;
nr = -1;
save_errno = 0;
@@ -90,7 +90,7 @@ restart:
if (input != STDIN_FILENO && tcgetattr(input, &oterm) == 0) {
memcpy(&term, &oterm, sizeof(term));
if (!(flags & RPP_ECHO_ON))
- term.c_lflag &= ~(ECHO | ECHONL);
+ term.c_lflag &= ~(ECHO | ECHONL);
(void)tcsetattr(input, TCSAFLUSH|TCSASOFT, &term);
} else {
memset(&term, 0, sizeof(term));
@@ -165,7 +165,7 @@ restart:
* If we were interrupted by a signal, resend it to ourselves
* now that we have restored the signal handlers.
*/
- for (i = 0; i < _NSIG; i++) {
+ for (i = 0; i < _NSIG; i++) {
if (signo[i]) {
kill(getpid(), i);
switch (i) {
@@ -184,9 +184,9 @@ restart:
return(nr == -1 ? NULL : buf);
}
-
+
static void handler(int s)
{
-
+
signo[s] = 1;
}
diff --git a/contrib/libs/libc_compat/reallocarray.c b/contrib/libs/libc_compat/reallocarray.c
index 21b0914fe4..c69f439b21 100644
--- a/contrib/libs/libc_compat/reallocarray.c
+++ b/contrib/libs/libc_compat/reallocarray.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: reallocarray.c,v 1.3 2015/09/13 08:31:47 guenther Exp $ */
+/* $OpenBSD: reallocarray.c,v 1.3 2015/09/13 08:31:47 guenther Exp $ */
/*
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
*
@@ -32,8 +32,8 @@ reallocarray(void *optr, size_t nmemb, size_t size)
if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
nmemb > 0 && SIZE_MAX / nmemb < size) {
errno = ENOMEM;
- return NULL;
+ return NULL;
}
- return realloc(optr, size * nmemb);
+ return realloc(optr, size * nmemb);
}
-
+
diff --git a/contrib/libs/libc_compat/string.h b/contrib/libs/libc_compat/string.h
index ad74d9a630..d183391084 100644
--- a/contrib/libs/libc_compat/string.h
+++ b/contrib/libs/libc_compat/string.h
@@ -1,18 +1,18 @@
-#pragma once
-
-#include <stddef.h>
+#pragma once
+
+#include <stddef.h>
#include <ctype.h>
#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if !defined(__FreeBSD__) && !defined(__APPLE__)
-size_t strlcpy(char* dst, const char* src, size_t len);
-size_t strlcat(char* dst, const char* src, size_t len);
+size_t strlcpy(char* dst, const char* src, size_t len);
+size_t strlcat(char* dst, const char* src, size_t len);
#endif
-
+
#if (!defined(__linux__) && !defined(__FreeBSD__) && !defined(__APPLE__)) || (defined(__ANDROID__) && __ANDROID_API__ < 21)
char* stpcpy(char* dst, const char* src);
#endif
@@ -39,6 +39,6 @@ char* strsep(char** stringp, const char* delim);
void* memrchr(const void* s, int c, size_t n);
#endif
-#ifdef __cplusplus
-} //extern "C"
-#endif
+#ifdef __cplusplus
+} //extern "C"
+#endif
diff --git a/contrib/libs/libc_compat/strlcat.c b/contrib/libs/libc_compat/strlcat.c
index d2198a2bdc..00ecf35646 100644
--- a/contrib/libs/libc_compat/strlcat.c
+++ b/contrib/libs/libc_compat/strlcat.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: strlcat.c,v 1.19 2019/01/25 00:19:25 millert Exp $ */
+/* $OpenBSD: strlcat.c,v 1.19 2019/01/25 00:19:25 millert Exp $ */
/*
- * Copyright (c) 1998, 2015 Todd C. Miller <millert@openbsd.org>
+ * Copyright (c) 1998, 2015 Todd C. Miller <millert@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -20,37 +20,37 @@
#include <string.h>
/*
- * Appends src to string dst of size dsize (unlike strncat, dsize is the
- * full size of dst, not space left). At most dsize-1 characters
- * will be copied. Always NUL terminates (unless dsize <= strlen(dst)).
- * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
- * If retval >= dsize, truncation occurred.
+ * Appends src to string dst of size dsize (unlike strncat, dsize is the
+ * full size of dst, not space left). At most dsize-1 characters
+ * will be copied. Always NUL terminates (unless dsize <= strlen(dst)).
+ * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
+ * If retval >= dsize, truncation occurred.
*/
size_t
-strlcat(char *dst, const char *src, size_t dsize)
+strlcat(char *dst, const char *src, size_t dsize)
{
- const char *odst = dst;
- const char *osrc = src;
- size_t n = dsize;
- size_t dlen;
+ const char *odst = dst;
+ const char *osrc = src;
+ size_t n = dsize;
+ size_t dlen;
- /* Find the end of dst and adjust bytes left but don't go past end. */
- while (n-- != 0 && *dst != '\0')
- dst++;
- dlen = dst - odst;
- n = dsize - dlen;
+ /* Find the end of dst and adjust bytes left but don't go past end. */
+ while (n-- != 0 && *dst != '\0')
+ dst++;
+ dlen = dst - odst;
+ n = dsize - dlen;
- if (n-- == 0)
- return(dlen + strlen(src));
- while (*src != '\0') {
- if (n != 0) {
- *dst++ = *src;
- n--;
- }
- src++;
- }
- *dst = '\0';
+ if (n-- == 0)
+ return(dlen + strlen(src));
+ while (*src != '\0') {
+ if (n != 0) {
+ *dst++ = *src;
+ n--;
+ }
+ src++;
+ }
+ *dst = '\0';
- return(dlen + (src - osrc)); /* count does not include NUL */
+ return(dlen + (src - osrc)); /* count does not include NUL */
}
diff --git a/contrib/libs/libc_compat/strlcpy.c b/contrib/libs/libc_compat/strlcpy.c
index 1797b86bb6..83a2dd9c4c 100644
--- a/contrib/libs/libc_compat/strlcpy.c
+++ b/contrib/libs/libc_compat/strlcpy.c
@@ -1,51 +1,51 @@
-/* $OpenBSD: strlcpy.c,v 1.16 2019/01/25 00:19:25 millert Exp $ */
+/* $OpenBSD: strlcpy.c,v 1.16 2019/01/25 00:19:25 millert Exp $ */
/*
- * Copyright (c) 1998, 2015 Todd C. Miller <millert@openbsd.org>
+ * Copyright (c) 1998, 2015 Todd C. Miller <millert@openbsd.org>
*
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
#include <string.h>
/*
- * Copy string src to buffer dst of size dsize. At most dsize-1
- * chars will be copied. Always NUL terminates (unless dsize == 0).
- * Returns strlen(src); if retval >= dsize, truncation occurred.
+ * Copy string src to buffer dst of size dsize. At most dsize-1
+ * chars will be copied. Always NUL terminates (unless dsize == 0).
+ * Returns strlen(src); if retval >= dsize, truncation occurred.
*/
-size_t
-strlcpy(char *dst, const char *src, size_t dsize)
+size_t
+strlcpy(char *dst, const char *src, size_t dsize)
{
- const char *osrc = src;
- size_t nleft = dsize;
+ const char *osrc = src;
+ size_t nleft = dsize;
- /* Copy as many bytes as will fit. */
- if (nleft != 0) {
- while (--nleft != 0) {
- if ((*dst++ = *src++) == '\0')
- break;
- }
- }
+ /* Copy as many bytes as will fit. */
+ if (nleft != 0) {
+ while (--nleft != 0) {
+ if ((*dst++ = *src++) == '\0')
+ break;
+ }
+ }
- /* Not enough room in dst, add NUL and traverse rest of src. */
- if (nleft == 0) {
- if (dsize != 0)
- *dst = '\0'; /* NUL-terminate dst */
- while (*src++)
- ;
- }
+ /* Not enough room in dst, add NUL and traverse rest of src. */
+ if (nleft == 0) {
+ if (dsize != 0)
+ *dst = '\0'; /* NUL-terminate dst */
+ while (*src++)
+ ;
+ }
- return(src - osrc - 1); /* count does not include NUL */
+ return(src - osrc - 1); /* count does not include NUL */
}
-
+
diff --git a/contrib/libs/libc_compat/ubuntu_14/ya.make b/contrib/libs/libc_compat/ubuntu_14/ya.make
index 7355c4ad9d..4e88c48aac 100644
--- a/contrib/libs/libc_compat/ubuntu_14/ya.make
+++ b/contrib/libs/libc_compat/ubuntu_14/ya.make
@@ -19,7 +19,7 @@ NO_UTIL()
DISABLE(NEED_PLATFORM_PEERDIRS)
DISABLE(OPENSOURCE_EXPORT)
-IF (OS_SDK == "ubuntu-14")
+IF (OS_SDK == "ubuntu-14")
PEERDIR(
build/platform/linux_sdk
)
diff --git a/contrib/libs/libc_compat/update.sh b/contrib/libs/libc_compat/update.sh
index 4cee160904..46788ed50f 100755
--- a/contrib/libs/libc_compat/update.sh
+++ b/contrib/libs/libc_compat/update.sh
@@ -1,22 +1,22 @@
-#!/bin/sh -e
-
-unweak() {
- sed --in-place --expression 's/DEF_WEAK(.\+);//g' "$1"
-}
-
+#!/bin/sh -e
+
+unweak() {
+ sed --in-place --expression 's/DEF_WEAK(.\+);//g' "$1"
+}
+
get_string_method() {
curl "https://raw.githubusercontent.com/openbsd/src/master/lib/libc/string/$1" --output "$1" && unweak "$1"
}
-fix_tabs() {
- sed --in-place --expression 's/\t/ /g' "$1"
-}
-
-fix_decls() {
- sed --in-place --expression 's/__BEGIN_DECLS/#ifdef __cplusplus\nextern "C" {\n#endif/g' "$1"
- sed --in-place --expression 's/__END_DECLS/#ifdef __cplusplus\n} \/\/ extern "C"\n#endif/g' "$1"
-}
-
+fix_tabs() {
+ sed --in-place --expression 's/\t/ /g' "$1"
+}
+
+fix_decls() {
+ sed --in-place --expression 's/__BEGIN_DECLS/#ifdef __cplusplus\nextern "C" {\n#endif/g' "$1"
+ sed --in-place --expression 's/__END_DECLS/#ifdef __cplusplus\n} \/\/ extern "C"\n#endif/g' "$1"
+}
+
get_string_method "strlcpy.c"
get_string_method "strlcat.c"
get_string_method "strsep.c"
@@ -28,13 +28,13 @@ get_string_method "stpcpy.c"
mkdir -p include/windows/sys
curl "https://raw.githubusercontent.com/openbsd/src/master/sys/sys/queue.h" --output "include/windows/sys/queue.h"
-mkdir -p include/readpassphrase
-curl "https://raw.githubusercontent.com/openbsd/src/master/include/readpassphrase.h" --output "include/readpassphrase/readpassphrase.h" && fix_decls "include/readpassphrase/readpassphrase.h"
-curl "https://raw.githubusercontent.com/openbsd/src/master/lib/libc/gen/readpassphrase.c" --output "readpassphrase.c" && unweak "readpassphrase.c" && fix_tabs "readpassphrase.c"
-
+mkdir -p include/readpassphrase
+curl "https://raw.githubusercontent.com/openbsd/src/master/include/readpassphrase.h" --output "include/readpassphrase/readpassphrase.h" && fix_decls "include/readpassphrase/readpassphrase.h"
+curl "https://raw.githubusercontent.com/openbsd/src/master/lib/libc/gen/readpassphrase.c" --output "readpassphrase.c" && unweak "readpassphrase.c" && fix_tabs "readpassphrase.c"
+
curl "https://raw.githubusercontent.com/freebsd/freebsd/master/include/glob.h" --output "glob.h"
curl "https://raw.githubusercontent.com/freebsd/freebsd/master/lib/libc/gen/glob.c" --output "glob.c"
-curl "https://raw.githubusercontent.com/openbsd/src/master/lib/libc/stdlib/reallocarray.c" --output "reallocarray.c" && unweak "reallocarray.c"
+curl "https://raw.githubusercontent.com/openbsd/src/master/lib/libc/stdlib/reallocarray.c" --output "reallocarray.c" && unweak "reallocarray.c"
> "collate.h"
> "stdlib.h"
> "unistd.h"
@@ -43,18 +43,18 @@ mkdir -p include/uchar
curl "https://git.musl-libc.org/cgit/musl/plain/include/uchar.h" --output "include/uchar/uchar.h"
# TODO: provide c16rtomb, mbrtoc16, c32rtomb, mbrtoc32 implementations for uchar
# if any code actually needs them
-
-mkdir -p include/random/sys
-curl "https://git.musl-libc.org/cgit/musl/plain/include/sys/random.h" --output "include/random/sys/random.h"
-curl "https://git.musl-libc.org/cgit/musl/plain/src/linux/getrandom.c" --output "getrandom.c"
-curl "https://git.musl-libc.org/cgit/musl/plain/src/linux/memfd_create.c" --output "memfd_create.c"
-
-# WARN: do not use github.com/morristech/android-ifaddrs, it is a long-ago abandoned fork
-curl "https://raw.githubusercontent.com/oliviertilmans/android-ifaddrs/master/ifaddrs.c" --output "ifaddrs.c"
-curl "https://raw.githubusercontent.com/oliviertilmans/android-ifaddrs/master/ifaddrs.h" --output "include/ifaddrs/ifaddrs.h"
-
-# apply patches if necessary
-for patch in patches/*.patch; do
- echo "Applying patch from $patch"
- patch -p1 < $patch
-done
+
+mkdir -p include/random/sys
+curl "https://git.musl-libc.org/cgit/musl/plain/include/sys/random.h" --output "include/random/sys/random.h"
+curl "https://git.musl-libc.org/cgit/musl/plain/src/linux/getrandom.c" --output "getrandom.c"
+curl "https://git.musl-libc.org/cgit/musl/plain/src/linux/memfd_create.c" --output "memfd_create.c"
+
+# WARN: do not use github.com/morristech/android-ifaddrs, it is a long-ago abandoned fork
+curl "https://raw.githubusercontent.com/oliviertilmans/android-ifaddrs/master/ifaddrs.c" --output "ifaddrs.c"
+curl "https://raw.githubusercontent.com/oliviertilmans/android-ifaddrs/master/ifaddrs.h" --output "include/ifaddrs/ifaddrs.h"
+
+# apply patches if necessary
+for patch in patches/*.patch; do
+ echo "Applying patch from $patch"
+ patch -p1 < $patch
+done
diff --git a/contrib/libs/libc_compat/ya.make b/contrib/libs/libc_compat/ya.make
index b92184c165..ed7fc64630 100644
--- a/contrib/libs/libc_compat/ya.make
+++ b/contrib/libs/libc_compat/ya.make
@@ -1,51 +1,51 @@
-OWNER(g:cpp-contrib)
-
-LIBRARY()
-
+OWNER(g:cpp-contrib)
+
+LIBRARY()
+
LICENSE(
BSD-1-Clause AND
BSD-2-Clause AND
BSD-3-Clause AND
ISC
)
-
+
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-NO_COMPILER_WARNINGS()
+NO_COMPILER_WARNINGS()
-NO_UTIL()
-
-NO_RUNTIME()
+NO_UTIL()
+NO_RUNTIME()
+
IF (NOT OS_WINDOWS)
- SRCS(
+ SRCS(
string.c
- )
+ )
ENDIF()
-# Android libc function appearance is documented here:
-# https://android.googlesource.com/platform/bionic/+/master/docs/status.md
-#
-# NB: nested IF's are needed due to the lack of lazy evaluation of logical statements: DEVTOOLS-7837
+# Android libc function appearance is documented here:
+# https://android.googlesource.com/platform/bionic/+/master/docs/status.md
+#
+# NB: nested IF's are needed due to the lack of lazy evaluation of logical statements: DEVTOOLS-7837
IF (OS_ANDROID)
SRCS(
strlcat.c
strlcpy.c
)
- IF (ANDROID_API < 28)
- SRCS(
- glob.c
- reallocarray.c
- )
- ENDIF()
- IF (ANDROID_API < 24)
- SRCS(
- ifaddrs.c
- )
- ADDINCL(
- GLOBAL contrib/libs/libc_compat/include/ifaddrs
- )
- ENDIF()
+ IF (ANDROID_API < 28)
+ SRCS(
+ glob.c
+ reallocarray.c
+ )
+ ENDIF()
+ IF (ANDROID_API < 24)
+ SRCS(
+ ifaddrs.c
+ )
+ ADDINCL(
+ GLOBAL contrib/libs/libc_compat/include/ifaddrs
+ )
+ ENDIF()
IF (ANDROID_API < 21)
SRCS(
stpcpy.c
@@ -59,18 +59,18 @@ IF (OS_WINDOWS OR OS_DARWIN OR OS_IOS)
)
ENDIF()
-IF (OS_DARWIN)
- SRCS(
- reallocarray.c
- )
-ENDIF()
-
+IF (OS_DARWIN)
+ SRCS(
+ reallocarray.c
+ )
+ENDIF()
+
IF (OS_WINDOWS)
- ADDINCL(
- GLOBAL contrib/libs/libc_compat/include/windows
- )
+ ADDINCL(
+ GLOBAL contrib/libs/libc_compat/include/windows
+ )
SRCS(
- reallocarray.c
+ reallocarray.c
stpcpy.c
strlcat.c
strlcpy.c
@@ -80,44 +80,44 @@ IF (OS_WINDOWS)
)
ENDIF()
-IF (OS_LINUX)
- ADDINCL(
- GLOBAL contrib/libs/libc_compat/include/readpassphrase
- )
- SRCS(
- readpassphrase.c
- )
-ENDIF()
-
-IF (OS_LINUX AND NOT MUSL)
- IF (OS_SDK == "ubuntu-12")
- ADDINCL(
- # uchar.h was introduced in glibc=2.16
- GLOBAL contrib/libs/libc_compat/include/uchar
- )
- ENDIF()
+IF (OS_LINUX)
+ ADDINCL(
+ GLOBAL contrib/libs/libc_compat/include/readpassphrase
+ )
+ SRCS(
+ readpassphrase.c
+ )
+ENDIF()
+
+IF (OS_LINUX AND NOT MUSL)
+ IF (OS_SDK == "ubuntu-12")
+ ADDINCL(
+ # uchar.h was introduced in glibc=2.16
+ GLOBAL contrib/libs/libc_compat/include/uchar
+ )
+ ENDIF()
IF (OS_SDK == "ubuntu-12" OR OS_SDK == "ubuntu-14" OR OS_SDK == "ubuntu-16")
- ADDINCL(
- GLOBAL contrib/libs/libc_compat/include/random
- )
- SRCS(
- # getrandom was added in glibc=2.25
- getrandom.c
- # memfd_create was added in glibc=2.27
- memfd_create.c
- )
- ENDIF()
- IF (OS_SDK != "ubuntu-20")
- SRCS(
- # reallocarray was added in glibc=2.29
- reallocarray.c
- )
- ENDIF()
- SRCS(
- # glibc does not offer strlcat / strlcpy yet
- strlcat.c
- strlcpy.c
- )
-ENDIF()
-
-END()
+ ADDINCL(
+ GLOBAL contrib/libs/libc_compat/include/random
+ )
+ SRCS(
+ # getrandom was added in glibc=2.25
+ getrandom.c
+ # memfd_create was added in glibc=2.27
+ memfd_create.c
+ )
+ ENDIF()
+ IF (OS_SDK != "ubuntu-20")
+ SRCS(
+ # reallocarray was added in glibc=2.29
+ reallocarray.c
+ )
+ ENDIF()
+ SRCS(
+ # glibc does not offer strlcat / strlcpy yet
+ strlcat.c
+ strlcpy.c
+ )
+ENDIF()
+
+END()