You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@kiwi.ICS.UCI.EDU> on 2000/02/17 01:49:08 UTC
Re: dup2() on Windows
>> I have two solutions available. I can use #ifdef WIN32 blocks in
>> ap_open_file(), or extend APR with the following new functions:
>>
>> ap_dup2stderr()
>> ap_dup2stdin()
>> ap_dup2stdout()
Why not just check the argument to see if the fd matches one of the
standard handles and allow it for those cases, returning an error on
win32 for the others?
....Roy
Re: dup2() on Windows
Posted by Bill Stoddard <st...@raleigh.ibm.com>.
> >> I have two solutions available. I can use #ifdef WIN32 blocks in
> >> ap_open_file(), or extend APR with the following new functions:
> >>
> >> ap_dup2stderr()
> >> ap_dup2stdin()
> >> ap_dup2stdout()
>
> Why not just check the argument to see if the fd matches one of the
> standard handles and allow it for those cases, returning an error on
> win32 for the others?
>
That'll work, although it is not very efficient. On Windows, I cannot rely
on the value of the standard handles, so I need to call
GetStdHandle(STD_ERROR_HANDLE). I don't think we call dup2 on the request
processing path, so performance is probably not an issue.
Bill
Re: dup2() on Windows
Posted by rb...@apache.org.
On Wed, 16 Feb 2000, Roy T. Fielding wrote:
> >> I have two solutions available. I can use #ifdef WIN32 blocks in
> >> ap_open_file(), or extend APR with the following new functions:
> >>
> >> ap_dup2stderr()
> >> ap_dup2stdin()
> >> ap_dup2stdout()
>
> Why not just check the argument to see if the fd matches one of the
> standard handles and allow it for those cases, returning an error on
> win32 for the others?
+1. We can document this easily, and this way we aren't adding functions
that can never be removed. :-)
Ryan
Come to the first official Apache Software Foundation
Conference!!! <http://ApacheCon.Com/>
_______________________________________________________________________________
Ryan Bloom rbb@ntrnet.net
2121 Stonehenge Dr. Apt #3
Raleigh, NC 27615 Ryan Bloom -- thinker, adventurer, artist,
writer, but mostly, friend.
-------------------------------------------------------------------------------