Skip to content

nbd-server: drop the double-fork#184

Open
eworm-de wants to merge 1 commit intoNetworkBlockDevice:masterfrom
eworm-de:daemonize
Open

nbd-server: drop the double-fork#184
eworm-de wants to merge 1 commit intoNetworkBlockDevice:masterfrom
eworm-de:daemonize

Conversation

@eworm-de
Copy link
Contributor

... as this breaks as systemd service: This is of type 'forking', so the (first) fork becomes the main and controlling process. The second fork makes the main process exit, and the service is stopped.

Closes: #182

... as this breaks as systemd service: This is of type 'forking', so the
(first) fork becomes the main and controlling process. The second fork
makes the main process exit, and the service is stopped.

Calling setsid() should be sufficient to detatch from terminal.

Closes: NetworkBlockDevice#182
@vincele
Copy link

vincele commented Mar 26, 2026

Instead of straight removal, I'd try to find an adequate macro to put around that code: something like #ifndef __SYSTEMD__ (pseudo-code, I don't know if this actually exists) to avoid potentially breaking other init systems.

@eworm-de
Copy link
Contributor Author

Do others actually need this? And how did the old code manage this?

@vincele
Copy link

vincele commented Mar 26, 2026

I think this is the historical way of doing "daemons" processes. Maybe what's needed for systemd is the "-n" CLI argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nbd-server immediately exits as systemd service

2 participants