symbols.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "symbols.h"
  2. #include <util/generic/singleton.h>
  3. #include <util/generic/utility.h>
  4. #include <util/system/dynlib.h>
  5. #define LOADSYM(name, type) {name = (TId<type>::R*)L->SymOptional(#name);}
  6. const TInfinibandSymbols* IBSym() {
  7. struct TSymbols: TInfinibandSymbols {
  8. TSymbols() {
  9. L.Reset(new TDynamicLibrary("/usr/lib/libibverbs.so"));
  10. DOVERBS(LOADSYM)
  11. }
  12. THolder<TDynamicLibrary> L;
  13. };
  14. return SingletonWithPriority<TSymbols, 100>();
  15. }
  16. const TRdmaSymbols* RDSym() {
  17. struct TSymbols: TRdmaSymbols {
  18. TSymbols() {
  19. L.Reset(new TDynamicLibrary("/usr/lib/librdmacm.so"));
  20. DORDMA(LOADSYM)
  21. }
  22. THolder<TDynamicLibrary> L;
  23. };
  24. return SingletonWithPriority<TSymbols, 100>();
  25. }
  26. const TMlx5Symbols* M5Sym() {
  27. struct TSymbols: TMlx5Symbols {
  28. TSymbols() {
  29. L.Reset(new TDynamicLibrary("/usr/lib/libmlx5.so"));
  30. DOMLX5(LOADSYM)
  31. }
  32. THolder<TDynamicLibrary> L;
  33. };
  34. return SingletonWithPriority<TSymbols, 100>();
  35. }
  36. #undef LOADSYM