Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > daemon mode not quite working

Reply
Thread Tools

daemon mode not quite working

 
 
unknown@example.com
Guest
Posts: n/a
 
      04-30-2008
Hi,

I have an application featuring a verbose mode and a daemon mode.
It's working just fine in verbose mode but in daemon mode it doesn't quite
seem to be functioning properly,
I get into Daemon mode with a fork command followed by exit() to be
specific, it looks like:
[C++]
pid = fork();
if (pid < 0)
{
exit(EXIT_FAILURE);
}
else if (pid > 0)
{
exit(EXIT_SUCCESS);
}

umask(0);

sid = setsid();
[/C++]
Is there a problem with this? Do I miss anything?
Thanks,
Ron
--
weeks of software enineering safe hours of planing
 
Reply With Quote
 
 
 
 
sk_usenet
Guest
Posts: n/a
 
      04-30-2008
<(E-Mail Removed)> wrote in message
> Hi,
>
> I have an application featuring a verbose mode and a daemon mode.
> It's working just fine in verbose mode but in daemon mode it doesn't quite
> seem to be functioning properly,
> I get into Daemon mode with a fork command followed by exit() to be
> specific, it looks like:
> [C++]
> pid = fork();
> if (pid < 0)
> {
> exit(EXIT_FAILURE);
> }
> else if (pid > 0)
> {
> exit(EXIT_SUCCESS);
> }
>
> umask(0);
>
> sid = setsid();
> [/C++]
> Is there a problem with this? Do I miss anything?


1. Nothing C++ language specific here, so it's OT.
2. Post to comp.unix.programmer. Also post as to what you mean by not
functioning properly. Have you tried some tool like ktrace/strace to debug
the problem?

--
http://techytalk.googlepages.com


 
Reply With Quote
 
 
 
 
sk_usenet
Guest
Posts: n/a
 
      04-30-2008

"Victor Bazarov" <(E-Mail Removed)> wrote in message >
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
[snip OT]

> The problem is that you're posting in a wrong newsgroup. C++ does
> not define how "fork" or "umask" or "setsid" works. You need to
> post your inquiry in the newsgroup that deals with your OS. You


You are very correct in marking the question as OT.

> probably missed the fact that this newsgroup only discusses the
> language issues, not interprocess communication provided by your
> platform. Sorry.


I didn't see any part referring to IPC etc. He is just trying to dameonize a
process, and it's pretty standard set of rules in Unix. Well, of course it's
still OT.

--
http://techytalk.googlepages.com


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: PEP 3143: Standard daemon process library (was: Writing awell-behaved daemon) Floris Bruynooghe Python 1 03-24-2009 02:58 PM
Re: PEP 3143: Standard daemon process library (was: Writing awell-behaved daemon) Jean-Paul Calderone Python 0 03-20-2009 01:02 PM
Daemon Win32::Daemon; ph1975@gmail.com Perl Misc 0 09-07-2006 10:58 AM
Flash drive not quite working Emrys Davies Computer Support 3 07-27-2005 12:01 AM
IE conditional comments not quite working delerious@no.spam.com HTML 6 12-27-2003 08:21 PM



Advertisments