diff options
author | MITSUNARI Shigeo <[email protected]> | 2022-03-08 10:42:57 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2022-03-08 10:42:57 +0900 |
commit | 615b665cc213d78373009fd626b974711fdc367c (patch) | |
tree | 0943c6b5f5c539e4ab3a89f0ffe4073fed743b1f | |
parent | 2861517f2598adbefb54bc6d1b5d500a17945b65 (diff) | |
download | xbyak-615b665cc213d78373009fd626b974711fdc367c.tar.gz xbyak-615b665cc213d78373009fd626b974711fdc367c.zip |
sample/memfd shows /proc/self/maps
-rw-r--r-- | sample/memfd.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sample/memfd.cpp b/sample/memfd.cpp index c29272b..1066c55 100644 --- a/sample/memfd.cpp +++ b/sample/memfd.cpp @@ -1,4 +1,5 @@ /* + a sample to use MmapAllocator with an user-defined name cat /proc/`psidof ./memfd`/maps 7fca70b44000-7fca70b4a000 rw-p 00000000 00:00 0 @@ -9,6 +10,7 @@ */ #define XBYAK_USE_MEMFD #include <xbyak/xbyak.h> +#include <fstream> class Code : Xbyak::MmapAllocator, public Xbyak::CodeGenerator { public: @@ -23,9 +25,15 @@ public: int main() { - Code c1("abc", 123); - Code c2("xyz", 456); + Code c1("Xbyak::abc", 123); + Code c2("Xbyak::xyz", 456); printf("c1 %d\n", c1.getCode<int (*)()>()()); printf("c2 %d\n", c2.getCode<int (*)()>()()); - getchar(); + std::ifstream ifs("/proc/self/maps", std::ios::binary); + if (ifs) { + std::string line; + while (std::getline(ifs, line)) { + printf("%s\n", line.c_str()); + } + } } |