linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Wen Guangcheng" <wen.guangcheng@cnt.sp.qnes.nec.co.jp>
To: "Zhang, Yanmin" <yanmin.zhang@intel.com>,
	linux-c-programming@vger.kernel.org
Subject: Re: How to execute a process in background by exec functions?
Date: Thu, 8 Apr 2004 18:31:55 +0900	[thread overview]
Message-ID: <004501c41d4c$5503f820$de01a8c0@qnessmphibiki> (raw)
In-Reply-To: 3AA03342E913FA4BA6D8BD0732BFC74B05530BA8@pdsmsx402.pd.intel.com

Hi,
Thanks a lot for your help.
Yes, I have tired this way. The daemon started, but I hope its PPID
is 1. We can do it by calling system("/home/wen/daemon &").
How can I do it by fork&exec way?

Best regards,

--Wen

----- Original Message ----- 
From: "Zhang, Yanmin" <yanmin.zhang@intel.com>
To: "Wen Guangcheng" <wen.guangcheng@cnt.sp.qnes.nec.co.jp>;
<linux-c-programming@vger.kernel.org>
Sent: Thursday, April 08, 2004 3:00 PM
Subject: RE: How to execute a process in background by exec functions?


> It doesn't work in this approach. Try this:
>
> pid=fork();
> if(pid == 0) {
> execv("/home/wen/daemon", NULL);
> exit(-1);
> }
>
> ... do parent process.
>
> Yanmin
>
>
> >-----Original Message-----
> >From: linux-c-programming-owner@vger.kernel.org [mailto:linux-c-
> >programming-owner@vger.kernel.org] On Behalf Of Wen Guangcheng
> >Sent: 2004Äê4ÔÂ8ÈĠ 13:41
> >To: linux-c-programming@vger.kernel.org
> >Subject: How to execute a process in background by exec functions?
> >
> >Hello All,
> >I am trying to execute a process in background by exec functions.
> >But it failed when I call the function of execv by
> >execv("/home/wen/daemon &", NULL);
> >The error is ENOENT(No such file or directory).
> >Would anyone tell me how to do it?
> >Thanks in advance.
> >
> >Best regards,
> >
> >--Wen
> >-
> >To unsubscribe from this list: send the line "unsubscribe linux-c-
> >programming" in
> >the body of a message to majordomo@vger.kernel.org
> >More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

       reply	other threads:[~2004-04-08  9:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3AA03342E913FA4BA6D8BD0732BFC74B05530BA8@pdsmsx402.pd.intel.com>
2004-04-08  9:31 ` Wen Guangcheng [this message]
2004-04-11 19:23 How to execute a process in background by exec functions? Jose Luis Alarcon Sanchez
  -- strict thread matches above, loose matches on Subject: below --
2004-04-11 17:37 Jose Luis Alarcon Sanchez
2004-04-11 17:05 ` John T. Williams
2004-04-11 23:02   ` Glynn Clements
2004-04-06 20:44 c++ compiling problem. undefined reference to main srg
2004-04-08  5:41 ` How to execute a process in background by exec functions? Wen Guangcheng
2004-04-08  8:56   ` Glynn Clements
2004-04-08 13:25   ` John T. Williams

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='004501c41d4c$5503f820$de01a8c0@qnessmphibiki' \
    --to=wen.guangcheng@cnt.sp.qnes.nec.co.jp \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=yanmin.zhang@intel.com \
    /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).