Patch for bug 25063 - _pclose should wait for the command processor to terminate and return it's exit status

Alexandre Julliard julliard at
Wed Nov 17 04:45:03 CST 2010

Borut Razem <borut.razem at> writes:

> Yes, it looks huge, but we can reduce by a third by removing empty
> lines and comments (just kidding ;-). But the run-time overhead is
> minimal: allocation of the array at the first popen call and
> reallocation if more then 16 childs are popened, which will probably
> happen very rarely. When the array is allocated, the cost is the same
> as in case of statically allocated array (OK, one additional "if" for
> initialization).

The main cost is in the linear search. This doesn't scale.

> I implemented it as flexible as possible so that there are no
> limitations about the number of popened childs and no overhead in data
> space used by statically allocated arrays. In file.c there is a
> statically allocated array of file descriptors with 2048 elements,
> which seems a big overhead for popened childs: usually there are only
> few childs popened per process. OTOH there is a comment in file.c
> saying: /* FIXME: this should be allocated dynamically */, which is
> exactly what I did ;-)

The best would be to put it directly in the file descriptors array, but
unfortunately there doesn't seem to be any room for this. That doesn't
mean you need a static array, you can still allocate a separate array
dynamically (and then of course you don't need 2048, only the highest
file descriptor in use).

Alexandre Julliard
julliard at

More information about the wine-devel mailing list