On Fri, May 29, 2026 at 08:23:24AM -0700, Stephen Hemminger wrote: > On Fri, 29 May 2026 09:01:34 +0100 > Bruce Richardson <[email protected]> wrote: > > > On Thu, May 28, 2026 at 07:04:48PM +0000, Sudheendra Sampath wrote: > > > This patch for bug 1832 will do the following: > > > 1. If /run/dpdk is not present, it will create it first with and > > > then create powermanager directory underneath it. > > > 2. If /run/dpdk is present, it will verify it is actually a directory > > > before creating subdirectory, powermanager. > > > > > I would suggest using $XDG_RUNTIME_DIR for the directory path, rather than > > hardcoding it by default. If XDG_RUNTIME_DIR is not set, then maybe > > consider using /run/dpdk. However, rather than /run/dpdk, I'd suggest using > > the normal runtime dir path on most distros as the default: > > /run/user/<uid>. > > > > /Bruce > > The login in EAL is a little more detailed. > The choice is from systemd conventions which follows filesystem hierarchy. > > > int eal_create_runtime_dir(void) > { > const char *directory; > char run_dir[PATH_MAX]; > char tmp[PATH_MAX]; > int ret; > > /* from RuntimeDirectory= see systemd.exec */ > directory = getenv("RUNTIME_DIRECTORY"); > if (directory == NULL) { > /* > * Used standard convention defined in > * XDG Base Directory Specification and > * Filesystem Hierarchy Standard. > */ > if (getuid() == 0) > directory = "/var/run"; > else > directory = getenv("XDG_RUNTIME_DIR") ? : "/tmp"; > } > > /* create DPDK subdirectory under runtime dir */ > ret = snprintf(tmp, sizeof(tmp), "%s/dpdk", directory); > if (ret < 0 || ret == sizeof(tmp)) { > EAL_LOG(ERR, "Error creating DPDK runtime path name"); > return -1; > } > > /* create prefix-specific subdirectory under DPDK runtime dir */ > ret = snprintf(run_dir, sizeof(run_dir), "%s/%s", > tmp, eal_get_hugefile_prefix()); > if (ret < 0 || ret == sizeof(run_dir)) { > EAL_LOG(ERR, "Error creating prefix-specific runtime path > name"); > return -1; > } > > /* create the path if it doesn't exist. no "mkdir -p" here, so do it > * step by step. > */ > ret = mkdir(tmp, 0700); > if (ret < 0 && errno != EEXIST) { > EAL_LOG(ERR, "Error creating '%s': %s", > tmp, strerror(errno)); > return -1; > } > > ret = mkdir(run_dir, 0700); > if (ret < 0 && errno != EEXIST) { > EAL_LOG(ERR, "Error creating '%s': %s", > run_dir, strerror(errno)); > return -1; > }
Yes. Can the power manager call the rte_eal_get_runtime_dir() API and use that as a basis for its working directory? Save duplicating all this logic. /Bruce

