From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from tyo201.gate.nec.co.jp (TYO201.gate.nec.co.jp [210.143.35.51]) by dpdk.org (Postfix) with ESMTP id AD17018F for ; Tue, 13 Jan 2015 09:07:46 +0100 (CET) Received: from mailgate3.nec.co.jp ([10.7.69.195]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id t0D87hs7027608; Tue, 13 Jan 2015 17:07:43 +0900 (JST) Received: from mailsv3.nec.co.jp (imss61.nec.co.jp [10.7.69.156]) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) with ESMTP id t0D87hC07749; Tue, 13 Jan 2015 17:07:43 +0900 (JST) Received: from mail01b.kamome.nec.co.jp (mail01b.kamome.nec.co.jp [10.25.43.2]) by mailsv3.nec.co.jp (8.13.8/8.13.4) with ESMTP id t0D87hSr027225; Tue, 13 Jan 2015 17:07:43 +0900 (JST) Received: from bpxc99gp.gisp.nec.co.jp ([10.38.151.144] [10.38.151.144]) by mail01b.kamome.nec.co.jp with ESMTP id BT-MMP-1223503; Tue, 13 Jan 2015 17:05:40 +0900 Received: from BPXM14GP.gisp.nec.co.jp ([169.254.1.73]) by BPXC16GP.gisp.nec.co.jp ([10.38.151.144]) with mapi id 14.03.0174.002; Tue, 13 Jan 2015 17:05:39 +0900 From: Hiroshi Shimamoto To: "Ni, Xun" , Stephen Hemminger , Neil Horman Thread-Topic: [dpdk-dev] daemon process problem in DPDK Thread-Index: AQHQLpwnyaA2gtznGE+uuLneuFb5FZy9VfcwgABas0A= Date: Tue, 13 Jan 2015 08:05:38 +0000 Message-ID: <7F861DC0615E0C47A872E6F3C5FCDDBD05DFC3A9@BPXM14GP.gisp.nec.co.jp> References: <91E2D863603AD4478F101CE81E76E45D01C3839B@SHSMSX103.ccr.corp.intel.com> <20150112145210.GC23467@hmsreliant.think-freely.org> <20150112111421.613ffe97@urahara> <91E2D863603AD4478F101CE81E76E45D01C38696@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <91E2D863603AD4478F101CE81E76E45D01C38696@SHSMSX103.ccr.corp.intel.com> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.205.5.123] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Tue, 13 Jan 2015 08:07:47 -0000 Hi, > Subject: Re: [dpdk-dev] daemon process problem in DPDK >=20 > Much appericated, Get it now. >=20 > Thanks, > Xun >=20 > -----Original Message----- > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Tuesday, January 13, 2015 3:14 AM > To: Neil Horman > Cc: Ni, Xun; dev@dpdk.org > Subject: Re: [dpdk-dev] daemon process problem in DPDK >=20 > On Mon, 12 Jan 2015 09:52:10 -0500 > Neil Horman wrote: >=20 > > 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 pr= ocess 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 with= in 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 > > >=20 > We did have to make some changes to the basic application model (not in D= PDK) to allow for a daemon. >=20 > 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. How about to have daemon option in DPDK eal? I think that many network service programs work as daemon. If DPDK has daemon option, it may be helpful. thanks, Hiroshi >=20 > 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. >=20 >=20 > int > main(int argc, char **argv) > { > int ret; > char *progname; >=20 > progname =3D strrchr(argv[0], '/'); > progname =3D strdup(progname ? progname + 1 : argv[0]); >=20 > ret =3D parse_args(argc, argv); > if (ret < 0) > return -1; >=20 > argc -=3D ret; > argv +=3D ret; >=20 > if (daemon_mode && daemon(1, 1) < 0) > return -1; >=20 > /* workaround fact that EAL expects progname as first argument */ > argv[0] =3D progname; >=20 > ret =3D rte_eal_init(argc, argv); > if (ret < 0) > return -1;