| I'm not clear from reading the preceding notes whether propagation of
stderr from parent to child is meant to work or not.
I am using Alpha VMS 6.2, patch ALPACRT08_062 applied. Using the program
in the basenote and a child program that looks like this
#include <stdio.h>
main()
{
fprintf(stderr,"this is child writing to stderr\n");
fprintf(stdout,"this is child writing to stdout\n");
}
I get the following output:
$ r parent
stderr is SYS$ERROR:.;
--- got args:
speaxp$dka300:[hudson.fork]parent.exe;1
new stderr is SYS$SYSDEVICE:[HUDSON.FORK]OUT.LIS;1
execv a child:
this is child writing to stderr
this is child writing to stdout
$ type out.lis
hello i'm an error
$
So, should this work? Is another patch needed
|
| >> So, should this work? Is another patch needed
It is supposed to work, but, both the "parent" program in the base note and
the DEC C RTL should be fixed.
As stated in the DEC C RTL Manual, the way the child process inherits the
parent's open files is that the exec functions pass the file-name string
associated with each file descriptor to the child and the child opens
the file. In the example in .0 the parent did not specify RMS sharing option
allowing the child to read and write the file and the child's open() failed
with "RMS-E-FLK, file currently locked by another user" status. After this
failure, the file descriptor associated with stderr remained uninitialized
and the first attempt to write to stderr resulted in calling internal DEC
C RTL routine opening stderr on the SYS$ERROR device.
To fix this, the freopen() statement in the parent program must look like the
following:
freopen("out.lis","a",stderr,"ctx=rec","shr=get,put","rop=rea")
Unfortunately, this is not enough. The DEC C RTL does passes among other
things RMS sharing options specified by the parent to the child, but the
the child fails to process them correctly.
This is being tracked in crtl internal bug tracking system as problem
number 1703.
Boris
|