env/dpdk: do not clean up DPDK 18.05 shared files
eal_get_runtime_dir() that we used so far is not available in DPDK shared libraries, so we remove its usages in SPDK together with the functionality of removing files left over by DPDK. Luckily for us, this only affects DPDK 18.05, as for DPDK 18.08+ the --no-shconf option that we use prevents all those files from being created whatsoever. Change-Id: I078fb7686d2445a6acb067b0c3762a9c99f9a429 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/426218 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Lance Hartmann <lance.hartmann@oracle.com> Reviewed-by: Seth Howell <seth.howell5141@gmail.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
e42bb743f9
commit
036d923972
@ -100,42 +100,20 @@ _sprintf_alloc(const char *format, ...)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if RTE_VERSION >= RTE_VERSION_NUM(18, 05, 0, 0)
|
||||
const char *eal_get_runtime_dir(void);
|
||||
#endif
|
||||
|
||||
static void
|
||||
spdk_env_unlink_shared_files(void)
|
||||
{
|
||||
/* Starting with DPDK 18.05, there are more files with unpredictable paths
|
||||
* and filenames. The --no-shconf option prevents from creating them, but
|
||||
* only for DPDK 18.08+. For DPDK 18.05 we just leave them be.
|
||||
*/
|
||||
#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0)
|
||||
char buffer[PATH_MAX];
|
||||
|
||||
#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0)
|
||||
snprintf(buffer, PATH_MAX, "/var/run/.spdk_pid%d_hugepage_info", getpid());
|
||||
if (unlink(buffer)) {
|
||||
fprintf(stderr, "Unable to unlink shared memory file: %s. Error code: %d\n", buffer, errno);
|
||||
}
|
||||
#else
|
||||
DIR *dir;
|
||||
struct dirent *d;
|
||||
|
||||
dir = opendir(eal_get_runtime_dir());
|
||||
if (!dir) {
|
||||
fprintf(stderr, "Failed to open DPDK runtime dir: %s (%d)\n", eal_get_runtime_dir(), errno);
|
||||
return;
|
||||
}
|
||||
|
||||
while ((d = readdir(dir)) != NULL) {
|
||||
if (d->d_type != DT_REG) {
|
||||
continue;
|
||||
}
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%s/%s", eal_get_runtime_dir(), d->d_name);
|
||||
if (unlink(buffer)) {
|
||||
fprintf(stderr, "Unable to unlink shared memory file: %s. Error code: %d\n", buffer, errno);
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user