From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by dpdk.org (Postfix) with ESMTP id 479145A7A for ; Mon, 12 Jan 2015 20:14:33 +0100 (CET) Received: by mail-pd0-f176.google.com with SMTP id r10so31998226pdi.7 for ; Mon, 12 Jan 2015 11:14:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=iExDGEI+3PjHULk5sjl5OQBy2IJ4RWL/gtz/LeMnl40=; b=E0Edd8pkOl6Is18V8YvJ371PJ9bfqnjw1dZlmXVN6yG+0Apc29dlIg5JGXIZ42qmiA qA7rJMTeX4T21lGops2X81A5D31SlBUbKKGGu5ylp7SESgbKd31Ywa7s9TWOIopzS4NC O25bgKONUvYbSRZHeu11LgJD8JNG71QwK5FVchyxcKvzu1Wh19KQFQmWxgVsxHCy3qcJ Ds4/78C49NR8tMmX2Pzx/6zbDu+0rumhtmXM+fWfMooOJLuE/Ug+UKvYbW3KX947OoYd l7Uov/R5dm5H54cPXdEMZtg9lz8Tccfr8/4OWRrXvRhW0+4RxQsxBytYGv0JKcOI5l8N zT1A== X-Gm-Message-State: ALoCoQn94SgvNjzZD8SHqf0irT0yPOFms7HBuhqNYL1E9ENQTKjD1J1PPFRt8kUjJcaUc6em8iFy X-Received: by 10.70.49.16 with SMTP id q16mr45926605pdn.2.1421090071377; Mon, 12 Jan 2015 11:14:31 -0800 (PST) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id od13sm15069081pdb.18.2015.01.12.11.14.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jan 2015 11:14:31 -0800 (PST) Date: Mon, 12 Jan 2015 11:14:21 -0800 From: Stephen Hemminger To: Neil Horman Message-ID: <20150112111421.613ffe97@urahara> In-Reply-To: <20150112145210.GC23467@hmsreliant.think-freely.org> References: <91E2D863603AD4478F101CE81E76E45D01C3839B@SHSMSX103.ccr.corp.intel.com> <20150112145210.GC23467@hmsreliant.think-freely.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] daemon process problem in DPDK X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jan 2015 19:14:33 -0000 On Mon, 12 Jan 2015 09:52:10 -0500 Neil Horman wrote: > On Mon, Jan 12, 2015 at 02:28:20PM +0000, Ni, Xun wrote: > > Hello: > > > > I have basic questions related to dpdk and trying to find help. > > > > I am about to create a daemon process, is there a way for other process to know whether the daemon is already created? I doesn't mean to get the pid, because it changes every time. > > > > If the daemon is created, how do other process to communicate with this daemon? Dpdk seems to have rte ring but it only exists on the Ethernet, while I am talking about the process within the same computer, and the way like share-memory, but I didn't find examples about the share memory between processes. > > > > Thanks, > > Xun > > > > > > Thats not really a dpdk question, that a generic programming question. You can > do this lots of ways. Open a socket that other process can connect to on an > agreed port, create a shared memory segment, write a file with connect > information to a well know location, etc. > Neil > We did have to make some changes to the basic application model (not in DPDK) to allow for a daemon. The normal/correct way to make a daemon is to use the daemon glibc call, and this closes all file descriptors etc. Therefore the DPDK (eal) must be initialized after the daemon call. Also, wanted to make daemon optional for debugging. This led to change where the main program process application argv first then passes DPDK args as second group. This is the inverse of the example applications. int main(int argc, char **argv) { int ret; char *progname; progname = strrchr(argv[0], '/'); progname = strdup(progname ? progname + 1 : argv[0]); ret = parse_args(argc, argv); if (ret < 0) return -1; argc -= ret; argv += ret; if (daemon_mode && daemon(1, 1) < 0) return -1; /* workaround fact that EAL expects progname as first argument */ argv[0] = progname; ret = rte_eal_init(argc, argv); if (ret < 0) return -1;