Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to bring an orphaned process to foreground ?

Posted on 2004-05-02
7
Medium Priority
?
626 Views
Last Modified: 2008-02-26
Hi.

This is the situation I have.

1. Process "p0" forks (started form terminal).
2. Child "exec"s process "p1"
3. Process "p0" terminates leaving child orphaned.

Now p1 need to read keyboard input. But since it is a background process it can not.

How to solve this ?

Maybe I can bring child to foreground or regain control over terminal ?

Thank You.
0
Comment
Question by:lklm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 12

Expert Comment

by:stefan73
ID: 10975489
Hi lklm,
> Now p1 need to read keyboard input. But since it is a background process
> it can not.

Maybe you can exec in p0 instead of p1?

Cheers,
Stefan
0
 

Author Comment

by:lklm
ID: 10975993
Hi

Unfortunately I can't change the structure of application.
This is multi process application I have access to all the sources but I change change the arch.

Thanks
0
 
LVL 7

Expert Comment

by:glassd
ID: 10976291
Not sure if this will work but:

The command "jobs" should show the backgrounded job, if it is still associated with the terminal. If it is job 1 then:
fg %1
should bring it to the foreground.

Might be worth a try.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:stefan73
ID: 10976375
lklm,
Is p1 really an interactive process? Or do you want to "remote control" its I/O from p0?

Stefan
0
 
LVL 8

Expert Comment

by:Anthony2000
ID: 10983085
I am assuming that once p0 terminates, process p1 loses its associated terminal and becomes owned by init.

Is there a reason why you cannot change the point where p0 is forked so that the parent just waits until the child is finished before exiting. Shell programs do this all the time. In your case when you return to your parent, have the parent exit then, instead of after it forks and execs to p1.

Does this make sense?

Anthony.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12243972
PAQed - no points refunded (of 130)

Computer101
E-E Admin
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question