Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Issue 6026005: Fix __fxstat which is called from fstat. Remove obsolete fstat64. (Closed)

Created:
10 years ago by halyavin
Modified:
9 years, 7 months ago
CC:
native-client-reviews_googlegroups.com
Visibility:
Public.

Description

Fix __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
Unified diffs Side-by-side diffs Delta from patch set Stats (+266 lines, -84 lines) Patch
M bits/types.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +3 lines, -3 lines 0 comments Download
M bits/typesizes.h View 1 2 3 4 5 2 chunks +30 lines, -0 lines 0 comments Download
M include/features.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +17 lines, -1 line 0 comments Download
M io/sys/stat.h View 1 2 3 4 5 6 7 8 2 chunks +4 lines, -1 line 0 comments Download
A sysdeps/nacl/fxstat.c View 1 2 3 4 5 6 7 8 9 10 1 chunk +50 lines, -0 lines 1 comment Download
M sysdeps/nacl/fxstat64.c View 1 2 3 4 1 chunk +1 line, -56 lines 0 comments Download
M sysdeps/nacl/nacl_stat.h View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
M sysdeps/nacl/xstat.c View 1 2 3 1 chunk +1 line, -19 lines 0 comments Download
A sysdeps/nacl/xstatconv.c View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -0 lines 0 comments Download
M sysdeps/unix/sysv/linux/bits/stat.h View 1 2 3 4 5 6 2 chunks +74 lines, -0 lines 1 comment Download
M sysdeps/unix/sysv/linux/kernel_stat.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -2 lines 0 comments Download
M sysdeps/unix/sysv/linux/x86_64/bits/stat.h View 1 2 3 4 5 6 2 chunks +76 lines, -0 lines 0 comments Download

Messages

Total messages: 23 (0 generated)
halyavin
10 years ago (2010-12-20 15:30:12 UTC) #1
eaeltsin
http://codereview.chromium.org/6026005/diff/1/sysdeps/nacl/nacl_stat.h File sysdeps/nacl/nacl_stat.h (right): http://codereview.chromium.org/6026005/diff/1/sysdeps/nacl/nacl_stat.h#newcode102 sysdeps/nacl/nacl_stat.h:102: void __nacl_abi_stat_to_stat (struct nacl_abi_stat *nacl_st, Please remove declaration from ...
10 years ago (2010-12-20 15:46:16 UTC) #2
pasko-google - do not use
This needs a test in tests/glibc_syscall_wrappers, please, check that it works for both glibc32 and ...
10 years ago (2010-12-20 15:46:35 UTC) #3
halyavin
On 2010/12/20 15:46:16, Evgeny Eltsin wrote: > http://codereview.chromium.org/6026005/diff/1/sysdeps/nacl/nacl_stat.h > File sysdeps/nacl/nacl_stat.h (right): > > http://codereview.chromium.org/6026005/diff/1/sysdeps/nacl/nacl_stat.h#newcode102 ...
10 years ago (2010-12-21 09:32:40 UTC) #4
halyavin
On 2010/12/20 15:46:35, pasko wrote: > This needs a test in tests/glibc_syscall_wrappers, please, check that ...
10 years ago (2010-12-21 11:24:07 UTC) #5
halyavin
Now structures are the same in 32-bit, 64-bit and between the modes. Andrey Khalyavin
10 years ago (2010-12-23 16:04:05 UTC) #6
pasko-google - do not use
General suggestions: please, provide explanations in the code review description of what you do and ...
10 years ago (2010-12-24 10:23:06 UTC) #7
halyavin
On 2010/12/24 10:23:06, pasko wrote: > Specific comments: > > the change in defining stat64 ...
10 years ago (2010-12-24 11:37:47 UTC) #8
halyavin
Updated description with explanation. Take another look. Andrey Khalyavin.
10 years ago (2010-12-24 12:29:17 UTC) #9
pasko-google - do not use
Andrey, thanks for a better description. Please, run io/test-stat.c and io/test-stat2.c on both nacl32 and ...
10 years ago (2010-12-24 12:32:46 UTC) #10
pasko-google - do not use
stat.h: As you know, I don't like massive copying. Can the definitions be included from ...
10 years ago (2010-12-24 13:04:49 UTC) #11
pasko-google - do not use
Quote from the Description: > 2. 32-bit system with _LARGEFILE64_SOURCE. > There is both func ...
10 years ago (2010-12-24 15:54:46 UTC) #12
halyavin
On 2010/12/24 13:04:49, pasko wrote: > stat.h: As you know, I don't like massive copying. ...
9 years, 12 months ago (2010-12-27 09:00:52 UTC) #13
halyavin
Take another look. Andrey Khalyavin
9 years, 12 months ago (2010-12-28 14:17:41 UTC) #14
eaeltsin
http://codereview.chromium.org/6026005/diff/41001/bits/types.h File bits/types.h (right): http://codereview.chromium.org/6026005/diff/41001/bits/types.h#newcode105 bits/types.h:105: New empty line here? Please remove if so. http://codereview.chromium.org/6026005/diff/41001/include/features.h ...
9 years, 11 months ago (2011-01-13 10:43:45 UTC) #15
halyavin
http://codereview.chromium.org/6026005/diff/41001/bits/types.h File bits/types.h (right): http://codereview.chromium.org/6026005/diff/41001/bits/types.h#newcode105 bits/types.h:105: On 2011/01/13 10:43:45, Evgeny Eltsin wrote: > New empty ...
9 years, 11 months ago (2011-01-13 11:15:21 UTC) #16
khim
One question, the rest LGTM... http://codereview.chromium.org/6026005/diff/48001/sysdeps/nacl/fxstat.c File sysdeps/nacl/fxstat.c (right): http://codereview.chromium.org/6026005/diff/48001/sysdeps/nacl/fxstat.c#newcode50 sysdeps/nacl/fxstat.c:50: extern __typeof (__nacl_abi_stat_to_stat64) __nacl_abi_stat_to_stat64 ...
9 years, 11 months ago (2011-01-13 13:12:38 UTC) #17
Mark Seaborn
This change is quite big in scope because you're changing bits/types.h and bits/typesizes.h. I did ...
9 years, 11 months ago (2011-01-14 16:10:44 UTC) #18
halyavin
> You have said "Although we don't need fstat externally, glibc uses it > internally". ...
9 years, 11 months ago (2011-01-17 08:11:44 UTC) #19
eaeltsin
lgtm
9 years, 11 months ago (2011-01-17 16:25:31 UTC) #20
Mark Seaborn
On 17 January 2011 08:11, <halyavin@google.com> wrote: > You have said "Although we don't need ...
9 years, 11 months ago (2011-01-18 16:19:46 UTC) #21
pasko-google - do not use
http://codereview.chromium.org/6026005/diff/48001/sysdeps/unix/sysv/linux/bits/stat.h File sysdeps/unix/sysv/linux/bits/stat.h (right): http://codereview.chromium.org/6026005/diff/48001/sysdeps/unix/sysv/linux/bits/stat.h#newcode36 sysdeps/unix/sysv/linux/bits/stat.h:36: struct stat64 this part is overly similar in sysdeps/unix/sysv/linux/bits/stat.h ...
9 years, 10 months ago (2011-01-29 11:57:56 UTC) #22
halyavin
9 years, 10 months ago (2011-01-31 08:33:36 UTC) #23
On 2011/01/29 11:57:56, pasko wrote:
>
http://codereview.chromium.org/6026005/diff/48001/sysdeps/unix/sysv/linux/bit...
> File sysdeps/unix/sysv/linux/bits/stat.h (right):
> 
>
http://codereview.chromium.org/6026005/diff/48001/sysdeps/unix/sysv/linux/bit...
> sysdeps/unix/sysv/linux/bits/stat.h:36: struct stat64
> this part is overly similar in
> sysdeps/unix/sysv/linux/bits/stat.h and
> sysdeps/unix/sysv/linux/x86_64/bits/stat.h
> 
> why did you not move it to a common header?
Glibc does not use a common header here. These two files will be used anyway. I
don't know the way to override the *.h files. Even if I did that, we would have
even more duplication because we need to copy the rest of stat.h file.

Andrey Khalyavin

Powered by Google App Engine
This is Rietveld 408576698