A libio patch
H.J. Lu
hjl@lucon.org
Sun Oct 25 19:27:00 GMT 1998
>
> > This is needed by VSX-PCT. It is how TET used by VSX-PCT works.
>
> With a subtle change like this, please always describe the specific
> behavior that you consider erroneous and are attempting to fix. POSIX.1
It is in the comments of my patch. Consider
FILE *fp = fopen ("foo", "a+");
if (fork () == 0)
{
fprintf (fp, "hello world");
fclose (fp);
}
else
{
wait for child to exit.
fseek (fp, 0, SEEK_SET);
fgets (buf, len, fp);
printf ("%s\n", buf);
fclose (fp);
}
What should the parent get from "fp"?
> gives a precise set of rules for when streams and fds must be in synch, and
> it can be a grave performance hit to force them into synch at other times
> when it is not strictly required. An fseek or fsetpos call is indeed
> required to synch the stream with its fd, but not ftell or fgetpos, and
> only a specific set of other situations.
>
I think Ulrich has fixed it.
H.J.
More information about the Libc-hacker
mailing list