> > On Fri, 11 Jul 2003 22:23:00 PDT, Andrew Morton said:
> >
> > > We've lived with it for this long.
> >
> > Well... you have a point there..
> >
> > > Given that the behaviour is undefined, the behaviour which we should
> > > implement is clearly "whatever 2.4 is doing". So let's leave it
alone.
> >
> > I suppose I could live with that *IF* somebody fixes 'man 2 open' to
> > reflect reality.
>
> Corrections and additions to manpages are always welcome.
> Mail to aeb@cwi.nl .
>
>
> (Concerning the topic under discussion, the man page says
>
> O_TRUNC
> If the file already exists and is a regular file
> and the open mode allows writing (i.e., is O_RDWR
> or O_WRONLY) it will be truncated to length 0. If
> the file is a FIFO or terminal device file, the
> O_TRUNC flag is ignored. Otherwise the effect of
> O_TRUNC is unspecified.
>
> which is precisely right. It continues
>
> (On many Linux versions it
> will be ignored; on other versions it will return
> an error.)
>
> where someone may read this as if this is an exhaustive list of
> possibilities. So adding ", or actually do the truncate" will
> clarify.)
>
>
> Concerning the desired behaviour: if I recall things correctly
> doing the truncate was old SunOS behaviour, not doing it,
> that is, honouring the O_RDONLY, is new Solaris behaviour.
> Maybe someone with access to such machines can check.
>
> Software exists that does O_RDONLY | O_TRUNC.
A late addition to this thread, but all of these systems DO truncate with
O_RDONLY | O_TRUNC:
Solaris 8
Tru64 5.1B
HP-UX 11.22
FreeBSD 4.7
Although this flag combination is left unspecified by SUSv3, I don't
know of an implementation that DOESN'T truncate in these circumstances.
Cheers
Michael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Wed Jul 23 2003 - 22:00:28 EST