DRAFT lib: stat: Use SYS_stat64 for 32bit platforms.

* include/linux/arm/syscall.h (SYS_stat64): New define.
* include/linux/x86/syscall.h (SYS_stat64): Likewise.
* lib/linux/stat.c (SYS_stat)[(__i386__ || __arm__) && SYS_stat64):
Redefine to SYS_stat64.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2022-10-29 13:17:58 +02:00
parent 23b101b54b
commit d270e5ef24
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
6 changed files with 36 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -29,6 +29,7 @@
#include <time.h>
#include <sys/types.h>
#include <syscall.h>
#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;

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -22,6 +22,11 @@
#include <syscall.h>
#include <sys/stat.h>
#if (__i386__ || __arm__) && SYS_fstat64
#undef SYS_fstat
#define SYS_fstat SYS_fstat64
#endif
int
fstat (int filedes, struct stat *statbuf)
{

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -22,6 +22,11 @@
#include <syscall.h>
#include <sys/stat.h>
#if (__i386__ || __arm__) && SYS_lstat64
#undef SYS_lstat
#define SYS_lstat SYS_lstat64
#endif
int
lstat (char const *file_name, struct stat *statbuf)
{

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -22,6 +22,11 @@
#include <syscall.h>
#include <sys/stat.h>
#if (__i386__ || __arm__) && SYS_stat64
#undef SYS_stat
#define SYS_stat SYS_stat64
#endif
int
stat (char const *file_name, struct stat *statbuf)
{