executing a new program in the same process ID
by Skaperen from LinuxQuestions.org on (#6JCK9)
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.
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.