diff --git a/include/linux/arm/syscall.h b/include/linux/arm/syscall.h index 66ee496a..3251c29a 100644 --- a/include/linux/arm/syscall.h +++ b/include/linux/arm/syscall.h @@ -55,6 +55,7 @@ #define SYS_lseek 0x13 #define SYS_rmdir 0x28 #define SYS_stat 0x6a +#define SYS_stat64 0xc3 /* libc+gnu */ #define SYS_chdir 0x0c @@ -71,8 +72,10 @@ #define SYS_fcntl 0x37 #define SYS_getrusage 0x4d #define SYS_lstat 0x6b +#define SYS_lstat64 0xc4 #define SYS_setitimer 0x68 #define SYS_fstat 0x6c +#define SYS_fstat64 0xc5 #define SYS_nanosleep 0xa2 #define SYS_getdents 0x8d diff --git a/include/linux/x86/syscall.h b/include/linux/x86/syscall.h index 736c3db6..8db1d6ba 100644 --- a/include/linux/x86/syscall.h +++ b/include/linux/x86/syscall.h @@ -53,9 +53,9 @@ #define SYS_lseek 0x13 #define SYS_rmdir 0x28 #define SYS_stat 0x6a +#define SYS_stat64 0xc3 /* libc+gnu */ - #define SYS_chdir 0x0c #define SYS_link 0x09 #define SYS_getpid 0x14 @@ -72,8 +72,10 @@ #define SYS_fcntl 0x37 #define SYS_getrusage 0x4d #define SYS_lstat 0x6b +#define SYS_lstat64 0xc4 #define SYS_setitimer 0x68 #define SYS_fstat 0x6c +#define SYS_fstat64 0xc5 #define SYS_nanosleep 0xa2 #define SYS_getdents 0x8d diff --git a/include/sys/stat.h b/include/sys/stat.h index 0644b361..52bacbd6 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -29,6 +29,7 @@ #include #include +#include #ifndef __MES_MODE_T #define __MES_MODE_T @@ -39,12 +40,12 @@ typedef int mode_t; #if __M2__ struct stat { - unsigned st_dev; - unsigned st_ino; - char st_mode[2]; - char st_nlink[2]; - char st_uid[2]; - char st_gid[2]; + unsigned st_dev; + unsigned st_ino; + unsigned st_mode; + unsigned st_nlink; + unsigned st_uid; + unsigned st_gid; unsigned st_rdev; long st_size; /* Linux: unsigned long; glibc: off_t (i.e. signed) */ unsigned st_blksize; @@ -58,7 +59,10 @@ struct stat unsigned __foo0; unsigned __foo1; }; -#elif __i386__ || __arm__ +// FIXME: M2-Planet 1.10.0 crashes on this... +// #elif (__i386__ || __arm__) && !SYS_stat64 +#define __i386__or__arm__ (__i386__or__arm__) +#elif __i386__or__arm__ && !SYS_stat64 struct stat { unsigned long st_dev; @@ -80,7 +84,7 @@ struct stat unsigned long __foo0; unsigned long __foo1; }; -#elif __x86_64__ +#else struct stat { unsigned long st_dev; diff --git a/lib/linux/fstat.c b/lib/linux/fstat.c index 19d3f6a9..7e5be794 100644 --- a/lib/linux/fstat.c +++ b/lib/linux/fstat.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -22,6 +22,11 @@ #include #include +#if (__i386__ || __arm__) && SYS_fstat64 +#undef SYS_fstat +#define SYS_fstat SYS_fstat64 +#endif + int fstat (int filedes, struct stat *statbuf) { diff --git a/lib/linux/lstat.c b/lib/linux/lstat.c index 039de0e1..1fa19d02 100644 --- a/lib/linux/lstat.c +++ b/lib/linux/lstat.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -22,6 +22,11 @@ #include #include +#if (__i386__ || __arm__) && SYS_lstat64 +#undef SYS_lstat +#define SYS_lstat SYS_lstat64 +#endif + int lstat (char const *file_name, struct stat *statbuf) { diff --git a/lib/linux/stat.c b/lib/linux/stat.c index d8f4465b..431eff5f 100644 --- a/lib/linux/stat.c +++ b/lib/linux/stat.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -22,6 +22,11 @@ #include #include +#if (__i386__ || __arm__) && SYS_stat64 +#undef SYS_stat +#define SYS_stat SYS_stat64 +#endif + int stat (char const *file_name, struct stat *statbuf) {