DarkflameUniverse / DarkflameServer

The main repository for the Darkflame Universe Server Emulator project.
https://www.darkflameuniverse.org/
GNU Affero General Public License v3.0
647 stars 172 forks source link

ENH: change system calls to fork/exec and CreateProcess #1543

Open EmosewaMC opened 6 months ago

EmosewaMC commented 6 months ago

Is your feature request related to a problem?

This would allow for more control over security, less work being done by master and better heartbeat controls for detecting if a server is alive or dead.

Describe the solution you'd like

Replace calls to system with fork/exec on *nix and CreateProcess on Windows.

Repository breaking implications

Could prevent servers from starting on platforms without those commands.

Describe alternatives you've considered

continuing to use system and being complacent

Additional context

https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa https://man7.org/linux/man-pages/man2/fork.2.html https://man7.org/linux/man-pages/man3/exec.3.html https://linux.die.net/man/3/execv

jadebenn commented 6 months ago

Do you have a sample of the code you have in mind to be changed? I'm wondering if there's a C++ or POSIX API that might have more cross-platform compatibility.

EmosewaMC commented 6 months ago

There is no standard way of doing this. It will differ based on platform