aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/symbols
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/python/symbols
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/python/symbols')
-rw-r--r--library/python/symbols/libc/syms.cpp170
-rw-r--r--library/python/symbols/libc/ya.make8
-rw-r--r--library/python/symbols/module/__init__.py96
-rw-r--r--library/python/symbols/module/module.cpp90
-rw-r--r--library/python/symbols/module/ya.make36
-rw-r--r--library/python/symbols/registry/syms.cpp62
-rw-r--r--library/python/symbols/registry/syms.h48
-rw-r--r--library/python/symbols/registry/ya.make18
-rw-r--r--library/python/symbols/ya.make12
9 files changed, 270 insertions, 270 deletions
diff --git a/library/python/symbols/libc/syms.cpp b/library/python/symbols/libc/syms.cpp
index 3b305a5e07..6c04a7ef6e 100644
--- a/library/python/symbols/libc/syms.cpp
+++ b/library/python/symbols/libc/syms.cpp
@@ -1,8 +1,8 @@
-#include <util/system/platform.h>
+#include <util/system/platform.h>
-#include <library/python/symbols/registry/syms.h>
-
-#if !defined(_MSC_VER)
+#include <library/python/symbols/registry/syms.h>
+
+#if !defined(_MSC_VER)
#if __has_include(<aio.h>)
#include <aio.h>
#endif
@@ -19,88 +19,88 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <errno.h>
-#include <sys/ipc.h>
-#include <dlfcn.h>
-
-#if defined(_linux_)
-#include <sys/prctl.h>
+#include <errno.h>
+#include <sys/ipc.h>
+#include <dlfcn.h>
+
+#if defined(_linux_)
+#include <sys/prctl.h>
#include <sys/ptrace.h>
-#include <sys/sendfile.h>
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-#endif
-
-#if defined(_darwin_)
-#include <sys/types.h>
-#include <sys/sysctl.h>
-#include <mach/mach_error.h> // Y_IGNORE
-#include <mach/mach_time.h> // Y_IGNORE
-#endif
-
-#if defined(_linux_)
-#include <sys/inotify.h>
+#include <sys/sendfile.h>
+#else
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+#endif
+
+#if defined(_darwin_)
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <mach/mach_error.h> // Y_IGNORE
+#include <mach/mach_time.h> // Y_IGNORE
+#endif
+
+#if defined(_linux_)
+#include <sys/inotify.h>
#include <sys/mman.h>
-#endif
-
-namespace {
- static inline void* ErrnoLocation() {
- return &errno;
- }
-
- static int ClockGetres(clockid_t clk_id, struct timespec* res) {
-#if defined(_darwin_)
- static auto func = (decltype(&ClockGetres))dlsym(RTLD_SELF, "_clock_getres");
-
- if (func) {
- return func(clk_id, res);
- }
-
- // https://opensource.apple.com/source/Libc/Libc-1158.1.2/gen/clock_gettime.c.auto.html
-
- switch (clk_id){
- case CLOCK_REALTIME:
- case CLOCK_MONOTONIC:
- case CLOCK_PROCESS_CPUTIME_ID:
- res->tv_nsec = NSEC_PER_USEC;
- res->tv_sec = 0;
-
- return 0;
-
- case CLOCK_MONOTONIC_RAW:
- case CLOCK_MONOTONIC_RAW_APPROX:
- case CLOCK_UPTIME_RAW:
- case CLOCK_UPTIME_RAW_APPROX:
- case CLOCK_THREAD_CPUTIME_ID: {
- mach_timebase_info_data_t tb_info;
-
- if (mach_timebase_info(&tb_info)) {
- return -1;
- }
-
- res->tv_nsec = tb_info.numer / tb_info.denom + (tb_info.numer % tb_info.denom != 0);
- res->tv_sec = 0;
-
- return 0;
- }
-
- default:
- errno = EINVAL;
- return -1;
- }
-#else
- return clock_getres(clk_id, res);
-#endif
- }
-}
-
-BEGIN_SYMS("c")
+#endif
+
+namespace {
+ static inline void* ErrnoLocation() {
+ return &errno;
+ }
+
+ static int ClockGetres(clockid_t clk_id, struct timespec* res) {
+#if defined(_darwin_)
+ static auto func = (decltype(&ClockGetres))dlsym(RTLD_SELF, "_clock_getres");
+
+ if (func) {
+ return func(clk_id, res);
+ }
+
+ // https://opensource.apple.com/source/Libc/Libc-1158.1.2/gen/clock_gettime.c.auto.html
+
+ switch (clk_id){
+ case CLOCK_REALTIME:
+ case CLOCK_MONOTONIC:
+ case CLOCK_PROCESS_CPUTIME_ID:
+ res->tv_nsec = NSEC_PER_USEC;
+ res->tv_sec = 0;
+
+ return 0;
+
+ case CLOCK_MONOTONIC_RAW:
+ case CLOCK_MONOTONIC_RAW_APPROX:
+ case CLOCK_UPTIME_RAW:
+ case CLOCK_UPTIME_RAW_APPROX:
+ case CLOCK_THREAD_CPUTIME_ID: {
+ mach_timebase_info_data_t tb_info;
+
+ if (mach_timebase_info(&tb_info)) {
+ return -1;
+ }
+
+ res->tv_nsec = tb_info.numer / tb_info.denom + (tb_info.numer % tb_info.denom != 0);
+ res->tv_sec = 0;
+
+ return 0;
+ }
+
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+#else
+ return clock_getres(clk_id, res);
+#endif
+ }
+}
+
+BEGIN_SYMS("c")
SYM(calloc)
SYM(clock_gettime)
-SYM_2("clock_getres", ClockGetres)
+SYM_2("clock_getres", ClockGetres)
SYM(closedir)
SYM(fdopen)
SYM(fflush)
@@ -124,9 +124,9 @@ SYM(sem_unlink)
SYM(sem_wait)
SYM(siginterrupt)
SYM(strdup)
-SYM(sendfile)
-SYM(strtod)
-SYM_2("__errno_location", ErrnoLocation)
+SYM(sendfile)
+SYM(strtod)
+SYM_2("__errno_location", ErrnoLocation)
#if defined(_linux_)
SYM(prctl)
@@ -154,4 +154,4 @@ SYM(aio_suspend)
#endif
END_SYMS()
-#endif
+#endif
diff --git a/library/python/symbols/libc/ya.make b/library/python/symbols/libc/ya.make
index ae0aecb676..7b84cbc961 100644
--- a/library/python/symbols/libc/ya.make
+++ b/library/python/symbols/libc/ya.make
@@ -1,9 +1,9 @@
-LIBRARY()
+LIBRARY()
-OWNER(pg orivej)
+OWNER(pg orivej)
PEERDIR(
- library/python/symbols/registry
+ library/python/symbols/registry
)
IF (GCC OR CLANG)
@@ -13,7 +13,7 @@ IF (GCC OR CLANG)
ENDIF()
SRCS(
- GLOBAL syms.cpp
+ GLOBAL syms.cpp
)
END()
diff --git a/library/python/symbols/module/__init__.py b/library/python/symbols/module/__init__.py
index 2472775377..0061b9e598 100644
--- a/library/python/symbols/module/__init__.py
+++ b/library/python/symbols/module/__init__.py
@@ -1,48 +1,48 @@
-import subprocess
-
-from collections import defaultdict
-
-from .syms import syms
-
-
-def gen_builtin():
- res = defaultdict(dict)
-
- for k, v in syms.items():
- mod, sym = k.split('|')
-
- res[mod][sym] = v
-
- return res
-
-
-builtin_symbols = gen_builtin()
-caps = builtin_symbols['_capability']
-
-
-def find_library(name, find_next):
- subst = {
- 'rt': 'c',
- 'pthread': 'c',
- 'm': 'c',
- }
-
- builtin = builtin_symbols.get(subst.get(name, name))
-
- if builtin:
- return {
- 'name': name,
- 'symbols': builtin,
- }
-
- if 'musl' in caps:
- return None
-
- try:
- subprocess.Popen.__patched__
-
- return None
- except Exception:
- pass
-
- return find_next(name)
+import subprocess
+
+from collections import defaultdict
+
+from .syms import syms
+
+
+def gen_builtin():
+ res = defaultdict(dict)
+
+ for k, v in syms.items():
+ mod, sym = k.split('|')
+
+ res[mod][sym] = v
+
+ return res
+
+
+builtin_symbols = gen_builtin()
+caps = builtin_symbols['_capability']
+
+
+def find_library(name, find_next):
+ subst = {
+ 'rt': 'c',
+ 'pthread': 'c',
+ 'm': 'c',
+ }
+
+ builtin = builtin_symbols.get(subst.get(name, name))
+
+ if builtin:
+ return {
+ 'name': name,
+ 'symbols': builtin,
+ }
+
+ if 'musl' in caps:
+ return None
+
+ try:
+ subprocess.Popen.__patched__
+
+ return None
+ except Exception:
+ pass
+
+ return find_next(name)
diff --git a/library/python/symbols/module/module.cpp b/library/python/symbols/module/module.cpp
index fc3fd8dc0f..92bc7f4d67 100644
--- a/library/python/symbols/module/module.cpp
+++ b/library/python/symbols/module/module.cpp
@@ -1,62 +1,62 @@
#include <Python.h>
-#include <library/python/symbols/registry/syms.h>
-
+#include <library/python/symbols/registry/syms.h>
+
#include <util/generic/string.h>
-#define CAP(x) SYM_2(x, x)
-
-BEGIN_SYMS("_capability")
-#if defined(_musl_)
-CAP("musl")
-#endif
-#if defined(_linux_)
-CAP("linux")
-#endif
-#if defined(_darwin_)
-CAP("darwin")
-#endif
-CAP("_sentinel")
-END_SYMS()
-
-#undef CAP
-
-using namespace NPrivate;
-
-namespace {
- template <class T>
- struct TCB: public ICB {
- inline TCB(T& t)
- : CB(&t)
- {
- }
-
- void Apply(const char* mod, const char* name, void* sym) override {
- (*CB)(mod, name, sym);
- }
-
- T* CB;
- };
-
- template <class T>
- static inline TCB<T> MakeTCB(T& t) {
- return t;
- }
-}
-
+#define CAP(x) SYM_2(x, x)
+
+BEGIN_SYMS("_capability")
+#if defined(_musl_)
+CAP("musl")
+#endif
+#if defined(_linux_)
+CAP("linux")
+#endif
+#if defined(_darwin_)
+CAP("darwin")
+#endif
+CAP("_sentinel")
+END_SYMS()
+
+#undef CAP
+
+using namespace NPrivate;
+
+namespace {
+ template <class T>
+ struct TCB: public ICB {
+ inline TCB(T& t)
+ : CB(&t)
+ {
+ }
+
+ void Apply(const char* mod, const char* name, void* sym) override {
+ (*CB)(mod, name, sym);
+ }
+
+ T* CB;
+ };
+
+ template <class T>
+ static inline TCB<T> MakeTCB(T& t) {
+ return t;
+ }
+}
+
static void DictSetStringPtr(PyObject* dict, const char* name, void* value) {
PyObject* p = PyLong_FromVoidPtr(value);
PyDict_SetItemString(dict, name, p);
Py_DECREF(p);
}
-
+
static PyObject* InitSyms(PyObject* m) {
if (!m)
return NULL;
PyObject* d = PyDict_New();
if (!d)
return NULL;
-
+
auto f = [&](const char* mod, const char* name, void* sym) {
DictSetStringPtr(d, (TString(mod) + "|" + TString(name)).c_str(), sym);
};
@@ -69,7 +69,7 @@ static PyObject* InitSyms(PyObject* m) {
m = NULL;
Py_DECREF(d);
return m;
-}
+}
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef module = {
diff --git a/library/python/symbols/module/ya.make b/library/python/symbols/module/ya.make
index 2385c35fe0..78e30f2547 100644
--- a/library/python/symbols/module/ya.make
+++ b/library/python/symbols/module/ya.make
@@ -1,23 +1,23 @@
PY23_LIBRARY()
-
-OWNER(pg orivej)
-
+
+OWNER(pg orivej)
+
NO_PYTHON_INCLUDES()
-PEERDIR(
+PEERDIR(
contrib/libs/python/Include
-)
-
-SRCS(
- module.cpp
-)
-
-PY_REGISTER(
+)
+
+SRCS(
+ module.cpp
+)
+
+PY_REGISTER(
library.python.symbols.module.syms
-)
-
-PY_SRCS(
- __init__.py
-)
-
-END()
+)
+
+PY_SRCS(
+ __init__.py
+)
+
+END()
diff --git a/library/python/symbols/registry/syms.cpp b/library/python/symbols/registry/syms.cpp
index 3529fb3ece..ae8e98b32e 100644
--- a/library/python/symbols/registry/syms.cpp
+++ b/library/python/symbols/registry/syms.cpp
@@ -1,31 +1,31 @@
-#include "syms.h"
-
-#include <util/generic/vector.h>
-#include <util/generic/string.h>
-#include <util/generic/singleton.h>
-
-using namespace NPrivate;
-
-namespace {
- struct TSym {
- const char* Mod;
- const char* Name;
- void* Sym;
- };
-
- struct TSymbols: public TVector<TSym> {
- static inline TSymbols* Instance() {
- return Singleton<TSymbols>();
- }
- };
-}
-
-void NPrivate::RegisterSymbol(const char* mod, const char* name, void* sym) {
- TSymbols::Instance()->push_back(TSym{mod, name, sym});
-}
-
-void NPrivate::ForEachSymbol(ICB& cb) {
- for (auto& x : *TSymbols::Instance()) {
- cb.Apply(x.Mod, x.Name, x.Sym);
- }
-}
+#include "syms.h"
+
+#include <util/generic/vector.h>
+#include <util/generic/string.h>
+#include <util/generic/singleton.h>
+
+using namespace NPrivate;
+
+namespace {
+ struct TSym {
+ const char* Mod;
+ const char* Name;
+ void* Sym;
+ };
+
+ struct TSymbols: public TVector<TSym> {
+ static inline TSymbols* Instance() {
+ return Singleton<TSymbols>();
+ }
+ };
+}
+
+void NPrivate::RegisterSymbol(const char* mod, const char* name, void* sym) {
+ TSymbols::Instance()->push_back(TSym{mod, name, sym});
+}
+
+void NPrivate::ForEachSymbol(ICB& cb) {
+ for (auto& x : *TSymbols::Instance()) {
+ cb.Apply(x.Mod, x.Name, x.Sym);
+ }
+}
diff --git a/library/python/symbols/registry/syms.h b/library/python/symbols/registry/syms.h
index 4aca713216..5e34d35298 100644
--- a/library/python/symbols/registry/syms.h
+++ b/library/python/symbols/registry/syms.h
@@ -1,24 +1,24 @@
-#pragma once
-
-namespace NPrivate {
- struct ICB {
- virtual void Apply(const char* mod, const char* name, void* sym) = 0;
- };
-
- void ForEachSymbol(ICB& cb);
- void RegisterSymbol(const char* mod, const char* name, void* sym);
-}
-
-#define BEGIN_SYMS(name) \
- namespace { \
- static struct TRegister { \
- const char* ModuleName = name; \
- inline TRegister() {
-#define END_SYMS() \
- } \
- } \
- REGISTRY; \
- }
-
-#define SYM_2(n, s) ::NPrivate::RegisterSymbol(this->ModuleName, n, (void*)&s);
-#define SYM(s) SYM_2(#s, s);
+#pragma once
+
+namespace NPrivate {
+ struct ICB {
+ virtual void Apply(const char* mod, const char* name, void* sym) = 0;
+ };
+
+ void ForEachSymbol(ICB& cb);
+ void RegisterSymbol(const char* mod, const char* name, void* sym);
+}
+
+#define BEGIN_SYMS(name) \
+ namespace { \
+ static struct TRegister { \
+ const char* ModuleName = name; \
+ inline TRegister() {
+#define END_SYMS() \
+ } \
+ } \
+ REGISTRY; \
+ }
+
+#define SYM_2(n, s) ::NPrivate::RegisterSymbol(this->ModuleName, n, (void*)&s);
+#define SYM(s) SYM_2(#s, s);
diff --git a/library/python/symbols/registry/ya.make b/library/python/symbols/registry/ya.make
index e0ef822f98..2737b9fce9 100644
--- a/library/python/symbols/registry/ya.make
+++ b/library/python/symbols/registry/ya.make
@@ -1,9 +1,9 @@
-LIBRARY()
-
-OWNER(pg orivej)
-
-SRCS(
- syms.cpp
-)
-
-END()
+LIBRARY()
+
+OWNER(pg orivej)
+
+SRCS(
+ syms.cpp
+)
+
+END()
diff --git a/library/python/symbols/ya.make b/library/python/symbols/ya.make
index 4e9031beb8..340a710c48 100644
--- a/library/python/symbols/ya.make
+++ b/library/python/symbols/ya.make
@@ -1,12 +1,12 @@
-RECURSE(
- module
- registry
+RECURSE(
+ module
+ registry
tests
crypto
- libc
+ libc
libmagic
python
- uuid
+ uuid
win_unicode_console
-)
+)