* [dpdk-dev] daemon process problem in DPDK @ 2015-01-12 14:28 Ni, Xun 2015-01-12 14:52 ` Neil Horman 0 siblings, 1 reply; 5+ messages in thread From: Ni, Xun @ 2015-01-12 14:28 UTC (permalink / raw) To: dev 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] daemon process problem in DPDK 2015-01-12 14:28 [dpdk-dev] daemon process problem in DPDK Ni, Xun @ 2015-01-12 14:52 ` Neil Horman 2015-01-12 19:14 ` Stephen Hemminger 0 siblings, 1 reply; 5+ messages in thread From: Neil Horman @ 2015-01-12 14:52 UTC (permalink / raw) To: Ni, Xun; +Cc: dev 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] daemon process problem in DPDK 2015-01-12 14:52 ` Neil Horman @ 2015-01-12 19:14 ` Stephen Hemminger 2015-01-13 2:36 ` Ni, Xun 0 siblings, 1 reply; 5+ messages in thread From: Stephen Hemminger @ 2015-01-12 19:14 UTC (permalink / raw) To: Neil Horman; +Cc: dev 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; ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] daemon process problem in DPDK 2015-01-12 19:14 ` Stephen Hemminger @ 2015-01-13 2:36 ` Ni, Xun 2015-01-13 8:05 ` Hiroshi Shimamoto 0 siblings, 1 reply; 5+ messages in thread From: Ni, Xun @ 2015-01-13 2:36 UTC (permalink / raw) To: Stephen Hemminger, Neil Horman; +Cc: dev 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; ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] daemon process problem in DPDK 2015-01-13 2:36 ` Ni, Xun @ 2015-01-13 8:05 ` Hiroshi Shimamoto 0 siblings, 0 replies; 5+ messages in thread From: Hiroshi Shimamoto @ 2015-01-13 8:05 UTC (permalink / raw) To: Ni, Xun, Stephen Hemminger, Neil Horman; +Cc: dev Hi, > Subject: Re: [dpdk-dev] daemon process problem in DPDK > > 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. 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 > > 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; ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-01-13 8:07 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-01-12 14:28 [dpdk-dev] daemon process problem in DPDK Ni, Xun 2015-01-12 14:52 ` Neil Horman 2015-01-12 19:14 ` Stephen Hemminger 2015-01-13 2:36 ` Ni, Xun 2015-01-13 8:05 ` Hiroshi Shimamoto
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).