caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* stat in Unix library
@ 2004-11-29  0:06 Ian Zimmerman
  2004-11-29  6:18 ` [Caml-list] " David Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Zimmerman @ 2004-11-29  0:06 UTC (permalink / raw)
  To: caml-list


I am looking at the 3.08 source and something about the code for stat
doesn't seem right.

The st_dev member of type Unix.stats is declared as int.  But according
to the Single Unix spec, the corresponding member of the C struct has
a defined type, dev_t; and in fact recent Linux kernels define dev_t
to a 64 bit type, even on 32 bit architectures.  So it looks like
the Ocaml function will lose the high order bits.

I came across this as I was trying to write a Unix interface for another
(unnamed) functional language :)  

-- 
"It's not true or not."  A reality show producer (real quote)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] stat in Unix library
  2004-11-29  0:06 stat in Unix library Ian Zimmerman
@ 2004-11-29  6:18 ` David Brown
  0 siblings, 0 replies; 2+ messages in thread
From: David Brown @ 2004-11-29  6:18 UTC (permalink / raw)
  To: Ian Zimmerman; +Cc: caml-list

On Sun, Nov 28, 2004 at 04:06:56PM -0800, Ian Zimmerman wrote:

> The st_dev member of type Unix.stats is declared as int.  But according
> to the Single Unix spec, the corresponding member of the C struct has
> a defined type, dev_t; and in fact recent Linux kernels define dev_t
> to a 64 bit type, even on 32 bit architectures.  So it looks like
> the Ocaml function will lose the high order bits.

st_ino as an in is a more damning problem.  Linux, with XFS can easily have
inode numbers that exceed a 32-bit integer (especially a 31-bit integer).

Practically, on Linux, st_dev is still only using 16-bits on Linux, but
people are still trying to increase that.

Unix.LargeFile almost fixes everything, except for the st_dev, st_rdev, and
st_ino fields still being too small.  Increase those, and I would stop
having to put my own bindings to lstat in my programs :-)

Dave


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-11-29  6:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-29  0:06 stat in Unix library Ian Zimmerman
2004-11-29  6:18 ` [Caml-list] " David Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).