From UNIX to Win NT

Gordon McMillan gmcm at hypernet.com
Mon Jul 3 08:20:35 EDT 2000


Thomas Thiele wrote:

>Hallo!
>
>I have a program running on UNIX(IRIX and LINUX). I now want to port
>this 
>program to Win NT. Is there anybody who have any experience with this?
>
>The problem is I am using threads, fork and exec. And I want to have the
>same behaviour using NT.
>
>- at first I create a new thread. (so the main thread is ready for
>receiving commands)

Threads work very well on NT.

>- then I fork 
>in the child I change it's userID (os.setuid()) and replace it by
>os.exec()
>the parent reads the stderr and stdout from the started program ( like
>popen2.popen3() ) 

You've got both technical and cultural problems here. There is no fork. If 
you use the Win32 extensions you can change the user id (never done this, 
so don't ask me for details), but be prepared for the fact that this kind 
of stuff *means* something different on NT - the models just aren't the 
same. There's also less reason to need it - between NT and the typical NT 
configuration, many things that would require setuid on *nix can be done by 
any wazoo on Windows.

>Last but not least I use sockets (a derived server from SocketServer.py) 

Sockets work fine. Select also works fine, but works *only* on sockets (eg 
if you're selecting on the pipes returned from popen3, you've got a 
problem).

- Gordon



More information about the Python-list mailing list