LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 08-01-2003, 09:43 PM   #1
Joran
LQ Newbie
 
Registered: May 2003
Location: Hunan, China
Posts: 4

Rep: Reputation: 0
Help, daemon process failed!


I writed a daemon program, using the daemon_init() function, giving by the UNIX Network Programming Vol1[Stevens 1998]. But
it exited after this function was called! And when I debuged it with
gdb, I found it exited normally just in this call. Even did the daemon() system call!
I'm very puzzled. Could someone who give me an explaination for detail?
Thanks a lot!

P.S. My kernel is 2.4.18-14(RH8.0)

Last edited by Joran; 08-01-2003 at 09:45 PM.
 
Old 08-02-2003, 01:05 AM   #2
Joran
LQ Newbie
 
Registered: May 2003
Location: Hunan, China
Posts: 4

Original Poster
Rep: Reputation: 0
And that is the code:
Code:
void daemon_init(/*const char* pname, int facility*/)
{
	int i;
	pid_t pid;

	if ((pid = fork()) != 0)
		exit(0);

	setsid();
	
	signal(SIGHUP, SIG_IGN);

	if ((pid = fork()) != 0)
		exit(0);

	/*daemon_proc = 1;*/

	chdir("/");

	umask(0);

	for (i = 0; i < MAXFD; i++)
		close(i);

	/*open(pname, LOG_PID, facility);*/
}
 
Old 08-03-2003, 06:35 AM   #3
Joran
LQ Newbie
 
Registered: May 2003
Location: Hunan, China
Posts: 4

Original Poster
Rep: Reputation: 0
no cool guy know this?

waiting........
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
start-stop-daemon problems after process crash emarti20 Linux - Software 3 04-15-2005 09:54 AM
Gnome-settings-daemon failed slackwarefan Slackware 3 03-09-2005 07:30 AM
unknown daemon process swmok Linux - Software 2 01-05-2005 12:10 AM
How can i attach gdb to a daemon process praveengujar Linux - General 0 08-11-2004 07:58 AM
Daemon Settings Failed At Startup!!!!!!!! kDwosk Linux - Newbie 2 08-22-2003 06:46 PM


All times are GMT -5. The time now is 12:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration