Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
a4384bad
Commit
a4384bad
authored
Dec 04, 2009
by
Janne Blomqvist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PR libfortran/40812 Large file support for MinGW
From-SVN: r154984
parent
0c552622
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
22 deletions
+83
-22
libgfortran/ChangeLog
+23
-0
libgfortran/io/unix.c
+48
-15
libgfortran/io/unix.h
+7
-7
libgfortran/libgfortran.h
+5
-0
No files found.
libgfortran/ChangeLog
View file @
a4384bad
2009-12-04 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/40812
* libgfortran.h: typedef gfc_offset differently for MinGW.
* io/unix.h (struct stream): Change function pointers to use
gfc_offset instead of off_t.
(sseek): Change prototype to use gfc_offset instead of off_t.
(stell): Likewise.
(struncate): Likewise.
* io/unix.c: Redefine lseek() for mingw.
(raw_seek): Use gfc_offset instead of off_t.
(raw_tell): Likewise.
(buf_seek): Likewise.
(buf_tell): Likewise.
(buf_truncate): Likewise.
(mem_seek): Likewise.
(mem_tell): Likewise.
(mem_truncate): Likewise.
(fd_to_stream): Likewise.
(file_length): Likewise.
(raw_truncate): Use gfc_offset instead of off_t, add large file
capable implementation for MinGW.
2009-11-30 Janus Weil <janus@gcc.gnu.org>
2009-11-30 Janus Weil <janus@gcc.gnu.org>
* gfortran.map: Add _gfortran_is_extension_of.
* gfortran.map: Add _gfortran_is_extension_of.
...
...
libgfortran/io/unix.c
View file @
a4384bad
...
@@ -47,6 +47,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
...
@@ -47,6 +47,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windows.h>
#define lseek _lseeki64
static
uint64_t
static
uint64_t
id_from_handle
(
HANDLE
hFile
)
id_from_handle
(
HANDLE
hFile
)
{
{
...
@@ -274,22 +276,53 @@ raw_write (unix_stream * s, const void * buf, ssize_t nbyte)
...
@@ -274,22 +276,53 @@ raw_write (unix_stream * s, const void * buf, ssize_t nbyte)
return
nbyte
-
bytes_left
;
return
nbyte
-
bytes_left
;
}
}
static
off_
t
static
gfc_offse
t
raw_seek
(
unix_stream
*
s
,
off_
t
offset
,
int
whence
)
raw_seek
(
unix_stream
*
s
,
gfc_offse
t
offset
,
int
whence
)
{
{
return
lseek
(
s
->
fd
,
offset
,
whence
);
return
lseek
(
s
->
fd
,
offset
,
whence
);
}
}
static
off_
t
static
gfc_offse
t
raw_tell
(
unix_stream
*
s
)
raw_tell
(
unix_stream
*
s
)
{
{
return
lseek
(
s
->
fd
,
0
,
SEEK_CUR
);
return
lseek
(
s
->
fd
,
0
,
SEEK_CUR
);
}
}
static
int
static
int
raw_truncate
(
unix_stream
*
s
,
off_
t
length
)
raw_truncate
(
unix_stream
*
s
,
gfc_offse
t
length
)
{
{
#ifdef HAVE_FTRUNCATE
#ifdef __MINGW32__
HANDLE
h
;
gfc_offset
cur
;
if
(
isatty
(
s
->
fd
))
{
errno
=
EBADF
;
return
-
1
;
}
h
=
_get_osfhandle
(
s
->
fd
);
if
(
h
==
INVALID_HANDLE_VALUE
)
{
errno
=
EBADF
;
return
-
1
;
}
cur
=
lseek
(
s
->
fd
,
0
,
SEEK_CUR
);
if
(
cur
==
-
1
)
return
-
1
;
if
(
lseek
(
s
->
fd
,
length
,
SEEK_SET
)
==
-
1
)
goto
error
;
if
(
!
SetEndOfFile
(
h
))
{
errno
=
EBADF
;
goto
error
;
}
if
(
lseek
(
s
->
fd
,
cur
,
SEEK_SET
)
==
-
1
)
return
-
1
;
return
0
;
error:
lseek
(
s
->
fd
,
cur
,
SEEK_SET
);
return
-
1
;
#elif defined HAVE_FTRUNCATE
return
ftruncate
(
s
->
fd
,
length
);
return
ftruncate
(
s
->
fd
,
length
);
#elif defined HAVE_CHSIZE
#elif defined HAVE_CHSIZE
return
chsize
(
s
->
fd
,
length
);
return
chsize
(
s
->
fd
,
length
);
...
@@ -470,8 +503,8 @@ buf_write (unix_stream * s, const void * buf, ssize_t nbyte)
...
@@ -470,8 +503,8 @@ buf_write (unix_stream * s, const void * buf, ssize_t nbyte)
return
nbyte
;
return
nbyte
;
}
}
static
off_
t
static
gfc_offse
t
buf_seek
(
unix_stream
*
s
,
off_
t
offset
,
int
whence
)
buf_seek
(
unix_stream
*
s
,
gfc_offse
t
offset
,
int
whence
)
{
{
switch
(
whence
)
switch
(
whence
)
{
{
...
@@ -495,14 +528,14 @@ buf_seek (unix_stream * s, off_t offset, int whence)
...
@@ -495,14 +528,14 @@ buf_seek (unix_stream * s, off_t offset, int whence)
return
offset
;
return
offset
;
}
}
static
off_
t
static
gfc_offse
t
buf_tell
(
unix_stream
*
s
)
buf_tell
(
unix_stream
*
s
)
{
{
return
s
->
logical_offset
;
return
s
->
logical_offset
;
}
}
static
int
static
int
buf_truncate
(
unix_stream
*
s
,
off_
t
length
)
buf_truncate
(
unix_stream
*
s
,
gfc_offse
t
length
)
{
{
int
r
;
int
r
;
...
@@ -631,8 +664,8 @@ mem_write (stream * s, const void * buf, ssize_t nbytes)
...
@@ -631,8 +664,8 @@ mem_write (stream * s, const void * buf, ssize_t nbytes)
}
}
static
off_
t
static
gfc_offse
t
mem_seek
(
stream
*
strm
,
off_
t
offset
,
int
whence
)
mem_seek
(
stream
*
strm
,
gfc_offse
t
offset
,
int
whence
)
{
{
unix_stream
*
s
=
(
unix_stream
*
)
strm
;
unix_stream
*
s
=
(
unix_stream
*
)
strm
;
switch
(
whence
)
switch
(
whence
)
...
@@ -668,7 +701,7 @@ mem_seek (stream * strm, off_t offset, int whence)
...
@@ -668,7 +701,7 @@ mem_seek (stream * strm, off_t offset, int whence)
}
}
static
off_
t
static
gfc_offse
t
mem_tell
(
stream
*
s
)
mem_tell
(
stream
*
s
)
{
{
return
((
unix_stream
*
)
s
)
->
logical_offset
;
return
((
unix_stream
*
)
s
)
->
logical_offset
;
...
@@ -677,7 +710,7 @@ mem_tell (stream * s)
...
@@ -677,7 +710,7 @@ mem_tell (stream * s)
static
int
static
int
mem_truncate
(
unix_stream
*
s
__attribute__
((
unused
)),
mem_truncate
(
unix_stream
*
s
__attribute__
((
unused
)),
off_
t
length
__attribute__
((
unused
)))
gfc_offse
t
length
__attribute__
((
unused
)))
{
{
return
0
;
return
0
;
}
}
...
@@ -764,7 +797,7 @@ fd_to_stream (int fd, int prot)
...
@@ -764,7 +797,7 @@ fd_to_stream (int fd, int prot)
fstat
(
fd
,
&
statbuf
);
fstat
(
fd
,
&
statbuf
);
if
(
lseek
(
fd
,
0
,
SEEK_CUR
)
==
(
off_
t
)
-
1
)
if
(
lseek
(
fd
,
0
,
SEEK_CUR
)
==
(
gfc_offse
t
)
-
1
)
s
->
file_length
=
-
1
;
s
->
file_length
=
-
1
;
else
else
s
->
file_length
=
S_ISREG
(
statbuf
.
st_mode
)
?
statbuf
.
st_size
:
-
1
;
s
->
file_length
=
S_ISREG
(
statbuf
.
st_mode
)
?
statbuf
.
st_size
:
-
1
;
...
@@ -1602,7 +1635,7 @@ inquire_readwrite (const char *string, int len)
...
@@ -1602,7 +1635,7 @@ inquire_readwrite (const char *string, int len)
gfc_offset
gfc_offset
file_length
(
stream
*
s
)
file_length
(
stream
*
s
)
{
{
off_
t
curr
,
end
;
gfc_offse
t
curr
,
end
;
if
(
!
is_seekable
(
s
))
if
(
!
is_seekable
(
s
))
return
-
1
;
return
-
1
;
curr
=
stell
(
s
);
curr
=
stell
(
s
);
...
...
libgfortran/io/unix.h
View file @
a4384bad
...
@@ -33,10 +33,10 @@ struct stream
...
@@ -33,10 +33,10 @@ struct stream
{
{
ssize_t
(
*
read
)
(
struct
stream
*
,
void
*
,
ssize_t
);
ssize_t
(
*
read
)
(
struct
stream
*
,
void
*
,
ssize_t
);
ssize_t
(
*
write
)
(
struct
stream
*
,
const
void
*
,
ssize_t
);
ssize_t
(
*
write
)
(
struct
stream
*
,
const
void
*
,
ssize_t
);
off_t
(
*
seek
)
(
struct
stream
*
,
off_
t
,
int
);
gfc_offset
(
*
seek
)
(
struct
stream
*
,
gfc_offse
t
,
int
);
off_
t
(
*
tell
)
(
struct
stream
*
);
gfc_offse
t
(
*
tell
)
(
struct
stream
*
);
/* Avoid keyword truncate due to AIX namespace collision. */
/* Avoid keyword truncate due to AIX namespace collision. */
int
(
*
trunc
)
(
struct
stream
*
,
off_
t
);
int
(
*
trunc
)
(
struct
stream
*
,
gfc_offse
t
);
int
(
*
flush
)
(
struct
stream
*
);
int
(
*
flush
)
(
struct
stream
*
);
int
(
*
close
)
(
struct
stream
*
);
int
(
*
close
)
(
struct
stream
*
);
};
};
...
@@ -54,20 +54,20 @@ swrite (stream * s, const void * buf, ssize_t nbyte)
...
@@ -54,20 +54,20 @@ swrite (stream * s, const void * buf, ssize_t nbyte)
return
s
->
write
(
s
,
buf
,
nbyte
);
return
s
->
write
(
s
,
buf
,
nbyte
);
}
}
static
inline
off_
t
static
inline
gfc_offse
t
sseek
(
stream
*
s
,
off_
t
offset
,
int
whence
)
sseek
(
stream
*
s
,
gfc_offse
t
offset
,
int
whence
)
{
{
return
s
->
seek
(
s
,
offset
,
whence
);
return
s
->
seek
(
s
,
offset
,
whence
);
}
}
static
inline
off_
t
static
inline
gfc_offse
t
stell
(
stream
*
s
)
stell
(
stream
*
s
)
{
{
return
s
->
tell
(
s
);
return
s
->
tell
(
s
);
}
}
static
inline
int
static
inline
int
struncate
(
stream
*
s
,
off_
t
length
)
struncate
(
stream
*
s
,
gfc_offse
t
length
)
{
{
return
s
->
trunc
(
s
,
length
);
return
s
->
trunc
(
s
,
length
);
}
}
...
...
libgfortran/libgfortran.h
View file @
a4384bad
...
@@ -56,7 +56,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
...
@@ -56,7 +56,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if HAVE_SYS_TYPES_H
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#include <sys/types.h>
#endif
#endif
#ifdef __MINGW32__
typedef
off64_t
gfc_offset
;
#else
typedef
off_t
gfc_offset
;
typedef
off_t
gfc_offset
;
#endif
#ifndef NULL
#ifndef NULL
#define NULL (void *) 0
#define NULL (void *) 0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment