| 204 | */ |
| 205 | #ifdef RTE_EXEC_ENV_LINUX |
| 206 | static char * |
| 207 | get_current_prefix(char *prefix, int size) |
| 208 | { |
| 209 | char path[PATH_MAX] = {0}; |
| 210 | char buf[PATH_MAX] = {0}; |
| 211 | |
| 212 | /* get file for config (fd is always 3) */ |
| 213 | snprintf(path, sizeof(path), "/proc/self/fd/%d", 3); |
| 214 | |
| 215 | /* return NULL on error */ |
| 216 | if (readlink(path, buf, sizeof(buf)) == -1) |
| 217 | return NULL; |
| 218 | |
| 219 | /* get the prefix */ |
| 220 | snprintf(prefix, size, "%s", basename(dirname(buf))); |
| 221 | |
| 222 | return prefix; |
| 223 | } |
| 224 | #endif |
| 225 | |
| 226 | #endif /* _PROCESS_H_ */ |
no test coverage detected