Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
it is easy enough to execute a new program image in the same process ID when running the execve() call in that same process. but i need to do something a bit different. i will have a process running program ABC which would be a binary image compiled and linked for Linux. after ABC ends, i want to run program XYZ in that very same process ID. but, program ABC has no code at its end to execute XYZ. changing the source code of ABC to do a re-compile is not an option because the source code is not available. i'd like to know if anyone has put together something that can accomplish this. my first thought is doing a dynamic loading of ABC in order to get control back at the end of ABC while still in the same process. i would think this needs to be in C. any ideas?
i know, many of you will wonder why i need to run XYZ in the same process. well i could work around it. but it would be a lot of automatically processing many output streams to fake process IDs, so i am looking at this as the simpler solution.
What normally happens when a program exits is that the kernel notifies the parent process, which is then supposed to call wait() to "reap" the child and collect its last words. After that the kernel destroys the child process's task structure, so that process no longer exists. If the parent doesn't reap the child, it becomes a zombie and its task structure remains inside the kernel. What you want to do would be the equivalent of bringing a zombie back to life. I don't think the kernel would let you do that.
no. I don't think you really need it. What do you want to solve by that?
This is against the philosophy of this whole thing. A process cannot be replaced on the fly, the only way is if the process itself wanted to do so (using the mentioned exec function).
It is just bad design.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.