[Fortran, committed to trunk] Preparing libf2c/libI77 for 64-bit file sizes.
Toon Moene
toon@moene.indiv.nluug.nl
Sun Jul 1 06:18:00 GMT 2001
L.S.,
Currently, on 32-bit targets, libf2c's I/O routines only support file
sizes and offsets up to 2 Gbyte.
To some of our customers, this is too limiting.
To fix this shortcoming, I first updated all variables indicating file
offsets to type `off_t'. It is my understanding that configure will
automatically convert `off_t' to `long' on systems that do not define
`off_t'.
This also allowed me to remove the FreeBSD hack w.r.t. the `off_t'
argument to ftruncate (however, I'll keep an eye on the FreeBSD check
results, because I couldn't test this).
Subsequently, I wanted to compile the libf2c/libI77 routines with
preprocessor flags that enable 64-bit file operations. Unfortunately, I
couldn't get the obvious -D__USE_FILE_OFFSET64 and -D__USE_LARGEFILE64
(Debian 2.2) to work. Perhaps someone could kindly mail me an example
? TIA.
The following patch [attached] survived a make bootstrap / make check
for C and Fortran on i686-pc-linux-gnu. I installed it on the trunk.
Thanks go to Pedro Vazquez <vazquez@penelope.iqm.unicamp.br>, a g77
supporter and alpha tester from the very first hour, for his
proof-of-concept of these changes !
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)
2001-07-01 Toon Moene <toon@moene.indiv.nluug.nl>
Pedro Vazquez <vazquez@penelope.iqm.unicamp.br>
* libI77/fio.h: Use off_t when appropriate.
* libI77/backspace.c (f_back): Ditto.
* libI77/endfile.c (t_runc): Ditto.
* libI77/err.c (f__nowreading): Ditto.
* libI77/ftell_.c (unit_chk): Ditto.
* libI77/sue.c (global f__recloc, s_wsue): Ditto.
*** fio.h.orig Tue May 19 12:51:07 1998
--- fio.h Sun Jul 1 12:34:53 2001
*************** typedef struct
*** 35,39 ****
int udev;
#endif
! int url; /*0=sequential*/
flag useek; /*true=can backspace, use dir, ...*/
flag ufmt;
--- 35,39 ----
int udev;
#endif
! off_t url; /*0=sequential*/
flag useek; /*true=can backspace, use dir, ...*/
flag ufmt;
*** backspace.c.orig Thu May 17 19:19:18 2001
--- backspace.c Sun Jul 1 12:23:18 2001
*************** integer f_back(alist *a)
*** 9,13 ****
#endif
{ unit *b;
! long v, w, x, y, z;
uiolen n;
FILE *f;
--- 9,13 ----
#endif
{ unit *b;
! off_t v, w, x, y, z;
uiolen n;
FILE *f;
*** endfile.c.orig Wed May 16 19:10:15 2001
--- endfile.c Sun Jul 1 12:26:56 2001
*************** t_runc(alist *a)
*** 71,75 ****
#endif
{
! long loc, len;
unit *b;
int rc;
--- 71,75 ----
#endif
{
! off_t loc, len;
unit *b;
int rc;
*************** done:
*** 132,139 ****
#else /* !defined(HAVE_FTRUNCATE) */
fflush(b->ufd);
! /* The cast of loc is helpful on FreeBSD. It helps
! in any case where ftruncate() prototype is somehow missing
! even though autoconf test found it properly. */
! rc = ftruncate(fileno(b->ufd), (off_t)loc);
#endif /* !defined(HAVE_FTRUNCATE) */
if (rc)
--- 132,136 ----
#else /* !defined(HAVE_FTRUNCATE) */
fflush(b->ufd);
! rc = ftruncate(fileno(b->ufd), loc);
#endif /* !defined(HAVE_FTRUNCATE) */
if (rc)
*** err.c.orig Thu May 17 19:19:19 2001
--- err.c Sun Jul 1 12:29:03 2001
*************** f__nowreading(unit *x)
*** 211,215 ****
#endif
{
! long loc;
int ufmt, urw;
extern char *f__r_mode[], *f__w_mode[];
--- 211,215 ----
#endif
{
! off_t loc;
int ufmt, urw;
extern char *f__r_mode[], *f__w_mode[];
*** ftell_.c.orig Thu May 17 19:19:19 2001
--- ftell_.c Sun Jul 1 12:30:26 2001
*************** unit_chk(integer Unit, char *who)
*** 15,19 ****
}
! integer
#ifdef KR_headers
G77_ftell_0 (Unit) integer *Unit;
--- 15,19 ----
}
! off_t
#ifdef KR_headers
G77_ftell_0 (Unit) integer *Unit;
*** sue.c.orig Thu May 17 19:19:19 2001
--- sue.c Sun Jul 1 12:33:04 2001
***************
*** 3,7 ****
#include "fio.h"
extern uiolen f__reclen;
! long f__recloc;
#ifdef KR_headers
--- 3,7 ----
#include "fio.h"
extern uiolen f__reclen;
! off_t f__recloc;
#ifdef KR_headers
*************** integer s_wsue(cilist *a)
*** 68,72 ****
}
integer e_wsue(Void)
! { long loc;
f__init = 1;
fwrite((char *)&f__reclen,sizeof(uiolen),1,f__cf);
--- 68,72 ----
}
integer e_wsue(Void)
! { off_t loc;
f__init = 1;
fwrite((char *)&f__reclen,sizeof(uiolen),1,f__cf);
More information about the Gcc-patches
mailing list