Hi Alin,

It was easier for me to call Windows APIs from python, that mimics 
detach_process,
and to be in a better control on what's happening, than creating a *DLL and 
loading
it in order to call this function.
*On Windows the LIB file cannot be loaded as-is; a DLL with entry point needs 
to be
created, allowing the ntdll loader to resolve the imported functions.

I don't say it isn't doable, but this seemed to be the right solution for this.
Also, creating a DLL loaded by python would add a dependency between
python and C components.

Regarding the *unix side, maybe a Linux guy can add his opinion about this.

Thanks,
Paul

> -----Original Message-----
> From: Alin Serdean
> Sent: Tuesday, July 12, 2016 10:54 PM
> To: Paul Boca; dev@openvswitch.org
> Subject: RE: [ovs-dev] [PATCH V6 12/17] python tests: Ported Python daemon
> to Windows
> 
> I am wondering if it is better if we could just import the shared library and
> call the detach function
> (https://github.com/openvswitch/ovs/blob/master/lib/daemon-
> windows.c#L342) instead of duplicating the effort.
> 
> I wonder if the same could be applied un the *unix side as well.
> 
> Thanks,
> Alin.
> 
> > -----Mesaj original-----
> > De la: dev [mailto:dev-boun...@openvswitch.org] În numele Paul Boca
> > Trimis: Wednesday, July 6, 2016 3:38 PM
> > Către: dev@openvswitch.org
> > Subiect: [ovs-dev] [PATCH V6 12/17] python tests: Ported Python daemon
> to
> > Windows
> >
> > Used subprocess.Popen instead os.fork (not implemented on windows)
> and
> > repaced of os.pipe with Windows pipes.
> >
> > To be able to identify the child process I added an extra parameter to
> > daemon process '--pipe-handle', this parameter also contains the parent
> > Windows pipe handle, used by the child to signal the start.
> >
> > The PID file is created directly on Windows, without using a temporary file
> > because the symbolic link doesn't inheriths the file lock set on temporary
> file.
> >
> > Signed-off-by: Paul-Daniel Boca <pb...@cloudbasesolutions.com>
> > ---
> > V2: Fix lockf on Linux, small error on os.link and missing pipe_handle
> > parameter.
> > V3: Import modules at the start of the code
> > V4: Close file before trying to delete it in signal hooks.
> >     On Windows the PID file cannot be deleted while it's handle
> >     is opened for write.
> > V5: No changes
> > V6: Explicitly close the vlog file in detached daemon. On Windows, even if
> the
> >     daemon is detached, the primary daemon is still holding a handle to the
> log
> >     file, therefore the log cannot be moved/deleted even is the vlog/close
> > command
> >     is sent to the detached daemon.
> > ---
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to