On 11-Jul-19 11:31 AM, yasufu...@gmail.com wrote:
From: Yasufumi Ogawa <ogawa.yasuf...@lab.ntt.co.jp>
In secondary_msl_create_walk(), it creates a file for fbarrays with its
PID for reserving unique name among secondary processes. However, it
does not work if secondary is run as app container because each of
containerized secondary has PID 1. To reserve unique name, use hostname
instead of PID because hostname is assigned as a short form of 64
digits full container ID in docker.
Cc: sta...@dpdk.org
Signed-off-by: Yasufumi Ogawa <ogawa.yasuf...@lab.ntt.co.jp>
---
<...>
+ if (getpid() == 1) {
+ FILE *hn_fp;
+ hn_fp = fopen("/etc/hostname", "r");
+ if (hn_fp == NULL) {
+ RTE_LOG(ERR, EAL,
+ "Cannot open '/etc/hostname' for secondary\n");
+ return -1;
+ }
+
+ /* with docker, /etc/hostname just has one entry of hostname */
+ if (fscanf(hn_fp, "%s", proc_id) == EOF) {
Apologies for not pointing this out earlier, but do i understand
correctly that there's no bounds checking here, and fscanf() will write
however many bytes it wants?
--
Thanks,
Anatoly