The netserver binary is often used for network performance profiling in conjunction with iperf3. In many contexts including other Stack Exchange questions, the method for launching netserver is shown with a mystery -D option.

The -D option is not documented in the manpage netserver(1), neither does the option appear to do anything different, nor is the reason for launching with -D given anywhere else I can discover.

So my question, if it can be answered - what is the -D option intended to do? and by extension, where is the -D option documented?

Here's a sample unitfile containing the -D, per Flavio's Blog which is close to what I'm using:

Description="Netperf netserver daemon"

ExecStart=/usr/local/bin/netserver -D


2 Answers 2


One way to find out is to look at the source code: -D causes netserver to not dæmonise, and to skip checking whether it’s an inetd child.

netserver -h mentions this (partially):

Usage: netserver [options]

    -D                Do not daemonize

So the purpose of the option, in netserver, is to prevent it from dæmonising, i.e. forking itself to run in the background.

The point of this option in the systemd unit is to make it easier to handle as a service.

  • The latter page appears to have been written several years after this option. You might want to find a source from which the developer got ideas, rather than the reverse. Oct 7, 2020 at 21:00
  • I’m not trying to explain why the option was added to netserver, but why it’s used in the systemd unit. Oct 8, 2020 at 5:29
  • You clinched it because of netserver -h which I totally missed. Thomas's answer is really good also for other reasons. I wish the two answers could be merged!
    – Rich
    Oct 8, 2020 at 21:58

D likely stands for debug, though no indication of its intent was provided by the developer when adding it (possibly on behalf of another):

commit 88eecaf68174e4e0190e2b866e0bcb59b81b6061                                 
Author: raj <raj@5bbd99f3-5903-0410-b283-f1d88047b228>                          
Date:   Mon Jul 11 21:58:41 2011 +0000                                          
massive re-write of src/netserver.c to clean out old spaghetti allow multiple listen sockets for control and run netserver without daemonizing or spawning children to avoid fork calls which may not sit well with various bypass libraries.  this has probably broken the Windows code and perhaps other platforms as well but it has been tested under linux

Use the source (i.e., read netserver.c):

case 'D':
  /* perhaps one of these days we'll take an argument */
  want_daemonize = 0;
  not_inetd = 1;

The first variable want_daemonize is used in the same file to control whether the program puts itself into the background:

/* we are the top netserver process, so we have to create the
   listen endpoint(s) and decide if we want to daemonize */
if (want_daemonize) {

The other variable, not_inetd controls whether it attempts to open a socket to the inetd service.

The developers probably had in mind the longstanding behavior of other programs, e.g., as described in this 2002 section 29.2.1 Invoking a standalone service (although in effect reversing the sense of the option):

Try the following (alternative commands in parentheses):
/usr/sbin/in.ftpd -D
( /usr/sbin/in.wuftpd -s )
The -D option instructs the service to start in Daemon mode (or standalone mode). This represents the first way of running an Internet service.

  • Really great info, Thomas! Although you kinda flubbed (as did I by missing usage info in netserver -h) where you say "no indication" because he says it: and run netserver without daemonizing or spawning children to avoid fork calls. Merging these two answers would be a useful addition to the netserver documentation :-)
    – Rich
    Oct 8, 2020 at 22:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .