> -----Original Message----- > From: Michal Schmidt [mailto:[email protected]] > Sent: Friday, November 04, 2011 17:45 > To: Michael D. Berger > Cc: [email protected] > Subject: Re: [systemd-devel] FW: pthread_create() fails SysV > in myDaemon on boot > > On Fri, 04 Nov 2011 14:36:05 -0400 Michael D. Berger wrote: > > Your assumption is correct. In the code I have: > > if (argc == 2) > > { > > string arg = argv[1]; > > if (arg != "--daemon") > > throw ... > > ::daemon(0,0); > > isDaemon = true; > > } > > Not related to your problem with the cpu cgroup controller, but ... > daemon(3) is not the best way to daemonize a process. I > suggest you to take a look at > http://0pointer.de/public/systemd-man/daemon.html > > Michal
As you see, I made a new thread of this. Looking at the recommended document, I concluded, perhaps incorrectly, that I should remove my daemon(0,0); and add: const char* const state = "OK"; sd_notify(1/*unset_environment*/,state); "man sd_notify" says the include file is #include "sd-daemon.h" but the only one like this is: #include </usr/share/doc/systemd/sd-daemon.h> I suuppose that I should have expected that ld can't find "sd-daemon", but I see: /usr/share/doc/systemd/sd-daemon.c Should I get it and compile it, or am I up the wrong tree? This is looking a little odd. I tried just removing "daemon(0,0)", but systemctl start myDaemon.service does not return, so it looked like sd_notify() might be a good thing. Thanks, Mike. -- Michael D. Berger [email protected] http://www.rosemike.net/ _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
