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:
parent
23b101b54b
commit
d270e5ef24
|
@ -55,6 +55,7 @@
|
||||||
#define SYS_lseek 0x13
|
#define SYS_lseek 0x13
|
||||||
#define SYS_rmdir 0x28
|
#define SYS_rmdir 0x28
|
||||||
#define SYS_stat 0x6a
|
#define SYS_stat 0x6a
|
||||||
|
#define SYS_stat64 0xc3
|
||||||
|
|
||||||
/* libc+gnu */
|
/* libc+gnu */
|
||||||
#define SYS_chdir 0x0c
|
#define SYS_chdir 0x0c
|
||||||
|
@ -71,8 +72,10 @@
|
||||||
#define SYS_fcntl 0x37
|
#define SYS_fcntl 0x37
|
||||||
#define SYS_getrusage 0x4d
|
#define SYS_getrusage 0x4d
|
||||||
#define SYS_lstat 0x6b
|
#define SYS_lstat 0x6b
|
||||||
|
#define SYS_lstat64 0xc4
|
||||||
#define SYS_setitimer 0x68
|
#define SYS_setitimer 0x68
|
||||||
#define SYS_fstat 0x6c
|
#define SYS_fstat 0x6c
|
||||||
|
#define SYS_fstat64 0xc5
|
||||||
#define SYS_nanosleep 0xa2
|
#define SYS_nanosleep 0xa2
|
||||||
#define SYS_getdents 0x8d
|
#define SYS_getdents 0x8d
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,9 @@
|
||||||
#define SYS_lseek 0x13
|
#define SYS_lseek 0x13
|
||||||
#define SYS_rmdir 0x28
|
#define SYS_rmdir 0x28
|
||||||
#define SYS_stat 0x6a
|
#define SYS_stat 0x6a
|
||||||
|
#define SYS_stat64 0xc3
|
||||||
|
|
||||||
/* libc+gnu */
|
/* libc+gnu */
|
||||||
|
|
||||||
#define SYS_chdir 0x0c
|
#define SYS_chdir 0x0c
|
||||||
#define SYS_link 0x09
|
#define SYS_link 0x09
|
||||||
#define SYS_getpid 0x14
|
#define SYS_getpid 0x14
|
||||||
|
@ -72,8 +72,10 @@
|
||||||
#define SYS_fcntl 0x37
|
#define SYS_fcntl 0x37
|
||||||
#define SYS_getrusage 0x4d
|
#define SYS_getrusage 0x4d
|
||||||
#define SYS_lstat 0x6b
|
#define SYS_lstat 0x6b
|
||||||
|
#define SYS_lstat64 0xc4
|
||||||
#define SYS_setitimer 0x68
|
#define SYS_setitimer 0x68
|
||||||
#define SYS_fstat 0x6c
|
#define SYS_fstat 0x6c
|
||||||
|
#define SYS_fstat64 0xc5
|
||||||
#define SYS_nanosleep 0xa2
|
#define SYS_nanosleep 0xa2
|
||||||
#define SYS_getdents 0x8d
|
#define SYS_getdents 0x8d
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <syscall.h>
|
||||||
|
|
||||||
#ifndef __MES_MODE_T
|
#ifndef __MES_MODE_T
|
||||||
#define __MES_MODE_T
|
#define __MES_MODE_T
|
||||||
|
@ -39,12 +40,12 @@ typedef int mode_t;
|
||||||
#if __M2__
|
#if __M2__
|
||||||
struct stat
|
struct stat
|
||||||
{
|
{
|
||||||
unsigned st_dev;
|
unsigned st_dev;
|
||||||
unsigned st_ino;
|
unsigned st_ino;
|
||||||
char st_mode[2];
|
unsigned st_mode;
|
||||||
char st_nlink[2];
|
unsigned st_nlink;
|
||||||
char st_uid[2];
|
unsigned st_uid;
|
||||||
char st_gid[2];
|
unsigned st_gid;
|
||||||
unsigned st_rdev;
|
unsigned st_rdev;
|
||||||
long st_size; /* Linux: unsigned long; glibc: off_t (i.e. signed) */
|
long st_size; /* Linux: unsigned long; glibc: off_t (i.e. signed) */
|
||||||
unsigned st_blksize;
|
unsigned st_blksize;
|
||||||
|
@ -58,7 +59,10 @@ struct stat
|
||||||
unsigned __foo0;
|
unsigned __foo0;
|
||||||
unsigned __foo1;
|
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
|
struct stat
|
||||||
{
|
{
|
||||||
unsigned long st_dev;
|
unsigned long st_dev;
|
||||||
|
@ -80,7 +84,7 @@ struct stat
|
||||||
unsigned long __foo0;
|
unsigned long __foo0;
|
||||||
unsigned long __foo1;
|
unsigned long __foo1;
|
||||||
};
|
};
|
||||||
#elif __x86_64__
|
#else
|
||||||
struct stat
|
struct stat
|
||||||
{
|
{
|
||||||
unsigned long st_dev;
|
unsigned long st_dev;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* GNU Mes --- Maxwell Equations of Software
|
* 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.
|
* This file is part of GNU Mes.
|
||||||
*
|
*
|
||||||
|
@ -22,6 +22,11 @@
|
||||||
#include <syscall.h>
|
#include <syscall.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#if (__i386__ || __arm__) && SYS_fstat64
|
||||||
|
#undef SYS_fstat
|
||||||
|
#define SYS_fstat SYS_fstat64
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
fstat (int filedes, struct stat *statbuf)
|
fstat (int filedes, struct stat *statbuf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* GNU Mes --- Maxwell Equations of Software
|
* 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.
|
* This file is part of GNU Mes.
|
||||||
*
|
*
|
||||||
|
@ -22,6 +22,11 @@
|
||||||
#include <syscall.h>
|
#include <syscall.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#if (__i386__ || __arm__) && SYS_lstat64
|
||||||
|
#undef SYS_lstat
|
||||||
|
#define SYS_lstat SYS_lstat64
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
lstat (char const *file_name, struct stat *statbuf)
|
lstat (char const *file_name, struct stat *statbuf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* GNU Mes --- Maxwell Equations of Software
|
* 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.
|
* This file is part of GNU Mes.
|
||||||
*
|
*
|
||||||
|
@ -22,6 +22,11 @@
|
||||||
#include <syscall.h>
|
#include <syscall.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#if (__i386__ || __arm__) && SYS_stat64
|
||||||
|
#undef SYS_stat
|
||||||
|
#define SYS_stat SYS_stat64
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
stat (char const *file_name, struct stat *statbuf)
|
stat (char const *file_name, struct stat *statbuf)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue