Skip to content

Commit 44d54de

Browse files
committed
Added AArch64 support for Linux.
1 parent 02a0977 commit 44d54de

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ OBJ = unix.o unix_dirent.o unix_errno.o unix_fcntl.o \
6060

6161
.PHONY: all clean doc examples install \
6262
freebsd freebsd_doc freebsd_examples \
63-
linux linux_doc linux_examples
63+
linux linux_aarch64 linux_doc linux_examples
6464

6565
all: $(TARGET)
6666

@@ -101,6 +101,9 @@ freebsd:
101101
linux:
102102
$(MAKE) $(TARGET) OS=linux
103103

104+
linux_aarch64:
105+
$(MAKE) $(TARGET) PPFLAGS="-cpp -D__linux__ -D__aarch64__"
106+
104107
freebsd_examples:
105108
$(MAKE) examples OS=FreeBSD
106109

src/unix_stat.F90

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,31 @@ module unix_stat
3838
integer(kind=c_int), parameter, public :: S_ISGID = int(o'0002000')
3939
integer(kind=c_int), parameter, public :: S_ISVTX = int(o'0001000')
4040

41-
! struct stat
41+
#if defined(__aarch64__)
42+
43+
! struct stat (aarch64)
44+
type, bind(c), public :: c_stat_type
45+
integer(kind=c_dev_t) :: st_dev = 0 ! ID of device containing file
46+
integer(kind=c_ino_t) :: st_ino = 0 ! inode number
47+
integer(kind=c_mode_t) :: st_mode = 0 ! protection
48+
integer(kind=c_nlink_t) :: st_nlink = 0 ! number of hard links
49+
integer(kind=c_uid_t) :: st_uid = 0 ! user ID of owner
50+
integer(kind=c_gid_t) :: st_gid = 0 ! group ID of owner
51+
integer(kind=c_dev_t) :: st_rdev = 0 ! device ID (if special file)
52+
integer(kind=c_dev_t), private :: pad0 = 0
53+
integer(kind=c_off_t) :: st_size = 0 ! total size, in bytes
54+
integer(kind=c_blksize_t) :: st_blksize = 0 ! blocksize for file system I/O
55+
integer(kind=c_int), private :: pad1 = 0
56+
integer(kind=c_blkcnt_t) :: st_blocks = 0 ! number of 512B blocks allocated
57+
type(c_timespec) :: st_atim ! time of last access
58+
type(c_timespec) :: st_mtim ! time of last modification
59+
type(c_timespec) :: st_ctim ! time of last status change
60+
integer(kind=c_long), private :: reserved(2) = 0
61+
end type c_stat_type
62+
63+
#else
64+
65+
! struct stat (x86-64)
4266
type, bind(c), public :: c_stat_type
4367
integer(kind=c_dev_t) :: st_dev = 0 ! ID of device containing file
4468
integer(kind=c_ino_t) :: st_ino = 0 ! inode number
@@ -57,6 +81,7 @@ module unix_stat
5781
integer(kind=c_long), private :: reserved(3) = 0
5882
end type c_stat_type
5983

84+
#endif
6085
#elif defined (__FreeBSD__)
6186

6287
integer(kind=c_int), parameter, public :: S_IRWXU = int(o'0000700')

0 commit comments

Comments
 (0)