Daemon of course ;-)
Yes, this is a migration of the code from OVS to OVN to consider windows.

I was not sure if it is better to depend on OVS as I understood that the path 
for OVN is more to separate from OVS.
If it is ok to use OVS parts, I agree that this would be better and would 
update the patch.
________________________________
Von: Dumitru Ceara <dce...@redhat.com>
Gesendet: Donnerstag, 6. März 2025 12:14
An: Frank Wagner <frank.wag...@dbosoft.eu>; d...@openvswitch.org 
<d...@openvswitch.org>
Cc: Ilya Maximets <i.maxim...@ovn.org>; Alin Serdean <aserd...@ovn.org>
Betreff: Re: [ovs-dev] [PATCH ovn 9/10] lib: Fix demon options for windows.

Hi Frank,

On 3/1/25 2:59 PM, Frank Wagner wrote:
> Demon options declaration is not working on Windows builds.

Nit: Daemon (same in the commit summary).

Do you mind adding more context here please?  I see daemon.h in OVS is
similar.

>
> Signed-off-by: Frank Wagner <frank.wag...@dbosoft.eu>
>
> ---
>  lib/ovn-util.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 73 insertions(+)
>
> diff --git a/lib/ovn-util.h b/lib/ovn-util.h
> index ce8cc0568..3d81967fe 100644
> --- a/lib/ovn-util.h
> +++ b/lib/ovn-util.h
> @@ -220,6 +220,7 @@ long long ovn_smap_get_llong(const struct smap *smap, 
> const char *key,
>                               long long def);
>
>  /* OVN daemon options. Taken from ovs/lib/daemon.h. */

However, can't we just use the OVS daemon.h definitions instead of
redefining them in OVN?  Or am I missing a subtle difference here?

> +#ifndef _WIN32
>  #define OVN_DAEMON_OPTION_ENUMS                     \
>      OVN_OPT_DETACH,                                 \
>      OVN_OPT_NO_SELF_CONFINEMENT,                    \
> @@ -277,6 +278,78 @@ long long ovn_smap_get_llong(const struct smap *smap, 
> const char *key,
>          case OVN_OPT_MONITOR:                       \
>          case OVN_OPT_USER_GROUP:
>
> +void set_detach(void);
> +void daemon_set_monitor(void);
> +void set_no_chdir(void);
> +void ignore_existing_pidfile(void);
> +pid_t read_pidfile(const char *name);
> +#else
> +#define OVN_DAEMON_OPTION_ENUMS                    \
> +    OVN_OPT_DETACH,                                \
> +    OVN_OPT_NO_SELF_CONFINEMENT,                   \
> +    OVN_OPT_NO_CHDIR,                              \
> +    OVN_OPT_PIDFILE,                               \
> +    OVN_OPT_PIPE_HANDLE,                           \
> +    OVN_OPT_SERVICE,                               \
> +    OVN_OPT_SERVICE_MONITOR,                       \
> +    OVN_OPT_USER_GROUP
> +
> +#define OVN_DAEMON_LONG_OPTIONS                                              
>  \
> +        {"detach",             no_argument, NULL, OVN_OPT_DETACH},           
>  \
> +        {"no-self-confinement", no_argument, NULL, 
> OVN_OPT_NO_SELF_CONFINEMENT}, \
> +        {"no-chdir",           no_argument, NULL, OVN_OPT_NO_CHDIR},         
>  \
> +        {"pidfile",            optional_argument, NULL, OVN_OPT_PIDFILE},    
>  \
> +        {"pipe-handle",        required_argument, NULL, 
> OVN_OPT_PIPE_HANDLE}, \
> +        {"service",            no_argument, NULL, OVN_OPT_SERVICE},          
>  \
> +        {"service-monitor",    no_argument, NULL, OVN_OPT_SERVICE_MONITOR},  
>  \
> +        {"user",               required_argument, NULL, OVN_OPT_USER_GROUP}
> +
> +#define OVN_DAEMON_OPTION_HANDLERS                  \
> +        case OVN_OPT_DETACH:                        \
> +            set_detach();                       \
> +            break;                              \
> +                                                \
> +        case OVN_OPT_NO_SELF_CONFINEMENT:           \
> +            daemon_disable_self_confinement();  \
> +            break;                              \
> +                                                \
> +        case OVN_OPT_NO_CHDIR:                      \
> +            break;                              \
> +                                                \
> +        case OVN_OPT_PIDFILE:                       \
> +            set_pidfile(optarg);                \
> +            break;                              \
> +                                                \
> +        case OVN_OPT_PIPE_HANDLE:                   \
> +            set_pipe_handle(optarg);            \
> +            break;                              \
> +                                                \
> +        case OVN_OPT_SERVICE:                       \
> +            set_detach();                       \
> +            break;                              \
> +                                                \
> +        case OVN_OPT_SERVICE_MONITOR:               \
> +            break;                              \
> +                                                \
> +        case OVN_OPT_USER_GROUP:                    \
> +            daemon_set_new_user(optarg);
> +
> +#define OVN_DAEMON_OPTION_CASES                     \
> +        case OVN_OPT_DETACH:                        \
> +        case OVN_OPT_NO_SELF_CONFINEMENT:           \
> +        case OVN_OPT_NO_CHDIR:                      \
> +        case OVN_OPT_PIDFILE:                       \
> +        case OVN_OPT_PIPE_HANDLE:                   \
> +        case OVN_OPT_SERVICE:                       \
> +        case OVN_OPT_SERVICE_MONITOR:               \
> +        case OVN_OPT_USER_GROUP:
> +
> +void control_handler(DWORD request);
> +void set_pipe_handle(const char *pipe_handle);
> +void set_detach(void);
> +#endif /* _WIN32 */
> +
> +
>  bool ip_address_and_port_from_lb_key(const char *key, char **ip_address,
>                                       struct in6_addr *ip, uint16_t *port,
>                                       int *addr_family);

Thanks,
Dumitru


_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to