From: Alexander Shiryaev Date: Wed, 14 Nov 2012 17:55:28 +0000 (+0400) Subject: OpenBSD siginfo clarified X-Git-Url: https://deadsoftware.ru/gitweb?a=commitdiff_plain;h=f78ae2c033ce037a87eadbe69a070641a0d7e287;p=bbcp.git OpenBSD siginfo clarified --- diff --git a/Trurl-based/_OpenBSD_/Lin/Mod/gen-Libc/Libc.txt.templ b/Trurl-based/_OpenBSD_/Lin/Mod/gen-Libc/Libc.txt.templ index dacb4db..299770b 100644 --- a/Trurl-based/_OpenBSD_/Lin/Mod/gen-Libc/Libc.txt.templ +++ b/Trurl-based/_OpenBSD_/Lin/Mod/gen-Libc/Libc.txt.templ @@ -144,29 +144,39 @@ MODULE LinLibc ["libc.so.66.0"]; pid_t* = INTEGER; (* OpenBSD 5.2: 32-bit *) uid_t* = INTEGER; (* OpenBSD 5.2: 32-bit *) +(* sigval_t* = INTEGER; (* OpenBSD: 32-bit (union sigval) *) +*) + sigval = RECORD [union] + sival_int*: INTEGER; (* integer value *) + sival_ptr*: PtrVoid; (* pointer value *) + END; siginfo_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/siginfo.h *) - si_signo*: INTEGER; (* Signal number *) (* OpenBSD: 32-bit *) - si_code*: INTEGER; (* Signal code *) (* OpenBSD: 32-bit *) - si_errno*: INTEGER; (* An errno value *) (* OpenBSD: 32-bit *) - - (* OpenBSD 5.2: 29 * 4 B below *) - - si_pid*: pid_t; (* Sending process ID *) - si_uid*: uid_t; (* Real user ID of sending process *) - si_status*: INTEGER; (* Exit value or signal *) (* OpenBSD 5.2: 32-bit *) - - (* si_utime*: clock_t; (* User time consumed *) *) (* OpenBSD: XXX *) - si_stime*: clock_t; (* System time consumed *) - (* si_value*: sigval_t; (* Signal value *) *) (* OpenBSD: XXX *) - (* si_int*: INTEGER; (* POSIX.1b signal *) *) (* OpenBSD: XXX *) - (* si_ptr*: PtrVoid; (* POSIX.1b signal *) *) (* OpenBSD: XXX *) - (* si_addr*: PtrVoid; (* Memory location which caused fault *) *) (* OpenBSD: XXX *) - (* si_band*: INTEGER; (* Band event *) *) (* OpenBSD: XXX *) - (* si_fd*: INTEGER; (* File descriptor *) *) (* OpenBSD: XXX *) - - xxx: ARRAY [untagged] 25 OF INTEGER; (* OpenBSD *) + si_signo*: INTEGER; (* signal from signal.h *) + si_code*: INTEGER; (* code from above *) + si_errno*: INTEGER; (* error from errno.h *) + _data*: RECORD [union] + _pad*: ARRAY [untagged] 29 (* SI_PAD *) OF INTEGER; (* for future growth *) + _proc*: RECORD [untagged] (* kill(), SIGCLD, siqqueue() *) + _pid*: pid_t; (* process ID *) + _pdata*: RECORD [union] + _kill*: RECORD [untagged] + _uid*: uid_t; + _value*: sigval; + END; + _cld*: RECORD [untagged] + _utime*: clock_t; + _status*: INTEGER; + _stime*: clock_t; + END; + END; + END; + _fault*: RECORD [untagged] (* SIGSEGV, SIGBUS, SIGILL and SIGFPE *) + _addr*: PtrVoid; (* faulting address *) + _trapno*: INTEGER; (* illegal trap number *) + END; + END; END; Ptrsiginfo_t* = POINTER TO siginfo_t; diff --git a/Trurl-based/_OpenBSD_/System/Mod/Kernel.odc b/Trurl-based/_OpenBSD_/System/Mod/Kernel.odc index 8f101f5..8003386 100644 Binary files a/Trurl-based/_OpenBSD_/System/Mod/Kernel.odc and b/Trurl-based/_OpenBSD_/System/Mod/Kernel.odc differ diff --git a/Trurl-based/_OpenBSD_/System/Mod/Kernel.txt b/Trurl-based/_OpenBSD_/System/Mod/Kernel.txt index 7920e4b..0732d5c 100644 --- a/Trurl-based/_OpenBSD_/System/Mod/Kernel.txt +++ b/Trurl-based/_OpenBSD_/System/Mod/Kernel.txt @@ -1941,9 +1941,13 @@ MODULE Kernel; KV("TRAPNO", context.sc_trapno); WriteString(", "); KV("ERR", context.sc_err); WriteLn; - (* WriteString("--------------------------------"); WriteLn; *) + WriteString("---- siginfo: ------------------"); WriteLn; - (* TODO: show siginfo *) + KV("signo", siginfo.si_signo); WriteString(", "); + KV("code", siginfo.si_code); WriteString(", "); + KV("errno", siginfo.si_errno); WriteLn; + KV("fault.addr", siginfo._data._fault._addr); WriteString(", "); + KV("fault.trapno", siginfo._data._fault._trapno); WriteLn; WriteString("================================"); WriteLn END ShowTrap; @@ -1972,7 +1976,7 @@ MODULE Kernel; (* OpenBSD *) ShowTrap(sig, siginfo, context); sp := context.sc_esp; fp := context.sc_ebp; pc := context.sc_eip; - val := siginfo.si_pid; (* XXX *) + val := siginfo._data._fault._addr; (* Int(sig); Int(siginfo.si_signo); Int(siginfo.si_code); Int(siginfo.si_errno); diff --git a/Trurl-based/_OpenBSD_/libBB.so b/Trurl-based/_OpenBSD_/libBB.so index f7ecdfe..b61ea94 100644 Binary files a/Trurl-based/_OpenBSD_/libBB.so and b/Trurl-based/_OpenBSD_/libBB.so differ diff --git a/Trurl-based/_OpenBSD_/libBB0.so b/Trurl-based/_OpenBSD_/libBB0.so index 95cad5c..ca0c8ed 100644 Binary files a/Trurl-based/_OpenBSD_/libBB0.so and b/Trurl-based/_OpenBSD_/libBB0.so differ