2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

coredump: lint fix for block comments

Block comment should start with '# '
https://www.flake8rules.com/rules/E265.html

Inline comment should start with '# '
https://www.flake8rules.com/rules/E262.html

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
This commit is contained in:
Radostin Stoyanov 2021-09-05 21:53:06 +01:00 committed by Andrei Vagin
parent 06306c8b1e
commit 579066633b
2 changed files with 578 additions and 420 deletions

View File

@ -223,7 +223,7 @@ class coredump_generator:
ehdr.e_phoff = ctypes.sizeof(elf.Elf64_Ehdr()) ehdr.e_phoff = ctypes.sizeof(elf.Elf64_Ehdr())
ehdr.e_ehsize = ctypes.sizeof(elf.Elf64_Ehdr()) ehdr.e_ehsize = ctypes.sizeof(elf.Elf64_Ehdr())
ehdr.e_phentsize = ctypes.sizeof(elf.Elf64_Phdr()) ehdr.e_phentsize = ctypes.sizeof(elf.Elf64_Phdr())
#FIXME Case len(phdrs) > PN_XNUM should be handled properly. # FIXME Case len(phdrs) > PN_XNUM should be handled properly.
# See fs/binfmt_elf.c from linux kernel. # See fs/binfmt_elf.c from linux kernel.
ehdr.e_phnum = len(phdrs) ehdr.e_phnum = len(phdrs)
@ -346,7 +346,7 @@ class coredump_generator:
ctypes.memset(ctypes.addressof(prstatus), 0, ctypes.sizeof(prstatus)) ctypes.memset(ctypes.addressof(prstatus), 0, ctypes.sizeof(prstatus))
#FIXME setting only some of the fields for now. Revisit later. # FIXME setting only some of the fields for now. Revisit later.
prstatus.pr_pid = tid prstatus.pr_pid = tid
prstatus.pr_ppid = pstree["ppid"] prstatus.pr_ppid = pstree["ppid"]
prstatus.pr_pgrp = pstree["pgid"] prstatus.pr_pgrp = pstree["pgid"]
@ -414,7 +414,6 @@ class coredump_generator:
*regs["st_space"]) *regs["st_space"])
fpregset.xmm_space = (ctypes.c_uint * len(regs["xmm_space"]))( fpregset.xmm_space = (ctypes.c_uint * len(regs["xmm_space"]))(
*regs["xmm_space"]) *regs["xmm_space"])
#fpregset.padding = regs["padding"] unused
nhdr = elf.Elf64_Nhdr() nhdr = elf.Elf64_Nhdr()
nhdr.n_namesz = 5 nhdr.n_namesz = 5
@ -588,7 +587,7 @@ class coredump_generator:
nhdr = elf.Elf64_Nhdr() nhdr = elf.Elf64_Nhdr()
nhdr.n_namesz = 5 #XXX strlen + 1 nhdr.n_namesz = 5 # strlen + 1
nhdr.n_descsz = ctypes.sizeof(elf_files()) nhdr.n_descsz = ctypes.sizeof(elf_files())
nhdr.n_type = elf.NT_FILE nhdr.n_type = elf.NT_FILE
@ -675,11 +674,11 @@ class coredump_generator:
return b"" return b""
if vma["status"] & status["VMA_AREA_VVAR"]: if vma["status"] & status["VMA_AREA_VVAR"]:
#FIXME this is what gdb does, as vvar vma # FIXME this is what gdb does, as vvar vma
# is not readable from userspace? # is not readable from userspace?
return b"\0" * size return b"\0" * size
elif vma["status"] & status["VMA_AREA_VSYSCALL"]: elif vma["status"] & status["VMA_AREA_VSYSCALL"]:
#FIXME need to dump it with criu or read from # FIXME need to dump it with criu or read from
# current process. # current process.
return b"\0" * size return b"\0" * size

View File

@ -16,16 +16,13 @@ EI_MAG0 = 0 # #define EI_MAG0 0 /* File identification by
ELFMAG0 = 0x7f # #define ELFMAG0 0x7f /* Magic number byte 0 */ ELFMAG0 = 0x7f # #define ELFMAG0 0x7f /* Magic number byte 0 */
EI_MAG1 = 1 # #define EI_MAG1 1 /* File identification byte 1 index */ EI_MAG1 = 1 # #define EI_MAG1 1 /* File identification byte 1 index */
ELFMAG1 = ord( ELFMAG1 = ord('E') # #define ELFMAG1 'E' /* Magic number byte 1 */
'E') # #define ELFMAG1 'E' /* Magic number byte 1 */
EI_MAG2 = 2 # #define EI_MAG2 2 /* File identification byte 2 index */ EI_MAG2 = 2 # #define EI_MAG2 2 /* File identification byte 2 index */
ELFMAG2 = ord( ELFMAG2 = ord('L') # #define ELFMAG2 'L' /* Magic number byte 2 */
'L') # #define ELFMAG2 'L' /* Magic number byte 2 */
EI_MAG3 = 3 # #define EI_MAG3 3 /* File identification byte 3 index */ EI_MAG3 = 3 # #define EI_MAG3 3 /* File identification byte 3 index */
ELFMAG3 = ord( ELFMAG3 = ord('F') # #define ELFMAG3 'F' /* Magic number byte 3 */
'F') # #define ELFMAG3 'F' /* Magic number byte 3 */
EI_CLASS = 4 # #define EI_CLASS 4 /* File class byte index */ EI_CLASS = 4 # #define EI_CLASS 4 /* File class byte index */
@ -48,7 +45,7 @@ EV_CURRENT = 1 # #define EV_CURRENT 1 /* Current version */
class Elf64_Ehdr(ctypes.Structure): # typedef struct class Elf64_Ehdr(ctypes.Structure): # typedef struct
_fields_ = [ # { _fields_ = [
("e_ident", ("e_ident",
ctypes.c_ubyte * EI_NIDENT), # unsigned char e_ident[EI_NIDENT]; ctypes.c_ubyte * EI_NIDENT), # unsigned char e_ident[EI_NIDENT];
("e_type", Elf64_Half), # Elf64_Half e_type; ("e_type", Elf64_Half), # Elf64_Half e_type;
@ -80,7 +77,7 @@ PF_R = 1 << 2 # #define PF_R (1 << 2) /* Segment is readable
class Elf64_Phdr(ctypes.Structure): # typedef struct class Elf64_Phdr(ctypes.Structure): # typedef struct
_fields_ = [ # { _fields_ = [
("p_type", Elf64_Word), # Elf64_Word p_type; ("p_type", Elf64_Word), # Elf64_Word p_type;
("p_flags", Elf64_Word), # Elf64_Word p_flags; ("p_flags", Elf64_Word), # Elf64_Word p_flags;
("p_offset", Elf64_Off), # Elf64_Off p_offset; ("p_offset", Elf64_Off), # Elf64_Off p_offset;
@ -100,11 +97,11 @@ class _Elf64_auxv_t_U(ctypes.Union):
class Elf64_auxv_t(ctypes.Structure): # typedef struct class Elf64_auxv_t(ctypes.Structure): # typedef struct
_fields_ = [ # { _fields_ = [
("a_type", ("a_type",
ctypes.c_uint64), # uint64_t a_type; /* Entry type */ ctypes.c_uint64), # uint64_t a_type; /* Entry type */
("a_un", _Elf64_auxv_t_U) # union ("a_un", _Elf64_auxv_t_U) # union
# {
# uint64_t a_val; /* Integer value */ # uint64_t a_val; /* Integer value */
# /* We use to have pointer elements added here. We cannot do that, # /* We use to have pointer elements added here. We cannot do that,
# though, since it does not work when using 32-bit definitions # though, since it does not work when using 32-bit definitions
@ -119,15 +116,13 @@ NT_PRSTATUS = 1 # #define NT_PRSTATUS 1 /* Contains copy of p
NT_FPREGSET = 2 # #define NT_FPREGSET 2 /* Contains copy of fpregset struct */ NT_FPREGSET = 2 # #define NT_FPREGSET 2 /* Contains copy of fpregset struct */
NT_PRPSINFO = 3 # #define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ NT_PRPSINFO = 3 # #define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
NT_AUXV = 6 # #define NT_AUXV 6 /* Contains copy of auxv array */ NT_AUXV = 6 # #define NT_AUXV 6 /* Contains copy of auxv array */
NT_SIGINFO = 0x53494749 # #define NT_SIGINFO 0x53494749 /* Contains copy of siginfo_t, NT_SIGINFO = 0x53494749 # #define NT_SIGINFO 0x53494749 /* Contains copy of siginfo_t, size might increase */
# size might increase */ NT_FILE = 0x46494c45 # #define NT_FILE 0x46494c45 /* Contains information about mapped files */
NT_FILE = 0x46494c45 # #define NT_FILE 0x46494c45 /* Contains information about mapped
# files */
NT_X86_XSTATE = 0x202 # #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ NT_X86_XSTATE = 0x202 # #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
class Elf64_Nhdr(ctypes.Structure): # typedef struct class Elf64_Nhdr(ctypes.Structure): # typedef struct
_fields_ = [ # { _fields_ = [
( (
"n_namesz", Elf64_Word "n_namesz", Elf64_Word
), # Elf64_Word n_namesz; /* Length of the note's name. */ ), # Elf64_Word n_namesz; /* Length of the note's name. */
@ -142,36 +137,49 @@ class Elf64_Nhdr(ctypes.Structure): # typedef struct
# Elf64_Shdr related constants. # Elf64_Shdr related constants.
class Elf64_Shdr(ctypes.Structure): # typedef struct class Elf64_Shdr(ctypes.Structure):
_fields_ = [ # { _fields_ = [
( (
# Section name (string tbl index)
"sh_name", Elf64_Word "sh_name", Elf64_Word
), # Elf64_Word sh_name; /* Section name (string tbl index) */ ),
("sh_type", Elf64_Word
), # Elf64_Word sh_type; /* Section type */
("sh_flags", Elf64_Xword
), # Elf64_Xword sh_flags; /* Section flags */
( (
# Section type
"sh_type", Elf64_Word
),
(
# Section flags
"sh_flags", Elf64_Xword
),
(
# Section virtual addr at execution
"sh_addr", Elf64_Addr "sh_addr", Elf64_Addr
), # Elf64_Addr sh_addr; /* Section virtual addr at execution */ ),
( (
# Section file offset
"sh_offset", Elf64_Off "sh_offset", Elf64_Off
), # Elf64_Off sh_offset; /* Section file offset */ ),
( (
# Section size in bytes
"sh_size", Elf64_Xword "sh_size", Elf64_Xword
), # Elf64_Xword sh_size; /* Section size in bytes */ ),
( (
# Link to another section
"sh_link", Elf64_Word "sh_link", Elf64_Word
), # Elf64_Word sh_link; /* Link to another section */ ),
( (
# Additional section information
"sh_info", Elf64_Word "sh_info", Elf64_Word
), # Elf64_Word sh_info; /* Additional section information */ ),
("sh_addralign", Elf64_Xword
), # Elf64_Xword sh_addralign; /* Section alignment */
( (
# Section alignment
"sh_addralign", Elf64_Xword
),
(
# Entry size if section holds table
"sh_entsize", Elf64_Xword "sh_entsize", Elf64_Xword
) # Elf64_Xword sh_entsize; /* Entry size if section holds table */ )
] # } Elf64_Shdr; ]
# elf_prstatus related constants. # elf_prstatus related constants.
@ -179,29 +187,39 @@ class Elf64_Shdr(ctypes.Structure): # typedef struct
# Signal info. # Signal info.
class elf_siginfo(ctypes.Structure): # struct elf_siginfo class elf_siginfo(ctypes.Structure): # struct elf_siginfo
_fields_ = [ # { _fields_ = [
("si_signo", ctypes.c_int (
), # int si_signo; /* Signal number. */ # Signal number
("si_code", ctypes.c_int "si_signo", ctypes.c_int
), # int si_code; /* Extra code. */ ),
("si_errno", ctypes.c_int (
) # int si_errno; /* Errno. */ # Extra code
] # }; "si_code", ctypes.c_int
),
(
# Errno
"si_errno", ctypes.c_int
)
]
# A time value that is accurate to the nearest # A time value that is accurate to the nearest
# microsecond but also has a range of years. # microsecond but also has a range of years.
class timeval(ctypes.Structure): # struct timeval class timeval(ctypes.Structure): # struct timeval
_fields_ = [ # { _fields_ = [
("tv_sec", (
ctypes.c_long), # __time_t tv_sec; /* Seconds. */ # __time_t tv_sec; /* Seconds. */
("tv_usec", ctypes.c_long "tv_sec", ctypes.c_long
) # __suseconds_t tv_usec; /* Microseconds. */ ),
] # }; (
# __suseconds_t tv_usec; /* Microseconds. */
"tv_usec", ctypes.c_long
)
]
class user_regs_struct(ctypes.Structure): # struct user_regs_struct class user_regs_struct(ctypes.Structure): # struct user_regs_struct
_fields_ = [ # { _fields_ = [
("r15", ("r15",
ctypes.c_ulonglong), # __extension__ unsigned long long int r15; ctypes.c_ulonglong), # __extension__ unsigned long long int r15;
("r14", ("r14",
@ -256,111 +274,177 @@ class user_regs_struct(ctypes.Structure): # struct user_regs_struct
ctypes.c_ulonglong), # __extension__ unsigned long long int fs; ctypes.c_ulonglong), # __extension__ unsigned long long int fs;
("gs", ctypes.c_ulonglong ("gs", ctypes.c_ulonglong
) # __extension__ unsigned long long int gs; ) # __extension__ unsigned long long int gs;
] # }; ]
#elf_greg_t = ctypes.c_ulonglong # elf_greg_t = ctypes.c_ulonglong
#ELF_NGREG = ctypes.sizeof(user_regs_struct)/ctypes.sizeof(elf_greg_t) # ELF_NGREG = ctypes.sizeof(user_regs_struct)/ctypes.sizeof(elf_greg_t)
#elf_gregset_t = elf_greg_t*ELF_NGREG # elf_gregset_t = elf_greg_t*ELF_NGREG
elf_gregset_t = user_regs_struct elf_gregset_t = user_regs_struct
class elf_prstatus(ctypes.Structure): # struct elf_prstatus class elf_prstatus(ctypes.Structure): # struct elf_prstatus
_fields_ = [ # { _fields_ = [
( (
# Info associated with signal
# struct elf_siginfo pr_info;
"pr_info", elf_siginfo "pr_info", elf_siginfo
), # struct elf_siginfo pr_info; /* Info associated with signal. */ ),
("pr_cursig", ctypes.c_short
), # short int pr_cursig; /* Current signal. */
( (
# Current signal
# short int pr_cursig;
"pr_cursig", ctypes.c_short
),
(
# Set of pending signals
# unsigned long int pr_sigpend;
"pr_sigpend", ctypes.c_ulong "pr_sigpend", ctypes.c_ulong
), # unsigned long int pr_sigpend; /* Set of pending signals. */ ),
( (
# Set of held signals
# unsigned long int pr_sighold;
"pr_sighold", ctypes.c_ulong "pr_sighold", ctypes.c_ulong
), # unsigned long int pr_sighold; /* Set of held signals. */ ),
("pr_pid", ctypes.c_int), # __pid_t pr_pid;
("pr_ppid", ctypes.c_int), # __pid_t pr_ppid;
("pr_pgrp", ctypes.c_int), # __pid_t pr_pgrp;
("pr_sid", ctypes.c_int), # __pid_t pr_sid;
("pr_utime",
timeval), # struct timeval pr_utime; /* User time. */
("pr_stime", timeval
), # struct timeval pr_stime; /* System time. */
( (
# Process ID
# __pid_t pr_pid;
"pr_pid", ctypes.c_int
),
(
# Parent process ID
# __pid_t pr_ppid;
"pr_ppid", ctypes.c_int
),
(
# Parent group ID
# __pid_t pr_pgrp;
"pr_pgrp", ctypes.c_int
),
(
# Parent session ID
# __pid_t pr_sid;
"pr_sid", ctypes.c_int
),
(
# User time
# struct timeval pr_utime;
"pr_utime", timeval
),
(
# System time
# struct timeval pr_stime;
"pr_stime", timeval
),
(
# Cumulative user time
# struct timeval pr_cutime;
"pr_cutime", timeval "pr_cutime", timeval
), # struct timeval pr_cutime; /* Cumulative user time. */ ),
( (
# Cumulative system time
# struct timeval pr_cstime;
"pr_cstime", timeval "pr_cstime", timeval
), # struct timeval pr_cstime; /* Cumulative system time. */ ),
("pr_reg", elf_gregset_t
), # elf_gregset_t pr_reg; /* GP registers. */
( (
# GP registers
# elf_gregset_t pr_reg;
"pr_reg", elf_gregset_t
),
(
# True if math copro being used
# int pr_fpvalid;
"pr_fpvalid", ctypes.c_int "pr_fpvalid", ctypes.c_int
) # int pr_fpvalid; /* True if math copro being used. */ )
] # }; ]
# elf_prpsinfo related constants. # elf_prpsinfo related constants.
ELF_PRARGSZ = 80 # #define ELF_PRARGSZ (80) /* Number of chars for args. */ # Number of chars for args
# #define ELF_PRARGSZ (80)
ELF_PRARGSZ = 80
class elf_prpsinfo(ctypes.Structure): # struct elf_prpsinfo class elf_prpsinfo(ctypes.Structure): # struct elf_prpsinfo
_fields_ = [ # { _fields_ = [
( (
# Numeric process state
# char pr_state;
"pr_state", ctypes.c_byte "pr_state", ctypes.c_byte
), # char pr_state; /* Numeric process state. */ ),
( (
# Char for pr_state
# char pr_sname;
"pr_sname", ctypes.c_char "pr_sname", ctypes.c_char
), # char pr_sname; /* Char for pr_state. */ ),
("pr_zomb", ctypes.c_byte (
), # char pr_zomb; /* Zombie. */ # Zombie
("pr_nice", ctypes.c_byte # char pr_zomb;
), # char pr_nice; /* Nice val. */ "pr_zomb", ctypes.c_byte
("pr_flag", ctypes.c_ulong ),
), # unsigned long int pr_flag; /* Flags. */ (
# #if __WORDSIZE == 32 # Nice value
# unsigned short int pr_uid; # char pr_nice;
# unsigned short int pr_gid; "pr_nice", ctypes.c_byte
# #else ),
("pr_uid", ctypes.c_uint), # unsigned int pr_uid; (
("pr_gid", ctypes.c_uint), # unsigned int pr_gid; # Flags
# #endif # unsigned long int pr_flag;
("pr_pid", ctypes.c_int), # int pr_pid, pr_ppid, pr_pgrp, pr_sid; "pr_flag", ctypes.c_ulong
),
(
# User ID
# unsigned int pr_uid;
"pr_uid", ctypes.c_uint
),
(
# Group ID
# unsigned int pr_gid;
"pr_gid", ctypes.c_uint
),
("pr_pid", ctypes.c_int),
("pr_ppid", ctypes.c_int), ("pr_ppid", ctypes.c_int),
("pr_pgrp", ctypes.c_int), ("pr_pgrp", ctypes.c_int),
("pr_sid", ctypes.c_int), ("pr_sid", ctypes.c_int),
# /* Lots missing */ # /* Lots missing */
( (
# Filename of executable
# char pr_fname[16];
"pr_fname", ctypes.c_char * 16 "pr_fname", ctypes.c_char * 16
), # char pr_fname[16]; /* Filename of executable. */ ),
( (
# Initial part of arg list
# char pr_psargs[ELF_PRARGSZ];
"pr_psargs", ctypes.c_char * ELF_PRARGSZ "pr_psargs", ctypes.c_char * ELF_PRARGSZ
) # char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ )
] # }; ]
class user_fpregs_struct(ctypes.Structure): # struct user_fpregs_struct class user_fpregs_struct(ctypes.Structure): # struct user_fpregs_struct
_fields_ = [ # { _fields_ = [
("cwd", ctypes.c_ushort), # unsigned short int cwd; # unsigned short int cwd;
("swd", ctypes.c_ushort), # unsigned short int swd; ("cwd", ctypes.c_ushort),
("ftw", ctypes.c_ushort), # unsigned short int ftw; # unsigned short int swd;
("fop", ctypes.c_ushort), # unsigned short int fop; ("swd", ctypes.c_ushort),
("rip", # unsigned short int ftw;
ctypes.c_ulonglong), # __extension__ unsigned long long int rip; ("ftw", ctypes.c_ushort),
("rdp", # unsigned short int fop;
ctypes.c_ulonglong), # __extension__ unsigned long long int rdp; ("fop", ctypes.c_ushort),
("mxcsr", ctypes.c_uint), # unsigned int mxcsr; # __extension__ unsigned long long int rip;
("mxcr_mask", ctypes.c_uint), # unsigned int mxcr_mask; ("rip", ctypes.c_ulonglong),
( # __extension__ unsigned long long int rdp;
"st_space", ctypes.c_uint * 32 ("rdp", ctypes.c_ulonglong),
), # unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ # unsigned int mxcsr;
( ("mxcsr", ctypes.c_uint),
"xmm_space", ctypes.c_uint * 64 # unsigned int mxcr_mask;
), # unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ ("mxcr_mask", ctypes.c_uint),
("padding", # unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
ctypes.c_uint * 24), # unsigned int padding[24]; ("st_space", ctypes.c_uint * 32),
] # }; # unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
("xmm_space", ctypes.c_uint * 64),
# unsigned int padding[24];
("padding", ctypes.c_uint * 24),
]
elf_fpregset_t = user_fpregs_struct elf_fpregset_t = user_fpregs_struct
@ -373,86 +457,133 @@ _SI_PAD_SIZE = (_SI_MAX_SIZE // ctypes.sizeof(ctypes.c_int)) - 4
# /* kill(). */ # /* kill(). */
class _siginfo_t_U_kill(ctypes.Structure): # struct class _siginfo_t_U_kill(ctypes.Structure): # struct
_fields_ = [ # { _fields_ = [
("si_pid", ctypes.c_int
), # __pid_t si_pid; /* Sending process ID. */
( (
# Sending process ID
# __pid_t si_pid;
"si_pid", ctypes.c_int
),
(
# Real user ID of sending process
# __uid_t si_uid;
"si_uid", ctypes.c_uint "si_uid", ctypes.c_uint
) # __uid_t si_uid; /* Real user ID of sending process. */ )
] # } _kill; ] # } _kill;
# Type for data associated with a signal. # Type for data associated with a signal.
class sigval_t(ctypes.Union): # typedef union sigval class sigval_t(ctypes.Union): # typedef union sigval
_fields_ = [ # { _fields_ = [
("sival_int", ctypes.c_int), # int sival_int; ("sival_int", ctypes.c_int), # int sival_int;
("sical_ptr", ctypes.c_void_p), # void *sival_ptr; ("sical_ptr", ctypes.c_void_p), # void *sival_ptr;
] # } sigval_t; ] # } sigval_t;
# /* POSIX.1b timers. */ # /* POSIX.1b timers. */
class _siginfo_t_U_timer(ctypes.Structure): # struct class _siginfo_t_U_timer(ctypes.Structure): # struct
_fields_ = [ # { _fields_ = [
("si_tid", (
ctypes.c_int), # int si_tid; /* Timer ID. */ # Timer ID
("si_overrun", ctypes.c_int # int si_tid;
), # int si_overrun; /* Overrun count. */ "si_tid", ctypes.c_int
("si_sigval", sigval_t ),
) # sigval_t si_sigval; /* Signal value. */ (
# Overrun count
# int si_overrun;
"si_overrun", ctypes.c_int
),
(
# Signal value
# sigval_t si_sigval;
"si_sigval", sigval_t
)
] # } _timer; ] # } _timer;
# /* POSIX.1b signals. */ # /* POSIX.1b signals. */
class _siginfo_t_U_rt(ctypes.Structure): # struct class _siginfo_t_U_rt(ctypes.Structure): # struct
_fields_ = [ # { _fields_ = [
("si_pid", ctypes.c_int
), # __pid_t si_pid; /* Sending process ID. */
( (
# Sending process ID
# __pid_t si_pid;
"si_pid", ctypes.c_int
),
(
# Real user ID of sending process
# __uid_t si_uid;
"si_uid", ctypes.c_uint "si_uid", ctypes.c_uint
), # __uid_t si_uid; /* Real user ID of sending process. */ ),
("si_sigval", sigval_t (
) # sigval_t si_sigval; /* Signal value. */ # Signal value
# sigval_t si_sigval;
"si_sigval", sigval_t
)
] # } _rt; ] # } _rt;
# /* SIGCHLD. */ # /* SIGCHLD. */
class _siginfo_t_U_sigchld(ctypes.Structure): # struct class _siginfo_t_U_sigchld(ctypes.Structure): # struct
_fields_ = [ # { _fields_ = [
("si_pid",
ctypes.c_int), # __pid_t si_pid; /* Which child. */
( (
# Which child
# __pid_t si_pid;
"si_pid", ctypes.c_int
),
(
# Real user ID of sending process
# __uid_t si_uid;
"si_uid", ctypes.c_uint "si_uid", ctypes.c_uint
), # __uid_t si_uid; /* Real user ID of sending process. */ ),
("si_status", ctypes.c_int (
), # int si_status; /* Exit value or signal. */ # Exit value or signal
("si_utime", ctypes.c_long), # __sigchld_clock_t si_utime; # int si_status;
("si_stime", ctypes.c_long) # __sigchld_clock_t si_stime; "si_status", ctypes.c_int
),
(
# __sigchld_clock_t si_utime;
"si_utime", ctypes.c_long
),
(
# __sigchld_clock_t si_stime;
"si_stime", ctypes.c_long
)
] # } _sigchld; ] # } _sigchld;
# /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
class _siginfo_t_U_sigfault(ctypes.Structure): # struct class _siginfo_t_U_sigfault(ctypes.Structure): # struct
_fields_ = [ # { _fields_ = [
("si_addr", ctypes.c_void_p
), # void *si_addr; /* Faulting insn/memory ref. */
( (
# Faulting insn/memory ref
# void *si_addr;
"si_addr", ctypes.c_void_p
),
(
# Valid LSB of the reported address
# short int si_addr_lsb;
"si_addr_lsb", ctypes.c_short "si_addr_lsb", ctypes.c_short
) # short int si_addr_lsb; /* Valid LSB of the reported address. */ )
] # } _sigfault; ] # } _sigfault;
# /* SIGPOLL. */ # /* SIGPOLL. */
class _siginfo_t_U_sigpoll(ctypes.Structure): # struct class _siginfo_t_U_sigpoll(ctypes.Structure): # struct
_fields_ = [ # { _fields_ = [
("si_band", ctypes.c_long (
), # long int si_band; /* Band event for SIGPOLL. */ # Band event for SIGPOLL
("si_fd", ctypes.c_int) # int si_fd; # long int si_band;
"si_band", ctypes.c_long
),
(
# int si_fd;
"si_fd", ctypes.c_int
)
] # } _sigpoll; ] # } _sigpoll;
# /* SIGSYS. */ # /* SIGSYS. */
class _siginfo_t_U_sigsys(ctypes.Structure): # struct class _siginfo_t_U_sigsys(ctypes.Structure): # struct
_fields_ = [ # { _fields_ = [
("_call_addr", ctypes.c_void_p ("_call_addr", ctypes.c_void_p
), # void *_call_addr; /* Calling user insn. */ ), # void *_call_addr; /* Calling user insn. */
( (
@ -464,60 +595,60 @@ class _siginfo_t_U_sigsys(ctypes.Structure): # struct
class _siginfo_t_U(ctypes.Union): # union class _siginfo_t_U(ctypes.Union): # union
_fields_ = [ # { _fields_ = [
("_pad", ("_pad",
ctypes.c_int * _SI_PAD_SIZE), # int _pad[__SI_PAD_SIZE]; ctypes.c_int * _SI_PAD_SIZE), # int _pad[__SI_PAD_SIZE];
#
# /* kill(). */ # /* kill(). */
("_kill", _siginfo_t_U_kill), # struct ("_kill", _siginfo_t_U_kill), # struct
# {
# __pid_t si_pid; /* Sending process ID. */ # __pid_t si_pid; /* Sending process ID. */
# __uid_t si_uid; /* Real user ID of sending process. */ # __uid_t si_uid; /* Real user ID of sending process. */
# } _kill; # } _kill;
#
# /* POSIX.1b timers. */ # /* POSIX.1b timers. */
("_timer", _siginfo_t_U_timer), # struct ("_timer", _siginfo_t_U_timer), # struct
# {
# int si_tid; /* Timer ID. */ # int si_tid; /* Timer ID. */
# int si_overrun; /* Overrun count. */ # int si_overrun; /* Overrun count. */
# sigval_t si_sigval; /* Signal value. */ # sigval_t si_sigval; /* Signal value. */
# } _timer; # } _timer;
#
# /* POSIX.1b signals. */ # /* POSIX.1b signals. */
("_rt", _siginfo_t_U_rt), # struct ("_rt", _siginfo_t_U_rt), # struct
# {
# __pid_t si_pid; /* Sending process ID. */ # __pid_t si_pid; /* Sending process ID. */
# __uid_t si_uid; /* Real user ID of sending process. */ # __uid_t si_uid; /* Real user ID of sending process. */
# sigval_t si_sigval; /* Signal value. */ # sigval_t si_sigval; /* Signal value. */
# } _rt; # } _rt;
#
# /* SIGCHLD. */ # /* SIGCHLD. */
("_sigchld", _siginfo_t_U_sigchld), # struct ("_sigchld", _siginfo_t_U_sigchld), # struct
# {
# __pid_t si_pid; /* Which child. */ # __pid_t si_pid; /* Which child. */
# __uid_t si_uid; /* Real user ID of sending process. */ # __uid_t si_uid; /* Real user ID of sending process. */
# int si_status; /* Exit value or signal. */ # int si_status; /* Exit value or signal. */
# __sigchld_clock_t si_utime; # __sigchld_clock_t si_utime;
# __sigchld_clock_t si_stime; # __sigchld_clock_t si_stime;
# } _sigchld; # } _sigchld;
#
# /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
("_sigfault", _siginfo_t_U_sigfault), # struct ("_sigfault", _siginfo_t_U_sigfault), # struct
# {
# void *si_addr; /* Faulting insn/memory ref. */ # void *si_addr; /* Faulting insn/memory ref. */
# short int si_addr_lsb; /* Valid LSB of the reported address. */ # short int si_addr_lsb; /* Valid LSB of the reported address. */
# } _sigfault; # } _sigfault;
#
# /* SIGPOLL. */ # /* SIGPOLL. */
("_sigpoll", _siginfo_t_U_sigpoll), # struct ("_sigpoll", _siginfo_t_U_sigpoll), # struct
# {
# long int si_band; /* Band event for SIGPOLL. */ # long int si_band; /* Band event for SIGPOLL. */
# int si_fd; # int si_fd;
# } _sigpoll; # } _sigpoll;
#
# /* SIGSYS. */ # /* SIGSYS. */
("_sigsys", _siginfo_t_U_sigpoll) # struct ("_sigsys", _siginfo_t_U_sigpoll) # struct
# {
# void *_call_addr; /* Calling user insn. */ # void *_call_addr; /* Calling user insn. */
# int _syscall; /* Triggering system call number. */ # int _syscall; /* Triggering system call number. */
# unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
@ -526,30 +657,39 @@ class _siginfo_t_U(ctypes.Union): # union
class siginfo_t(ctypes.Structure): # typedef struct class siginfo_t(ctypes.Structure): # typedef struct
_fields_ = [ # { _fields_ = [
("si_signo", ctypes.c_int
), # int si_signo; /* Signal number. */
( (
# Signal number
# int si_signo;
"si_signo", ctypes.c_int
),
(
# If non-zero, an errno value associated with
# int si_errno;
"si_errno", ctypes.c_int "si_errno", ctypes.c_int
), # int si_errno; /* If non-zero, an errno value associated with ),
# this signal, as defined in <errno.h>. */ (
("si_code", ctypes.c_int # Signal code - this signal, as defined in <errno.h>
), # int si_code; /* Signal code. */ # int si_code;
# "si_code", ctypes.c_int
("_sifields", _siginfo_t_U) # union ),
# { (
# Union
"_sifields", _siginfo_t_U
)
# int _pad[__SI_PAD_SIZE]; # int _pad[__SI_PAD_SIZE];
# #
# /* kill(). */ # /* kill(). */
# struct # struct
# {
# __pid_t si_pid; /* Sending process ID. */ # __pid_t si_pid; /* Sending process ID. */
# __uid_t si_uid; /* Real user ID of sending process. */ # __uid_t si_uid; /* Real user ID of sending process. */
# } _kill; # } _kill;
# #
# /* POSIX.1b timers. */ # /* POSIX.1b timers. */
# struct # struct
# {
# int si_tid; /* Timer ID. */ # int si_tid; /* Timer ID. */
# int si_overrun; /* Overrun count. */ # int si_overrun; /* Overrun count. */
# sigval_t si_sigval; /* Signal value. */ # sigval_t si_sigval; /* Signal value. */
@ -557,7 +697,7 @@ class siginfo_t(ctypes.Structure): # typedef struct
# #
# /* POSIX.1b signals. */ # /* POSIX.1b signals. */
# struct # struct
# {
# __pid_t si_pid; /* Sending process ID. */ # __pid_t si_pid; /* Sending process ID. */
# __uid_t si_uid; /* Real user ID of sending process. */ # __uid_t si_uid; /* Real user ID of sending process. */
# sigval_t si_sigval; /* Signal value. */ # sigval_t si_sigval; /* Signal value. */
@ -565,7 +705,7 @@ class siginfo_t(ctypes.Structure): # typedef struct
# #
# /* SIGCHLD. */ # /* SIGCHLD. */
# struct # struct
# {
# __pid_t si_pid; /* Which child. */ # __pid_t si_pid; /* Which child. */
# __uid_t si_uid; /* Real user ID of sending process. */ # __uid_t si_uid; /* Real user ID of sending process. */
# int si_status; /* Exit value or signal. */ # int si_status; /* Exit value or signal. */
@ -575,21 +715,21 @@ class siginfo_t(ctypes.Structure): # typedef struct
# #
# /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
# struct # struct
# {
# void *si_addr; /* Faulting insn/memory ref. */ # void *si_addr; /* Faulting insn/memory ref. */
# short int si_addr_lsb; /* Valid LSB of the reported address. */ # short int si_addr_lsb; /* Valid LSB of the reported address. */
# } _sigfault; # } _sigfault;
# #
# /* SIGPOLL. */ # /* SIGPOLL. */
# struct # struct
# {
# long int si_band; /* Band event for SIGPOLL. */ # long int si_band; /* Band event for SIGPOLL. */
# int si_fd; # int si_fd;
# } _sigpoll; # } _sigpoll;
# #
# /* SIGSYS. */ # /* SIGSYS. */
# struct # struct
# {
# void *_call_addr; /* Calling user insn. */ # void *_call_addr; /* Calling user insn. */
# int _syscall; /* Triggering system call number. */ # int _syscall; /* Triggering system call number. */
# unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
@ -602,84 +742,103 @@ class siginfo_t(ctypes.Structure): # typedef struct
class ymmh_struct(ctypes.Structure): # struct ymmh_struct { class ymmh_struct(ctypes.Structure): # struct ymmh_struct {
_fields_ = [("ymmh_space", 64 * ctypes.c_uint _fields_ = [
) # u32 ymmh_space[64]; # u32 ymmh_space[64];
("ymmh_space", 64 * ctypes.c_uint)
] # } __packed; ] # } __packed;
class xsave_hdr_struct(ctypes.Structure): # struct xsave_hdr_struct { class xsave_hdr_struct(ctypes.Structure): # struct xsave_hdr_struct {
_fields_ = [ _fields_ = [
("xstate_bv", ctypes.c_ulonglong # u64 xstate_bv;
), # u64 xstate_bv; ("xstate_bv", ctypes.c_ulonglong),
("reserved1", ctypes.c_ulonglong * # u64 reserved1[2];
2), # u64 reserved1[2]; ("reserved1", ctypes.c_ulonglong * 2),
("reserved2", ctypes.c_ulonglong * 5 # u64 reserved2[5];
) # u64 reserved2[5]; ("reserved2", ctypes.c_ulonglong * 5)
] # } __packed; ] # } __packed;
class i387_fxsave_struct(ctypes.Structure): # struct i387_fxsave_struct { class i387_fxsave_struct(ctypes.Structure): # struct i387_fxsave_struct {
_fields_ = [ _fields_ = [
( (
# Control Word
# u16 cwd;
"cwd", ctypes.c_ushort "cwd", ctypes.c_ushort
), # u16 cwd; /* Control Word */ ),
( (
# Status Word
# u16 swd;
"swd", ctypes.c_ushort "swd", ctypes.c_ushort
), # u16 swd; /* Status Word */ ),
( (
# Tag Word
# u16 twd;
"twd", ctypes.c_ushort "twd", ctypes.c_ushort
), # u16 twd; /* Tag Word */ ),
( (
# Last Instruction Opcode
# u16 fop;
"fop", ctypes.c_ushort "fop", ctypes.c_ushort
), # u16 fop; /* Last Instruction Opcode */ ),
# union { # union {
# struct { # struct {
( (
# Instruction Pointer
# u64 rip;
"rip", ctypes.c_ulonglong "rip", ctypes.c_ulonglong
), # u64 rip; /* Instruction Pointer */ ),
( (
# Data Pointer
# u64 rdp;
"rdp", ctypes.c_ulonglong "rdp", ctypes.c_ulonglong
), # u64 rdp; /* Data Pointer */ ),
# };
# struct { # struct {
# u32 fip; /* FPU IP Offset */ # u32 fip; /* FPU IP Offset */
# u32 fcs; /* FPU IP Selector */ # u32 fcs; /* FPU IP Selector */
# u32 foo; /* FPU Operand Offset */ # u32 foo; /* FPU Operand Offset */
# u32 fos; /* FPU Operand Selector */ # u32 fos; /* FPU Operand Selector */
# };
# };
( (
# MXCSR Register State
# u32 mxcsr;
"mxcsr", ctypes.c_uint "mxcsr", ctypes.c_uint
), # u32 mxcsr; /* MXCSR Register State */ ),
( (
# MXCSR Mask
# u32 mxcsr_mask;
"mxcsr_mask", ctypes.c_uint "mxcsr_mask", ctypes.c_uint
), # u32 mxcsr_mask; /* MXCSR Mask */ ),
# # 8*16 bytes for each FP-reg = 128 bytes
# /* 8*16 bytes for each FP-reg = 128 bytes */ (
("st_space", ctypes.c_uint * 32 # u32 st_space[32];
), # u32 st_space[32]; "st_space", ctypes.c_uint * 32
# ),
# /* 16*16 bytes for each XMM-reg = 256 bytes */ # 16*16 bytes for each XMM-reg = 256 bytes
("xmm_space", ctypes.c_uint * 64 (
), # u32 xmm_space[64]; # u32 xmm_space[64];
# "xmm_space", ctypes.c_uint * 64
("padding", ctypes.c_uint * 12 ),
), # u32 padding[12]; (
# # u32 padding[12];
"padding", ctypes.c_uint * 12
),
# union { # union {
("padding1", ctypes.c_uint * 12 (
) # u32 padding1[12]; # u32 padding1[12];
"padding1", ctypes.c_uint * 12
)
# u32 sw_reserved[12]; # u32 sw_reserved[12];
# };
#
] # } __aligned(16); ] # } __aligned(16);
class elf_xsave_struct(ctypes.Structure): # struct xsave_struct { class elf_xsave_struct(ctypes.Structure): # struct xsave_struct {
_fields_ = [ _fields_ = [
("i387", # struct i387_fxsave_struct i387;
i387_fxsave_struct), # struct i387_fxsave_struct i387; ("i387", i387_fxsave_struct),
("xsave_hdr", xsave_hdr_struct # struct xsave_hdr_struct xsave_hdr;
), # struct xsave_hdr_struct xsave_hdr; ("xsave_hdr", xsave_hdr_struct),
("ymmh", ymmh_struct) # struct ymmh_struct ymmh; # struct ymmh_struct ymmh;
("ymmh", ymmh_struct)
] # } __aligned(FP_MIN_ALIGN_BYTES) __packed; ] # } __aligned(FP_MIN_ALIGN_BYTES) __packed;