Using the same logic as in DPDK's EAL, get the DPDK runtime directory based on the file-prefix and user
(fp)
| 133 | |
| 134 | |
| 135 | def get_dpdk_runtime_dir(fp): |
| 136 | """ Using the same logic as in DPDK's EAL, get the DPDK runtime directory |
| 137 | based on the file-prefix and user """ |
| 138 | run_dir = os.environ.get('RUNTIME_DIRECTORY') |
| 139 | if not run_dir: |
| 140 | if (os.getuid() == 0): |
| 141 | run_dir = '/var/run' |
| 142 | else: |
| 143 | run_dir = os.environ.get('XDG_RUNTIME_DIR', '/tmp') |
| 144 | return os.path.join(run_dir, 'dpdk', fp) |
| 145 | |
| 146 | |
| 147 | if __name__ == "__main__": |