This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: A libio patch
- To: roland@frob.com (Roland McGrath)
- Subject: Re: A libio patch
- From: hjl@lucon.org (H.J. Lu)
- Date: Sun, 25 Oct 1998 19:22:21 -0800 (PST)
- Cc: libc-hacker@cygnus.com
>
> > 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.