This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] Re: FIONREAD and IRIX 6


Benjamin Kosnik <bkoz@redhat.com> writes:
>>There are 4 27_io/basic_filebuf/sgetn/char failures on IRIX:
>>
>>   http://gcc.gnu.org/ml/gcc-testresults/2004-01/msg01339.html
>>
>>These are due to IRIX's FIONREAD taking a "size_t *" rather than "int *"
>>argument.  __basic_file<char>::showmanyc() ends up returning the high word
>>of the size_t, which is 0 for these tests.
>
> Thanks for tracking this down.

Turns out I had the wrong type.  ioctl(2) says size_t (which is 4 bytes
on o32 & n32, 8 on n64) but it appears to really be an off_t (4 bytes
on o32, 8 on n32 & n64).

>>What's the preferred way of handling this sort thing?  Is it OK to
>>add a new #define to config/os/irix/irix6.5/os_defines.h and use
>>that to alter the type in showmanyc()?  If so, what sort of name
>>would you suggest?
>
> This sounds acceptable. You can either do something like
> _GLIBCXX_FIONREAD_FIXUP or whatever, as long as it's guarded correctly.

Thanks.  Is the patch below OK?  It fixes:

-FAIL: 27_io/basic_filebuf/sgetn/char/1-in.cc execution test
-FAIL: 27_io/basic_filebuf/sgetn/char/1-io.cc execution test
-FAIL: 27_io/basic_filebuf/sgetn/char/2-in.cc execution test
-FAIL: 27_io/basic_filebuf/sgetn/char/2-io.cc execution test
-FAIL: 27_io/basic_istream/readsome/char/6746-2.cc execution test

for n32 & n64.  No change for o32, which wasn't failing these tests.

Bootstrapped & regression tested on mips-sgi-irix6.5.

Richard

(I went for a slightly more verbose macro name, hope that's OK.)


	* config/os/irix/irix6.5/os_defines.h (_GLIBCXX_FIONREAD_TAKES_OFF_T):
	Define.
	* config/io/basic_file_stdio.cc (__basic_file<char>::showmanyc): Use
	it to decide whether FIONREAD should take an off_t or int argument.

Index: config/os/irix/irix6.5/os_defines.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/os/irix/irix6.5/os_defines.h,v
retrieving revision 1.3
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 os_defines.h
*** config/os/irix/irix6.5/os_defines.h	5 Jul 2003 04:05:32 -0000	1.3
--- config/os/irix/irix6.5/os_defines.h	5 Feb 2004 06:04:20 -0000
*************** #define __ssize_t ssize_t
*** 51,55 ****
--- 51,58 ----
  // GCC does not use thunks on IRIX. 
  #define _G_USING_THUNKS 0
  
+ // FINOREAD takes an "off_t *" as argument.
+ #define _GLIBCXX_FIONREAD_TAKES_OFF_T
+ 
  #endif
  
Index: config/io/basic_file_stdio.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/io/basic_file_stdio.cc,v
retrieving revision 1.25
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.25 basic_file_stdio.cc
*** config/io/basic_file_stdio.cc	10 Dec 2003 17:37:22 -0000	1.25
--- config/io/basic_file_stdio.cc	5 Feb 2004 06:04:20 -0000
*************** namespace std 
*** 285,291 ****
--- 285,295 ----
    {
  #ifdef FIONREAD
      // Pipes and sockets.    
+ #ifdef _GLIBCXX_FIONREAD_TAKES_OFF_T
+     off_t __num = 0;
+ #else
      int __num = 0;
+ #endif
      int __r = ioctl(this->fd(), FIONREAD, &__num);
      if (!__r && __num >= 0)
        return __num; 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]