1. Won't this leave the parent process running until the child completes? And, if you do this again & again, won't that stack up a bunch of basically dead parent processes? Maybe I'm misunderstanding how parent/child relatioships work with ForkExec
2. What if you want the command-line arguments to change for the new process?
3. In addressing (2), in general would it be simpler to omit the parent-child relationship with a wrapper program? The running (old) process can write its listener file descriptor to a file, similar to how it is done here, and the wrapper reads that file & sets an environment variable (or cmd-line argument) telling the new process?
The wrapper could be used for any server process which adheres to a simple convention:
on startup, re-use a listener FD if provided (via env or cmd line ... or ./.listener)
once listening, write your listener FD to well-known file (./.listener)
on SIGTERM, stop processing new connections but don't close the listener (& exit after waiting for current connections to close, obvi)
4. Am i the only one who finds "Add(1)/Done()" to be an odd naming convention? I might go with "Add(1)/Add(-1)" instead just for readability