LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-12-2008, 05:39 AM   #1
vdx
Member
 
Registered: Aug 2007
Location: The Greate INDIA
Distribution: CentOS, RHEL, Fedora
Posts: 102

Rep: Reputation: 24
Red face how to de-daemonize a process


Hi, friends

I have a program in which i am calling the daemon() syscall so the it leaves the terminal and goes continue running into background. Now wt i am expecting is I want tht process back to foreground. And it should be done through programming.

I kno the "fg" can be used to bring a process foreground but I want it through progrming aka using syscalls/lib functions like tht..

 
Old 09-12-2008, 12:54 PM   #2
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
I would guess that you would have to hit the system process structure for this process and set stdin, stdout, and stderr to some values that would let you interact with your un-daemonized daemon. This wouldn't work, though, if the daemon had closed those files; if they were closed then one would expect that the daemon would never look at them again. If, however, it had redirected them to /dev/null, you might get control of it by doing this.

It might be possible to take the daemon away from init, but I would guess that the way to do this could vary from version to version of the kernel, so any solution might prove to be non-portable.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help to daemonize btaunchmany a550ee Linux - Server 2 12-18-2007 03:50 PM
kernel 2.6.1: driver compile err: daemonize() too few parameters qwijibow Linux - Software 0 01-21-2004 08:54 PM
A problem with serial port after adding daemonize code. Calvin Fang Linux - General 0 01-21-2004 05:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:47 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration