~ubuntu-branches/ubuntu/hardy/apache2/hardy-proposed

« back to all changes in this revision

Viewing changes to srclib/apr/threadproc/win32/proc.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Fritsch
  • Date: 2008-01-17 20:27:56 UTC
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20080117202756-hv38rjknhwa2ilwi
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include <process.h>
33
33
#endif
34
34
 
 
35
/* We have very carefully excluded volumes of definitions from the
 
36
 * Microsoft Platform SDK, which kill the build time performance.
 
37
 * These the sole constants we borrow from WinBase.h and WinUser.h
 
38
 */
35
39
#ifndef LOGON32_LOGON_NETWORK
36
40
#define LOGON32_LOGON_NETWORK 3
37
41
#endif
83
87
            in = APR_READ_BLOCK;
84
88
        else if (in == APR_PARENT_BLOCK)
85
89
            in = APR_WRITE_BLOCK;
86
 
        stat = apr_create_nt_pipe(&attr->child_in, &attr->parent_in, in,
87
 
                                  attr->pool);
 
90
 
 
91
        stat = apr_create_nt_pipe(&attr->child_in, &attr->parent_in,
 
92
                                  in, attr->pool);
 
93
        if (stat == APR_SUCCESS) { 
 
94
            switch (in) { 
 
95
                case APR_FULL_BLOCK:
 
96
                    break;
 
97
                case APR_READ_BLOCK:
 
98
                    apr_file_pipe_timeout_set(attr->parent_in, 0);
 
99
                    break;
 
100
                case APR_WRITE_BLOCK:
 
101
                    apr_file_pipe_timeout_set(attr->child_in, 0);
 
102
                    break;
 
103
                default:
 
104
                    apr_file_pipe_timeout_set(attr->child_in, 0);
 
105
                    apr_file_pipe_timeout_set(attr->parent_in, 0);
 
106
            }
 
107
        }
88
108
        if (stat == APR_SUCCESS)
89
109
            stat = apr_file_inherit_unset(attr->parent_in);
90
110
    }
91
111
    if (out && stat == APR_SUCCESS) {
92
 
        stat = apr_create_nt_pipe(&attr->parent_out, &attr->child_out, out,
93
 
                                  attr->pool);
 
112
        stat = apr_create_nt_pipe(&attr->parent_out, &attr->child_out,
 
113
                                  out, attr->pool);
 
114
        if (stat == APR_SUCCESS) { 
 
115
            switch (out) {
 
116
                case APR_FULL_BLOCK:
 
117
                    break;
 
118
                case APR_PARENT_BLOCK:
 
119
                    apr_file_pipe_timeout_set(attr->child_out, 0);
 
120
                    break;
 
121
                case APR_CHILD_BLOCK:
 
122
                    apr_file_pipe_timeout_set(attr->parent_out, 0);
 
123
                    break;
 
124
                default:
 
125
                    apr_file_pipe_timeout_set(attr->child_out, 0);
 
126
                    apr_file_pipe_timeout_set(attr->parent_out, 0);
 
127
            }
 
128
        }
94
129
        if (stat == APR_SUCCESS)
95
130
            stat = apr_file_inherit_unset(attr->parent_out);
96
131
    }
97
132
    if (err && stat == APR_SUCCESS) {
98
 
        stat = apr_create_nt_pipe(&attr->parent_err, &attr->child_err, err,
99
 
                                  attr->pool);
 
133
        stat = apr_create_nt_pipe(&attr->parent_err, &attr->child_err,
 
134
                                  err, attr->pool);
 
135
        if (stat == APR_SUCCESS) { 
 
136
            switch (err) {
 
137
                case APR_FULL_BLOCK:
 
138
                    break;
 
139
                case APR_PARENT_BLOCK:
 
140
                    apr_file_pipe_timeout_set(attr->child_err, 0);
 
141
                    break;
 
142
                case APR_CHILD_BLOCK:
 
143
                    apr_file_pipe_timeout_set(attr->parent_err, 0);
 
144
                    break;
 
145
                default:
 
146
                    apr_file_pipe_timeout_set(attr->child_err, 0);
 
147
                    apr_file_pipe_timeout_set(attr->parent_err, 0);
 
148
            }
 
149
        }
100
150
        if (stat == APR_SUCCESS)
101
151
            stat = apr_file_inherit_unset(attr->parent_err);
102
152
    }
776
826
            si.dwFlags |= STARTF_USESTDHANDLES;
777
827
 
778
828
            si.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
 
829
            if (GetHandleInformation(si.hStdInput, &stdin_reset)
 
830
                    && (stdin_reset &= HANDLE_FLAG_INHERIT))
 
831
                SetHandleInformation(si.hStdInput,
 
832
                                     HANDLE_FLAG_INHERIT, 0);
 
833
 
779
834
            if (attr->child_in && attr->child_in->filehand)
780
835
            {
781
 
                if (GetHandleInformation(si.hStdInput,
782
 
                                         &stdin_reset)
783
 
                        && (stdin_reset &= HANDLE_FLAG_INHERIT))
784
 
                    SetHandleInformation(si.hStdInput,
785
 
                                         HANDLE_FLAG_INHERIT, 0);
786
 
 
787
836
                si.hStdInput = attr->child_in->filehand;
788
837
                SetHandleInformation(si.hStdInput, HANDLE_FLAG_INHERIT,
789
838
                                                   HANDLE_FLAG_INHERIT);
790
839
            }
 
840
            else
 
841
                si.hStdInput = INVALID_HANDLE_VALUE;
791
842
            
792
843
            si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
 
844
            if (GetHandleInformation(si.hStdOutput, &stdout_reset)
 
845
                    && (stdout_reset &= HANDLE_FLAG_INHERIT))
 
846
                SetHandleInformation(si.hStdOutput,
 
847
                                     HANDLE_FLAG_INHERIT, 0);
 
848
 
793
849
            if (attr->child_out && attr->child_out->filehand)
794
850
            {
795
 
                if (GetHandleInformation(si.hStdOutput,
796
 
                                         &stdout_reset)
797
 
                        && (stdout_reset &= HANDLE_FLAG_INHERIT))
798
 
                    SetHandleInformation(si.hStdOutput,
799
 
                                         HANDLE_FLAG_INHERIT, 0);
800
 
 
801
851
                si.hStdOutput = attr->child_out->filehand;
802
852
                SetHandleInformation(si.hStdOutput, HANDLE_FLAG_INHERIT,
803
853
                                                    HANDLE_FLAG_INHERIT);
804
854
            }
 
855
            else
 
856
                si.hStdOutput = INVALID_HANDLE_VALUE;
805
857
 
806
858
            si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
 
859
            if (GetHandleInformation(si.hStdError, &stderr_reset)
 
860
                    && (stderr_reset &= HANDLE_FLAG_INHERIT))
 
861
                SetHandleInformation(si.hStdError,
 
862
                                     HANDLE_FLAG_INHERIT, 0);
 
863
 
807
864
            if (attr->child_err && attr->child_err->filehand)
808
865
            {
809
 
                if (GetHandleInformation(si.hStdError,
810
 
                                         &stderr_reset)
811
 
                        && (stderr_reset &= HANDLE_FLAG_INHERIT))
812
 
                    SetHandleInformation(si.hStdError,
813
 
                                         HANDLE_FLAG_INHERIT, 0);
814
 
 
815
866
                si.hStdError = attr->child_err->filehand;
816
867
                SetHandleInformation(si.hStdError, HANDLE_FLAG_INHERIT,
817
 
                                                   HANDLE_FLAG_INHERIT);
 
868
                                                       HANDLE_FLAG_INHERIT);
818
869
            }
 
870
            else
 
871
                si.hStdError = INVALID_HANDLE_VALUE;
819
872
        }
820
873
        if (attr->user_token) {
821
874
            /* XXX: for terminal services, handles can't be cannot be