From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 33D5545452 for ; Fri, 14 Jun 2024 01:23:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 141B440274; Fri, 14 Jun 2024 01:23:43 +0200 (CEST) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mails.dpdk.org (Postfix) with ESMTP id 06E9F4014F for ; Fri, 14 Jun 2024 01:23:42 +0200 (CEST) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1f70c457823so13518035ad.3 for ; Thu, 13 Jun 2024 16:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1718321021; x=1718925821; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=Zpqolwmwwyc5sCVIviB7Tqsgglv63GhHUb1XulKLrrk=; b=AUtpm6PkD/cAJL9ql11wilI8MXgCjuCOCgRayKpzWsebjFAvujK2aNFzHboh5eQ3SP /D4qJvPoKg9izPQac2KhvMtthGmJkffN4XZ1LGumqyk5AtyVCXa6rWujoZWO2SVg+VcV kJ/lhUttqKQ2d2xVz8mwex0FVlVpi+5I6y7Kxc7VIZpfzKtvkYrJ1PVd+CKO3T3OT2xt SRl2XjEZxVBrsGkFWJBdayeVuVT8x1GyRQP576r0EhT6oS5heOhZwkhPlTho4tcaRtwx tY778HS4HFBs1xNZeQq5EnzsvOODfTGAea4ISGAEYJm2y5Qd0hdpVWhZgEXZ6i0VwJyD HT4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718321021; x=1718925821; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zpqolwmwwyc5sCVIviB7Tqsgglv63GhHUb1XulKLrrk=; b=m7BGGZXDbRoZyBoxiya5yk1vm2wd3ZQZpzv5EJRCtP2H6V3/BiOsdILIBRXyBEyBoI EUn16TV49t1ievm8om8Jpe/1WNX8IrR8D3PSj3NoviA6mCePGDB7jUL4YVVgJMULCfHC uMQDr+1fXawAagb0Eti9OUAlnZsMMWx9s0xBN/2/NILSFU34BH4qui6ssk+JuIxWEgdF cwMl2LUMLOTVe7Z6n3xXyvO2nj84Y0JIuQNlMceaPtI5N/AH+4lw3qQ+K64GHtul5sxU P+TeA827fOgVwcW/LcbJH19AVJ4uJnwpi7RiNatFZWRFp2y2oNn7bJFP5Y67yzKq4wSV 4n4g== X-Forwarded-Encrypted: i=1; AJvYcCVFgthE7Z62JMKdqLlLUcrFH4RYkAJ6MpvSGlpU+kBoCnFYqw+bFAOX2OZ4t6sJ2BCpE/S8CODgdYo/MqVwrWY= X-Gm-Message-State: AOJu0YziTJkOCD8nPjjg/gxsteqDslSE3rpnL+FgPf7GYCsRlgixZXvH T+Knio6CeutI4KVbpglT9gz1LoBhGHxhlydcksSxDCvPzxYigOCzE7bkPtqai6ba3aPiBmk6W4E e X-Google-Smtp-Source: AGHT+IEZnDUQhreVTxPMDLy3fhGtvI7oE6IAv2tqySjcQ+Rq4xjZ9xVcpnNfakgMHxNWTU8uEhLerA== X-Received: by 2002:a17:902:d507:b0:1f7:1aff:679e with SMTP id d9443c01a7336-1f862a0aefbmr12736555ad.66.1718321021006; Thu, 13 Jun 2024 16:23:41 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f855e55e77sm19848215ad.12.2024.06.13.16.23.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 16:23:40 -0700 (PDT) Date: Thu, 13 Jun 2024 16:23:38 -0700 From: Stephen Hemminger To: Kaisen You Cc: dev@dpdk.org, qiming.yang@intel.com, yidingx.zhou@intel.com, stable@dpdk.org Subject: Re: [PATCH] child process synchronization NIC startup parameters Message-ID: <20240613162338.3c9f4be4@hermes.local> In-Reply-To: <20230705093515.3285574-1-kaisenx.you@intel.com> References: <20230705093515.3285574-1-kaisenx.you@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Wed, 5 Jul 2023 17:35:14 +0800 Kaisen You wrote: > > +/* get cmdline form PID. Read process info form /proc/$PID. */ > +static char *get_cmdline_from_pid(pid_t pid, char *buf, int len) > +{ > + char filename[PATH_MAX]; > + char *name = NULL; > + int fd; > + int ret; > + > + if (pid < 1 || buf == NULL || len < 0) { > + printf("%s: illegal param\n", __func__); > + return NULL; > + } > + > + snprintf(filename, PATH_MAX, "/proc/%d/cmdline", pid); > + memset(buf, 0, len); > + fd = open(filename, O_RDONLY); > + if (fd < 0) { > + perror("open:"); > + return NULL; > + } > + ret = read(fd, buf, len); > + close(fd); > + > + if (ret < 0) > + return NULL; > + > + if (buf[ret-1] == '\n') > + buf[--ret] = 0; > + > + name = buf; > + while (ret) { > + if (((unsigned char)*name) < ' ') > + *name = ' '; > + name++; > + ret--; > + } > + *name = 0; > + > + if (buf[0]) > + return buf; > + > + return NULL; > +} Bad idea, this is not portable, and easily broken by system changes and container environments. Please use some form of explicit communication like is done for primary / secondary process support.