[ovs-dev] [PATCH v2 1/2] daemon-windows: Ability to handle windows service calls.

Gurucharan Shetty shettyg at nicira.com
Mon Feb 3 22:10:43 UTC 2014

On Fri, Jan 31, 2014 at 2:56 PM, Ben Pfaff <blp at nicira.com> wrote:
> On Tue, Jan 28, 2014 at 01:56:21PM -0800, Gurucharan Shetty wrote:
>> The following code does not add any users yet.
>> The visioned workflow that this piece of code should work with is:
>> * Create a windows service through a startup script with
>> a tool like 'sc'
>> ex:  sc create ovsdb-server binpath=
>>  "C:\openvswitch\usr\sbin\ovsdb-server.exe -vconsole:off
>> -vsyslog:off -vfile:info --remote=ptcp:6632: --log-file
>> --service-monitor --service"
>> * Start the service from the startup script.
>> ex: sc start ovsdb-server
>> * Terminate the service during shutdown process.
>> ex: sc stop ovsdb-server
>> * Abrupt termination will restart the service.
>> CC: Saurabh Shah <ssaurabh at vmware.com>
>> Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
>> ---
>> v1->v2:
>>     Add the ability to be woken up during a poll_block() using CreateEvent()
>>     and poll_fd_wait_event().
> I am happy with this, although I do not know Windows well enough to
> judge its overall correctness.
> It is probably (even more) confusing now to a newcomer how to use
> daemon.h.  It would be nice to add a comment at the top explaining
> what's going on and outlining its use.

I am not sure how descriptive it needs to be. How about the following.

/* This file provides an interface for utilities to run in the background
 * as daemons on POSIX platforms like Linux or as services on Windows platform.
 * Some of the functionalities defined in this file are only applicable to
 * POSIX platforms and some are applicable only on Windows. As such, the
 * function definitions unique to each platform are separated out with
 * ifdef macros. More descriptive comments on individual functions are provided
 * in daemon.c (for Linux) and daemon-windows.c (for Windows).

 * macros are useful for parsing command-line options in individual utilities.
 * For e.g., the command-line option "--detach" is recognized on Linux
 * and results in calling the set_detach() function. The same option is not
 * recognized on Windows platform.

> In the manpage, I would capitalize Windows.
> Acked-by: Ben Pfaff <blp at nicira.com>

More information about the dev mailing list