From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailfilter02.viettel.com.vn (mailfilter02.viettel.com.vn [125.235.240.54]) by dpdk.org (Postfix) with ESMTP id 5F0EEA48C for ; Mon, 22 Jan 2018 11:15:27 +0100 (CET) X-IronPort-AV: E=Sophos;i="5.46,396,1511802000"; d="scan'208,217";a="73354439" Received: from 125.235.240.45.adsl.viettel.vn (HELO mta2.viettel.com.vn) ([125.235.240.45]) by mailfilter02.viettel.com.vn with ESMTP; 22 Jan 2018 17:15:25 +0700 Received: from localhost (localhost [127.0.0.1]) by mta2.viettel.com.vn (Postfix) with ESMTP id 494876A32F0; Mon, 22 Jan 2018 17:15:22 +0700 (ICT) Received: from mta2.viettel.com.vn ([127.0.0.1]) by localhost (mta2.viettel.com.vn [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id TWa2SRnFxOeB; Mon, 22 Jan 2018 17:15:22 +0700 (ICT) Received: from localhost (localhost [127.0.0.1]) by mta2.viettel.com.vn (Postfix) with ESMTP id 285586A32F3; Mon, 22 Jan 2018 17:15:22 +0700 (ICT) X-Virus-Scanned: amavisd-new at Received: from mta2.viettel.com.vn ([127.0.0.1]) by localhost (mta2.viettel.com.vn [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id rTufhffotOry; Mon, 22 Jan 2018 17:15:22 +0700 (ICT) Received: from ANMLONGTB5 (unknown [27.68.241.28]) by mta2.viettel.com.vn (Postfix) with ESMTPSA id E90196A32F0; Mon, 22 Jan 2018 17:15:21 +0700 (ICT) To: Cc: Message-ID: <001501d3936a$5ad21450$10763cf0$@viettel.com.vn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdOTZuoiGosEXYjDTY+ojFaEJ8qwBw== Content-Language: en-us MilterAction: FORWARD Date: Mon, 22 Jan 2018 17:15:22 +0700 (ICT) From: longtb5@viettel.com.vn Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-users] librte_cmdline usage X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jan 2018 10:15:29 -0000 Hi all, I'm writing an application where there already exists a cmdline. Users can issue commands by typing from stdin. I want to support another user interface where commands are read from sources other than stdin, saved into a string buffer, then executed using the already existed cmd_parse_ctx_t. So far I have implemented this functionality using the cmdline_interact() API like so (pseudo code). /* Initialization */ /* cmds_ctx is the existing command context * that I wish to reuse */ new_cl = cmdline_new(cmds_ctx, "", cmdbuf_fd, 1); /* Polling */ for ( ; ; ) { snprintf(cmdbuf, cmdlen + 2, "%s\n", raw_string); lseek(cmdbuf_fd, 0 , SEEK_SET); cmdline_interact(new_cl); } There are a couple of questions: 1. Using cmdline_interact() seems to be quite expensive. How can I reduce this cost. Is there a leaner/more elegant way to implement this using DPDK API or do I have to write my own code/change the lib? 2. How can I disable the behavior where every interaction is written to stdout, i.e., to have no output what so ever. Again this is to improve performance since writing to stdout is costly. Thanks and best regards, --BL