incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Black <abl...@roguewave.com>
Subject Use of Windows Jobs API in exec utility
Date Thu, 24 Aug 2006 20:46:10 GMT
Greetings all.

I have started looking at what would be required to implement the child
process limits logic and child process statistic gathering functionality
in the exec utility on Windows.

The research I have done indicates that it is possible to accomplish
both tasks using the job object API ( 
http://msdn.microsoft.com/library/en-us/dllproc/base/job_objects.asp ). 
  The problem with using this API is that it was introduced with Windows 
2000 (I think) and is protected by a 'Legacy Macro' ( 
http://msdn.microsoft.com/library/en-us/winprog/winprog/using_the_windows_headers.asp 
).  In this case, the guarding macro is _WIN32_WINNT, which needs to be 
defined to 0x0500 or higher prior to the inclusion of windows.h.

There are a few tactics we could take with regards to this situation, 
and I would appreciate thoughts on which should be taken.

The simplest method would be to require the exec utility to be built on 
Windows 2000 or newer versions of the operating system.  The trade off 
of doing so is that it would be more difficult to build the utility, and 
by extension the library, on older operating systems.  Unfortunately, I 
don't know what older versions of windows that the library is still able 
to build on.

A more complex method would be to define this macro unconditionally, but 
guard the uses of the job object API by runtime checks, similar to the 
checks around the GenerateConsoleCtrlEvent calls.  This could allow the 
utility to build with newer compilers on older operating systems, but it 
would still fail to build with versions of the windows SDK prior to the 
release of Windows 2000.

The most compatible way to do things would be to guard the uses of the 
job object API by #ifdef directives.  However, it would make the code 
harder to read, and it might take some work to figure out what macro(s) 
to check.

--Andrew Black

Mime
View raw message