How can I execute external commands in C / Linux without using system, popen, fork, exec?

I would like to know if there is a good way to execute an external command in a Linux environment using the C language without using system (), popen (), fork (), exec ()?

The reason I can’t use these features is because my main application used most of the system resources (like memory) in the internal board. If I make the plug, the board will not be able to duplicate my main application. From what I read in the book, both system () and popen () actually use fork () at the bottom, so I can't use them.

The only idea I have now is to create a process before starting the main application and using IPC (pipe or socket) so that the new process knows which external commands it needs to run using system () or popen () and return the results will return to my application when this is done.

+4
source share
1 answer

You cannot do this. Linux creates a new process by calling fork()and exec(). No other way to create a process exists.

fork() . Copy-on-Write , fork() , . , exec() fork(), .

UPD. , . clone(), fork() . , . man 2 fork man 2 clone.

+8

All Articles