DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ni, Xun" <xun.ni@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	Neil Horman <nhorman@tuxdriver.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] daemon process problem in DPDK
Date: Tue, 13 Jan 2015 02:36:30 +0000	[thread overview]
Message-ID: <91E2D863603AD4478F101CE81E76E45D01C38696@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20150112111421.613ffe97@urahara>

Much appericated, Get it now.

Thanks,
Xun

-----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

On Mon, 12 Jan 2015 09:52:10 -0500
Neil Horman <nhorman@tuxdriver.com> 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;

  reply	other threads:[~2015-01-13  2:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12 14:28 Ni, Xun
2015-01-12 14:52 ` Neil Horman
2015-01-12 19:14   ` Stephen Hemminger
2015-01-13  2:36     ` Ni, Xun [this message]
2015-01-13  8:05       ` Hiroshi Shimamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=91E2D863603AD4478F101CE81E76E45D01C38696@SHSMSX103.ccr.corp.intel.com \
    --to=xun.ni@intel.com \
    --cc=dev@dpdk.org \
    --cc=nhorman@tuxdriver.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).