update musl src to v1.1.24

This commit is contained in:
Andrew Kelley 2019-10-17 11:55:43 -04:00
parent 1135c9523b
commit 88b9579488
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
176 changed files with 1903 additions and 873 deletions

View File

@ -30,3 +30,11 @@
#define HWCAP_SB (1 << 29)
#define HWCAP_PACA (1 << 30)
#define HWCAP_PACG (1UL << 31)
#define HWCAP2_DCPODP (1 << 0)
#define HWCAP2_SVE2 (1 << 1)
#define HWCAP2_SVEAES (1 << 2)
#define HWCAP2_SVEPMULL (1 << 3)
#define HWCAP2_SVEBITPERM (1 << 4)
#define HWCAP2_SVESHA3 (1 << 5)
#define HWCAP2_SVESM4 (1 << 6)

View File

@ -1,14 +0,0 @@
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
uid_t cuid;
gid_t cgid;
mode_t mode;
unsigned short __ipc_perm_seq;
unsigned long __pad1;
unsigned long __pad2;
};
#define IPC_64 0

View File

@ -1,13 +0,0 @@
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
time_t msg_rtime;
time_t msg_ctime;
unsigned long msg_cbytes;
msgqnum_t msg_qnum;
msglen_t msg_qbytes;
pid_t msg_lspid;
pid_t msg_lrpid;
unsigned long __pad1;
unsigned long __pad2;
};

View File

@ -1,14 +0,0 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
time_t sem_ctime;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
#else
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
unsigned short sem_nsems;
#endif
time_t __unused3;
time_t __unused4;
};

View File

@ -1,24 +0,0 @@
#define SHMLBA 4096
struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
time_t shm_dtime;
time_t shm_ctime;
pid_t shm_cpid;
pid_t shm_lpid;
unsigned long shm_nattch;
unsigned long __pad1;
unsigned long __pad2;
};
struct shminfo {
unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
};
struct shm_info {
int __used_ids;
unsigned long shm_tot, shm_rss, shm_swp;
unsigned long __swap_attempts, __swap_successes;
};

View File

@ -281,4 +281,10 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433

View File

@ -0,0 +1,21 @@
struct kstat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
unsigned long __pad;
off_t st_size;
blksize_t st_blksize;
int __pad2;
blkcnt_t st_blocks;
long st_atime_sec;
long st_atime_nsec;
long st_mtime_sec;
long st_mtime_nsec;
long st_ctime_sec;
long st_ctime_nsec;
unsigned __unused[2];
};

View File

@ -74,3 +74,5 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
#define VDSO_USEFUL
#define VDSO_CGT_SYM "__kernel_clock_gettime"
#define VDSO_CGT_VER "LINUX_2.6.39"
#define IPC_64 0

View File

@ -0,0 +1 @@
#define IPC_STAT 2

View File

@ -1,8 +1,11 @@
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
int __unused1;
time_t msg_rtime;
int __unused2;
time_t msg_ctime;
int __unused3;
unsigned long msg_cbytes;
msgqnum_t msg_qnum;
msglen_t msg_qbytes;

View File

@ -1,14 +1,16 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
long __unused1;
time_t sem_ctime;
long __unused2;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
#else
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
unsigned short sem_nsems;
#endif
time_t __unused3;
time_t __unused4;
long __unused3;
long __unused4;
};

View File

@ -4,8 +4,11 @@ struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
int __unused1;
time_t shm_dtime;
int __unused2;
time_t shm_ctime;
int __unused3;
pid_t shm_cpid;
pid_t shm_lpid;
unsigned long shm_nattch;
@ -22,4 +25,3 @@ struct shm_info {
unsigned long shm_tot, shm_rss, shm_swp;
unsigned long __swap_attempts, __swap_successes;
};

View File

@ -381,6 +381,12 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
#define __ARM_NR_breakpoint 0x0f0001
#define __ARM_NR_cacheflush 0x0f0002

View File

@ -0,0 +1,21 @@
struct kstat {
dev_t st_dev;
int __st_dev_padding;
long __st_ino_truncated;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
int __st_rdev_padding;
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
long st_atime_sec;
long st_atime_nsec;
long st_mtime_sec;
long st_mtime_nsec;
long st_ctime_sec;
long st_ctime_nsec;
ino_t st_ino;
};

View File

@ -9,5 +9,3 @@ struct ipc_perm {
long __pad1;
long __pad2;
};
#define IPC_64 0x100

View File

@ -0,0 +1 @@
#define IPC_STAT 2

View File

@ -1,11 +1,8 @@
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
int __unused1;
time_t msg_rtime;
int __unused2;
time_t msg_ctime;
int __unused3;
unsigned long msg_cbytes;
msgqnum_t msg_qnum;
msglen_t msg_qbytes;

View File

@ -1,16 +1,14 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
time_t __unused1;
time_t sem_ctime;
time_t __unused2;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
#else
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
unsigned short sem_nsems;
#endif
time_t __unused3;
time_t __unused4;
long __unused3;
long __unused4;
};

View File

@ -4,11 +4,8 @@ struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
int __unused1;
time_t shm_dtime;
int __unused2;
time_t shm_ctime;
int __unused3;
pid_t shm_cpid;
pid_t shm_lpid;
unsigned long shm_nattch;
@ -25,4 +22,3 @@ struct shm_info {
unsigned long shm_tot, shm_rss, shm_swp;
unsigned long __swap_attempts, __swap_successes;
};

View File

@ -0,0 +1 @@
#define IPC_STAT 2

View File

@ -1,8 +1,11 @@
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
int __unused1;
time_t msg_rtime;
int __unused2;
time_t msg_ctime;
int __unused3;
unsigned long msg_cbytes;
msgqnum_t msg_qnum;
msglen_t msg_qbytes;

View File

@ -0,0 +1,11 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
long __unused1;
time_t sem_ctime;
long __unused2;
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
long __unused3;
long __unused4;
};

View File

@ -4,8 +4,11 @@ struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
int __unused1;
time_t shm_dtime;
int __unused2;
time_t shm_ctime;
int __unused3;
pid_t shm_cpid;
pid_t shm_lpid;
unsigned long shm_nattch;

View File

@ -418,4 +418,10 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433

View File

@ -0,0 +1,21 @@
struct kstat {
dev_t st_dev;
int __st_dev_padding;
long __st_ino_truncated;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
int __st_rdev_padding;
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
long st_atime_sec;
long st_atime_nsec;
long st_mtime_sec;
long st_mtime_nsec;
long st_ctime_sec;
long st_ctime_nsec;
ino_t st_ino;
};

View File

@ -0,0 +1 @@
#define IPC_STAT 2

View File

@ -4,11 +4,11 @@ struct semid_ds {
time_t sem_ctime;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
#else
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
unsigned short sem_nsems;
#endif
time_t __unused3;
time_t __unused4;
long __unused3;
long __unused4;
};

View File

@ -22,4 +22,3 @@ struct shm_info {
unsigned long shm_tot, shm_rss, shm_swp;
unsigned long __swap_attempts, __swap_successes;
};

View File

@ -400,4 +400,10 @@
#define __NR_io_uring_setup 4425
#define __NR_io_uring_enter 4426
#define __NR_io_uring_register 4427
#define __NR_open_tree 4428
#define __NR_move_mount 4429
#define __NR_fsopen 4430
#define __NR_fsconfig 4431
#define __NR_fsmount 4432
#define __NR_fspick 4433

View File

@ -0,0 +1,22 @@
struct kstat {
unsigned st_dev;
long __st_padding1[3];
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
unsigned st_rdev;
long __st_padding2[3];
off_t st_size;
long st_atime_sec;
long st_atime_nsec;
long st_mtime_sec;
long st_mtime_nsec;
long st_ctime_sec;
long st_ctime_nsec;
blksize_t st_blksize;
long __st_padding3;
blkcnt_t st_blocks;
long __st_padding4[14];
};

View File

@ -5,27 +5,25 @@
#define SYSCALL_RLIM_INFINITY (-1UL/2)
#if _MIPSEL || __MIPSEL || __MIPSEL__
#define __stat_fix(st) ((st),(void)0)
#if __mips_isa_rev >= 6
#define SYSCALL_CLOBBERLIST \
"$1", "$3", "$11", "$12", "$13", \
"$14", "$15", "$24", "$25", "memory"
#else
#include <sys/stat.h>
static inline void __stat_fix(long p)
{
struct stat *st = (struct stat *)p;
st->st_dev >>= 32;
st->st_rdev >>= 32;
}
#define SYSCALL_CLOBBERLIST \
"$1", "$3", "$11", "$12", "$13", \
"$14", "$15", "$24", "$25", "hi", "lo", "memory"
#endif
static inline long __syscall0(long n)
{
register long r7 __asm__("$7");
register long r2 __asm__("$2");
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"addu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
"syscall"
: "+r"(r2), "=r"(r7)
:
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
return r7 ? -r2 : r2;
}
@ -33,13 +31,12 @@ static inline long __syscall1(long n, long a)
{
register long r4 __asm__("$4") = a;
register long r7 __asm__("$7");
register long r2 __asm__("$2");
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"addu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
"r"(r4)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
"syscall"
: "+r"(r2), "=r"(r7)
: "r"(r4)
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
return r7 ? -r2 : r2;
}
@ -48,17 +45,13 @@ static inline long __syscall2(long n, long a, long b)
register long r4 __asm__("$4") = a;
register long r5 __asm__("$5") = b;
register long r7 __asm__("$7");
register long r2 __asm__("$2");
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"addu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
"r"(r4), "r"(r5)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
if (r7) return -r2;
long ret = r2;
if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
return ret;
"syscall"
: "+r"(r2), "=r"(r7)
: "r"(r4), "r"(r5)
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
return r7 ? -r2 : r2;
}
static inline long __syscall3(long n, long a, long b, long c)
@ -67,17 +60,13 @@ static inline long __syscall3(long n, long a, long b, long c)
register long r5 __asm__("$5") = b;
register long r6 __asm__("$6") = c;
register long r7 __asm__("$7");
register long r2 __asm__("$2");
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"addu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
"r"(r4), "r"(r5), "r"(r6)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
if (r7) return -r2;
long ret = r2;
if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
return ret;
"syscall"
: "+r"(r2), "=r"(r7)
: "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
return r7 ? -r2 : r2;
}
static inline long __syscall4(long n, long a, long b, long c, long d)
@ -86,18 +75,13 @@ static inline long __syscall4(long n, long a, long b, long c, long d)
register long r5 __asm__("$5") = b;
register long r6 __asm__("$6") = c;
register long r7 __asm__("$7") = d;
register long r2 __asm__("$2");
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"addu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
"r"(r4), "r"(r5), "r"(r6)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
if (r7) return -r2;
long ret = r2;
if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
if (n == SYS_fstatat64) __stat_fix(c);
return ret;
"syscall"
: "+r"(r2), "+r"(r7)
: "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
return r7 ? -r2 : r2;
}
static inline long __syscall5(long n, long a, long b, long c, long d, long e)
@ -107,20 +91,15 @@ static inline long __syscall5(long n, long a, long b, long c, long d, long e)
register long r6 __asm__("$6") = c;
register long r7 __asm__("$7") = d;
register long r8 __asm__("$8") = e;
register long r2 __asm__("$2");
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"subu $sp,$sp,32 ; sw $8,16($sp) ; "
"addu $2,$0,%3 ; syscall ;"
"syscall ;"
"addu $sp,$sp,32"
: "=&r"(r2), "=r"(r7), "+r"(r8)
: "ir"(n), "0"(r2), "1"(r7), "r"(r4), "r"(r5), "r"(r6)
: "$1", "$3", "$9", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
if (r7) return -r2;
long ret = r2;
if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
if (n == SYS_fstatat64) __stat_fix(c);
return r2;
: "+r"(r2), "+r"(r7), "+r"(r8)
: "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST, "$9", "$10");
return r7 ? -r2 : r2;
}
static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
@ -131,20 +110,15 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
register long r7 __asm__("$7") = d;
register long r8 __asm__("$8") = e;
register long r9 __asm__("$9") = f;
register long r2 __asm__("$2");
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; "
"addu $2,$0,%4 ; syscall ;"
"syscall ;"
"addu $sp,$sp,32"
: "=&r"(r2), "=r"(r7), "+r"(r8), "+r"(r9)
: "ir"(n), "0"(r2), "1"(r7), "r"(r4), "r"(r5), "r"(r6)
: "$1", "$3", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
if (r7) return -r2;
long ret = r2;
if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
if (n == SYS_fstatat64) __stat_fix(c);
return r2;
: "+r"(r2), "+r"(r7), "+r"(r8), "+r"(r9)
: "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST, "$10");
return r7 ? -r2 : r2;
}
static inline long __syscall7(long n, long a, long b, long c, long d, long e, long f, long g)
@ -156,22 +130,20 @@ static inline long __syscall7(long n, long a, long b, long c, long d, long e, lo
register long r8 __asm__("$8") = e;
register long r9 __asm__("$9") = f;
register long r10 __asm__("$10") = g;
register long r2 __asm__("$2");
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; sw $10,24($sp) ; "
"addu $2,$0,%5 ; syscall ;"
"syscall ;"
"addu $sp,$sp,32"
: "=&r"(r2), "=r"(r7), "+r"(r8), "+r"(r9), "+r"(r10)
: "ir"(n), "0"(r2), "1"(r7), "r"(r4), "r"(r5), "r"(r6)
: "$1", "$3", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
if (r7) return -r2;
long ret = r2;
if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
if (n == SYS_fstatat64) __stat_fix(c);
return r2;
: "+r"(r2), "+r"(r7), "+r"(r8), "+r"(r9), "+r"(r10)
: "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST);
return r7 ? -r2 : r2;
}
#define VDSO_USEFUL
#define VDSO_CGT_SYM "__vdso_clock_gettime"
#define VDSO_CGT_VER "LINUX_2.6"
#define SO_SNDTIMEO_OLD 0x1005
#define SO_RCVTIMEO_OLD 0x1006

View File

@ -10,5 +10,3 @@ struct ipc_perm {
unsigned long __unused1;
unsigned long __unused2;
};
#define IPC_64 0x100

View File

@ -1,13 +0,0 @@
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
time_t msg_rtime;
time_t msg_ctime;
unsigned long msg_cbytes;
msgqnum_t msg_qnum;
msglen_t msg_qbytes;
pid_t msg_lspid;
pid_t msg_lrpid;
unsigned long __pad1;
unsigned long __pad2;
};

View File

@ -1,6 +1,3 @@
#include <string.h>
#include <bits/alltypes.h>
struct stat {
dev_t st_dev;
int __pad1[3];

View File

@ -330,4 +330,10 @@
#define __NR_io_uring_setup 5425
#define __NR_io_uring_enter 5426
#define __NR_io_uring_register 5427
#define __NR_open_tree 5428
#define __NR_move_mount 5429
#define __NR_fsopen 5430
#define __NR_fsconfig 5431
#define __NR_fsmount 5432
#define __NR_fspick 5433

View File

@ -0,0 +1,21 @@
struct kstat {
unsigned st_dev;
int __pad1[3];
ino_t st_ino;
mode_t st_mode;
unsigned st_nlink;
uid_t st_uid;
gid_t st_gid;
unsigned st_rdev;
int __pad2[3];
off_t st_size;
int st_atime_sec;
int st_atime_nsec;
int st_mtime_sec;
int st_mtime_nsec;
int st_ctime_sec;
int st_ctime_nsec;
unsigned st_blksize;
unsigned __pad3;
blkcnt_t st_blocks;
};

View File

@ -3,58 +3,25 @@
#define SYSCALL_RLIM_INFINITY (-1UL/2)
#include <sys/stat.h>
struct kernel_stat {
unsigned int st_dev;
unsigned int __pad1[3];
unsigned long long st_ino;
unsigned int st_mode;
unsigned int st_nlink;
int st_uid;
int st_gid;
unsigned int st_rdev;
unsigned int __pad2[3];
long long st_size;
unsigned int st_atime_sec;
unsigned int st_atime_nsec;
unsigned int st_mtime_sec;
unsigned int st_mtime_nsec;
unsigned int st_ctime_sec;
unsigned int st_ctime_nsec;
unsigned int st_blksize;
unsigned int __pad3;
unsigned long long st_blocks;
};
static void __stat_fix(struct kernel_stat *kst, struct stat *st)
{
st->st_dev = kst->st_dev;
st->st_ino = kst->st_ino;
st->st_mode = kst->st_mode;
st->st_nlink = kst->st_nlink;
st->st_uid = kst->st_uid;
st->st_gid = kst->st_gid;
st->st_rdev = kst->st_rdev;
st->st_size = kst->st_size;
st->st_atim.tv_sec = kst->st_atime_sec;
st->st_atim.tv_nsec = kst->st_atime_nsec;
st->st_mtim.tv_sec = kst->st_mtime_sec;
st->st_mtim.tv_nsec = kst->st_mtime_nsec;
st->st_ctim.tv_sec = kst->st_ctime_sec;
st->st_ctim.tv_nsec = kst->st_ctime_nsec;
st->st_blksize = kst->st_blksize;
st->st_blocks = kst->st_blocks;
}
#if __mips_isa_rev >= 6
#define SYSCALL_CLOBBERLIST \
"$1", "$3", "$10", "$11", "$12", "$13", \
"$14", "$15", "$24", "$25", "memory"
#else
#define SYSCALL_CLOBBERLIST \
"$1", "$3", "$10", "$11", "$12", "$13", \
"$14", "$15", "$24", "$25", "hi", "lo", "memory"
#endif
static inline long __syscall0(long n)
{
register long r7 __asm__("$7");
register long r2 __asm__("$2");
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
"syscall"
: "+&r"(r2), "=r"(r7)
:
: SYSCALL_CLOBBERLIST);
return r7 ? -r2 : r2;
}
@ -62,175 +29,100 @@ static inline long __syscall1(long n, long a)
{
register long r4 __asm__("$4") = a;
register long r7 __asm__("$7");
register long r2 __asm__("$2");
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
"r"(r4)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
"syscall"
: "+&r"(r2), "=r"(r7)
: "r"(r4)
: SYSCALL_CLOBBERLIST);
return r7 ? -r2 : r2;
}
static inline long __syscall2(long n, long a, long b)
{
struct kernel_stat kst;
long ret;
register long r4 __asm__("$4") = a;
register long r5 __asm__("$5") = b;
register long r7 __asm__("$7");
register long r2 __asm__("$2");
if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
r5 = (long) &kst;
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
"r"(r4), "r"(r5)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
if (r7) return -r2;
ret = r2;
if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
__stat_fix(&kst, (struct stat *)b);
return ret;
"syscall"
: "+&r"(r2), "=r"(r7)
: "r"(r4), "r"(r5)
: SYSCALL_CLOBBERLIST);
return r7 ? -r2 : r2;
}
static inline long __syscall3(long n, long a, long b, long c)
{
struct kernel_stat kst;
long ret;
register long r4 __asm__("$4") = a;
register long r5 __asm__("$5") = b;
register long r6 __asm__("$6") = c;
register long r7 __asm__("$7");
register long r2 __asm__("$2");
if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
r5 = (long) &kst;
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
"r"(r4), "r"(r5), "r"(r6)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
if (r7) return -r2;
ret = r2;
if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
__stat_fix(&kst, (struct stat *)b);
return ret;
"syscall"
: "+&r"(r2), "=r"(r7)
: "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST);
return r7 ? -r2 : r2;
}
static inline long __syscall4(long n, long a, long b, long c, long d)
{
struct kernel_stat kst;
long ret;
register long r4 __asm__("$4") = a;
register long r5 __asm__("$5") = b;
register long r6 __asm__("$6") = c;
register long r7 __asm__("$7") = d;
register long r2 __asm__("$2");
if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
r5 = (long) &kst;
if (n == SYS_newfstatat)
r6 = (long) &kst;
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
"r"(r4), "r"(r5), "r"(r6)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
if (r7) return -r2;
ret = r2;
if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
__stat_fix(&kst, (struct stat *)b);
if (n == SYS_newfstatat)
__stat_fix(&kst, (struct stat *)c);
return ret;
"syscall"
: "+&r"(r2), "+r"(r7)
: "r"(r4), "r"(r5), "r"(r6)
: SYSCALL_CLOBBERLIST);
return r7 ? -r2 : r2;
}
static inline long __syscall5(long n, long a, long b, long c, long d, long e)
{
struct kernel_stat kst;
long ret;
register long r4 __asm__("$4") = a;
register long r5 __asm__("$5") = b;
register long r6 __asm__("$6") = c;
register long r7 __asm__("$7") = d;
register long r8 __asm__("$8") = e;
register long r2 __asm__("$2");
if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
r5 = (long) &kst;
if (n == SYS_newfstatat)
r6 = (long) &kst;
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
"r"(r4), "r"(r5), "r"(r6), "r"(r8)
: "$1", "$3", "$9", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
if (r7) return -r2;
ret = r2;
if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
__stat_fix(&kst, (struct stat *)b);
if (n == SYS_newfstatat)
__stat_fix(&kst, (struct stat *)c);
return ret;
"syscall"
: "+&r"(r2), "+r"(r7)
: "r"(r4), "r"(r5), "r"(r6), "r"(r8)
: SYSCALL_CLOBBERLIST);
return r7 ? -r2 : r2;
}
static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
{
struct kernel_stat kst;
long ret;
register long r4 __asm__("$4") = a;
register long r5 __asm__("$5") = b;
register long r6 __asm__("$6") = c;
register long r7 __asm__("$7") = d;
register long r8 __asm__("$8") = e;
register long r9 __asm__("$9") = f;
register long r2 __asm__("$2");
if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
r5 = (long) &kst;
if (n == SYS_newfstatat)
r6 = (long) &kst;
register long r2 __asm__("$2") = n;
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
"r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
: "$1", "$3", "$10", "$11", "$12", "$13",
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
if (r7) return -r2;
ret = r2;
if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
__stat_fix(&kst, (struct stat *)b);
if (n == SYS_newfstatat)
__stat_fix(&kst, (struct stat *)c);
return ret;
"syscall"
: "+&r"(r2), "+r"(r7)
: "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
: SYSCALL_CLOBBERLIST);
return r7 ? -r2 : r2;
}
#define VDSO_USEFUL
#define VDSO_CGT_SYM "__vdso_clock_gettime"
#define VDSO_CGT_VER "LINUX_2.6"
#define SO_SNDTIMEO_OLD 0x1005
#define SO_RCVTIMEO_OLD 0x1006

View File

@ -6,8 +6,12 @@ TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
#ifdef __WCHAR_TYPE__
TYPEDEF __WCHAR_TYPE__ wchar_t;
#else
TYPEDEF long wchar_t;
#endif
#endif
TYPEDEF float float_t;
TYPEDEF double double_t;

View File

@ -10,6 +10,3 @@ struct ipc_perm {
long long __pad2;
long long __pad3;
};
#define IPC_64 0x100

View File

@ -0,0 +1 @@
#define IPC_STAT 2

View File

@ -26,4 +26,3 @@ struct shm_info {
unsigned long shm_tot, shm_rss, shm_swp;
unsigned long __swap_attempts, __swap_successes;
};

View File

@ -407,4 +407,10 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433

View File

@ -1,10 +1,8 @@
struct pt_regs {
unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, mq;
unsigned long trap, dar, dsisr, result;
};
struct user {
struct pt_regs regs;
struct {
unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, mq;
unsigned long trap, dar, dsisr, result;
} regs;
unsigned long u_tsize, u_dsize, u_ssize;
unsigned long start_code, start_data, start_stack;
long signal;

View File

@ -0,0 +1,20 @@
struct kstat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
short __st_rdev_padding;
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
long st_atime_sec;
long st_atime_nsec;
long st_mtime_sec;
long st_mtime_nsec;
long st_ctime_sec;
long st_ctime_nsec;
unsigned __unused[2];
};

View File

@ -9,6 +9,7 @@
#define TPOFF_K (-0x7000)
#define REL_SYMBOLIC R_PPC_ADDR32
#define REL_USYMBOLIC R_PPC_UADDR32
#define REL_GOT R_PPC_GLOB_DAT
#define REL_PLT R_PPC_JMP_SLOT
#define REL_RELATIVE R_PPC_RELATIVE

View File

@ -89,3 +89,6 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
}
#define SYSCALL_FADVISE_6_ARG
#define SO_RCVTIMEO_OLD 18
#define SO_SNDTIMEO_OLD 19

View File

@ -10,6 +10,3 @@ struct ipc_perm {
long long __pad2;
long long __pad3;
};
#define IPC_64 0x100

View File

@ -1,12 +0,0 @@
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
time_t msg_rtime;
time_t msg_ctime;
unsigned long msg_cbytes;
msgqnum_t msg_qnum;
msglen_t msg_qbytes;
pid_t msg_lspid;
pid_t msg_lrpid;
unsigned long __unused[2];
};

View File

@ -1,13 +0,0 @@
#include <endian.h>
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
time_t sem_ctime;
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned short __pad[3], sem_nsems;
#else
unsigned short sem_nsems, __pad[3];
#endif
unsigned long __unused[2];
};

View File

@ -21,4 +21,3 @@ struct shm_info {
unsigned long shm_tot, shm_rss, shm_swp;
unsigned long __swap_attempts, __swap_successes;
};

View File

@ -379,4 +379,10 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433

View File

@ -1,10 +1,8 @@
struct pt_regs {
unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, softe;
unsigned long trap, dar, dsisr, result;
};
struct user {
struct pt_regs regs;
struct {
unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, softe;
unsigned long trap, dar, dsisr, result;
} regs;
unsigned long u_tsize, u_dsize, u_ssize;
unsigned long start_code, start_data, start_stack;
long signal;

View File

@ -0,0 +1,19 @@
struct kstat {
dev_t st_dev;
ino_t st_ino;
nlink_t st_nlink;
mode_t st_mode;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
long st_atime_sec;
long st_atime_nsec;
long st_mtime_sec;
long st_mtime_nsec;
long st_ctime_sec;
long st_ctime_nsec;
unsigned long __unused[3];
};

View File

@ -11,6 +11,7 @@
#define TPOFF_K (-0x7000)
#define REL_SYMBOLIC R_PPC64_ADDR64
#define REL_USYMBOLIC R_PPC64_UADDR64
#define REL_GOT R_PPC64_GLOB_DAT
#define REL_PLT R_PPC64_JMP_SLOT
#define REL_RELATIVE R_PPC64_RELATIVE

View File

@ -85,3 +85,6 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
:: "memory", "cr0", "r9", "r10", "r11", "r12");
return r3;
}
#define SO_RCVTIMEO_OLD 18
#define SO_SNDTIMEO_OLD 19

View File

@ -14,7 +14,7 @@ static inline int a_cas(volatile int *p, int t, int s)
" sc.w.aqrl %1, %4, (%2)\n"
" bnez %1, 1b\n"
"1:"
: "=&r"(old), "=r"(tmp)
: "=&r"(old), "=&r"(tmp)
: "r"(p), "r"(t), "r"(s)
: "memory");
return old;
@ -31,7 +31,7 @@ static inline void *a_cas_p(volatile void *p, void *t, void *s)
" sc.d.aqrl %1, %4, (%2)\n"
" bnez %1, 1b\n"
"1:"
: "=&r"(old), "=r"(tmp)
: "=&r"(old), "=&r"(tmp)
: "r"(p), "r"(t), "r"(s)
: "memory");
return old;

View File

@ -1,14 +0,0 @@
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
uid_t cuid;
gid_t cgid;
mode_t mode;
unsigned short __ipc_perm_seq;
unsigned long __pad1;
unsigned long __pad2;
};
#define IPC_64 0

View File

@ -1,13 +0,0 @@
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
time_t msg_rtime;
time_t msg_ctime;
unsigned long msg_cbytes;
msgqnum_t msg_qnum;
msglen_t msg_qbytes;
pid_t msg_lspid;
pid_t msg_lrpid;
unsigned long __pad1;
unsigned long __pad2;
};

View File

@ -1,9 +0,0 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
time_t sem_ctime;
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
time_t __unused3;
time_t __unused4;
};

View File

@ -1,25 +0,0 @@
#define SHMLBA 4096
struct shmid_ds
{
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
time_t shm_dtime;
time_t shm_ctime;
pid_t shm_cpid;
pid_t shm_lpid;
unsigned long shm_nattch;
unsigned long __pad1;
unsigned long __pad2;
};
struct shminfo {
unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
};
struct shm_info {
int __used_ids;
unsigned long shm_tot, shm_rss, shm_swp;
unsigned long __swap_attempts, __swap_successes;
};

View File

@ -6,46 +6,43 @@
# define SIGSTKSZ 8192
#endif
/* gregs[0] holds the program counter. */
typedef unsigned long __riscv_mc_gp_state[32];
struct __riscv_mc_f_ext_state {
unsigned int __f[32];
unsigned int __fcsr;
};
struct __riscv_mc_d_ext_state {
unsigned long long __f[32];
unsigned int __fcsr;
};
struct __riscv_mc_q_ext_state {
unsigned long long __f[64] __attribute__((aligned(16)));
unsigned int __fcsr;
unsigned int __reserved[3];
};
union __riscv_mc_fp_state {
struct __riscv_mc_f_ext_state __f;
struct __riscv_mc_d_ext_state __d;
struct __riscv_mc_q_ext_state __q;
};
typedef struct mcontext_t {
__riscv_mc_gp_state __gregs;
union __riscv_mc_fp_state __fpregs;
} mcontext_t;
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef unsigned long greg_t;
typedef unsigned long gregset_t[32];
struct __riscv_f_ext_state {
unsigned int f[32];
unsigned int fcsr;
};
struct __riscv_d_ext_state {
unsigned long long f[32];
unsigned int fcsr;
};
struct __riscv_q_ext_state {
unsigned long long f[64] __attribute__((aligned(16)));
unsigned int fcsr;
unsigned int reserved[3];
};
union __riscv_fp_state {
struct __riscv_f_ext_state f;
struct __riscv_d_ext_state d;
struct __riscv_q_ext_state q;
};
typedef union __riscv_fp_state fpregset_t;
typedef struct sigcontext {
typedef union __riscv_mc_fp_state fpregset_t;
struct sigcontext {
gregset_t gregs;
fpregset_t fpregs;
} mcontext_t;
#else
typedef struct {
unsigned long gregs[32];
unsigned long long fpregs[66];
} mcontext_t;
};
#endif
struct sigaltstack {
@ -54,10 +51,10 @@ struct sigaltstack {
size_t ss_size;
};
typedef struct __ucontext
typedef struct ucontext_t
{
unsigned long uc_flags;
struct __ucontext *uc_link;
struct ucontext_t *uc_link;
stack_t uc_stack;
sigset_t uc_sigmask;
mcontext_t uc_mcontext;

View File

@ -273,5 +273,20 @@
#define __NR_pkey_mprotect 288
#define __NR_pkey_alloc 289
#define __NR_pkey_free 290
#define __NR_statx 291
#define __NR_io_pgetevents 292
#define __NR_rseq 293
#define __NR_kexec_file_load 294
#define __NR_pidfd_send_signal 424
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
#define __NR_sysriscv __NR_arch_specific_syscall
#define __NR_riscv_flush_icache (__NR_sysriscv + 15)

View File

@ -1,43 +1,5 @@
struct user_regs_struct {
unsigned long pc;
unsigned long ra;
unsigned long sp;
unsigned long gp;
unsigned long tp;
unsigned long t0;
unsigned long t1;
unsigned long t2;
unsigned long s0;
unsigned long s1;
unsigned long a0;
unsigned long a1;
unsigned long a2;
unsigned long a3;
unsigned long a4;
unsigned long a5;
unsigned long a6;
unsigned long a7;
unsigned long s2;
unsigned long s3;
unsigned long s4;
unsigned long s5;
unsigned long s6;
unsigned long s7;
unsigned long s8;
unsigned long s9;
unsigned long s10;
unsigned long s11;
unsigned long t3;
unsigned long t4;
unsigned long t5;
unsigned long t6;
};
struct user_fpregs_struct {
double f[32];
unsigned int fcsr;
};
#include <signal.h>
#define ELF_NGREG 32
typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
typedef struct user_fpregs_struct elf_fpregset_t;
typedef union __riscv_mc_fp_state elf_fpregset_t;

View File

@ -0,0 +1,21 @@
struct kstat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
unsigned long __pad;
off_t st_size;
blksize_t st_blksize;
int __pad2;
blkcnt_t st_blocks;
long st_atime_sec;
long st_atime_nsec;
long st_mtime_sec;
long st_mtime_nsec;
long st_ctime_sec;
long st_ctime_nsec;
unsigned __unused[2];
};

View File

@ -11,4 +11,4 @@ static inline struct pthread *__pthread_self()
#define DTP_OFFSET 0x800
#define MC_PC gregs[0]
#define MC_PC __gregs[0]

View File

@ -74,3 +74,5 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
/* We don't have a clock_gettime function.
#define VDSO_CGT_SYM "__vdso_clock_gettime"
#define VDSO_CGT_VER "LINUX_2.6" */
#define IPC_64 0

View File

@ -1,14 +0,0 @@
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
uid_t cuid;
gid_t cgid;
mode_t mode;
unsigned short __pad1;
unsigned short __ipc_perm_seq;
unsigned long __pad2;
unsigned long __pad3;
};
#define IPC_64 0x100

View File

@ -1,7 +0,0 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
time_t sem_ctime;
unsigned short __pad[3], sem_nsems;
unsigned long __unused[2];
};

View File

@ -1,25 +0,0 @@
#define SHMLBA 4096
struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
time_t shm_dtime;
time_t shm_ctime;
pid_t shm_cpid;
pid_t shm_lpid;
unsigned long shm_nattch;
unsigned long __pad1;
unsigned long __pad2;
};
struct shminfo {
unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
};
struct shm_info {
int __used_ids;
unsigned long shm_tot, shm_rss, shm_swp;
unsigned long __swap_attempts, __swap_successes;
};

View File

@ -344,4 +344,10 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433

View File

@ -0,0 +1,19 @@
struct kstat {
dev_t st_dev;
ino_t st_ino;
nlink_t st_nlink;
mode_t st_mode;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
off_t st_size;
long st_atime_sec;
long st_atime_nsec;
long st_mtime_sec;
long st_mtime_nsec;
long st_ctime_sec;
long st_ctime_nsec;
blksize_t st_blksize;
blkcnt_t st_blocks;
unsigned long __unused[3];
};

View File

@ -1,13 +0,0 @@
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
uid_t cuid;
gid_t cgid;
mode_t mode;
int __ipc_perm_seq;
long __pad1;
long __pad2;
};
#define IPC_64 0

View File

@ -0,0 +1,11 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
long __unused1;
time_t sem_ctime;
long __unused2;
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
long __unused3;
long __unused4;
};

View File

@ -337,4 +337,10 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433

View File

@ -0,0 +1,22 @@
struct kstat {
dev_t st_dev;
ino_t st_ino;
nlink_t st_nlink;
mode_t st_mode;
uid_t st_uid;
gid_t st_gid;
unsigned int __pad0;
dev_t st_rdev;
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
long st_atime_sec;
long st_atime_nsec;
long st_mtime_sec;
long st_mtime_nsec;
long st_ctime_sec;
long st_ctime_nsec;
long __unused[3];
};

View File

@ -66,3 +66,5 @@ static __inline long __syscall6(long n, long a1, long a2, long a3, long a4, long
#define VDSO_CGT_VER "LINUX_2.6"
#define VDSO_GETCPU_SYM "__vdso_getcpu"
#define VDSO_GETCPU_VER "LINUX_2.6"
#define IPC_64 0

View File

@ -100,6 +100,11 @@ int posix_fallocate(int, off_t, off_t);
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define AT_NO_AUTOMOUNT 0x800
#define AT_EMPTY_PATH 0x1000
#define AT_STATX_SYNC_TYPE 0x6000
#define AT_STATX_SYNC_AS_STAT 0x0000
#define AT_STATX_FORCE_SYNC 0x2000
#define AT_STATX_DONT_SYNC 0x4000
#define AT_RECURSIVE 0x8000
#define FAPPEND O_APPEND
#define FFSYNC O_SYNC

View File

@ -31,6 +31,9 @@ void globfree(glob_t *);
#define GLOB_NOESCAPE 0x40
#define GLOB_PERIOD 0x80
#define GLOB_TILDE 0x1000
#define GLOB_TILDE_CHECK 0x4000
#define GLOB_NOSPACE 1
#define GLOB_ABORTED 2
#define GLOB_NOMATCH 3

View File

@ -76,6 +76,7 @@
#define ETH_P_QINQ2 0x9200
#define ETH_P_QINQ3 0x9300
#define ETH_P_EDSA 0xDADA
#define ETH_P_DSA_8021Q 0xDADB
#define ETH_P_IFE 0xED3E
#define ETH_P_AF_IUCV 0xFBFB

View File

@ -18,10 +18,12 @@ extern "C" {
struct sched_param {
int sched_priority;
int sched_ss_low_priority;
struct timespec sched_ss_repl_period;
struct timespec sched_ss_init_budget;
int sched_ss_max_repl;
int __reserved1;
struct {
time_t __reserved1;
long __reserved2;
} __reserved2[2];
int __reserved3;
};
int sched_get_priority_max(int);
@ -47,6 +49,7 @@ int sched_yield(void);
#define CLONE_FS 0x00000200
#define CLONE_FILES 0x00000400
#define CLONE_SIGHAND 0x00000800
#define CLONE_PIDFD 0x00001000
#define CLONE_PTRACE 0x00002000
#define CLONE_VFORK 0x00004000
#define CLONE_PARENT 0x00008000

View File

@ -71,6 +71,11 @@ int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int
int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *__restrict, const char *__restrict);
int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int);
#endif
#ifdef __cplusplus
}
#endif

View File

@ -152,6 +152,7 @@ int ptsname_r(int, char *, size_t);
char *ecvt(double, int, int *, int *);
char *fcvt(double, int, int *, int *);
char *gcvt(double, int, char *);
char *secure_getenv(const char *);
struct __locale_struct;
float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);

View File

@ -22,6 +22,7 @@ extern "C" {
#endif
#include <bits/ipc.h>
#include <bits/ipcstat.h>
#define IPC_CREAT 01000
#define IPC_EXCL 02000
@ -29,7 +30,6 @@ extern "C" {
#define IPC_RMID 0
#define IPC_SET 1
#define IPC_STAT 2
#define IPC_INFO 3
#define IPC_PRIVATE ((key_t) 0)

View File

@ -25,9 +25,9 @@ typedef unsigned long msglen_t;
#define MSG_NOERROR 010000
#define MSG_EXCEPT 020000
#define MSG_STAT 11
#define MSG_STAT (11 | (IPC_STAT & 0x100))
#define MSG_INFO 12
#define MSG_STAT_ANY 13
#define MSG_STAT_ANY (13 | (IPC_STAT & 0x100))
struct msginfo {
int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql;

View File

@ -31,9 +31,9 @@ extern "C" {
#define _SEM_SEMUN_UNDEFINED 1
#define SEM_STAT 18
#define SEM_STAT (18 | (IPC_STAT & 0x100))
#define SEM_INFO 19
#define SEM_STAT_ANY 20
#define SEM_STAT_ANY (20 | (IPC_STAT & 0x100))
struct seminfo {
int semmap;

View File

@ -33,9 +33,9 @@ extern "C" {
#define SHM_LOCK 11
#define SHM_UNLOCK 12
#define SHM_STAT 13
#define SHM_STAT (13 | (IPC_STAT & 0x100))
#define SHM_INFO 14
#define SHM_STAT_ANY 15
#define SHM_STAT_ANY (15 | (IPC_STAT & 0x100))
#define SHM_DEST 01000
#define SHM_LOCKED 02000
#define SHM_HUGETLB 04000

View File

@ -176,6 +176,7 @@ long syscall(long, ...);
int execvpe(const char *, char *const [], char *const []);
int issetugid(void);
int getentropy(void *, size_t);
extern int optreset;
#endif
#ifdef _GNU_SOURCE
@ -188,6 +189,7 @@ char *get_current_dir_name(void);
int syncfs(int);
int euidaccess(const char *, int);
int eaccess(const char *, int);
ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
#endif
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)

8
lib/libc/musl/src/env/secure_getenv.c vendored Normal file
View File

@ -0,0 +1,8 @@
#define _GNU_SOURCE
#include <stdlib.h>
#include "libc.h"
char *secure_getenv(const char *name)
{
return libc.secure ? NULL : getenv(name);
}

View File

@ -4,6 +4,7 @@
#include "../../include/time.h"
hidden int __clock_gettime(clockid_t, struct timespec *);
hidden int __clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *);
hidden char *__asctime_r(const struct tm *, char *);
hidden struct tm *__gmtime_r(const time_t *restrict, struct tm *restrict);

View File

@ -9,5 +9,6 @@ hidden int __dup3(int, int, int);
hidden int __mkostemps(char *, int, int);
hidden int __execvpe(const char *, char *const *, char *const *);
hidden int __aio_close(int);
hidden off_t __lseek(int, off_t, int);
#endif

View File

@ -28,6 +28,7 @@ typedef Elf64_Sym Sym;
enum {
REL_NONE = 0,
REL_SYMBOLIC = -100,
REL_USYMBOLIC,
REL_GOT,
REL_PLT,
REL_RELATIVE,

View File

@ -125,7 +125,6 @@ struct __timer {
0x80000000 })
void *__tls_get_addr(tls_mod_off_t *);
hidden void *__tls_get_new(tls_mod_off_t *);
hidden int __init_tp(void *);
hidden void *__copy_tls(unsigned char *);
hidden void __reset_tls();

View File

@ -43,8 +43,8 @@ hidden long __syscall_ret(unsigned long),
#define __syscall(...) __SYSCALL_DISP(__syscall,__VA_ARGS__)
#define syscall(...) __syscall_ret(__syscall(__VA_ARGS__))
#define socketcall __socketcall
#define socketcall_cp __socketcall_cp
#define socketcall(nm,a,b,c,d,e,f) __syscall_ret(__socketcall(nm,a,b,c,d,e,f))
#define socketcall_cp(nm,a,b,c,d,e,f) __syscall_ret(__socketcall_cp(nm,a,b,c,d,e,f))
#define __syscall_cp0(n) (__syscall_cp)(n,0,0,0,0,0,0)
#define __syscall_cp1(n,a) (__syscall_cp)(n,__scc(a),0,0,0,0,0)
@ -58,12 +58,12 @@ hidden long __syscall_ret(unsigned long),
#define syscall_cp(...) __syscall_ret(__syscall_cp(__VA_ARGS__))
#ifndef SYSCALL_USE_SOCKETCALL
#define __socketcall(nm,a,b,c,d,e,f) syscall(SYS_##nm, a, b, c, d, e, f)
#define __socketcall_cp(nm,a,b,c,d,e,f) syscall_cp(SYS_##nm, a, b, c, d, e, f)
#define __socketcall(nm,a,b,c,d,e,f) __syscall(SYS_##nm, a, b, c, d, e, f)
#define __socketcall_cp(nm,a,b,c,d,e,f) __syscall_cp(SYS_##nm, a, b, c, d, e, f)
#else
#define __socketcall(nm,a,b,c,d,e,f) syscall(SYS_socketcall, __SC_##nm, \
#define __socketcall(nm,a,b,c,d,e,f) __syscall(SYS_socketcall, __SC_##nm, \
((long [6]){ (long)a, (long)b, (long)c, (long)d, (long)e, (long)f }))
#define __socketcall_cp(nm,a,b,c,d,e,f) syscall_cp(SYS_socketcall, __SC_##nm, \
#define __socketcall_cp(nm,a,b,c,d,e,f) __syscall_cp(SYS_socketcall, __SC_##nm, \
((long [6]){ (long)a, (long)b, (long)c, (long)d, (long)e, (long)f }))
#endif
@ -193,6 +193,89 @@ hidden long __syscall_ret(unsigned long),
#define SYS_sendfile SYS_sendfile64
#endif
/* Ensure that the plain syscall names are defined even for "time64-only"
* archs. These facilitate callers passing null time arguments, and make
* tests for establishing which to use/fallback-to more consistent when
* they do need to be called with time arguments. */
#ifndef SYS_clock_gettime
#define SYS_clock_gettime SYS_clock_gettime64
#endif
#ifndef SYS_clock_settime
#define SYS_clock_settime SYS_clock_settime64
#endif
#ifndef SYS_clock_adjtime
#define SYS_clock_adjtime SYS_clock_adjtime64
#endif
#ifndef SYS_clock_getres
#define SYS_clock_getres SYS_clock_getres_time64
#endif
#ifndef SYS_clock_nanosleep
#define SYS_clock_nanosleep SYS_clock_nanosleep_time64
#endif
#ifndef SYS_timer_gettime
#define SYS_timer_gettime SYS_timer_gettime64
#endif
#ifndef SYS_timer_settime
#define SYS_timer_settime SYS_timer_settime64
#endif
#ifndef SYS_timerfd_gettime
#define SYS_timerfd_gettime SYS_timerfd_gettime64
#endif
#ifndef SYS_timerfd_settime
#define SYS_timerfd_settime SYS_timerfd_settime64
#endif
#ifndef SYS_utimensat
#define SYS_utimensat SYS_utimensat_time64
#endif
#ifndef SYS_pselect6
#define SYS_pselect6 SYS_pselect6_time64
#endif
#ifndef SYS_ppoll
#define SYS_ppoll SYS_ppoll_time64
#endif
#ifndef SYS_recvmmsg
#define SYS_recvmmsg SYS_recvmmsg_time64
#endif
#ifndef SYS_mq_timedsend
#define SYS_mq_timedsend SYS_mq_timedsend_time64
#endif
#ifndef SYS_mq_timedreceive
#define SYS_mq_timedreceive SYS_mq_timedreceive_time64
#endif
/* SYS_semtimedop omitted because SYS_ipc may provide it */
#ifndef SYS_rt_sigtimedwait
#define SYS_rt_sigtimedwait SYS_rt_sigtimedwait_time64
#endif
#ifndef SYS_futex
#define SYS_futex SYS_futex_time64
#endif
#ifndef SYS_sched_rr_get_interval
#define SYS_sched_rr_get_interval SYS_sched_rr_get_interval_time64
#endif
/* socketcall calls */
#define __SC_socket 1
@ -216,6 +299,20 @@ hidden long __syscall_ret(unsigned long),
#define __SC_recvmmsg 19
#define __SC_sendmmsg 20
#ifndef SO_RCVTIMEO_OLD
#define SO_RCVTIMEO_OLD 20
#endif
#ifndef SO_SNDTIMEO_OLD
#define SO_SNDTIMEO_OLD 21
#endif
#ifndef SIOCGSTAMP_OLD
#define SIOCGSTAMP_OLD 0x8906
#endif
#ifndef SIOCGSTAMPNS_OLD
#define SIOCGSTAMPNS_OLD 0x8907
#endif
#ifdef SYS_open
#define __sys_open2(x,pn,fl) __syscall2(SYS_open, pn, (fl)|O_LARGEFILE)
#define __sys_open3(x,pn,fl,mo) __syscall3(SYS_open, pn, (fl)|O_LARGEFILE, mo)

View File

@ -1 +1 @@
#define VERSION "1.1.23"
#define VERSION "1.1.24"

View File

@ -1,3 +1,5 @@
#include "syscall.h"
#define IPCOP_semop 1
#define IPCOP_semget 2
#define IPCOP_semctl 3
@ -10,3 +12,13 @@
#define IPCOP_shmdt 22
#define IPCOP_shmget 23
#define IPCOP_shmctl 24
#ifndef IPC_64
#define IPC_64 0x100
#endif
#define IPC_TIME64 (IPC_STAT & 0x100)
#define IPC_CMD(cmd) (((cmd) & ~IPC_TIME64) | IPC_64)
#define IPC_HILO(b,t) ((b)->t = (b)->__##t##_lo | 0LL+(b)->__##t##_hi<<32)

View File

@ -18,17 +18,24 @@ int msgctl(int q, int cmd, struct msqid_ds *buf)
}
#endif
#ifndef SYS_ipc
int r = __syscall(SYS_msgctl, q, cmd | IPC_64, buf);
int r = __syscall(SYS_msgctl, q, IPC_CMD(cmd), buf);
#else
int r = __syscall(SYS_ipc, IPCOP_msgctl, q, cmd | IPC_64, 0, buf, 0);
int r = __syscall(SYS_ipc, IPCOP_msgctl, q, IPC_CMD(cmd), 0, buf, 0);
#endif
#ifdef SYSCALL_IPC_BROKEN_MODE
if (r >= 0) switch (cmd) {
if (r >= 0) switch (cmd | IPC_TIME64) {
case IPC_STAT:
case MSG_STAT:
case MSG_STAT_ANY:
buf->msg_perm.mode >>= 16;
}
#endif
#if IPC_TIME64
if (r >= 0 && (cmd&IPC_TIME64)) {
IPC_HILO(buf, msg_stime);
IPC_HILO(buf, msg_rtime);
IPC_HILO(buf, msg_ctime);
}
#endif
return __syscall_ret(r);
}

View File

@ -18,9 +18,12 @@ int semctl(int id, int num, int cmd, ...)
{
union semun arg = {0};
va_list ap;
switch (cmd) {
case SETVAL: case GETALL: case SETALL: case IPC_STAT: case IPC_SET:
case IPC_INFO: case SEM_INFO: case SEM_STAT:
switch (cmd & ~IPC_TIME64) {
case SETVAL: case GETALL: case SETALL: case IPC_SET:
case IPC_INFO: case SEM_INFO:
case IPC_STAT & ~IPC_TIME64:
case SEM_STAT & ~IPC_TIME64:
case SEM_STAT_ANY & ~IPC_TIME64:
va_start(ap, cmd);
arg = va_arg(ap, union semun);
va_end(ap);
@ -34,17 +37,23 @@ int semctl(int id, int num, int cmd, ...)
}
#endif
#ifndef SYS_ipc
int r = __syscall(SYS_semctl, id, num, cmd | IPC_64, arg.buf);
int r = __syscall(SYS_semctl, id, num, IPC_CMD(cmd), arg.buf);
#else
int r = __syscall(SYS_ipc, IPCOP_semctl, id, num, cmd | IPC_64, &arg.buf);
int r = __syscall(SYS_ipc, IPCOP_semctl, id, num, IPC_CMD(cmd), &arg.buf);
#endif
#ifdef SYSCALL_IPC_BROKEN_MODE
if (r >= 0) switch (cmd) {
if (r >= 0) switch (cmd | IPC_TIME64) {
case IPC_STAT:
case SEM_STAT:
case SEM_STAT_ANY:
arg.buf->sem_perm.mode >>= 16;
}
#endif
#if IPC_TIME64
if (r >= 0 && (cmd&IPC_TIME64)) {
IPC_HILO(arg.buf, sem_otime);
IPC_HILO(arg.buf, sem_ctime);
}
#endif
return __syscall_ret(r);
}

View File

@ -1,13 +1,35 @@
#define _GNU_SOURCE
#include <sys/sem.h>
#include <errno.h>
#include "syscall.h"
#include "ipc.h"
#define IS32BIT(x) !((x)+0x80000000ULL>>32)
#define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63))
#if !defined(SYS_semtimedop) && !defined(SYS_ipc)
#define NO_TIME32 1
#else
#define NO_TIME32 0
#endif
int semtimedop(int id, struct sembuf *buf, size_t n, const struct timespec *ts)
{
#ifndef SYS_ipc
#ifdef SYS_semtimedop_time64
time_t s = ts ? ts->tv_sec : 0;
long ns = ts ? ts->tv_nsec : 0;
int r = -ENOSYS;
if (NO_TIME32 || !IS32BIT(s))
r = __syscall(SYS_semtimedop_time64, id, buf, n,
ts ? ((long long[]){s, ns}) : 0);
if (NO_TIME32 || r!=-ENOSYS) return __syscall_ret(r);
ts = ts ? (void *)(long[]){CLAMP(s), ns} : 0;
#endif
#if defined(SYS_ipc)
return syscall(SYS_ipc, IPCOP_semtimedop, id, n, 0, buf, ts);
#elif defined(SYS_semtimedop)
return syscall(SYS_semtimedop, id, buf, n, ts);
#else
return syscall(SYS_ipc, IPCOP_semtimedop, id, n, 0, buf, ts);
return __syscall_ret(-ENOSYS);
#endif
}

View File

@ -18,17 +18,24 @@ int shmctl(int id, int cmd, struct shmid_ds *buf)
}
#endif
#ifndef SYS_ipc
int r = __syscall(SYS_shmctl, id, cmd | IPC_64, buf);
int r = __syscall(SYS_shmctl, id, IPC_CMD(cmd), buf);
#else
int r = __syscall(SYS_ipc, IPCOP_shmctl, id, cmd | IPC_64, 0, buf, 0);
int r = __syscall(SYS_ipc, IPCOP_shmctl, id, IPC_CMD(cmd), 0, buf, 0);
#endif
#ifdef SYSCALL_IPC_BROKEN_MODE
if (r >= 0) switch (cmd) {
if (r >= 0) switch (cmd | IPC_TIME64) {
case IPC_STAT:
case SHM_STAT:
case SHM_STAT_ANY:
buf->shm_perm.mode >>= 16;
}
#endif
#if IPC_TIME64
if (r >= 0 && (cmd&IPC_TIME64)) {
IPC_HILO(buf, shm_atime);
IPC_HILO(buf, shm_dtime);
IPC_HILO(buf, shm_ctime);
}
#endif
return __syscall_ret(r);
}

View File

@ -9,15 +9,11 @@ __tlsdesc_static:
ldr x0,[x0,#8]
ret
.hidden __tls_get_new
// size_t __tlsdesc_dynamic(size_t *a)
// {
// struct {size_t modidx,off;} *p = (void*)a[1];
// size_t *dtv = *(size_t**)(tp - 8);
// if (p->modidx <= dtv[0])
// return dtv[p->modidx] + p->off - tp;
// return __tls_get_new(p) - tp;
// return dtv[p->modidx] + p->off - tp;
// }
.global __tlsdesc_dynamic
.hidden __tlsdesc_dynamic

Some files were not shown because too many files have changed in this diff Show More