mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-06 23:02:10 +03:00
3f959f6f76
the elf_prstatus structure is used in core dumps, and the timeval structures in it are longs matching the elf class, *not* the kernel "old timeval" for the arch. this means using timeval here for x32 was always wrong, despite kernel uapi headers and glibc also exposing it this way, and of course it's wrong for any arch with 64-bit time_t. rather than just changing the type on affected archs, use a tagless struct containing long tv_sec and tv_usec members in place of the timevals. this intentionally breaks use of them as timevals (e.g. assignment, passing address, etc.) on 64-bit archs as well so that any usage unsafe for 32-bit archs is caught even in software that only gets tested on 64-bit archs. from what I could gather, there is not any software using these members anyway. the only reason they need to be fixed to begin with is that the only members which are commonly used, the saved registers, follow the time members and have the wrong offset if the time members are sized incorrectly.
64 lines
1.1 KiB
C
64 lines
1.1 KiB
C
#ifndef _SYS_PROCFS_H
|
|
#define _SYS_PROCFS_H
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <sys/time.h>
|
|
#include <sys/types.h>
|
|
#include <sys/user.h>
|
|
|
|
struct elf_siginfo {
|
|
int si_signo;
|
|
int si_code;
|
|
int si_errno;
|
|
};
|
|
|
|
struct elf_prstatus {
|
|
struct elf_siginfo pr_info;
|
|
short int pr_cursig;
|
|
unsigned long int pr_sigpend;
|
|
unsigned long int pr_sighold;
|
|
pid_t pr_pid;
|
|
pid_t pr_ppid;
|
|
pid_t pr_pgrp;
|
|
pid_t pr_sid;
|
|
struct {
|
|
long tv_sec, tv_usec;
|
|
} pr_utime, pr_stime, pr_cutime, pr_cstime;
|
|
elf_gregset_t pr_reg;
|
|
int pr_fpvalid;
|
|
};
|
|
|
|
#define ELF_PRARGSZ 80
|
|
|
|
struct elf_prpsinfo {
|
|
char pr_state;
|
|
char pr_sname;
|
|
char pr_zomb;
|
|
char pr_nice;
|
|
unsigned long int pr_flag;
|
|
#if UINTPTR_MAX == 0xffffffff
|
|
unsigned short int pr_uid;
|
|
unsigned short int pr_gid;
|
|
#else
|
|
unsigned int pr_uid;
|
|
unsigned int pr_gid;
|
|
#endif
|
|
int pr_pid, pr_ppid, pr_pgrp, pr_sid;
|
|
char pr_fname[16];
|
|
char pr_psargs[ELF_PRARGSZ];
|
|
};
|
|
|
|
typedef void *psaddr_t;
|
|
typedef elf_gregset_t prgregset_t;
|
|
typedef elf_fpregset_t prfpregset_t;
|
|
typedef pid_t lwpid_t;
|
|
typedef struct elf_prstatus prstatus_t;
|
|
typedef struct elf_prpsinfo prpsinfo_t;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|