DescriptionFix __fxstat which is called from fstat. It was used linux syscall.
There is two kind of file functions and types in glibc - func and func64. There is several modes that determine how these functions come into play.
1. 32-bit system, no 64-bit features.
There is only func that works with 32-bit offsets.
2. 32-bit system with _LARGEFILE64_SOURCE.
There is both func and func64. func works with 32-bit offsets, func64 works with 64-bit offsets.
3. 32-bit system with _FILE_OFFSET_BITS=64.
There are func and func64 that are exported as/mapped to "func64".
4. 64-bit system.
There is func that works with 64-bit offsets.
5. 64-bit system with _FILE_OFFSET_BITS=64
There is func and func64 that are exported as/mapped to "func64".
In this patch I implement fstat and fstat64 that both work with 64-bit offsets (i.e. cases 3 and 5). Although we don't need fstat externally, glibc uses it internally.
Change explanations.
bits/types.h: due to long int being 32-bit with __WORDSIZE=64 I have to fix basic type defines.
typesizes.h: if __something_t and __something64_t are different, then weak mapping funcs64 to funcs produce compile errors. This is needed for 64-bit glibc only.
fxstat[64].c: I moved code from fxstat64.c adapting it to new stat structure.
xstat.c: I removed code duplication (converting stat structure) here.
nacl_stat.h: xstat and xstat64 call convertation function by two different names.
xstatconv.c: Glibc have stat convertation functions here. We have our own function and these functions produce compiler errors now so I removed them.
kernel_stat.h: I removed padding and obsolete fields in stat structures because we don't need them anymore and so need to update defines in this file.
bits/stat.h files: here goes our new stat[64] structures. One file is used with 32-bit glibc, the other is used with 64-bit glibc. My changes are identical in these files.
features.h: I force _FILE_OFFSET_BITS to be equal to 64 in user code.
sys/stat.h file: I map __fxstat64 to __fxstat if not in the libc.so. Otherwise it is done in fxstat.c.
BUG=none
TEST=http://codereview.chromium.org/6018003/
Committed: http://git.chromium.org/gitweb/?p=nacl-glibc.git;a=commit;h=08f0205
Patch Set 1 #
Total comments: 1
Patch Set 2 : make convert function inaccessible #Patch Set 3 : remove static because these functions are used by xstat and xstat64 #Patch Set 4 : fix typo #Patch Set 5 : Fix __fxstat, unificating struct stat and struct stat64. #
Total comments: 1
Patch Set 6 : features.h forces _FILE_OFFSET_BITS==64 #Patch Set 7 : hide stat64 if _LARGEFILE64_SOURCE not set #Patch Set 8 : Make func64 inacaessible from user code. #Patch Set 9 : implementing ideal scheme #Patch Set 10 : removed debuging code. #Patch Set 11 : refactoring fxstat.c #
Total comments: 20
Patch Set 12 : fixing comments, spacing and some other minor stuff. #
Total comments: 2
Messages
Total messages: 23 (0 generated)
|