DEADSOFTWARE

OpenBSD siginfo clarified
authorAlexander Shiryaev <aixp@mail.ru>
Wed, 14 Nov 2012 17:55:28 +0000 (21:55 +0400)
committerAlexander Shiryaev <aixp@mail.ru>
Wed, 14 Nov 2012 17:55:28 +0000 (21:55 +0400)
Trurl-based/_OpenBSD_/Lin/Mod/gen-Libc/Libc.txt.templ
Trurl-based/_OpenBSD_/System/Mod/Kernel.odc
Trurl-based/_OpenBSD_/System/Mod/Kernel.txt
Trurl-based/_OpenBSD_/libBB.so
Trurl-based/_OpenBSD_/libBB0.so

index dacb4db495fcc4d437adacc1518286b1b6cc3e4d..299770b97072123998a594de08283c836ebbca7f 100644 (file)
@@ -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;
 
index 8f101f5acebcd7294a2c02c1db4d283ae0701958..80033868af08909645d87dfb125cb1317191a845 100644 (file)
Binary files a/Trurl-based/_OpenBSD_/System/Mod/Kernel.odc and b/Trurl-based/_OpenBSD_/System/Mod/Kernel.odc differ
index 7920e4be9a7ceeccba1600d3aa7e371f6316837a..0732d5c06fd0265ff29279c1a16eb82d4b92d489 100644 (file)
@@ -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);
index f7ecdfed82804a3d074368b1f5751bc428bc1733..b61ea943fd4067bdb7c01ee525b5a54af3f2eb40 100644 (file)
Binary files a/Trurl-based/_OpenBSD_/libBB.so and b/Trurl-based/_OpenBSD_/libBB.so differ
index 95cad5cad0972acb5fe4dbcd071387aa9eee2911..ca0c8ed5fc2b0af333bb869c70d48c3560bd9011 100644 (file)
Binary files a/Trurl-based/_OpenBSD_/libBB0.so and b/Trurl-based/_OpenBSD_/libBB0.so differ