www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Version (X86_64) for struct_stat64 on Linux x86_64

reply Chuck Blake <cb mit.edu> writes:
Hi.  I realize that 64-bit phobos is relatively work in progress.  I thought
I'd contribute.  struct_stat64 is broken on Linux x86_64 which further breaks
an awful lot of file IO.  I have a small patch that fixes it.  I tested this
with gdc 2.051 within gcc-4.5.2, with an attached program and comparing to the
output from the 'stat' utility.  It is so basic and logic-free that I
seriously doubt environmental considerations matter.  This doesn't completely
fix file IO, but it at least gives it a running chance.  I can read files
under 8MB, for example. :)
begin 644 stat64_x86_64.patch
M(R!(1R!C:&%N9V5S970 <&%T8V *(R!5<V5R(&-B0&UI="YE9'4*(R!$871E





M8F$Q861A-B!D+W!H;V)O<S(O<W1D+V9I;&4N9`HM+2T 82]D+W!H;V)O<S(O

M(&(O9"]P:&]B;W,R+W-T9"]F:6QE+F0)5'5E($1E8R`R."`Q.3HS,3HT,B`R

M;'-E"B` ("` >PHM("` ("` ("!S=')U8W0 <W1R=6-T7W-T870V-"` ("` 
M("` +R\ 9&ES=&EN9W5I<V  :70 9G)O;2!T:&4 <W1A=" I(&9U;F-T:6]N
M"BL ("` ("` ('9E<G-I;VX *% X-E\V-"D >R` ("` ("` ("`O+R!,:6YU

M=&%T-C0**R` ("` ("` ("` ('L**R` ("` ("` ("` ("` ("!U;&]N9R!S
M=%]D978[("` ("` ("\O($1E=FEC92X**R` ("` ("` ("` ("` ("!U;&]N
M9R!S=%]I;F\[("` ("` ("\O($9I;&4 <V5R:6%L(&YU;6)E<BX**R` ("` 
M("` ("` ("` ("!U;&]N9R!S=%]N;&EN:SL ("` ("\O($QI;FL 8V]U;G0N
M"BL ("` ("` ("` ("` ("` =6EN="` <W1?;6]D93L ("` ("`O+R!&:6QE
M(&UO9&4N"BL ("` ("` ("` ("` ("` =6EN="` <W1?=6ED.R` ("` ("`O
M+R!5<V5R($E$(&]F('1H92!F:6QE)W, ;W=N97(N(`HK("` ("` ("` ("` 
M("` ('5I;G0 ('-T7V=I9#L ("` ("` +R\ 1W)O=7` 240 ;V8 =&AE(&9I

M("` ("` ("` ("` ("` =6QO;F< <W1?<F1E=CL ("` ("`O+R!$979I8V4 
M;G5M8F5R+"!I9B!D979I8V4N"BL ("` ("` ("` ("` ("` ;&]N9R` <W1?
M<VEZ93L ("` ("`O+R!3:7IE(&]F(&9I;&4L(&EN(&)Y=&5S+ HK("` ("` 
M("` ("` ("` (&QO;F< ('-T7V)L:W-I>F4[("` +R\ 3W!T:6UA;"!B;&]C
M:R!S:7IE(&9O<B!)+T\N"BL ("` ("` ("` ("` ("` ;&]N9R` <W1?8FQO
M8VMS.R` ("`O+R!.<BX -3$R+6)Y=&4 8FQO8VMS(&%L;&]C871E9"X**R` 
M("` ("` ("` ("` ("!L;VYG("!S=%]A=&EM93L ("` ("\O(%1I;64 ;V8 
M;&%S="!A8V-E<W,N"BL ("` ("` ("` ("` ("` =6QO;F< <W1?871I;65N
M<V5C.R`O+R!.<V-E8W, ;V8 ;&%S="!A8V-E<W,N"BL ("` ("` ("` ("` 
M("` ;&]N9R` <W1?;71I;64[("` ("`O+R!4:6UE(&]F(&QA<W0 ;6]D:69I
M8V%T:6]N+ HK("` ("` ("` ("` ("` ('5L;VYG('-T7VUT:6UE;G-E8SL 
M+R\ 3G-E8W, ;V8 ;&%S="!M;V1I9FEC871I;VXN"BL ("` ("` ("` ("` 
M("` ;&]N9R` <W1?8W1I;64[("` ("`O+R!4:6UE(&]F(&QA<W0 <W1A='5S
M(&-H86YG92X**R` ("` ("` ("` ("` ("!U;&]N9R!S=%]C=&EM96YS96,[
M("\O($YS96-S(&]F(&QA<W0 <W1A='5S(&-H86YG92X**R` ("` ("` ("` 
M("` ("!L;VYG("!?7W5N=7-E9%LS73L**R` ("` ("` ("` ('T**R` ("` 
M("` ?0HK("` ("` ("!E;'-E"B` ("` ("` ('L*+2` ("` ("` ("` ('5L
M;VYG('-T7V1E=CL ("` ("` ("\O+R!D979I8V4*+2` ("` ("` ("` ('5I
M;G0 7U]P860Q.PHM("` ("` ("` ("` =6EN="!S=%]I;F\[("` ("` ("`O
M+R\ 9FEL92!S97)I86P ;G5M8F5R"BT ("` ("` ("` ("!U:6YT('-T7VUO
M9&4[("` ("` ("`O+R\ 9FEL92!M;V1E"BT ("` ("` ("` ("!U:6YT('-T
M7VYL:6YK.R` ("` ("` +R\O(&QI;FL 8V]U;G0*+2` ("` ("` ("` ('5I
M;G0 <W1?=6ED.R` ("` ("` +R\O('5S97( 240 ;V8 9FEL92=S(&]W;F5R
M"BT ("` ("` ("` ("!U:6YT('-T7V=I9#L ("` ("` ("\O+R!U<V5R($E$
M(&]F(&=R;W5P)W, ;W=N97(*+2` ("` ("` ("` ('5L;VYG('-T7W)D978[
M("` ("` ("`O+R\ :68 9&5V:6-E('1H96X 9&5V:6-E(&YU;6)E< HM("` 

M;&]N9R!S=%]S:7IE.PHM("` ("` ("` ("` :6YT('-T7V)L:W-I>F4[("` 
M("` ("`O+R\ ;W!T:6UA;"!)+T\ 8FQO8VL <VEZ90HM("` ("` ("` ("` 
M=6QO;F< <W1?8FQO8VMS.R` ("` ("` +R\O(&YU;6)E<B!O9B!A;&QO8V%T
M960 -3$R(&)Y=&4 8FQO8VMS"BT ("` ("` ("` ("!I;G0 <W1?871I;64[
M"BT ("` ("` ("` ("!U:6YT('-T7V%T:6UE;G-E8SL*+2` ("` ("` ("` 
M(&EN="!S=%]M=&EM93L*+2` ("` ("` ("` ('5I;G0 <W1?;71I;65N<V5C
M.PHM("` ("` ("` ("` :6YT('-T7V-T:6UE.PHM("` ("` ("` ("` =6EN
M="!S=%]C=&EM96YS96,["BT*+2` ("` ("` ("` ('5L;VYG('-T7VEN;S8T
M.PHK("` ("` ("` ("` <W1R=6-T('-T<G5C=%]S=&%T-C0 ("` +R\ 9&ES
M=&EN9W5I<V  :70 9G)O;2!T:&4 <W1A=" I(&9U;F-T:6]N"BL ("` ("` 
M("` ("!["BL ("` ("` ("` ("` ("` =6QO;F< <W1?9&5V.R` ("` ("`O
M+R\ 9&5V:6-E"BL ("` ("` ("` ("` ("` =6EN="` 7U]P860Q.PHK("` 
M("` ("` ("` ("` ('5I;G0 ('-T7VEN;SL ("` ("` +R\O(&9I;&4 <V5R
M:6%L(&YU;6)E< HK("` ("` ("` ("` ("` ('5I;G0 ('-T7VUO9&4[("` 
M("` +R\O(&9I;&4 ;6]D90HK("` ("` ("` ("` ("` ('5I;G0 ('-T7VYL
M:6YK.R` ("` +R\O(&QI;FL 8V]U;G0**R` ("` ("` ("` ("` ("!U:6YT
M("!S=%]U:60[("` ("` ("\O+R!U<V5R($E$(&]F(&9I;&4G<R!O=VYE< HK
M("` ("` ("` ("` ("` ('5I;G0 ('-T7V=I9#L ("` ("` +R\O('5S97( 
M240 ;V8 9W)O=7`G<R!O=VYE< HK("` ("` ("` ("` ("` ('5L;VYG('-T
M7W)D978[("` ("` +R\O(&EF(&1E=FEC92!T:&5N(&1E=FEC92!N=6UB97(*

M("` 86QI9VXH-"D =6QO;F< <W1?<VEZ93L**R` ("` ("` ("` ("` ("!I
M;G0 ("!S=%]B;&MS:7IE.R` ("\O+R!O<'1I;6%L($DO3R!B;&]C:R!S:7IE
M"BL ("` ("` ("` ("` ("` =6QO;F< <W1?8FQO8VMS.R` ("`O+R\ ;G5M
M8F5R(&]F(&%L;&]C871E9"`U,3( 8GET92!B;&]C:W,**R` ("` ("` ("` 
M("` ("!I;G0 ("!S=%]A=&EM93L**R` ("` ("` ("` ("` ("!U:6YT("!S
M=%]A=&EM96YS96,["BL ("` ("` ("` ("` ("` :6YT("` <W1?;71I;64[
M"BL ("` ("` ("` ("` ("` =6EN="` <W1?;71I;65N<V5C.PHK("` ("` 
M("` ("` ("` (&EN="` ('-T7V-T:6UE.PHK("` ("` ("` ("` ("` ('5I
M;G0 ('-T7V-T:6UE;G-E8SL**R` ("` ("` ("` ("` ("!U;&]N9R!S=%]I
M;F\V-#L**R` ("` ("` ("` ('T*("` ("` ("` ?0HM"B` ("` ("` (&5X

M("` ("` 97AT97)N*$,I(&EN="!S=&%T-C0H:6X 8VAA<BHL('-T<G5C=%]S
0=&%T-C0J*3L*("` ("!]" ``
`
end
begin 644 stat.d
M:6UP;W)T('-T9"YS=&1I;RP <W1D+F9I;&4L('-T9"YS=')I;F<[" II;G0 
M;6%I;BAC:&%R6UU;72!A<F=S*2!["B` ("!V97)S:6]N("A0;W-I>"D >PH 
M("` ("` ('-T<G5C=%]S=&%T-C0 <W0 /2!V;VED.PH ("` ("` (&9O<F5A
M8V  *'!A=& [(&%R9W-;,2`N+B!A<F=S+FQE;F=T:%TI('L*("` ("` ("` 

M:68 *'!A=&  (3T 87)G<ULQ72D*("` ("` ("` ("` ("` ('=R:71E9FQN
M*"(B*3L*("` ("` ("` ("` =W)I=&5F;&XH(G!A=&  ("` ("` ("`Z("5S
M(BP <&%T:"D["B` ("` ("` ("` ('=R:71E9FQN*")S=%]D978 ("` ("` 
M.B`E<R(L('-T+G-T7V1E=BD["B` ("` ("` ("` ('=R:71E9FQN*")S=%]I
M;F\ ("` ("` .B`E<R(L('-T+G-T7VEN;RD["B` ("` ("` ("` ('=R:71E
M9FQN*")S=%]N;&EN:R` ("` .B`E<R(L('-T+G-T7VYL:6YK*3L*("` ("` 
M("` ("` =W)I=&5F;&XH(G-T7VUO9&4 ("` ("`Z("5O(BP <W0N<W1?;6]D
M92D["B` ("` ("` ("` ('=R:71E9FQN*")S=%]U:60 ("` ("` .B`E<R(L
M('-T+G-T7W5I9"D["B` ("` ("` ("` ('=R:71E9FQN*")S=%]G:60 ("` 
M("` .B`E<R(L('-T+G-T7V=I9"D["B` ("` ("` ("` ('=R:71E9FQN*")S
M=%]R9&5V("` ("` .B`E<R(L('-T+G-T7W)D978I.PH ("` ("` ("` ("!W
M<FET969L;B B<W1?<VEZ92` ("` (#H )7,B+"!S="YS=%]S:7IE*3L*("` 
M("` ("` ("` =W)I=&5F;&XH(G-T7V)L:W-I>F4 ("`Z("5S(BP <W0N<W1?
M8FQK<VEZ92D["B` ("` ("` ("` ('=R:71E9FQN*")S=%]B;&]C:W, ("` 
M.B`E<R(L('-T+G-T7V)L;V-K<RD["B` ("` ("` ("` ('=R:71E9FQN*")S
M=%]A=&EM92` ("` .B`E<R(L('-T+G-T7V%T:6UE*3L*("` ("` ("` ("` 
M=W)I=&5F;&XH(G-T7V%T:6UE;G-E8R`Z("5S(BP <W0N<W1?871I;65N<V5C
M*3L*("` ("` ("` ("` =W)I=&5F;&XH(G-T7VUT:6UE("` ("`Z("5S(BP 
M<W0N<W1?;71I;64I.PH ("` ("` ("` ("!W<FET969L;B B<W1?;71I;65N
M<V5C(#H )7,B+"!S="YS=%]M=&EM96YS96,I.PH ("` ("` ("` ("!W<FET
M969L;B B<W1?8W1I;64 ("` (#H )7,B+"!S="YS=%]C=&EM92D["B` ("` 
M("` ("` ('=R:71E9FQN*")S=%]C=&EM96YS96, .B`E<R(L('-T+G-T7V-T

`
end
Dec 28 2010
parent "Simen kjaeraas" <simen.kjaras gmail.com> writes:
Chuck Blake <cb mit.edu> wrote:

 Hi.  I realize that 64-bit phobos is relatively work in progress.  I  
 thought
 I'd contribute.  struct_stat64 is broken on Linux x86_64 which further  
 breaks
 an awful lot of file IO.  I have a small patch that fixes it.  I tested  
 this
 with gdc 2.051 within gcc-4.5.2, with an attached program and comparing  
 to the
 output from the 'stat' utility.  It is so basic and logic-free that I
 seriously doubt environmental considerations matter.  This doesn't  
 completely
 fix file IO, but it at least gives it a running chance.  I can read files
 under 8MB, for example. :)
This is an automated newsgroup. Please post to digitalmars.D or digitalmars.D.learn, or file your issue in BugZilla. For this specific problem, you might also consider joining the Phobos mailing list at http://lists.puremagic.com/mailman/listinfo/ -- Simen
Dec 28 2010