using off_t in talloc
Love Hörnquist Åstrand
lha at kth.se
Thu Jul 20 14:29:43 GMT 2006
"Stefan (metze) Metzmacher" <metze at samba.org> writes:
> Hi *,
>
> I thought about removing off_t from talloc,
> it's used as return value of talloc_total_size() and
> talloc_total_blocks().
>
> I have added some configure checks
> to the standalone build of talloc.
> And it seems that:
>
> sizeof(off_t) is 8 (only Stratos has 4)
> sizeof(size_t) is 4 on x86 and 8 on 64bit platforms
>
> Are there any platforms where the total RAM-size per
> process doesn't fit into size_t?
short answer: no.
size_t is the type returned by sizeof operator. c99 defines MAX_SIZE (that
is the maximum value of size_t) to be 65535, or greater.
That said, you should look at mmap for a clue how its used. size_t for
memory sizes, off_t is for disk offsets, so depending on what you want to
return, memory offset or disk offset you have to choose from size_t or
off_t.
http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_12.html
contains defintions for both types.
Love
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 823 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20060720/f2f5a7bf/attachment.bin
More information about the samba-technical
mailing list