mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-27 00:57:50 +00:00
Fix the Modula-3 runtime so it will work with the new larger
sigset_t types in -current.
This commit is contained in:
parent
de6dd9eda5
commit
42cd159a01
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=23899
@ -46,6 +46,16 @@ have_boot!= /bin/sh scripts/check_files files/T.boot installed /usr/local
|
||||
DISTFILES+= m3-fbsd-boot-3.6.tar.gz
|
||||
.endif
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${OSVERSION} >= 400011
|
||||
EXTRA_PATCHES= ${FILESDIR}/patch-new-sigset-aa \
|
||||
${FILESDIR}/patch-new-sigset-ab \
|
||||
${FILESDIR}/patch-new-sigset-ac
|
||||
.else
|
||||
EXTRA_PATCHES= ${FILESDIR}/patch-old-sigset-aa
|
||||
.endif
|
||||
|
||||
# Startup script, run at boot time
|
||||
startup_dir= ${PREFIX}/etc/rc.d
|
||||
startup_script= ${startup_dir}/50.m3.sh
|
||||
@ -151,4 +161,4 @@ do-install:
|
||||
@${ECHO_MSG} "Running ldconfig"
|
||||
@${SETENV} OBJFORMAT=${PORTOBJFORMAT} ${LDCONFIG} -m ${PREFIX}/lib/m3/FreeBSD2
|
||||
|
||||
.include <bsd.port.mk>
|
||||
.include <bsd.port.post.mk>
|
||||
|
192
lang/modula-3-lib/files/extra-patch-new-sigset-aa
Normal file
192
lang/modula-3-lib/files/extra-patch-new-sigset-aa
Normal file
@ -0,0 +1,192 @@
|
||||
--- m3/m3core/src/unix/freebsd-2/Usignal.i3.orig Mon Aug 12 15:47:48 1996
|
||||
+++ m3/m3core/src/unix/freebsd-2/Usignal.i3 Wed Dec 22 22:12:10 1999
|
||||
@@ -12,8 +12,6 @@
|
||||
|
||||
(*** <signal.h> ***)
|
||||
|
||||
- (* I don't know about all the indented values below from the
|
||||
- Linux implementation *)
|
||||
CONST
|
||||
SIGHUP = 1; (* hangup *)
|
||||
SIGINT = 2; (* interrupt *)
|
||||
@@ -23,27 +21,19 @@
|
||||
SIGIOT = 6; (* IOT instruction *)
|
||||
SIGEMT = 7; (* EMT instruction *)
|
||||
SIGFPE = 8; (* floating point exception *)
|
||||
- FPE_INTDIV_TRAP = 20; (* integer divide by zero *)
|
||||
- FPE_INTOVF_TRAP = 21; (* integer overflow *)
|
||||
- FPE_FLTOPERR_TRAP = 1; (* [floating operand error] *)
|
||||
- FPE_FLTDEN_TRAP = 2; (* [floating denormalized operand] *)
|
||||
- FPE_FLTDIV_TRAP = 3; (* [floating divide by zero] *)
|
||||
- FPE_FLTOVF_TRAP = 4; (* [floating overflow] *)
|
||||
- FPE_FLTUND_TRAP = 5; (* [floating underflow] *)
|
||||
- FPE_FLTINEX_TRAP = 6; (* [floating inexact result] *)
|
||||
- FPE_UUOP_TRAP = 7; (* [floating undefined opcode] *)
|
||||
- FPE_DATACH_TRAP = 8; (* [floating data chain exception] *)
|
||||
- FPE_FLTSTK_TRAP = 16; (* [floating stack fault] *)
|
||||
- FPE_FPA_ENABLE = 17; (* [FPA not enabled] *)
|
||||
- FPE_FPA_ERROR = 18; (* [FPA arithmetic exception] *)
|
||||
+ FPE_INTOVF_TRAP = 1; (* integer overflow *)
|
||||
+ FPE_INTDIV_TRAP = 2; (* integer divide by zero *)
|
||||
+ FPE_FLTDIV_TRAP = 3; (* floating/decimal divide by zero *)
|
||||
+ FPE_FLTOVF_TRAP = 4; (* floating overflow *)
|
||||
+ FPE_FLTUND_TRAP = 5; (* floating underflow *)
|
||||
+ FPE_FPU_NP_TRAP = 6; (* floating point unit not present *)
|
||||
+ FPE_SUBRNG_TRAP = 7; (* subrange out of bounds *)
|
||||
SIGKILL = 9; (* kill (cannot be caught or ignored) *)
|
||||
SIGBUS = 10; (* bus error *)
|
||||
- BUS_HWERR = 1; (* misc hardware error (e.g. timeout) *)
|
||||
- BUS_ALIGN = 2; (* hardware alignment error *)
|
||||
+ BUS_PAGE_FAULT = 12; (* page fault protection base *)
|
||||
+ BUS_SEGNP_FAULT = 26; (* segment not present *)
|
||||
+ BUS_STK_FAULT = 27; (* stack fault *)
|
||||
SIGSEGV = 11; (* segmentation violation *)
|
||||
- SEGV_NOMAP = 3; (* no mapping at the fault address *)
|
||||
- SEGV_PROT = 4; (* access exceeded protections *)
|
||||
- SEGV_OBJERR = 5; (* object returned errno value *)
|
||||
SIGSYS = 12; (* bad argument to system call *)
|
||||
SIGPIPE = 13; (* write on a pipe with no one to read it *)
|
||||
SIGALRM = 14; (* alarm clock *)
|
||||
@@ -61,9 +51,9 @@
|
||||
SIGVTALRM = 26; (* virtual time alarm *)
|
||||
SIGPROF = 27; (* profiling time alarm *)
|
||||
SIGWINCH = 28; (* window size changes *)
|
||||
- SIGLOST = 29; (* Sys-V rec lock: notify user upon server crash *)
|
||||
- SIGUSR1 = 30; (* User signal 1 (from SysV) *)
|
||||
- SIGUSR2 = 31; (* User signal 2 (from SysV) *)
|
||||
+ SIGINFO = 29; (* information request *)
|
||||
+ SIGUSR1 = 30; (* user defined signal 1 *)
|
||||
+ SIGUSR2 = 31; (* user defined signal 2 *)
|
||||
|
||||
(* System V definitions *)
|
||||
SIGCLD = SIGCHLD;
|
||||
@@ -75,17 +65,19 @@
|
||||
SignalHandler = PROCEDURE (sig, code: int;
|
||||
scp: UNTRACED REF struct_sigcontext);
|
||||
|
||||
- sigset_t = int;
|
||||
+ sigset_t = ARRAY [0..3] OF unsigned_int;
|
||||
+ sigset_t_star = UNTRACED REF sigset_t;
|
||||
|
||||
struct_sigvec = RECORD
|
||||
sv_handler: SignalHandler; (* signal handler *)
|
||||
- sv_mask: sigset_t; (* signal mask to apply *)
|
||||
- sv_flags: int; (* see signal options below *) END;
|
||||
+ sv_mask: int; (* signal mask to apply *)
|
||||
+ sv_flags: int; (* see signal options below *)
|
||||
+ END;
|
||||
|
||||
|
||||
CONST
|
||||
- empty_sigset_t : sigset_t = 0;
|
||||
- empty_sv_mask : sigset_t = 0;
|
||||
+ empty_sigset_t = sigset_t{ 0, .. };
|
||||
+ empty_sv_mask : int = 0;
|
||||
|
||||
CONST
|
||||
(* Valid flags defined for sv_flags field of sigvec structure. *)
|
||||
@@ -101,16 +93,10 @@
|
||||
SIG_SETMASK = 3; (* Set block mask to this mask *)
|
||||
|
||||
TYPE
|
||||
- SignalActionHandler = PROCEDURE (sig: int);
|
||||
- SignalRestoreHandler = PROCEDURE ();
|
||||
-
|
||||
struct_sigaction = RECORD
|
||||
- sa_handler : SignalActionHandler; (* signal handler *)
|
||||
- sa_mask : sigset_t; (* signals to block while in handler *)
|
||||
+ sa_handler : SignalHandler; (* signal handler *)
|
||||
sa_flags : int; (* signal action flags *)
|
||||
- (* ow
|
||||
- sa_restorer : SignalRestoreHandler; (* restores interrupted state *)
|
||||
- *)
|
||||
+ sa_mask : sigset_t; (* signals to block while in handler *)
|
||||
END;
|
||||
|
||||
struct_sigaction_star = UNTRACED REF struct_sigaction;
|
||||
@@ -135,31 +121,31 @@
|
||||
* execution of the signal handler. It is also made available
|
||||
* to the handler to allow it to properly restore state if
|
||||
* a non-standard exit is performed.
|
||||
- *
|
||||
- * WARNING: THE sigcontext MUST BE KEPT CONSISTENT WITH /usr/include/setjmp.h
|
||||
- * AND THE LIBC ROUTINES setjmp() AND longjmp()
|
||||
- * ???? (ow)
|
||||
*)
|
||||
|
||||
TYPE
|
||||
struct_sigcontext = RECORD
|
||||
+ sc_mask: sigset_t; (* signal mask to restore *)
|
||||
sc_onstack: int; (* sigstack state to restore *)
|
||||
- sc_mask: int; (* signal mask to restore *)
|
||||
- sc_esp: int; (* stack pinter *)
|
||||
- sc_ebp: int; (* frame pointer *)
|
||||
- sc_isp: int;
|
||||
- sc_eip: int; (* program counter *)
|
||||
- sc_efl: int; (* program status word *)
|
||||
+ sc_gs: int;
|
||||
+ sc_fs: int;
|
||||
sc_es: int;
|
||||
sc_ds: int;
|
||||
- sc_cs: int;
|
||||
- sc_ss: int;
|
||||
sc_edi: int;
|
||||
sc_esi: int;
|
||||
+ sc_ebp: int; (* frame pointer *)
|
||||
+ sc_isp: int;
|
||||
sc_ebx: int;
|
||||
sc_edx: int;
|
||||
sc_ecx: int;
|
||||
sc_eax: int;
|
||||
+ sc_trapno: int;
|
||||
+ sc_err: int;
|
||||
+ sc_eip: int; (* program counter *)
|
||||
+ sc_cs: int;
|
||||
+ sc_efl: int;
|
||||
+ sc_esp: int; (* stack pinter *)
|
||||
+ sc_ss: int;
|
||||
END;
|
||||
|
||||
(* Do not modifiy these variables *)
|
||||
@@ -204,8 +190,13 @@
|
||||
|
||||
(*** sigstack(2) - set and/or get signal stack context ***)
|
||||
|
||||
+(* FIXME - It is OK for ss and/or oss to be NIL, so we shouldn't use VAR *)
|
||||
<*EXTERNAL*> PROCEDURE sigstack (VAR ss, oss: struct_sigstack): int;
|
||||
|
||||
+(*** sigsuspend(2) - release blocked signals and wait for interrupt ***)
|
||||
+
|
||||
+<*EXTERNAL*>
|
||||
+PROCEDURE sigsuspend (VAR sigmask: sigset_t): int;
|
||||
|
||||
(*** sigaction(2) - software signal facilities ***)
|
||||
|
||||
@@ -214,10 +205,27 @@
|
||||
|
||||
(*** sigvec(2) - software signal facilities ***)
|
||||
|
||||
+(* FIXME - It is OK for vec and/or ovec to be NIL, so we shouldn't use VAR *)
|
||||
<*EXTERNAL*>
|
||||
PROCEDURE sigvec (sig: int; VAR vec, ovec: struct_sigvec): int;
|
||||
|
||||
+(* FIXME - It is OK for vec and/or ovec to be NIL, so we shouldn't use VAR *)
|
||||
<*EXTERNAL*>
|
||||
PROCEDURE sigprocmask (how: int; VAR set, oldset: sigset_t) : int;
|
||||
+
|
||||
+<*EXTERNAL*>
|
||||
+PROCEDURE sigemptyset (VAR set: sigset_t) : int;
|
||||
+
|
||||
+<*EXTERNAL*>
|
||||
+PROCEDURE sigfillset (VAR set: sigset_t) : int;
|
||||
+
|
||||
+<*EXTERNAL*>
|
||||
+PROCEDURE sigaddset (VAR set: sigset_t; signo: int) : int;
|
||||
+
|
||||
+<*EXTERNAL*>
|
||||
+PROCEDURE sigdelset (VAR set: sigset_t; signo: int) : int;
|
||||
+
|
||||
+<*EXTERNAL*>
|
||||
+PROCEDURE sigismember(VAR set: sigset_t; signo: int) : int;
|
||||
|
||||
END Usignal.
|
32
lang/modula-3-lib/files/extra-patch-new-sigset-ab
Normal file
32
lang/modula-3-lib/files/extra-patch-new-sigset-ab
Normal file
@ -0,0 +1,32 @@
|
||||
--- m3/m3core/src/runtime/FreeBSD2/RTHeapDep.m3.orig Fri Jan 20 09:41:09 1995
|
||||
+++ m3/m3core/src/runtime/FreeBSD2/RTHeapDep.m3 Wed Oct 6 15:22:49 1999
|
||||
@@ -101,25 +101,11 @@
|
||||
PROCEDURE Fault (sig : Ctypes.int;
|
||||
code: Ctypes.int;
|
||||
scp : UNTRACED REF Usignal.struct_sigcontext) =
|
||||
- VAR sf_addr_addr: UNTRACED REF ARRAY[0..1] OF ADDRESS;
|
||||
- sf_addr : ADDRESS;
|
||||
- (*
|
||||
- * Signal frame of FreeBSD 1.1.5
|
||||
- *
|
||||
- * struct sigframe {
|
||||
- * int sf_signum;
|
||||
- * int sf_code;
|
||||
- * struct sigcontext *sf_scp;
|
||||
- * char *sf_addr; <-- this is the faulting address
|
||||
- * sig_t sf_handler;
|
||||
- * struct sigcontext sf_sc; <-- this address is passed in scp
|
||||
- * };
|
||||
- *)
|
||||
-
|
||||
+ VAR
|
||||
+ sf_addr := LOOPHOLE(scp.sc_err, ADDRESS);
|
||||
+
|
||||
BEGIN
|
||||
- sf_addr_addr := scp - ( 2 * BYTESIZE(ADDRESS));
|
||||
- sf_addr := sf_addr_addr[0];
|
||||
- IF scp # NIL AND RTHeapRep.Fault(sf_addr) THEN
|
||||
+ IF RTHeapRep.Fault(sf_addr) THEN
|
||||
RETURN;
|
||||
END;
|
||||
IF defaultSIGSEGV = Usignal.SIG_IGN THEN RETURN; END;
|
30
lang/modula-3-lib/files/extra-patch-new-sigset-ac
Normal file
30
lang/modula-3-lib/files/extra-patch-new-sigset-ac
Normal file
@ -0,0 +1,30 @@
|
||||
--- m3/m3core/src/runtime/FreeBSD2/RTThread.m3.orig Wed Nov 23 13:01:14 1994
|
||||
+++ m3/m3core/src/runtime/FreeBSD2/RTThread.m3 Wed Oct 6 15:22:49 1999
|
||||
@@ -93,19 +93,21 @@
|
||||
END setup_sigvtalrm;
|
||||
|
||||
PROCEDURE allow_sigvtalrm () =
|
||||
- VAR svt : Usignal.sigset_t := Usignal.sigmask(Usignal.SIGVTALRM);
|
||||
- old : Usignal.sigset_t;
|
||||
- i : INTEGER;
|
||||
+ VAR svt, old : Usignal.sigset_t;
|
||||
+ i : INTEGER;
|
||||
BEGIN
|
||||
+ EVAL Usignal.sigemptyset(svt);
|
||||
+ EVAL Usignal.sigaddset(svt, Usignal.SIGVTALRM);
|
||||
i := Usignal.sigprocmask(Usignal.SIG_UNBLOCK, svt, old);
|
||||
<*ASSERT i = 0 *>
|
||||
END allow_sigvtalrm;
|
||||
|
||||
PROCEDURE disallow_sigvtalrm () =
|
||||
- VAR svt : Usignal.sigset_t := Usignal.sigmask(Usignal.SIGVTALRM);
|
||||
- old : Usignal.sigset_t;
|
||||
- i : INTEGER;
|
||||
+ VAR svt, old : Usignal.sigset_t;
|
||||
+ i : INTEGER;
|
||||
BEGIN
|
||||
+ EVAL Usignal.sigemptyset(svt);
|
||||
+ EVAL Usignal.sigaddset(svt, Usignal.SIGVTALRM);
|
||||
i := Usignal.sigprocmask(Usignal.SIG_BLOCK, svt, old);
|
||||
<*ASSERT i = 0 *>
|
||||
END disallow_sigvtalrm;
|
Loading…
Reference in New Issue
Block a user