Index: sbin/casperd/casperd.8 =================================================================== --- sbin/casperd/casperd.8 (revision 287119) +++ sbin/casperd/casperd.8 (working copy) @@ -35,8 +35,8 @@ .Nd "Capability Services friendly daemon" .Sh SYNOPSIS .Nm -[-Fhv] [-D servconfdir] [-P pidfile] [-S sockpath] .Op Fl Fhv +.Op Fl l Ar listenqueue .Op Fl D Ar servconfdir .Op Fl P Ar pidfile .Op Fl S Ar sockpath @@ -74,6 +74,12 @@ Print the .Nm usage message. +.It Fl l Ar listenqueue +Specify depth of socket listen queue for the +.Nm +daemon. +The default queue length is +.Pa SOMAXCONN . .It Fl P Ar pidfile Specify alternative location of a file where main process PID will be stored. Index: sbin/casperd/casperd.c =================================================================== --- sbin/casperd/casperd.c (revision 287119) +++ sbin/casperd/casperd.c (working copy) @@ -534,7 +534,7 @@ } static void -main_loop(const char *sockpath, struct pidfh *pfh) +main_loop(int lqlen, const char *sockpath, struct pidfh *pfh) { fd_set fds; struct sockaddr_un sun; @@ -559,7 +559,7 @@ if (bind(lsock, (struct sockaddr *)&sun, sizeof(sun)) == -1) pjdlog_exit(1, "Unable to bind to %s", sockpath); (void)umask(oldumask); - if (listen(lsock, 8) == -1) + if (listen(lsock, lqlen) == -1) pjdlog_exit(1, "Unable to listen on %s", sockpath); for (;;) { @@ -627,7 +627,7 @@ struct pidfh *pfh; const char *pidfile, *servconfdir, *sockpath; pid_t otherpid; - int ch, debug; + int ch, debug, lqlen; bool foreground; pjdlog_init(PJDLOG_MODE_STD); @@ -634,11 +634,12 @@ debug = 0; foreground = false; + lqlen = SOMAXCONN; pidfile = CASPERD_PIDFILE; servconfdir = CASPERD_SERVCONFDIR; sockpath = CASPERD_SOCKPATH; - while ((ch = getopt(argc, argv, "D:FhP:S:v")) != -1) { + while ((ch = getopt(argc, argv, "D:Fhl:P:S:v")) != -1) { switch (ch) { case 'D': servconfdir = optarg; @@ -646,6 +647,11 @@ case 'F': foreground = true; break; + case 'l': + lqlen = strtol(optarg, NULL, 0); + if (lqlen < 1) + lqlen = SOMAXCONN; + break; case 'P': pidfile = optarg; break; @@ -711,5 +717,5 @@ /* * Wait for connections. */ - main_loop(sockpath, pfh); + main_loop(lqlen, sockpath, pfh); }