Index: m3/pm3/graphics/animation/anim3D/src/win-opengl/Win_OpenGL_Base.m3 diff -c m3/pm3/graphics/animation/anim3D/src/win-opengl/Win_OpenGL_Base.m3:1.2 m3/pm3/graphics/animation/anim3D/src/win-opengl/Win_OpenGL_Base.m3:1.3 *** m3/pm3/graphics/animation/anim3D/src/win-opengl/Win_OpenGL_Base.m3:1.2 Thu Nov 5 20:29:26 1998 --- m3/pm3/graphics/animation/anim3D/src/win-opengl/Win_OpenGL_Base.m3 Mon Jun 7 13:09:34 1999 *************** *** 213,219 **** DashDot = 2_1110010011100100; ! PROCEDURE Init (self: T; title: TEXT; x, y, w, h: INTEGER): T BEGIN (*** Initialize windowThreadCV ***) self.windowThreadCV := NEW (Thread.Condition); --- 213,219 ---- DashDot = 2_1110010011100100; ! PROCEDURE Init (self: T; title: TEXT; x, y, w, h: INTEGER): T = BEGIN (*** Initialize windowThreadCV ***) self.windowThreadCV := NEW (Thread.Condition); Index: m3/pm3/intro/src/questions/bookstore.html diff -c m3/pm3/intro/src/questions/bookstore.html:1.1.1.1 m3/pm3/intro/src/questions/bookstore.html:removed *** m3/pm3/intro/src/questions/bookstore.html:1.1.1.1 Sat Jan 31 14:47:15 1998 --- m3/pm3/intro/src/questions/bookstore.html Mon Jun 7 17:07:17 1999 *************** *** 1,10 **** - Where to find Modula-3 books? -

Where to find Modula-3 books?

-

- If you cannot find some of the Modula-3 books at your favorite bookstore, - here are bookstores connected to the net known to carry them: - UCI Bookstore , - Roswell Electronic Computer Bookstore - (rjames@fox.nstn.ns.ca) -

- --- 0 ---- Index: m3/pm3/intro/src/questions/m3makefile diff -c m3/pm3/intro/src/questions/m3makefile:1.3 m3/pm3/intro/src/questions/m3makefile:1.4 *** m3/pm3/intro/src/questions/m3makefile:1.3 Mon May 25 09:45:17 1998 --- m3/pm3/intro/src/questions/m3makefile Mon Jun 7 13:10:13 1999 *************** *** 1,6 **** HtmlFile("CcallM3") HtmlFile("ESChecking") - HtmlFile("bookstore") HtmlFile("compare") HtmlFile("contrib") HtmlFile("copyObject") --- 1,5 ---- Index: m3/pm3/intro/src/questions/questions.html diff -c m3/pm3/intro/src/questions/questions.html:1.4 m3/pm3/intro/src/questions/questions.html:1.5 *** m3/pm3/intro/src/questions/questions.html:1.4 Tue Apr 28 15:57:56 1998 --- m3/pm3/intro/src/questions/questions.html Mon Jun 7 13:10:13 1999 *************** *** 6,12 ****

Michel Dagenais ! Michel Dagenais, GNU General Public License, 1998
michel.dagenais@polymtl.ca
Ecole Polytechnique
--- 6,12 ----
Michel Dagenais ! Michel Dagenais, GNU General Public License, 1998-1999
michel.dagenais@polymtl.ca
Ecole Polytechnique
*************** *** 20,26 **** Maintained by Michel Dagenais (michel.dagenais@polymtl.ca), suggestions are most welcome. ! Last updated 2 April 1998. The latest copy of this FAQ may be obtained from the Polytechnique Montreal Modula-3 Home. --- 20,26 ---- Maintained by Michel Dagenais (michel.dagenais@polymtl.ca), suggestions are most welcome. ! Last updated 4 May 1999. The latest copy of this FAQ may be obtained from the Polytechnique Montreal Modula-3 Home. *************** *** 50,56 ****

Miscellaneous Questions

    -
  • Where to find Modula-3 books?
  • Can I get Modula-3 other than by FTP or HTTP?
  • How to call Modula-3 procedures from a C program?
  • Can Modula-3 code call C++ and vice-versa? --- 50,55 ---- Index: m3/pm3/intro/src/questions/uppercase.html diff -c m3/pm3/intro/src/questions/uppercase.html:1.1.1.1 m3/pm3/intro/src/questions/uppercase.html:1.2 *** m3/pm3/intro/src/questions/uppercase.html:1.1.1.1 Sat Jan 31 14:47:15 1998 --- m3/pm3/intro/src/questions/uppercase.html Mon Jun 7 13:10:13 1999 *************** *** 6,10 **** and there is no solution that will completely satisfy everyone's tastes. Fortunately this is a very minor issue and you can easily have lowercase keywords automatically converted for you using an emacs macro package like ! m3su .

    --- 6,10 ---- and there is no solution that will completely satisfy everyone's tastes. Fortunately this is a very minor issue and you can easily have lowercase keywords automatically converted for you using an emacs macro package like ! m3su .

    Index: m3/pm3/language/modula3/m3compiler/m3bootstrap/src/m3makefile diff -c m3/pm3/language/modula3/m3compiler/m3bootstrap/src/m3makefile:1.15 m3/pm3/language/modula3/m3compiler/m3bootstrap/src/m3makefile:1.18 *** m3/pm3/language/modula3/m3compiler/m3bootstrap/src/m3makefile:1.15 Fri Jan 29 20:50:45 1999 --- m3/pm3/language/modula3/m3compiler/m3bootstrap/src/m3makefile Mon Jun 7 13:48:13 1999 *************** *** 28,34 **** " in " & target & CR) end >> "pm3-" & target & SL & "config.tmpl" in ! write("override(\"" & pkg & "\",\".." & SL & "..\")") end end --- 28,34 ---- " in " & target & CR) end >> "pm3-" & target & SL & "config.tmpl" in ! write("override(\"" & pkg & "\",\".." & SL & "..\")" & CR) end end *************** *** 199,211 **** write("option(\"bootstrap\",\"T\")",CR) write("option(\"shared_lib\",\"\")",CR) if equal(target,"HPPA") or equal(target,"DS3100") or equal(target,"IRIX5") ! or equal(target,"NT386GNU") or equal(target,"ALPHA_OSF") or ! equal(target,"IBMR2") write("option(\"optimization\",\"\")",CR) else write("option(\"optimization\",\"T\")",CR) end ! write("option(\"debuginfo\",\"" & BOOTDEBUG & "\")",CR) write("HOST=\"" & host & "\"",CR) write("USE_M3DOC=\"\"",CR) write("IBACK=\"\"",CR) --- 199,215 ---- write("option(\"bootstrap\",\"T\")",CR) write("option(\"shared_lib\",\"\")",CR) if equal(target,"HPPA") or equal(target,"DS3100") or equal(target,"IRIX5") ! or equal(target,"NT386GNU") or equal(target,"IBMR2") write("option(\"optimization\",\"\")",CR) else write("option(\"optimization\",\"T\")",CR) end ! if equal(target,"ALPHA_OSF") ! % m3cgc1 generates bad code when -g flag is not used ! write("option(\"debuginfo\",\"T\")",CR) ! else ! write("option(\"debuginfo\",\"" & BOOTDEBUG & "\")",CR) ! end write("HOST=\"" & host & "\"",CR) write("USE_M3DOC=\"\"",CR) write("IBACK=\"\"",CR) *************** *** 249,255 **** CleanPkg("m3ship",target) local header = "M3OPTIONS=" & CR ! local options = "\"CC=${CC}\" \"CCFLAGS=${CCFLAGS}\"" & " \"AS=${AS}\" \"ASFLAGS=${ASFLAGS}\"" & " \"AR=${AR}\" \"ARFLAGS=${ARFLAGS}\"" & " \"RANLIB=${RANLIB}\" \"EXTRALIBS=${EXTRALIBS}\"" & --- 253,259 ---- CleanPkg("m3ship",target) local header = "M3OPTIONS=" & CR ! local options = "\"CC=${CC}\" \"CFLAGS=${CFLAGS}\"" & " \"AS=${AS}\" \"ASFLAGS=${ASFLAGS}\"" & " \"AR=${AR}\" \"ARFLAGS=${ARFLAGS}\"" & " \"RANLIB=${RANLIB}\" \"EXTRALIBS=${EXTRALIBS}\"" & *************** *** 257,272 **** if equal(target,"NT386GNU") header = header & "EXTRALIBS=-ladvapi32" & CR else ! if equal(target,"SOLsun") ! header = header & "EXTRALIBS=-lsunmath -lm" & CR ! else ! if equal(target,"HPPA") ! header = header & "EXTRALIBS=-lm -lBSD" & CR ! else ! header = header & "EXTRALIBS=-lm" & CR ! end ! end end if equal(target,"SOLgnu") or equal(target,"SOLsun") --- 261,274 ---- if equal(target,"NT386GNU") header = header & "EXTRALIBS=-ladvapi32" & CR + else if equal(target,"SOLsun") + header = header & "EXTRALIBS=-lsunmath -lm" & CR + else if equal(target,"HPPA") + header = header & "EXTRALIBS=-lm -lBSD" & CR else ! header = header & "EXTRALIBS=-lm" & CR ! end ! end end if equal(target,"SOLgnu") or equal(target,"SOLsun") *************** *** 278,284 **** header = header & "CC=gcc" & CR end ! header = header & "RANLIB=touch" & CR CreateMakefile("pm3-" & target & SL & "Makefile." & target,target, header, options) --- 280,301 ---- header = header & "CC=gcc" & CR end ! if equal(target,"LINUXLIBC6") ! include("../../../../../m3config/src/GCWRAP") ! header = header & "LDFLAGS=" & GCWRAPFLAGS & CR ! end ! ! if equal(target,"ALPHA_OSF") ! header = header & "CFLAGS=-ieee_with_no_inexact -g3" & CR ! header = header & "LDFLAGS=-ieee_with_no_inexact" & CR ! header = header & "ASFLAGS=-g3" & CR ! end ! ! if equal(target,"FreeBSD2") ! header = header & "RANLIB=ranlib" & CR ! else ! header = header & "RANLIB=touch" & CR ! end CreateMakefile("pm3-" & target & SL & "Makefile." & target,target, header, options) Index: m3/pm3/language/modula3/m3compiler/m3build/src/Main.m3 diff -c m3/pm3/language/modula3/m3compiler/m3build/src/Main.m3:1.7 m3/pm3/language/modula3/m3compiler/m3build/src/Main.m3:1.8 *** m3/pm3/language/modula3/m3compiler/m3build/src/Main.m3:1.7 Wed Aug 26 10:54:10 1998 --- m3/pm3/language/modula3/m3compiler/m3build/src/Main.m3 Mon Jun 7 13:10:36 1999 *************** *** 14,20 **** CONST SL = M3Config.PATH_SEP; ! M3_VERSION = "SRC Modula-3 version XX.X"; TYPE DefineList = REF RECORD --- 14,21 ---- CONST SL = M3Config.PATH_SEP; ! M3_VERSION = "PM3 Version " & M3Config.M3_VERSION & ! " (" & M3Config.M3_VERSION_DATE & ")"; TYPE DefineList = REF RECORD Index: m3/pm3/language/modula3/m3compiler/m3cc/gcc/configure diff -c m3/pm3/language/modula3/m3compiler/m3cc/gcc/configure:1.1.1.1 m3/pm3/language/modula3/m3compiler/m3cc/gcc/configure:1.2 *** m3/pm3/language/modula3/m3compiler/m3cc/gcc/configure:1.1.1.1 Thu Feb 6 16:32:12 1997 --- m3/pm3/language/modula3/m3compiler/m3cc/gcc/configure Mon Jun 7 13:10:48 1999 *************** *** 598,603 **** --- 598,613 ---- a29k-*-*) # Default a29k environment. use_collect2=yes ;; + alpha-*-freebsd*) + tm_file=alpha/freebsd.h + xm_file=alpha/xm-freebsd.h + # On FreeBSD, the headers are already ok. + fixincludes=Makefile.in + xmake_file=alpha/x-freebsd + gas=yes + gnu_ld=yes + stabs=yes + ;; alpha-*-linux*ecoff*) tm_file="${tm_file} alpha/linux.h" xm_file="${xm_file} alpha/xm-linux.h" Index: m3/pm3/language/modula3/m3compiler/m3cc/gcc/m3.c diff -c m3/pm3/language/modula3/m3compiler/m3cc/gcc/m3.c:1.2 m3/pm3/language/modula3/m3compiler/m3cc/gcc/m3.c:1.3 *** m3/pm3/language/modula3/m3compiler/m3cc/gcc/m3.c:1.2 Sun Oct 11 17:14:19 1998 --- m3/pm3/language/modula3/m3compiler/m3cc/gcc/m3.c Mon Jun 7 13:10:53 1999 *************** *** 632,638 **** #define PROC(x) tree x = scan_proc () ! static tree all_procs [1000]; static tree scan_proc () { --- 632,638 ---- #define PROC(x) tree x = scan_proc () ! static tree all_procs [5000]; static tree scan_proc () { Index: m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/alpha.c diff -c m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/alpha.c:1.1.1.1 m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/alpha.c:1.2 *** m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/alpha.c:1.1.1.1 Thu Feb 6 16:32:26 1997 --- m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/alpha.c Mon Jun 7 13:11:02 1999 *************** *** 919,925 **** for (; bits > 0; bits--) if ((temp = (alpha_emit_set_const (subtarget, mode, ! (unsigned HOST_WIDE_INT) c >> bits, i))) != 0 || ((temp = (alpha_emit_set_const (subtarget, mode, ((unsigned HOST_WIDE_INT) c) >> bits, i))) --- 919,925 ---- for (; bits > 0; bits--) if ((temp = (alpha_emit_set_const (subtarget, mode, ! c >> bits, i))) != 0 || ((temp = (alpha_emit_set_const (subtarget, mode, ((unsigned HOST_WIDE_INT) c) >> bits, i))) *************** *** 1579,1585 **** /* Write a version stamp. Don't write anything if we are running as a cross-compiler. Otherwise, use the versions in /usr/include/stamp.h. */ ! #if !defined(CROSS_COMPILE) && !defined(_WIN32) && !defined(__linux__) #include #endif --- 1579,1586 ---- /* Write a version stamp. Don't write anything if we are running as a cross-compiler. Otherwise, use the versions in /usr/include/stamp.h. */ ! #if !defined(CROSS_COMPILE) && !defined(_WIN32) && !defined(__linux__) && \ ! !defined(__FreeBSD__) #include #endif Index: m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/freebsd.h diff -c /dev/null m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/freebsd.h:1.1 *** /dev/null Mon Jun 7 17:07:27 1999 --- m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/freebsd.h Mon Jun 7 13:11:02 1999 *************** *** 0 **** --- 1,48 ---- + /* + * Minimal alpha/freebsd.h file for compiling m3cgc1. + * + * This file is in the public domain. + */ + + #include "alpha/alpha.h" + #include "alpha/elf.h" + + #undef WCHAR_TYPE + #define WCHAR_TYPE "int" + + #undef WCHAR_TYPE_SIZE + #define WCHAR_TYPE_SIZE 32 + + #undef ASM_SPEC + #define ASM_SPEC " %|" + + #undef ASM_FINAL_SPEC + + #undef FUNCTION_PROFILER + #define FUNCTION_PROFILER(FILE, LABELNO) \ + fputs ("\tjsr $28,_mcount\n", (FILE)); /* at */ + + #define TARGET_PROFILING_NEEDS_GP + + #define bsd4_4 + #undef HAS_INIT_SECTION + + #undef TARGET_DEFAULT + #define TARGET_DEFAULT MASK_FP|MASK_FPREGS|MASK_IEEE|MASK_IEEE_CONFORMANT + + #undef TARGET_VERSION + #define TARGET_VERSION fprintf (stderr, " (FreeBSD/alpha ELF)"); + + #undef SDB_DEBUGGING_INFO + #define SDB_DEBUGGING_INFO + #undef DBS_DEBUGGING_INFO + #define DBX_DEBUGGING_INFO + + #undef PREFERRED_DEBUGGING_TYPE + #define PREFERRED_DEBUGGING_TYPE \ + ((len > 1 && !strncmp (str, "gsdb", len)) ? SDB_DEBUG : DBX_DEBUG) + + #define HANDLE_SYSV_PRAGMA + + #undef SET_ASM_OP + #define SET_ASM_OP ".set" Index: m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/x-freebsd diff -c /dev/null m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/x-freebsd:1.1 *** /dev/null Mon Jun 7 17:07:27 1999 --- m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/x-freebsd Mon Jun 7 13:11:02 1999 *************** *** 0 **** --- 1,4 ---- + # Don't run fixproto + STMP_FIXPROTO = + # Use only native include files + USER_H = Index: m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/xm-freebsd.h diff -c /dev/null m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/xm-freebsd.h:1.1 *** /dev/null Mon Jun 7 17:07:27 1999 --- m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/alpha/xm-freebsd.h Mon Jun 7 13:11:02 1999 *************** *** 0 **** --- 1,4 ---- + /* Configuration for GCC for Intel i386 running FreeBSD as host. */ + + #include + #include Index: m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/i386/freebsd.h diff -c m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/i386/freebsd.h:1.1.1.1 m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/i386/freebsd.h:1.2 *** m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/i386/freebsd.h:1.1.1.1 Thu Feb 6 16:32:29 1997 --- m3/pm3/language/modula3/m3compiler/m3cc/gcc/config/i386/freebsd.h Mon Jun 7 13:11:07 1999 *************** *** 20,28 **** the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /* This goes away when the math-emulator is fixed */ - #define TARGET_CPU_DEFAULT 0400 /* TARGET_NO_FANCY_MATH_387 */ - /* This is tested by i386gas.h. */ #define YES_UNDERSCORES --- 20,25 ---- Index: m3/pm3/language/modula3/m3compiler/m3cc/src/m3makefile diff -c m3/pm3/language/modula3/m3compiler/m3cc/src/m3makefile:1.5 m3/pm3/language/modula3/m3compiler/m3cc/src/m3makefile:1.8 *** m3/pm3/language/modula3/m3compiler/m3cc/src/m3makefile:1.5 Mon May 25 09:46:00 1998 --- m3/pm3/language/modula3/m3compiler/m3cc/src/m3makefile Mon Jun 7 13:11:20 1999 *************** *** 9,18 **** readonly m3cc_config = { ! "HPPA" : "--with-gnu-as", % The HP assembler doesn't understand inline debugger info. ! "IRIX5" : "--with-stabs --with-gnu-as" % mips-sgi-irix5 does not support debugging using the native % assembler. If you don't have gas, delete the config options above. % You will need the latest version of gas (binutils-2.5 or better). --- 9,18 ---- readonly m3cc_config = { ! "HPPA" : [ "--with-gnu-as" ], % The HP assembler doesn't understand inline debugger info. ! "IRIX5" : [ "--with-stabs", "--with-gnu-as" ] % mips-sgi-irix5 does not support debugging using the native % assembler. If you don't have gas, delete the config options above. % You will need the latest version of gas (binutils-2.5 or better). *************** *** 27,33 **** if m3cc_config contains target return m3cc_config {target} else ! return "" end end --- 27,33 ---- if m3cc_config contains target return m3cc_config {target} else ! return [] end end *************** *** 35,41 **** if equal (ov, "*") return "" else ! return format ("%s=\"%s\"", nm, ov) end end --- 35,41 ---- if equal (ov, "*") return "" else ! return format ("%s=%s", nm, ov) end end *************** *** 82,89 **** if equal (M3CC_HOST, M3CC_TARGET) LibdExport (program_name("m3cgc1")) if equal (M3CC_HOST, "DS3100") or equal (M3CC_HOST, "ALPHA_OSF") ! pgms = "m3cgc1 mips-tfile" LibdExport ("mips-tfile") end end --- 82,101 ---- if equal (M3CC_HOST, M3CC_TARGET) LibdExport (program_name("m3cgc1")) if equal (M3CC_HOST, "DS3100") or equal (M3CC_HOST, "ALPHA_OSF") ! pgms = ["m3cgc1", "mips-tfile"] LibdExport ("mips-tfile") + end + if equal (M3CC_HOST, "ALPHA_OSF") + > "as" in + write("#!/bin/sh",CR) + write("/bin/as $*",CR) + end + > "fixobj" in + write("#!/bin/sh",CR) + write(LIB_USE & "/mips-tfile $*",CR) + end + LibdExport ("as") + LibdExport ("fixobj") end end Index: m3/pm3/language/modula3/m3compiler/m3driver/src/M3Driver.i3 diff -c m3/pm3/language/modula3/m3compiler/m3driver/src/M3Driver.i3:1.4 m3/pm3/language/modula3/m3compiler/m3driver/src/M3Driver.i3:1.5 *** m3/pm3/language/modula3/m3compiler/m3driver/src/M3Driver.i3:1.4 Thu Feb 26 11:27:27 1998 --- m3/pm3/language/modula3/m3compiler/m3driver/src/M3Driver.i3 Mon Jun 7 13:11:25 1999 *************** *** 47,52 **** --- 47,53 ---- Interface = OBJECT dump_config : BOOLEAN := FALSE; bootstrap_mode : BOOLEAN := FALSE; + bootstrap_il : BOOLEAN := FALSE; gui : BOOLEAN := FALSE; do_debug : BOOLEAN := FALSE; heap_stats : BOOLEAN := FALSE; Index: m3/pm3/language/modula3/m3compiler/m3driver/src/M3Driver.m3 diff -c m3/pm3/language/modula3/m3compiler/m3driver/src/M3Driver.m3:1.10 m3/pm3/language/modula3/m3compiler/m3driver/src/M3Driver.m3:1.11 *** m3/pm3/language/modula3/m3compiler/m3driver/src/M3Driver.m3:1.10 Fri Oct 2 12:33:55 1998 --- m3/pm3/language/modula3/m3compiler/m3driver/src/M3Driver.m3 Mon Jun 7 13:11:25 1999 *************** *** 65,70 **** --- 65,71 ---- gen_static : BOOLEAN := FALSE; new_linkInfo : BOOLEAN := FALSE; bootstrap_mode: BOOLEAN := FALSE; + bootstrap_il : BOOLEAN := FALSE; compile_once : BOOLEAN := FALSE; gui : BOOLEAN := FALSE; (* for NT *) heap_stats : BOOLEAN := FALSE; *************** *** 130,135 **** --- 131,137 ---- interface := i; dump_config := i.dump_config; bootstrap_mode := i.bootstrap_mode; + bootstrap_il := i.bootstrap_il; gui := i.gui; do_debug := i.do_debug; heap_stats := i.heap_stats; *************** *** 227,232 **** --- 229,235 ---- gen_static := FALSE; new_linkInfo := FALSE; bootstrap_mode:= FALSE; + bootstrap_il := FALSE; compile_once := FALSE; gui := FALSE; (* for NT *) heap_stats := FALSE; *************** *** 417,422 **** --- 420,426 ---- Msg.OutL ("lib path := ", NIL, lib_path); Msg.Out ("make mode := ", Bool [make_mode], Wr.EOL); Msg.Out ("bootstrap := ", Bool [bootstrap_mode], Wr.EOL); + Msg.Out ("bootstrap IL := ", Bool [bootstrap_il], Wr.EOL); Msg.Out ("keep files := ", Bool [keep_files], Wr.EOL); Msg.Out ("coverage := ", Bool [do_coverage]," ",link_coverage,Wr.EOL); Msg.Out ("keep_cache := ", Bool [keep_cache], Wr.EOL); *************** *** 1102,1113 **** | 6, (* +bootstrap, +pass 6, -pass 7 *) 7 => (* +bootstrap, +pass 6, +pass 7 *) tmpC := TempCName (f); ! IF (NOT keep_files) THEN Utils.NoteTempFile (tmpC) END; IF Pass0 (f, tmpC) THEN ! EVAL Pass6 (tmpC, f.object, f.name.base); need_merge := TRUE; END; ! IF (NOT keep_files) THEN Utils.Remove (tmpC) END; END; (* CASE plan *) Utils.NoteNewFile (f.object); --- 1106,1121 ---- | 6, (* +bootstrap, +pass 6, -pass 7 *) 7 => (* +bootstrap, +pass 6, +pass 7 *) tmpC := TempCName (f); ! IF (NOT keep_files AND NOT bootstrap_il) THEN ! Utils.NoteTempFile (tmpC) ! END; IF Pass0 (f, tmpC) THEN ! IF NOT bootstrap_il THEN ! EVAL Pass6 (tmpC, f.object, f.name.base) ! END; need_merge := TRUE; END; ! IF (NOT keep_files AND NOT bootstrap_il) THEN Utils.Remove (tmpC) END; END; (* CASE plan *) Utils.NoteNewFile (f.object); *************** *** 2258,2278 **** wr := Utils.OpenWriter (Makefile, fatal := TRUE); TRY Wr.PutText (wr, "# bootstrap Modula-3 makefile"); Wr.PutText (wr, Target.EOL); Wr.PutText (wr, Target.EOL); - - Wr.PutText (wr, "%_m.o: %.ms"); - Wr.PutText (wr, Target.EOL); - Wr.PutText (wr, "\t$(AS) -o $@ $(ASFLAGS) $<"); - Wr.PutText (wr, Target.EOL); - Wr.PutText (wr, Target.EOL); - ! Wr.PutText (wr, "%_i.o: %.is"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, "\t$(AS) -o $@ $(ASFLAGS) $<"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, Target.EOL); Wr.PutText (wr, "all: "); Wr.PutText (wr, pgm_name); --- 2266,2312 ---- wr := Utils.OpenWriter (Makefile, fatal := TRUE); TRY Wr.PutText (wr, "# bootstrap Modula-3 makefile"); + IF bootstrap_il THEN + Wr.PutText (wr, " (bootstrap_il = TRUE)"); + ELSE + Wr.PutText (wr, " (bootstrap_il = FALSE)"); + END; Wr.PutText (wr, Target.EOL); Wr.PutText (wr, Target.EOL); ! IF bootstrap_il THEN ! Wr.PutText (wr, "M3CG = m3cgc1"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, "M3CGFLAGS = -fno-strength-reduce -quiet -fPIC -g"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, Target.EOL); ! ! Wr.PutText (wr, "%_m.o: %.mc"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, ! "\t$(M3CG) -o - $(M3CGFLAGS) $< | $(AS) -o $@ $(ASFLAGS) -"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, Target.EOL); ! ! Wr.PutText (wr, "%_i.o: %.ic"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, ! "\t$(M3CG) -o - $(M3CGFLAGS) $< | $(AS) -o $@ $(ASFLAGS) -"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, Target.EOL); ! ELSE ! Wr.PutText (wr, "%_m.o: %.ms"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, "\t$(AS) -o $@ $(ASFLAGS) $<"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, Target.EOL); ! ! Wr.PutText (wr, "%_i.o: %.is"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, "\t$(AS) -o $@ $(ASFLAGS) $<"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, Target.EOL); ! END; Wr.PutText (wr, "all: "); Wr.PutText (wr, pgm_name); *************** *** 2352,2358 **** END; IF ext_pass_7 THEN target := base & "_i.o"; ! dep := base & ".is"; ELSE RETURN base & "_i.o"; END; --- 2386,2396 ---- END; IF ext_pass_7 THEN target := base & "_i.o"; ! IF bootstrap_il THEN ! dep := base & ".ic" ! ELSE ! dep := base & ".is" ! END; ELSE RETURN base & "_i.o"; END; *************** *** 2364,2370 **** END; IF ext_pass_7 THEN target := base & "_m.o"; ! dep := base & ".ms"; ELSE RETURN base & "_m.o"; END; --- 2402,2412 ---- END; IF ext_pass_7 THEN target := base & "_m.o"; ! IF bootstrap_il THEN ! dep := base & ".mc" ! ELSE ! dep := base & ".ms" ! END; ELSE RETURN base & "_m.o"; END; *************** *** 2474,2494 **** wr := Utils.OpenWriter (Makefile, fatal := TRUE); TRY Wr.PutText (wr, "# bootstrap Modula-3 makefile"); Wr.PutText (wr, Target.EOL); Wr.PutText (wr, Target.EOL); - - Wr.PutText (wr, "%_m.o: %.ms"); - Wr.PutText (wr, Target.EOL); - Wr.PutText (wr, "\t$(AS) -o $@ $(ASFLAGS) $<"); - Wr.PutText (wr, Target.EOL); - Wr.PutText (wr, Target.EOL); - ! Wr.PutText (wr, "%_i.o: %.is"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, "\t$(AS) -o $@ $(ASFLAGS) $<"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, Target.EOL); Wr.PutText (wr, "all: "); Wr.PutText (wr, lib_name); --- 2516,2562 ---- wr := Utils.OpenWriter (Makefile, fatal := TRUE); TRY Wr.PutText (wr, "# bootstrap Modula-3 makefile"); + IF bootstrap_il THEN + Wr.PutText (wr, " (bootstrap_il = TRUE)"); + ELSE + Wr.PutText (wr, " (bootstrap_il = FALSE)"); + END; Wr.PutText (wr, Target.EOL); Wr.PutText (wr, Target.EOL); ! IF bootstrap_il THEN ! Wr.PutText (wr, "M3CG = m3cgc1"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, "M3CGFLAGS = -fno-strength-reduce -quiet -fPIC -g"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, Target.EOL); ! ! Wr.PutText (wr, "%_m.o: %.mc"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, ! "\t$(M3CG) -o - $(M3CGFLAGS) $< | $(AS) -o $@ $(ASFLAGS) -"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, Target.EOL); ! ! Wr.PutText (wr, "%_i.o: %.ic"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, ! "\t$(M3CG) -o - $(M3CGFLAGS) $< | $(AS) -o $@ $(ASFLAGS) -"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, Target.EOL); ! ELSE ! Wr.PutText (wr, "%_m.o: %.ms"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, "\t$(AS) -o $@ $(ASFLAGS) $<"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, Target.EOL); ! ! Wr.PutText (wr, "%_i.o: %.is"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, "\t$(AS) -o $@ $(ASFLAGS) $<"); ! Wr.PutText (wr, Target.EOL); ! Wr.PutText (wr, Target.EOL); ! END; Wr.PutText (wr, "all: "); Wr.PutText (wr, lib_name); *************** *** 2691,2696 **** --- 2759,2776 ---- | NK.IO, NK.MO, NK.O => RETURN f.source; ELSE RETURN NIL; END; + + ELSIF bootstrap_il THEN + CASE ext OF + | NK.I3 => ext := NK.IC; + | NK.M3 => ext := NK.MC; + | NK.IS => shorten := TRUE; + | NK.MS => shorten := TRUE; + | NK.IC, NK.MC => (* skip *) + | NK.C, NK.S, NK.H => (* skip *) + | NK.IO, NK.MO, NK.O => (* skip *) + ELSE RETURN NIL; + END; ELSIF (ext_pass_7) THEN (* bootstrap with an assembler *) Index: m3/pm3/language/modula3/m3compiler/m3export/src/m3makefile diff -c m3/pm3/language/modula3/m3compiler/m3export/src/m3makefile:1.21 m3/pm3/language/modula3/m3compiler/m3export/src/m3makefile:1.22 *** m3/pm3/language/modula3/m3compiler/m3export/src/m3makefile:1.21 Fri Jan 29 20:51:22 1999 --- m3/pm3/language/modula3/m3compiler/m3export/src/m3makefile Mon Jun 7 13:11:31 1999 *************** *** 167,175 **** CheckExec(["cvs","export","-D",NOW,"-d",versionName,"m3/pm3"],[], EXPORT_TMP_SRC,"cvs export failed") ! > EXPORT_TMP_SRC & "/" & versionName & "/" & "m3config/src/VERSION" in ! write("VERSION=\"", VersionNumber(version),"\"",CR, ! "VERSION_DATE=\"",NOW,"\"",CR) end > EXPORT_TMP_SRC & "/" & versionName & "/" & "README" in --- 167,175 ---- CheckExec(["cvs","export","-D",NOW,"-d",versionName,"m3/pm3"],[], EXPORT_TMP_SRC,"cvs export failed") ! >> EXPORT_TMP_SRC & "/" & versionName & "/" & "m3config/src/COMMON" in ! write("M3_VERSION=\"", VersionNumber(version),"\"",CR, ! "M3_VERSION_DATE=\"",NOW,"\"",CR) end > EXPORT_TMP_SRC & "/" & versionName & "/" & "README" in *************** *** 258,264 **** VersionName(previousVersion)],[],".") ret = Exec(["rm", "-r", ! EXPORT_SRC & "/" & "targzip" & "/" & VersionName(previousVersion) & "-" & platform & "-boot.tgz"], [],".") --- 258,264 ---- VersionName(previousVersion)],[],".") ret = Exec(["rm", "-r", ! EXPORT_ROOT & "/" & "targzip" & "/" & VersionName(previousVersion) & "-" & platform & "-boot.tgz"], [],".") *************** *** 291,297 **** CheckExec(["tar", "cfz", versionName & "-src.tgz", versionName],[], EXPORT_TMP_SRC,"building src.tgz failed") CheckExec(["mv", EXPORT_TMP_SRC & "/" & versionName & "-src.tgz", ! EXPORT_SRC & "/" & "targzip"],[],".","export tar source failed") % % Move the source tree --- 291,297 ---- CheckExec(["tar", "cfz", versionName & "-src.tgz", versionName],[], EXPORT_TMP_SRC,"building src.tgz failed") CheckExec(["mv", EXPORT_TMP_SRC & "/" & versionName & "-src.tgz", ! EXPORT_ROOT & "/" & "targzip"],[],".","export tar source failed") % % Move the source tree *************** *** 318,324 **** "building boot.tgz failed") CheckExec(["mv", EXPORT_TMP_BOOTSTRAP & "/" & platform & "/" & versionName & "-" & platform & "-boot.tgz", ! EXPORT_SRC & "/" & "targzip"], [],".","export tar boot failed") % --- 318,324 ---- "building boot.tgz failed") CheckExec(["mv", EXPORT_TMP_BOOTSTRAP & "/" & platform & "/" & versionName & "-" & platform & "-boot.tgz", ! EXPORT_ROOT & "/" & "targzip"], [],".","export tar boot failed") % *************** *** 817,825 **** CheckExec(["mv", "boot-" & TARGET, "Makefile",path_of("../../../../..")], [], "../../m3bootstrap/" & TARGET & "/pm3-" & TARGET, "move bootstrap to build binaries failed") ! CheckExec(["make","exportall","M3OPTIONS=" & M3MAKEOPTIONS], ! ["","make.stdout","make.stderr"], ! path_of("../../../../.."),"building bootstrap failed") % Not in pre-release test mode --- 817,827 ---- CheckExec(["mv", "boot-" & TARGET, "Makefile",path_of("../../../../..")], [], "../../m3bootstrap/" & TARGET & "/pm3-" & TARGET, "move bootstrap to build binaries failed") ! if not equal(PRERELEASE,"BOOTSTRAP") ! CheckExec(["make","exportall","M3OPTIONS=" & M3MAKEOPTIONS], ! ["","make.stdout","make.stderr"], ! path_of("../../../../.."),"building bootstrap failed") ! end % Not in pre-release test mode Index: m3/pm3/language/modula3/m3compiler/m3linker/src/MxGenCG.m3 diff -c m3/pm3/language/modula3/m3compiler/m3linker/src/MxGenCG.m3:1.4 m3/pm3/language/modula3/m3compiler/m3linker/src/MxGenCG.m3:1.5 *** m3/pm3/language/modula3/m3compiler/m3linker/src/MxGenCG.m3:1.4 Sun Oct 4 22:53:41 1998 --- m3/pm3/language/modula3/m3compiler/m3linker/src/MxGenCG.m3 Mon Jun 7 13:11:37 1999 *************** *** 391,416 **** { /* initialize RTLinker's global data */ _LINKER* linker = (_LINKER* )&@IR_Prefix[TRUE]@RTLinker; *) ! s.main_proc.id := M3ID.Add("WinMain"); s.main_proc.proc := s.cg.declare_procedure(s.main_proc.id, 4, Target.CGType.Int, 0, Target.DefaultCall, TRUE, NIL); s.self_var.id := M3ID.Add("self"); s.self_var.var := s.cg.declare_param(s.self_var.id, Target.Address.bytes, ! align, Target.CGType.Addr, 0, FALSE, FALSE, 1); s.prev_var.id := M3ID.Add("pref"); s.prev_var.var := s.cg.declare_param(s.prev_var.id, Target.Address.bytes, ! align, Target.CGType.Addr, 0, FALSE, FALSE, 1); s.argv_var.id := M3ID.Add("args"); s.argv_var.var := s.cg.declare_param(s.argv_var.id, Target.Address.bytes, ! align, Target.CGType.Addr, 0, FALSE, FALSE, 1); s.mode_var.id := M3ID.Add("mode"); s.mode_var.var := s.cg.declare_param(s.mode_var.id, Target.Integer.bytes, ! align, Target.CGType.Int, 0, FALSE, FALSE, 1); s.cg.begin_procedure(s.main_proc.proc); s.linker_var.var := s.cg.declare_temp(Target.Address.bytes, align, Target.CGType.Addr, --- 391,416 ---- { /* initialize RTLinker's global data */ _LINKER* linker = (_LINKER* )&@IR_Prefix[TRUE]@RTLinker; *) ! s.main_proc.id := M3ID.Add("WinMain@16"); s.main_proc.proc := s.cg.declare_procedure(s.main_proc.id, 4, Target.CGType.Int, 0, Target.DefaultCall, TRUE, NIL); s.self_var.id := M3ID.Add("self"); s.self_var.var := s.cg.declare_param(s.self_var.id, Target.Address.bytes, ! 4, Target.CGType.Addr, 0, FALSE, FALSE, 1); s.prev_var.id := M3ID.Add("pref"); s.prev_var.var := s.cg.declare_param(s.prev_var.id, Target.Address.bytes, ! 4, Target.CGType.Addr, 0, FALSE, FALSE, 1); s.argv_var.id := M3ID.Add("args"); s.argv_var.var := s.cg.declare_param(s.argv_var.id, Target.Address.bytes, ! 4, Target.CGType.Addr, 0, FALSE, FALSE, 1); s.mode_var.id := M3ID.Add("mode"); s.mode_var.var := s.cg.declare_param(s.mode_var.id, Target.Integer.bytes, ! 4, Target.CGType.Int, 0, FALSE, FALSE, 1); s.cg.begin_procedure(s.main_proc.proc); s.linker_var.var := s.cg.declare_temp(Target.Address.bytes, align, Target.CGType.Addr, *************** *** 435,446 **** s.cg.store(s.m3_link_info_var.var, Target.Address.bytes + Target.Integer.bytes, Target.CGType.Int); ! s.cg.load(s.argc_var.var, 0, Target.CGType.Addr); s.cg.store(s.m3_link_info_var.var, Target.Address.bytes + Target.Integer.bytes * 2, Target.CGType.Addr); ! proc := s.cg.import_procedure(M3ID.Add("GetEnvironmentStrings"), 0, Target.CGType.Addr, Target.DefaultCall); s.cg.start_call_direct(proc, 0, Target.CGType.Addr); s.cg.call_direct(proc, Target.CGType.Addr); --- 435,446 ---- s.cg.store(s.m3_link_info_var.var, Target.Address.bytes + Target.Integer.bytes, Target.CGType.Int); ! s.cg.load(s.argv_var.var, 0, Target.CGType.Addr); s.cg.store(s.m3_link_info_var.var, Target.Address.bytes + Target.Integer.bytes * 2, Target.CGType.Addr); ! proc := s.cg.import_procedure(M3ID.Add("GetEnvironmentStrings@0"), 0, Target.CGType.Addr, Target.DefaultCall); s.cg.start_call_direct(proc, 0, Target.CGType.Addr); s.cg.call_direct(proc, Target.CGType.Addr); *************** *** 555,562 **** *) <* ASSERT s.MM_RTLinker_var.var # NIL *> s.cg.start_call_indirect(Target.CGType.Void, Target.DefaultCall); ! s.cg.load(s.MM_RTLinker_var.var, Target.Address.bytes * 10, ! Target.CGType.Addr); s.cg.call_indirect(Target.CGType.Void, Target.DefaultCall); (* return 0; --- 555,561 ---- *) <* ASSERT s.MM_RTLinker_var.var # NIL *> s.cg.start_call_indirect(Target.CGType.Void, Target.DefaultCall); ! s.cg.load(s.MM_RTLinker_var.var, 40, Target.CGType.Addr); s.cg.call_indirect(Target.CGType.Void, Target.DefaultCall); (* return 0; Index: m3/pm3/language/modula3/m3compiler/m3middle/src/M3File.m3 diff -c m3/pm3/language/modula3/m3compiler/m3middle/src/M3File.m3:1.1.1.1 m3/pm3/language/modula3/m3compiler/m3middle/src/M3File.m3:1.2 *** m3/pm3/language/modula3/m3compiler/m3middle/src/M3File.m3:1.1.1.1 Thu Jan 16 16:30:29 1997 --- m3/pm3/language/modula3/m3compiler/m3middle/src/M3File.m3 Mon Jun 7 13:11:43 1999 *************** *** 17,23 **** RAISES {OSError.E} = VAR ptr: BufPtr; BEGIN ! IF (NUMBER (buf) <= 0) THEN RETURN 0 END; ptr := LOOPHOLE (ADR (buf[0]), BufPtr); RETURN f.read (SUBARRAY (ptr^, 0, MIN (len, NUMBER (buf))), mayBlock := TRUE); --- 17,23 ---- RAISES {OSError.E} = VAR ptr: BufPtr; BEGIN ! IF (NUMBER (buf) <= 0 OR len <= 0) THEN RETURN 0 END; ptr := LOOPHOLE (ADR (buf[0]), BufPtr); RETURN f.read (SUBARRAY (ptr^, 0, MIN (len, NUMBER (buf))), mayBlock := TRUE); Index: m3/pm3/language/modula3/m3compiler/m3middle/src/Target.m3 diff -c m3/pm3/language/modula3/m3compiler/m3middle/src/Target.m3:1.8 m3/pm3/language/modula3/m3compiler/m3middle/src/Target.m3:1.9 *** m3/pm3/language/modula3/m3compiler/m3middle/src/Target.m3:1.8 Wed Aug 26 10:54:26 1998 --- m3/pm3/language/modula3/m3compiler/m3middle/src/Target.m3 Mon Jun 7 13:11:43 1999 *************** *** 15,21 **** TYPE Systems = { AIX386, ALPHA_OSF, AP3000, ARM, DS3100, ! FreeBSD, FreeBSD2, HP300, HPPA, IBMR2, IBMRT, IRIX5, LINUX, LINUXELF, LINUXLIBC6, NEXT, NT386, NT386GNU, OKI, SEQUENT, SOLgnu, SOLsun, SPARC, SUN3, SUN386, --- 15,21 ---- TYPE Systems = { AIX386, ALPHA_OSF, AP3000, ARM, DS3100, ! FBSD_ALPHA, FreeBSD, FreeBSD2, FreeBSD3, HP300, HPPA, IBMR2, IBMRT, IRIX5, LINUX, LINUXELF, LINUXLIBC6, NEXT, NT386, NT386GNU, OKI, SEQUENT, SOLgnu, SOLsun, SPARC, SUN3, SUN386, *************** *** 25,31 **** CONST SystemNames = ARRAY Systems OF TEXT { "AIX386", "ALPHA_OSF", "AP3000", "ARM", "DS3100", ! "FreeBSD", "FreeBSD2", "HP300", "HPPA", "IBMR2", "IBMRT", "IRIX5", "LINUX", "LINUXELF", "LINUXLIBC6", "NEXT", "NT386", "NT386GNU", "OKI", "SEQUENT", "SOLgnu", "SOLsun", "SPARC", "SUN3", "SUN386", --- 25,31 ---- CONST SystemNames = ARRAY Systems OF TEXT { "AIX386", "ALPHA_OSF", "AP3000", "ARM", "DS3100", ! "FBSD_ALPHA", "FreeBSD", "FreeBSD2", "FreeBSD3", "HP300", "HPPA", "IBMR2", "IBMRT", "IRIX5", "LINUX", "LINUXELF", "LINUXLIBC6", "NEXT", "NT386", "NT386GNU", "OKI", "SEQUENT", "SOLgnu", "SOLsun", "SPARC", "SUN3", "SUN386", *************** *** 248,254 **** Aligned_procedures := TRUE; EOL := "\n"; ! | Systems.FreeBSD, Systems.FreeBSD2 => max_align := 32; Little_endian := TRUE; PCC_bitfield_type_matters := TRUE; --- 248,293 ---- Aligned_procedures := TRUE; EOL := "\n"; ! | Systems.FBSD_ALPHA => ! Int_C.cg_type := CGType.Int_C; ! Word_C.cg_type := CGType.Word_C; ! Word_C.max.x[1] := FF; ! ! Int_D.cg_type := CGType.Int_D; ! Int_D.size := 64; ! Int_D.align := 64; ! Int_D.min.x := IChunks { 00, 00, 00, 16_8000 }; ! Int_D.max.x := IChunks { FF, FF, FF, 16_7fff }; ! ! Word_D.cg_type := CGType.Word_D; ! Word_D.size := 64; ! Word_D.align := 64; ! Word_D.min.x := IChunks { 00, 00, 00, 00 }; ! Word_D.max.x := IChunks { FF, FF, FF, FF }; ! ! Integer := Int_D; ! Address := Word_D; ! Address.cg_type := CGType.Addr; ! ! max_align := 64; ! Little_endian := TRUE; ! PCC_bitfield_type_matters := TRUE; ! Structure_size_boundary := 8; ! Bitfield_can_overlap := FALSE; ! First_readable_addr := 8192 * Char.size; ! Jumpbuf_size := 82 * Address.size; ! Jumpbuf_align := Address.align; ! Fixed_frame_size := 4 * Address.size; ! Guard_page_size := 8192 * Char.size; ! All_floats_legal := TRUE; ! Has_stack_walker := FALSE; ! Setjmp := "_setjmp"; ! Checks_integer_ops := FALSE; ! Global_handler_stack := TRUE; ! Aligned_procedures := TRUE; ! EOL := "\n"; ! ! | Systems.FreeBSD, Systems.FreeBSD2, Systems.FreeBSD3 => max_align := 32; Little_endian := TRUE; PCC_bitfield_type_matters := TRUE; Index: m3/pm3/language/modula3/m3compiler/m3ship/src/Main.m3 diff -c m3/pm3/language/modula3/m3compiler/m3ship/src/Main.m3:1.5 m3/pm3/language/modula3/m3compiler/m3ship/src/Main.m3:1.6 *** m3/pm3/language/modula3/m3compiler/m3ship/src/Main.m3:1.5 Fri Nov 28 09:23:31 1997 --- m3/pm3/language/modula3/m3compiler/m3ship/src/Main.m3 Mon Jun 7 13:11:49 1999 *************** *** 13,19 **** CONST SL = M3Config.PATH_SEP; ! M3_VERSION = "SRC Modula-3 version XX.X"; TYPE DefineList = REF RECORD --- 13,20 ---- CONST SL = M3Config.PATH_SEP; ! M3_VERSION = "PM3 Version " & M3Config.M3_VERSION & ! " (" & M3Config.M3_VERSION_DATE & ")"; TYPE DefineList = REF RECORD Index: m3/pm3/language/modula3/m3compiler/m3templates/src/BldFace.m3 diff -c m3/pm3/language/modula3/m3compiler/m3templates/src/BldFace.m3:1.5 m3/pm3/language/modula3/m3compiler/m3templates/src/BldFace.m3:1.6 *** m3/pm3/language/modula3/m3compiler/m3templates/src/BldFace.m3:1.5 Tue Aug 25 12:50:09 1998 --- m3/pm3/language/modula3/m3compiler/m3templates/src/BldFace.m3 Mon Jun 7 13:11:54 1999 *************** *** 70,75 **** --- 70,78 ---- GetIt("INTERNAL_BACKEND",val); t.ext_pass_6 := NOT QVal.ToBool(m,val); + GetIt("BOOTSTRAP_TO_IL",val); + t.bootstrap_il := QVal.ToBool(m,val); + GetIt("M3_BACKEND_OUTPUT",val); id := QVal.ToID(m,val); FOR i := FIRST(outarr) TO LAST(outarr) DO Index: m3/pm3/language/modula3/m3compiler/m3templates/src/BldQuake.m3 diff -c m3/pm3/language/modula3/m3compiler/m3templates/src/BldQuake.m3:1.34 m3/pm3/language/modula3/m3compiler/m3templates/src/BldQuake.m3:1.35 *** m3/pm3/language/modula3/m3compiler/m3templates/src/BldQuake.m3:1.34 Tue Aug 25 12:50:09 1998 --- m3/pm3/language/modula3/m3compiler/m3templates/src/BldQuake.m3 Mon Jun 7 13:11:54 1999 *************** *** 1598,1604 **** --- 1598,1641 ---- QVal.ToText(t, dest)); END DoInstallLink; + PROCEDURE InstallAliasLink(t: T; src, target, alias, dest: TEXT) RAISES {Error}= + VAR + val : QValue.T; + link : TEXT; + wr : Wr.T; + BEGIN + IF t.get(M3ID.Add("HAVE_PKGTOOLS"), val) AND QVal.ToBool(t, val) THEN + RAISE Error("install_alias_link not implemented for pkgtools"); + ELSE + target := target & t.SL & src; + link := dest & t.SL & alias; + TRY + wr := FileWr.OpenAppend(M3SHIP_FILE); + + U_InstallDir(t, dest, wr); + Wr.PutText(wr, "link_file(\""& Escape(target) & "\", \"" & Escape(link) & "\")" & t.CR); + Utils.CloseWriter(wr, M3SHIP_FILE); + EXCEPT + M3Driver.Error, OSError.E, Thread.Alerted, + Wr.Failure => FErr(M3SHIP_FILE); + END; + END; + END InstallAliasLink; + + PROCEDURE DoInstallAliasLink(t: QMachine.T; n_args: INTEGER) RAISES {Error}= + VAR src, target, alias, dest: QValue.T; + BEGIN + <* ASSERT n_args = 4 *> + t.pop(dest); + t.pop(alias); + t.pop(target); + t.pop(src); + InstallAliasLink(t, QVal.ToText(t, src), QVal.ToText(t, target), + QVal.ToText(t, alias), QVal.ToText(t, dest)); + END DoInstallAliasLink; + + (*--------------------------------------------------- exported interfaces ---*) (* installation of exported interfaces & implementations *) *************** *** 2315,2322 **** IF GenUnit(t.s_sources) THEN RETURN END; arr := BldHooks.WhereUnitsHooks(t); ! FOR i := FIRST(arr^) TO LAST(arr^) DO ! IF GenUnit(arr[i]) THEN RETURN END; END; Wr.PutText(t.cur_wr(), "\"" & unit & "\" not found" & t.CR); <* NOWARN *> --- 2352,2361 ---- IF GenUnit(t.s_sources) THEN RETURN END; arr := BldHooks.WhereUnitsHooks(t); ! IF (arr # NIL) THEN ! FOR i := FIRST(arr^) TO LAST(arr^) DO ! IF GenUnit(arr[i]) THEN RETURN END; ! END; END; Wr.PutText(t.cur_wr(), "\"" & unit & "\" not found" & t.CR); <* NOWARN *> *************** *** 3052,3058 **** PROCEDURE InitProcs(): REF ARRAY OF ProcRec = VAR ! Procs := NEW(REF ARRAY OF ProcRec, 117); BEGIN Procs[0].proc := NewProc ("reset_cache", DoResetCache, 0, FALSE); Procs[1].proc := NewProc ("m3", DoM3, 0, FALSE); --- 3091,3097 ---- PROCEDURE InitProcs(): REF ARRAY OF ProcRec = VAR ! Procs := NEW(REF ARRAY OF ProcRec, 118); BEGIN Procs[0].proc := NewProc ("reset_cache", DoResetCache, 0, FALSE); Procs[1].proc := NewProc ("m3", DoM3, 0, FALSE); *************** *** 3188,3193 **** --- 3227,3234 ---- Procs[114].proc := NewProc("install_sources", DoInstallSources, 0, FALSE); Procs[115].proc := NewProc("_install_file", DoInstallFile, 4, FALSE); Procs[116].proc := NewProc("inc", DoInc, 2, TRUE); + Procs[117].proc := NewProc("install_alias_link", DoInstallAliasLink, 4, + FALSE); RETURN Procs; END InitProcs; Index: m3/pm3/language/modula3/m3compiler/m3where/src/Main.m3 diff -c m3/pm3/language/modula3/m3compiler/m3where/src/Main.m3:1.5 m3/pm3/language/modula3/m3compiler/m3where/src/Main.m3:1.6 *** m3/pm3/language/modula3/m3compiler/m3where/src/Main.m3:1.5 Fri Nov 28 09:23:58 1997 --- m3/pm3/language/modula3/m3compiler/m3where/src/Main.m3 Mon Jun 7 13:12:38 1999 *************** *** 13,19 **** CONST SL = M3Config.PATH_SEP; ! M3_VERSION = "SRC Modula-3 version XX.X"; TYPE DefineList = REF RECORD --- 13,20 ---- CONST SL = M3Config.PATH_SEP; ! M3_VERSION = "PM3 Version " & M3Config.M3_VERSION & ! " (" & M3Config.M3_VERSION_DATE & ")"; TYPE DefineList = REF RECORD Index: m3/pm3/language/modula3/m3compiler/src/m3args.html diff -c m3/pm3/language/modula3/m3compiler/src/m3args.html:1.2 m3/pm3/language/modula3/m3compiler/src/m3args.html:1.3 *** m3/pm3/language/modula3/m3compiler/src/m3args.html:1.2 Tue Feb 10 22:57:47 1998 --- m3/pm3/language/modula3/m3compiler/src/m3args.html Mon Jun 7 13:12:47 1999 *************** *** 82,87 **** --- 82,103 ---- the dump includes exception and procedure frames. On other systems only the exception frames are dumped. +

  • @M3nopreemption disables preemptive scheduling, on platforms where + user level threads are used. + +
  • @M3netobjlog produces debugging information for tracing network + objects invocations. + +
  • @M3ngcmonitor produces debugging information for tracing network + objects distributed garbage collection. + +
  • @M3StarTrek disables showing a StarTrek shaped icon during + garbage collection pauses when using the Trestle library. + +
  • Options @M3CheckShape, @M3TraceWinMsgs, and @M3SlowTrace are available + to activate sanity checks on VBT shapes, and to produce a trace of Windows + messages for Trestle in Win32. +

Index: m3/pm3/language/modula3/m3tools/coverage/src/analyze_coverage.c diff -c m3/pm3/language/modula3/m3tools/coverage/src/analyze_coverage.c:1.2 m3/pm3/language/modula3/m3tools/coverage/src/analyze_coverage.c:1.3 *** m3/pm3/language/modula3/m3tools/coverage/src/analyze_coverage.c:1.2 Fri Jan 17 14:21:26 1997 --- m3/pm3/language/modula3/m3tools/coverage/src/analyze_coverage.c Mon Jun 7 13:12:52 1999 *************** *** 26,32 **** char text[100] = ""; FILE *code; ! FILE* output_file = stdout; /***** long current_line, line, count, p, number; char c; --- 26,32 ---- char text[100] = ""; FILE *code; ! FILE* output_file; /***** long current_line, line, count, p, number; char c; *************** *** 560,565 **** --- 560,566 ---- char *s; program_name = basename (argv[0]); + output_file = stdout; init_command (argc-1, argv+1); source_path = getenv ("COVERAGE_PATH"); Index: m3/pm3/language/modula3/m3tools/gnuemacs/src/lex-yacc/lex.yy.c diff -c m3/pm3/language/modula3/m3tools/gnuemacs/src/lex-yacc/lex.yy.c:1.1.1.1 m3/pm3/language/modula3/m3tools/gnuemacs/src/lex-yacc/lex.yy.c:1.2 *** m3/pm3/language/modula3/m3tools/gnuemacs/src/lex-yacc/lex.yy.c:1.1.1.1 Thu Jan 16 16:31:51 1997 --- m3/pm3/language/modula3/m3tools/gnuemacs/src/lex-yacc/lex.yy.c Thu Apr 29 23:57:01 1999 *************** *** 1,23 **** ! # include "stdio.h" ! # define U(x) ((x)&0377) # define NLSTATE yyprevious=YYNEWLINE # define BEGIN yybgin = yysvec + 1 + # define INITIAL 0 # define YYLERR yysvec # define YYSTATE (yyestate-yysvec-1) # define YYOPTIM 1 ! # define YYLMAX 200 ! # define output(c) putc(c,yyout) ! # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) # define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;} # define yymore() (yymorfg=1) ! # define ECHO fprintf(yyout, "%s",yytext) # define REJECT { nstr = yyreject(); goto yyfussy;} ! int yyleng; extern char yytext[]; int yymorfg; extern char *yysptr, yysbuf[]; int yytchar; ! FILE *yyin ={stdin}, *yyout ={stdout}; extern int yylineno; struct yysvf { struct yywork *yystoff; --- 1,73 ---- ! #include ! # define U(x) x # define NLSTATE yyprevious=YYNEWLINE # define BEGIN yybgin = yysvec + 1 + # define INITIAL 0 # define YYLERR yysvec # define YYSTATE (yyestate-yysvec-1) # define YYOPTIM 1 ! # define YYLMAX BUFSIZ ! #ifndef __cplusplus ! # define output(c) (void)putc(c,yyout) ! #else ! # define lex_output(c) (void)putc(c,yyout) ! #endif ! ! #if defined(__cplusplus) || defined(__STDC__) ! ! #if defined(__cplusplus) && defined(__EXTERN_C__) ! extern "C" { ! #endif ! int yyback(int *, int); ! int yyinput(void); ! int yylook(void); ! void yyoutput(int); ! int yyracc(int); ! int yyreject(void); ! void yyunput(int); ! int yylex(void); ! #ifdef YYLEX_E ! void yywoutput(wchar_t); ! wchar_t yywinput(void); ! #endif ! #ifndef yyless ! int yyless(int); ! #endif ! #ifndef yywrap ! int yywrap(void); ! #endif ! #ifdef LEXDEBUG ! void allprint(char); ! void sprint(char *); ! #endif ! #if defined(__cplusplus) && defined(__EXTERN_C__) ! } ! #endif ! ! #ifdef __cplusplus ! extern "C" { ! #endif ! void exit(int); ! #ifdef __cplusplus ! } ! #endif ! ! #endif # define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;} # define yymore() (yymorfg=1) ! #ifndef __cplusplus ! # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) ! #else ! # define lex_input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) ! #endif ! #define ECHO fprintf(yyout, "%s",yytext) # define REJECT { nstr = yyreject(); goto yyfussy;} ! int yyleng; ! char yytext[YYLMAX]; int yymorfg; extern char *yysptr, yysbuf[]; int yytchar; ! FILE *yyin = {stdin}, *yyout = {stdout}; extern int yylineno; struct yysvf { struct yywork *yystoff; *************** *** 25,30 **** --- 75,107 ---- int *yystops;}; struct yysvf *yyestate; extern struct yysvf yysvec[], *yybgin; + + # line 2 "../parse.lex" + /* Copyright (C) 1989, Digital Equipment Corporation */ + + # line 3 "../parse.lex" + /* All rights reserved. */ + + # line 4 "../parse.lex" + /* See the file COPYRIGHT for a full description. */ + + # line 5 "../parse.lex" + /* */ + + # line 6 "../parse.lex" + /* Last modified on Mon Jan 30 09:18:47 PST 1995 by kalsow */ + + # line 7 "../parse.lex" + /* modified on Fri Mar 20 20:11:40 PST 1992 by muller */ + + # line 8 "../parse.lex" + /* modified on Fri Jan 31 16:09:58 PST 1992 by goldberg@xerox.com */ + + # line 9 "../parse.lex" + /* modified on Mon Nov 25 17:41:09 PST 1991 by meehan */ + + # line 10 "../parse.lex" + /* modified on Mon Aug 19 14:51:03 1991 by nichols@xerox.com */ # define Prog 2 # define Com 4 # define Prag 6 *************** *** 43,139 **** } initializeLex () { ! BEGIN Prog; ! } # define YYNEWLINE 10 yylex(){ int nstr; extern int yyprevious; while((nstr = yylook()) >= 0) yyfussy: switch(nstr){ case 0: if(yywrap()) return(0); break; case 1: {eot(); return(PLUS);} break; case 2: {eot(); return(MINUS);} break; case 3: {eot(); return(ASTERISK);} break; case 4: {eot(); return(SLASH);} break; case 5: {eot(); return(ASSIGN);} break; case 6: {eot(); return(AMPERSAND);} break; case 7: {eot(); return(DOT);} break; case 8: {eot(); return(COMMA);} break; case 9: {eot(); return(SEMICOLON);} break; case 10: {eot(); return(LPAREN);} break; case 11: {eot(); return(LBRACKET);} break; case 12: {eot(); return(LBRACE);} break; case 13: {eot(); return(UPARROW);} break; case 14: {eot(); return(EQUAL);} break; case 15: {eot(); return(RARROW);} break; case 16: {eot(); return(SHARP);} break; case 17: {eot(); return(LESS);} break; case 18: {eot(); return(GREATER);} break; case 19: {eot(); return(LSEQUAL);} break; case 20: {eot(); return(SUBTYPE);} break; case 21: {eot(); return(GREQUAL);} break; case 22: {eot(); return(DOTDOT);} break; case 23: {eot(); return(COLON);} break; case 24: {eot(); return(RPAREN);} break; case 25: {eot(); return(RBRACKET);} break; case 26: {eot(); return(RBRACE);} break; case 27: {eot(); return(BAR);} break; case 28: {PTRKEYWORDENTRY tempp; eot(); if ((tempp=lookup(yytext))!=NULL){ --- 120,277 ---- } initializeLex () { ! BEGIN Prog; ! } # define YYNEWLINE 10 yylex(){ int nstr; extern int yyprevious; + #ifdef __cplusplus + /* to avoid CC and lint complaining yyfussy not being used ...*/ + static int __lex_hack = 0; + if (__lex_hack) goto yyfussy; + #endif while((nstr = yylook()) >= 0) yyfussy: switch(nstr){ case 0: if(yywrap()) return(0); break; case 1: + + # line 36 "../parse.lex" {eot(); return(PLUS);} break; case 2: + + # line 37 "../parse.lex" {eot(); return(MINUS);} break; case 3: + + # line 38 "../parse.lex" {eot(); return(ASTERISK);} break; case 4: + + # line 39 "../parse.lex" {eot(); return(SLASH);} break; case 5: + + # line 40 "../parse.lex" {eot(); return(ASSIGN);} break; case 6: + + # line 41 "../parse.lex" {eot(); return(AMPERSAND);} break; case 7: + + # line 42 "../parse.lex" {eot(); return(DOT);} break; case 8: + + # line 43 "../parse.lex" {eot(); return(COMMA);} break; case 9: + + # line 44 "../parse.lex" {eot(); return(SEMICOLON);} break; case 10: + + # line 45 "../parse.lex" {eot(); return(LPAREN);} break; case 11: + + # line 46 "../parse.lex" {eot(); return(LBRACKET);} break; case 12: + + # line 47 "../parse.lex" {eot(); return(LBRACE);} break; case 13: + + # line 48 "../parse.lex" {eot(); return(UPARROW);} break; case 14: + + # line 49 "../parse.lex" {eot(); return(EQUAL);} break; case 15: + + # line 50 "../parse.lex" {eot(); return(RARROW);} break; case 16: + + # line 51 "../parse.lex" {eot(); return(SHARP);} break; case 17: + + # line 52 "../parse.lex" {eot(); return(LESS);} break; case 18: + + # line 53 "../parse.lex" {eot(); return(GREATER);} break; case 19: + + # line 54 "../parse.lex" {eot(); return(LSEQUAL);} break; case 20: + + # line 55 "../parse.lex" {eot(); return(SUBTYPE);} break; case 21: + + # line 56 "../parse.lex" {eot(); return(GREQUAL);} break; case 22: + + # line 57 "../parse.lex" {eot(); return(DOTDOT);} break; case 23: + + # line 58 "../parse.lex" {eot(); return(COLON);} break; case 24: + + # line 59 "../parse.lex" {eot(); return(RPAREN);} break; case 25: + + # line 60 "../parse.lex" {eot(); return(RBRACKET);} break; case 26: + + # line 61 "../parse.lex" {eot(); return(RBRACE);} break; case 27: + + # line 62 "../parse.lex" {eot(); return(BAR);} break; case 28: + + # line 64 "../parse.lex" {PTRKEYWORDENTRY tempp; eot(); if ((tempp=lookup(yytext))!=NULL){ *************** *** 145,214 **** } break; case 29: {eot(); return(CARD_CONST);} break; case 30: {eot(); return(REAL_CONST);} break; case 31: { eot(); return(STR_CONST);} break; case 32: { eot(); return(STR_CONST);} break; case 33: {eot(); eol();} break; case 34: {eot(); } break; case 35: /* other spaces */ /* putchar(' ')*/ eot(); break; case 36: {eot(); BEGIN Com; comdepth=1; } break; case 37: {eot(); comdepth++; } break; case 38: {eot(); comdepth--; if (comdepth==0) BEGIN Prog; } break; case 39: {eot(); BEGIN Prag; pragdepth=1; } break; case 40: {eot(); pragdepth++; } break; case 41: {eot(); pragdepth--; if (pragdepth==0) BEGIN Prog; } break; case 42: {eot(); eol();} break; case 43: {eot(); eol();} break; case 44: {eot();} break; case 45: {eot();} break; case 46: {yyless(0); BEGIN Prog;} break; case -1: break; default: ! fprintf(yyout,"bad switch yylook %d",nstr); } return(0); } /* end of yylex */ ! int yyvstop[] ={ 0, 46, --- 283,388 ---- } break; case 29: + + # line 74 "../parse.lex" {eot(); return(CARD_CONST);} break; case 30: + + # line 76 "../parse.lex" {eot(); return(REAL_CONST);} break; case 31: + + # line 78 "../parse.lex" { eot(); return(STR_CONST);} break; case 32: + + # line 82 "../parse.lex" { eot(); return(STR_CONST);} break; case 33: + + # line 86 "../parse.lex" {eot(); eol();} break; case 34: + + # line 87 "../parse.lex" {eot(); } break; case 35: + + # line 88 "../parse.lex" /* other spaces */ /* putchar(' ')*/ eot(); break; case 36: + + # line 91 "../parse.lex" {eot(); BEGIN Com; comdepth=1; } break; case 37: + + # line 92 "../parse.lex" {eot(); comdepth++; } break; case 38: + + # line 93 "../parse.lex" {eot(); comdepth--; if (comdepth==0) BEGIN Prog; } break; case 39: + + # line 95 "../parse.lex" {eot(); BEGIN Prag; pragdepth=1; } break; case 40: + + # line 96 "../parse.lex" {eot(); pragdepth++; } break; case 41: + + # line 97 "../parse.lex" {eot(); pragdepth--; if (pragdepth==0) BEGIN Prog; } break; case 42: + + # line 99 "../parse.lex" {eot(); eol();} break; case 43: + + # line 100 "../parse.lex" {eot(); eol();} break; case 44: + + # line 101 "../parse.lex" {eot();} break; case 45: + + # line 102 "../parse.lex" {eot();} break; case 46: + + # line 104 "../parse.lex" {yyless(0); BEGIN Prog;} break; case -1: break; default: ! (void)fprintf(yyout,"bad switch yylook %d",nstr); } return(0); } /* end of yylex */ ! int yyvstop[] = { 0, 46, *************** *** 433,439 **** 0, 0}; # define YYTYPE unsigned char ! struct yywork { YYTYPE verify, advance; } yycrank[] ={ 0,0, 0,0, 1,9, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 1,9, 1,0, --- 607,613 ---- 0, 0}; # define YYTYPE unsigned char ! struct yywork { YYTYPE verify, advance; } yycrank[] = { 0,0, 0,0, 1,9, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 1,9, 1,0, *************** *** 568,574 **** 0,0, 0,0, 57,73, 57,73, 57,73, 57,73, 57,73, 57,73, 0,0}; ! struct yysvf yysvec[] ={ 0, 0, 0, yycrank+-1, 0, 0, yycrank+-2, yysvec+1, 0, --- 742,748 ---- 0,0, 0,0, 57,73, 57,73, 57,73, 57,73, 57,73, 57,73, 0,0}; ! struct yysvf yysvec[] = { 0, 0, 0, yycrank+-1, 0, 0, yycrank+-2, yysvec+1, 0, *************** *** 649,689 **** 0, 0, 0}; struct yywork *yytop = yycrank+531; struct yysvf *yybgin = yysvec+1; ! char yymatch[] ={ ! 00 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,011 ,012 ,01 ,011 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 011 ,01 ,'"' ,01 ,01 ,01 ,01 ,047 , ! 01 ,01 ,01 ,'+' ,01 ,'+' ,'.' ,01 , ! '0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' , ! '0' ,'0' ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,'A' ,'A' ,'A' ,'D' ,'D' ,'A' ,'G' , ! 'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' , ! 'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' , ! 'X' ,'G' ,'G' ,01 ,0134,01 ,01 ,'_' , ! 01 ,'A' ,'A' ,'A' ,'D' ,'D' ,'A' ,'G' , ! 'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' , ! 'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' , ! 'X' ,'G' ,'G' ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , ! 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , 0}; ! char yyextra[] ={ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, --- 823,863 ---- 0, 0, 0}; struct yywork *yytop = yycrank+531; struct yysvf *yybgin = yysvec+1; ! char yymatch[] = { ! 0, 1, 1, 1, 1, 1, 1, 1, ! 1, 9, 10, 1, 9, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 9, 1, 34, 1, 1, 1, 1, 39, ! 1, 1, 1, 43, 1, 43, 46, 1, ! 48, 48, 48, 48, 48, 48, 48, 48, ! 48, 48, 1, 1, 1, 1, 1, 1, ! 1, 65, 65, 65, 68, 68, 65, 71, ! 71, 71, 71, 71, 71, 71, 71, 71, ! 71, 71, 71, 71, 71, 71, 71, 71, ! 88, 71, 71, 1, 92, 1, 1, 95, ! 1, 65, 65, 65, 68, 68, 65, 71, ! 71, 71, 71, 71, 71, 71, 71, 71, ! 71, 71, 71, 71, 71, 71, 71, 71, ! 88, 71, 71, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, 0}; ! char yyextra[] = { 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, *************** *** 691,713 **** 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0}; ! /* ncform 4.1 83/08/11 */ int yylineno =1; # define YYU(x) x # define NLSTATE yyprevious=YYNEWLINE - char yytext[YYLMAX]; struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; char yysbuf[YYLMAX]; char *yysptr = yysbuf; int *yyfnd; extern struct yysvf *yyestate; int yyprevious = YYNEWLINE; ! yylook(){ register struct yysvf *yystate, **lsp; register struct yywork *yyt; struct yysvf *yyz; ! int yych; struct yywork *yyr; # ifdef LEXDEBUG int debug; --- 865,898 ---- 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0}; ! /* Copyright (c) 1989 AT&T */ ! /* All Rights Reserved */ ! ! /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ ! /* The copyright notice above does not evidence any */ ! /* actual or intended publication of such source code. */ + #pragma ident "@(#)ncform 6.8 95/02/11 SMI" + int yylineno =1; # define YYU(x) x # define NLSTATE yyprevious=YYNEWLINE struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; char yysbuf[YYLMAX]; char *yysptr = yysbuf; int *yyfnd; extern struct yysvf *yyestate; int yyprevious = YYNEWLINE; ! #if defined(__cplusplus) || defined(__STDC__) ! int yylook(void) ! #else ! yylook() ! #endif ! { register struct yysvf *yystate, **lsp; register struct yywork *yyt; struct yysvf *yyz; ! int yych, yyfirst; struct yywork *yyr; # ifdef LEXDEBUG int debug; *************** *** 717,722 **** --- 902,908 ---- # ifdef LEXDEBUG debug = 0; # endif + yyfirst=1; if (!yymorfg) yylastch = yytext; else { *************** *** 732,747 **** if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1); # endif yyt = yystate->yystoff; ! if(yyt == yycrank){ /* may not be any transitions */ yyz = yystate->yyother; if(yyz == 0)break; if(yyz->yystoff == yycrank)break; } *yylastch++ = yych = input(); tryagain: # ifdef LEXDEBUG if(debug){ ! fprintf(yyout,"unsigned char "); allprint(yych); putchar('\n'); } --- 918,942 ---- if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1); # endif yyt = yystate->yystoff; ! if(yyt == yycrank && !yyfirst){ /* may not be any transitions */ yyz = yystate->yyother; if(yyz == 0)break; if(yyz->yystoff == yycrank)break; } + #ifndef __cplusplus *yylastch++ = yych = input(); + #else + *yylastch++ = yych = lex_input(); + #endif + if(yylastch > &yytext[YYLMAX]) { + fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); + exit(1); + } + yyfirst=0; tryagain: # ifdef LEXDEBUG if(debug){ ! fprintf(yyout,"char "); allprint(yych); putchar('\n'); } *************** *** 753,758 **** --- 948,957 ---- if(yyt->advance+yysvec == YYLERR) /* error transitions */ {unput(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; + if(lsp > &yylstate[YYLMAX]) { + fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); + exit(1); + } goto contin; } } *************** *** 767,772 **** --- 966,975 ---- if(yyt->advance+yysvec == YYLERR) /* error transitions */ {unput(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; + if(lsp > &yylstate[YYLMAX]) { + fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); + exit(1); + } goto contin; } yyt = yyr + YYU(yymatch[yych]); *************** *** 781,786 **** --- 984,993 ---- if(yyt->advance+yysvec == YYLERR) /* error transition */ {unput(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; + if(lsp > &yylstate[YYLMAX]) { + fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); + exit(1); + } goto contin; } } *************** *** 840,874 **** yysptr=yysbuf; return(0); } yyprevious = yytext[0] = input(); if (yyprevious>0) output(yyprevious); yylastch=yytext; # ifdef LEXDEBUG if(debug)putchar('\n'); # endif } } yyback(p, m) int *p; { ! if (p==0) return(0); ! while (*p) ! { ! if (*p++ == m) ! return(1); } ! return(0); } /* the following are only used in the lex library */ ! yyinput(){ return(input()); } yyoutput(c) ! int c; { output(c); } yyunput(c) ! int c; { unput(c); } --- 1047,1113 ---- yysptr=yysbuf; return(0); } + #ifndef __cplusplus yyprevious = yytext[0] = input(); if (yyprevious>0) output(yyprevious); + #else + yyprevious = yytext[0] = lex_input(); + if (yyprevious>0) + lex_output(yyprevious); + #endif yylastch=yytext; # ifdef LEXDEBUG if(debug)putchar('\n'); # endif } } + #if defined(__cplusplus) || defined(__STDC__) + int yyback(int *p, int m) + #else yyback(p, m) int *p; + #endif { ! if (p==0) return(0); ! while (*p) { ! if (*p++ == m) ! return(1); } ! return(0); } /* the following are only used in the lex library */ ! #if defined(__cplusplus) || defined(__STDC__) ! int yyinput(void) ! #else ! yyinput() ! #endif ! { ! #ifndef __cplusplus return(input()); + #else + return(lex_input()); + #endif } + #if defined(__cplusplus) || defined(__STDC__) + void yyoutput(int c) + #else yyoutput(c) ! int c; ! #endif ! { ! #ifndef __cplusplus output(c); + #else + lex_output(c); + #endif } + #if defined(__cplusplus) || defined(__STDC__) + void yyunput(int c) + #else yyunput(c) ! int c; ! #endif ! { unput(c); } Index: m3/pm3/language/modula3/m3tools/gnuemacs/src/lex-yacc/y.tab.c diff -c m3/pm3/language/modula3/m3tools/gnuemacs/src/lex-yacc/y.tab.c:1.1.1.1 m3/pm3/language/modula3/m3tools/gnuemacs/src/lex-yacc/y.tab.c:1.2 *** m3/pm3/language/modula3/m3tools/gnuemacs/src/lex-yacc/y.tab.c:1.1.1.1 Thu Jan 16 16:31:51 1997 --- m3/pm3/language/modula3/m3tools/gnuemacs/src/lex-yacc/y.tab.c Thu Apr 29 23:57:01 1999 *************** *** 1,104 **** ! /* A Bison parser, made from ../parse.yacc with Bison version GNU Bison version 1.22 */ #define YYBISON 1 /* Identify Bison output. */ ! #define ENDOFFILE 258 ! #define AMPERSAND 259 ! #define ASSIGN 260 ! #define ASTERISK 261 ! #define BAR 262 ! #define COLON 263 ! #define COMMA 264 ! #define DOT 265 ! #define DOTDOT 266 ! #define EQUAL 267 ! #define GREATER 268 ! #define GREQUAL 269 ! #define LESS 270 ! #define LSEQUAL 271 ! #define MINUS 272 ! #define SHARP 273 ! #define PERIOD 274 ! #define PLUS 275 ! #define RARROW 276 ! #define RBRACE 277 ! #define RBRACKET 278 ! #define RPAREN 279 ! #define SEMICOLON 280 ! #define SLASH 281 ! #define SUBTYPE 282 ! #define UPARROW 283 ! #define LPAREN 284 ! #define LBRACKET 285 ! #define LBRACE 286 ! #define IDENT 287 ! #define CARD_CONST 288 ! #define REAL_CONST 289 ! #define CHAR_CONST 290 ! #define STR_CONST 291 ! #define AND 292 ! #define ANY 293 ! #define ARRAY 294 ! #define AS 295 ! #define BGN 296 ! #define BITS 297 ! #define BRANDED 298 ! #define BY 299 ! #define CASE 300 ! #define CONST 301 ! #define DIV 302 ! #define DO 303 ! #define ELSE 304 ! #define ELSIF 305 ! #define END 306 ! #define EVAL 307 ! #define EXCEPT 308 ! #define EXCEPTION 309 ! #define EXIT 310 ! #define EXPORTS 311 ! #define FINALLY 312 ! #define FOR 313 ! #define FROM 314 ! #define GENERIC 315 ! #define IF 316 ! #define IMPORT 317 ! #define IN 318 ! #define INTERFACE 319 ! #define LOCK 320 ! #define LOOP 321 ! #define METHODS 322 ! #define MOD 323 ! #define MODULE 324 ! #define NOT 325 ! #define OBJECT 326 ! #define OF 327 ! #define OR 328 ! #define OVERRIDES 329 ! #define PROCEDURE 330 ! #define RAISE 331 ! #define RAISES 332 ! #define READONLY 333 ! #define RECORD 334 ! #define REF 335 ! #define REPEAT 336 ! #define RETURN 337 ! #define REVEAL 338 ! #define ROOT 339 ! #define SET 340 ! #define THEN 341 ! #define TO 342 ! #define TRY 343 ! #define TYPE 344 ! #define TYPECASE 345 ! #define UNSAFE 346 ! #define UNTIL 347 ! #define UNTRACED 348 ! #define VALUE 349 ! #define VAR 350 ! #define WHILE 351 ! #define WITH 352 #line 39 "../parse.yacc" --- 1,105 ---- ! /* A Bison parser, made from ../parse.yacc ! by GNU Bison version 1.27 */ #define YYBISON 1 /* Identify Bison output. */ ! #define ENDOFFILE 257 ! #define AMPERSAND 258 ! #define ASSIGN 259 ! #define ASTERISK 260 ! #define BAR 261 ! #define COLON 262 ! #define COMMA 263 ! #define DOT 264 ! #define DOTDOT 265 ! #define EQUAL 266 ! #define GREATER 267 ! #define GREQUAL 268 ! #define LESS 269 ! #define LSEQUAL 270 ! #define MINUS 271 ! #define SHARP 272 ! #define PERIOD 273 ! #define PLUS 274 ! #define RARROW 275 ! #define RBRACE 276 ! #define RBRACKET 277 ! #define RPAREN 278 ! #define SEMICOLON 279 ! #define SLASH 280 ! #define SUBTYPE 281 ! #define UPARROW 282 ! #define LPAREN 283 ! #define LBRACKET 284 ! #define LBRACE 285 ! #define IDENT 286 ! #define CARD_CONST 287 ! #define REAL_CONST 288 ! #define CHAR_CONST 289 ! #define STR_CONST 290 ! #define AND 291 ! #define ANY 292 ! #define ARRAY 293 ! #define AS 294 ! #define BGN 295 ! #define BITS 296 ! #define BRANDED 297 ! #define BY 298 ! #define CASE 299 ! #define CONST 300 ! #define DIV 301 ! #define DO 302 ! #define ELSE 303 ! #define ELSIF 304 ! #define END 305 ! #define EVAL 306 ! #define EXCEPT 307 ! #define EXCEPTION 308 ! #define EXIT 309 ! #define EXPORTS 310 ! #define FINALLY 311 ! #define FOR 312 ! #define FROM 313 ! #define GENERIC 314 ! #define IF 315 ! #define IMPORT 316 ! #define IN 317 ! #define INTERFACE 318 ! #define LOCK 319 ! #define LOOP 320 ! #define METHODS 321 ! #define MOD 322 ! #define MODULE 323 ! #define NOT 324 ! #define OBJECT 325 ! #define OF 326 ! #define OR 327 ! #define OVERRIDES 328 ! #define PROCEDURE 329 ! #define RAISE 330 ! #define RAISES 331 ! #define READONLY 332 ! #define RECORD 333 ! #define REF 334 ! #define REPEAT 335 ! #define RETURN 336 ! #define REVEAL 337 ! #define ROOT 338 ! #define SET 339 ! #define THEN 340 ! #define TO 341 ! #define TRY 342 ! #define TYPE 343 ! #define TYPECASE 344 ! #define UNSAFE 345 ! #define UNTIL 346 ! #define UNTRACED 347 ! #define VALUE 348 ! #define VAR 349 ! #define WHILE 350 ! #define WITH 351 #line 39 "../parse.yacc" *************** *** 120,142 **** int pragdepth = 0; /* depth of pragmas, used only by lexer. */ - - #ifndef YYLTYPE - typedef - struct yyltype - { - int timestamp; - int first_line; - int first_column; - int last_line; - int last_column; - char *text; - } - yyltype; - - #define YYLTYPE yyltype - #endif - #ifndef YYSTYPE #define YYSTYPE int #endif --- 121,126 ---- *************** *** 154,160 **** #define YYFLAG -32768 #define YYNTBASE 98 ! #define YYTRANSLATE(x) ((unsigned)(x) <= 352 ? yytranslate[x] : 234) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, --- 138,144 ---- #define YYFLAG -32768 #define YYNTBASE 98 ! #define YYTRANSLATE(x) ((unsigned)(x) <= 351 ? yytranslate[x] : 234) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, *************** *** 182,198 **** 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, ! 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ! 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, ! 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, ! 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, ! 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, ! 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, ! 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ! 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, ! 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, ! 96, 97 }; #if YYDEBUG != 0 --- 166,182 ---- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, ! 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ! 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, ! 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, ! 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, ! 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, ! 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, ! 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, ! 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, ! 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, ! 97 }; #if YYDEBUG != 0 *************** *** 366,373 **** 638, 640, 643, 645, 648, 650, 651, 654, 656, 659, 661, 662, 665, 667, 670, 672, 675, 677 }; ! static const char * const yytname[] = { "$","error","$illegal.","ENDOFFILE", "AMPERSAND","ASSIGN","ASTERISK","BAR","COLON","COMMA","DOT","DOTDOT","EQUAL", "GREATER","GREQUAL","LESS","LSEQUAL","MINUS","SHARP","PERIOD","PLUS","RARROW", "RBRACE","RBRACKET","RPAREN","SEMICOLON","SLASH","SUBTYPE","UPARROW","LPAREN", --- 350,361 ---- 638, 640, 643, 645, 648, 650, 651, 654, 656, 659, 661, 662, 665, 667, 670, 672, 675, 677 }; + #endif + ! #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) ! ! static const char * const yytname[] = { "$","error","$undefined.","ENDOFFILE", "AMPERSAND","ASSIGN","ASTERISK","BAR","COLON","COMMA","DOT","DOTDOT","EQUAL", "GREATER","GREQUAL","LESS","LSEQUAL","MINUS","SHARP","PERIOD","PLUS","RARROW", "RBRACE","RBRACKET","RPAREN","SEMICOLON","SLASH","SUBTYPE","UPARROW","LPAREN", *************** *** 397,403 **** "override_semi_list","override_semi","override","expr","zexpr","e1","ze1","e2", "e3","ze3","relop","e4","ze4","addop","e5","ze5","mulop","e6","e7","e8","selector_list", "selector","expr_list","actual_list","actual","elem_list","elem","elem_tail", ! "opt_id_list","id_list","" }; #endif --- 385,391 ---- "override_semi_list","override_semi","override","expr","zexpr","e1","ze1","e2", "e3","ze3","relop","e4","ze4","addop","e5","ze5","mulop","e6","e7","e8","selector_list", "selector","expr_list","actual_list","actual","elem_list","elem","elem_tail", ! "opt_id_list","id_list", NULL }; #endif *************** *** 825,838 **** -1, -1, 93, 95 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ ! #line 3 "/contrib/share/lib/bison.simple" /* Skeleton output parser for bison, ! Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, --- 813,827 ---- -1, -1, 93, 95 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ ! #line 3 "/p/gnu/lib/bison-1.27/bison.simple" ! /* This file comes from bison-1.27. */ /* Skeleton output parser for bison, ! Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, *************** *** 842,883 **** You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ ! #ifndef alloca #ifdef __GNUC__ #define alloca __builtin_alloca #else /* not GNU C. */ ! #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) #include #else /* not sparc */ ! #if defined (MSDOS) && !defined (__TURBOC__) #include #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) ! #include #pragma alloca ! #else /* not MSDOS, __TURBOC__, or _AIX */ ! #ifdef __hpux ! #ifdef __cplusplus ! extern "C" { ! void *alloca (unsigned int); ! }; ! #else /* not __cplusplus */ ! void *alloca (); ! #endif /* not __cplusplus */ #endif /* __hpux */ #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ ! #endif /* not sparc. */ ! #endif /* not GNU C. */ ! #endif /* alloca not defined. */ ! /* This is the parser code that is written into each bison parser ! when the %semantic_parser declaration is not specified in the grammar. ! It was written by Richard Stallman by simplifying the hairy parser ! used when %semantic_parser is specified. */ /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action --- 831,896 ---- You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, ! Boston, MA 02111-1307, USA. */ + /* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ ! /* This is the parser code that is written into each bison parser ! when the %semantic_parser declaration is not specified in the grammar. ! It was written by Richard Stallman by simplifying the hairy parser ! used when %semantic_parser is specified. */ ! ! #ifndef YYSTACK_USE_ALLOCA ! #ifdef alloca ! #define YYSTACK_USE_ALLOCA ! #else /* alloca not defined */ #ifdef __GNUC__ + #define YYSTACK_USE_ALLOCA #define alloca __builtin_alloca #else /* not GNU C. */ ! #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) ! #define YYSTACK_USE_ALLOCA #include #else /* not sparc */ ! /* We think this test detects Watcom and Microsoft C. */ ! /* This used to test MSDOS, but that is a bad idea ! since that symbol is in the user namespace. */ ! #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) ! #if 0 /* No need for malloc.h, which pollutes the namespace; ! instead, just don't use alloca. */ #include + #endif #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) ! /* I don't know what this was needed for, but it pollutes the namespace. ! So I turned it off. rms, 2 May 1997. */ ! /* #include */ #pragma alloca ! #define YYSTACK_USE_ALLOCA ! #else /* not MSDOS, or __TURBOC__, or _AIX */ ! #if 0 ! #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, ! and on HPUX 10. Eventually we can turn this on. */ ! #define YYSTACK_USE_ALLOCA ! #define alloca __builtin_alloca #endif /* __hpux */ + #endif #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ ! #endif /* not sparc */ ! #endif /* not GNU C */ ! #endif /* alloca not defined */ ! #endif /* YYSTACK_USE_ALLOCA not defined */ ! #ifdef YYSTACK_USE_ALLOCA ! #define YYSTACK_ALLOC alloca ! #else ! #define YYSTACK_ALLOC malloc ! #endif /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action *************** *** 887,894 **** #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 ! #define YYACCEPT return(0) ! #define YYABORT return(1) #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the --- 900,907 ---- #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 ! #define YYACCEPT goto yyacceptlab ! #define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the *************** *** 917,926 **** --- 930,947 ---- #ifdef YYPURE #ifdef YYLSP_NEEDED + #ifdef YYLEX_PARAM + #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) + #else #define YYLEX yylex(&yylval, &yylloc) + #endif + #else /* not YYLSP_NEEDED */ + #ifdef YYLEX_PARAM + #define YYLEX yylex(&yylval, YYLEX_PARAM) #else #define YYLEX yylex(&yylval) #endif + #endif /* not YYLSP_NEEDED */ #endif /* If nonreentrant, generate the variables here */ *************** *** 961,984 **** #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif - - /* Prevent warning if -Wstrict-prototypes. */ - #ifdef __GNUC__ - int yyparse (void); - #endif #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ ! #define __yy_bcopy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void ! __yy_bcopy (from, to, count) ! char *from; char *to; ! int count; { register char *f = from; register char *t = to; --- 982,1005 ---- #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif + /* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ ! #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void ! __yy_memcpy (to, from, count) char *to; ! char *from; ! unsigned int count; { register char *f = from; register char *t = to; *************** *** 993,1002 **** /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void ! __yy_bcopy (char *from, char *to, int count) { - register char *f = from; register char *t = to; register int i = count; while (i-- > 0) --- 1014,1023 ---- /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void ! __yy_memcpy (char *to, char *from, unsigned int count) { register char *t = to; + register char *f = from; register int i = count; while (i-- > 0) *************** *** 1006,1014 **** #endif #endif ! #line 184 "/contrib/share/lib/bison.simple" int ! yyparse() { register int yystate; register int yyn; --- 1027,1065 ---- #endif #endif ! #line 216 "/p/gnu/lib/bison-1.27/bison.simple" ! ! /* The user can define YYPARSE_PARAM as the name of an argument to be passed ! into yyparse. The argument should have type void *. ! It should actually point to an object. ! Grammar actions can access the variable by casting it ! to the proper pointer type. */ ! ! #ifdef YYPARSE_PARAM ! #ifdef __cplusplus ! #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM ! #define YYPARSE_PARAM_DECL ! #else /* not __cplusplus */ ! #define YYPARSE_PARAM_ARG YYPARSE_PARAM ! #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; ! #endif /* not __cplusplus */ ! #else /* not YYPARSE_PARAM */ ! #define YYPARSE_PARAM_ARG ! #define YYPARSE_PARAM_DECL ! #endif /* not YYPARSE_PARAM */ ! ! /* Prevent warning if -Wstrict-prototypes. */ ! #ifdef __GNUC__ ! #ifdef YYPARSE_PARAM ! int yyparse (void *); ! #else ! int yyparse (void); ! #endif ! #endif ! int ! yyparse(YYPARSE_PARAM_ARG) ! YYPARSE_PARAM_DECL { register int yystate; register int yyn; *************** *** 1034,1039 **** --- 1085,1091 ---- #endif int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; #ifdef YYPURE int yychar; *************** *** 1118,1135 **** if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; ! yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); ! __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); ! yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); ! __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); #ifdef YYLSP_NEEDED ! yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); ! __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp)); #endif #endif /* no yyoverflow */ --- 1170,1201 ---- if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); + #ifdef YYLSP_NEEDED + free (yyls); + #endif + } return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; ! #ifndef YYSTACK_USE_ALLOCA ! yyfree_stacks = 1; ! #endif ! yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); ! __yy_memcpy ((char *)yyss, (char *)yyss1, ! size * (unsigned int) sizeof (*yyssp)); ! yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); ! __yy_memcpy ((char *)yyvs, (char *)yyvs1, ! size * (unsigned int) sizeof (*yyvsp)); #ifdef YYLSP_NEEDED ! yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); ! __yy_memcpy ((char *)yyls, (char *)yyls1, ! size * (unsigned int) sizeof (*yylsp)); #endif #endif /* no yyoverflow */ *************** *** 1351,1357 **** break;} } /* the action file gets copied in in place of this dollarsign */ ! #line 465 "/contrib/share/lib/bison.simple" yyvsp -= yylen; yyssp -= yylen; --- 1417,1423 ---- break;} } /* the action file gets copied in in place of this dollarsign */ ! #line 542 "/p/gnu/lib/bison-1.27/bison.simple" yyvsp -= yylen; yyssp -= yylen; *************** *** 1546,1551 **** --- 1612,1641 ---- yystate = yyn; goto yynewstate; + + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); + #ifdef YYLSP_NEEDED + free (yyls); + #endif + } + return 0; + + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); + #ifdef YYLSP_NEEDED + free (yyls); + #endif + } + return 1; } #line 681 "../parse.yacc" *************** *** 1571,1576 **** --- 1661,1667 ---- char qualifier[200]; recordQual(name) + char *name; { strcpy(qualifier, name); } Index: m3/pm3/language/modula3/m3tools/m3gdb/gdb/gdb/m3-lang.c diff -c m3/pm3/language/modula3/m3tools/m3gdb/gdb/gdb/m3-lang.c:1.9 m3/pm3/language/modula3/m3tools/m3gdb/gdb/gdb/m3-lang.c:1.10 *** m3/pm3/language/modula3/m3tools/m3gdb/gdb/gdb/m3-lang.c:1.9 Sun Nov 15 23:38:20 1998 --- m3/pm3/language/modula3/m3tools/m3gdb/gdb/gdb/m3-lang.c Wed Apr 28 11:53:28 1999 *************** *** 460,465 **** --- 460,466 ---- { int thread__t__context_size, thread__t__context_offset; struct type * thread__t__context_type; + int dataOffset = TARGET_PTR_BIT; if (thread__t) return; *************** *** 489,502 **** find_m3_rec_field (thread__t__context_type, "buf", &thread__t__buf_size, &thread__t__buf_offset, 0); ! /* skip past the method pointer */ ! thread__t__id_offset += TARGET_PTR_BIT; ! thread__t__state_offset += TARGET_PTR_BIT; ! thread__t__next_offset += TARGET_PTR_BIT; ! thread__t__cond_offset += TARGET_PTR_BIT; ! thread__t__mutex_offset += TARGET_PTR_BIT; ! thread__t__time_offset += TARGET_PTR_BIT; ! thread__t__buf_offset += TARGET_PTR_BIT + thread__t__context_offset; } /*--------------------------------------------------------- jmpbuf layout ---*/ --- 490,507 ---- find_m3_rec_field (thread__t__context_type, "buf", &thread__t__buf_size, &thread__t__buf_offset, 0); ! #if defined(sparc) ! /* deal with sparc realignment */ ! dataOffset += TARGET_PTR_BIT; ! #endif ! ! thread__t__id_offset += dataOffset; ! thread__t__state_offset += dataOffset; ! thread__t__next_offset += dataOffset; ! thread__t__cond_offset += dataOffset; ! thread__t__mutex_offset += dataOffset; ! thread__t__time_offset += dataOffset; ! thread__t__buf_offset += dataOffset + thread__t__context_offset; } /*--------------------------------------------------------- jmpbuf layout ---*/ *************** *** 1421,1431 **** TARGET_PTR_BIT / TARGET_CHAR_BIT); /* the typecode is in Modula-3 bits 1..21 */ ! #if TARGET_BYTE_ORDER == BIG_ENDIAN ! typecode = (typecode >> 11) & 0xfffff; ! #else ! typecode = (typecode >> 1) & 0xfffff; ! #endif target_read_memory (rt0u_types_value + typecode * TARGET_PTR_BIT / TARGET_CHAR_BIT, --- 1426,1432 ---- TARGET_PTR_BIT / TARGET_CHAR_BIT); /* the typecode is in Modula-3 bits 1..21 */ ! typecode = m3_unpack_ord((char *)&typecode, 1, 20, 0); target_read_memory (rt0u_types_value + typecode * TARGET_PTR_BIT / TARGET_CHAR_BIT, Index: m3/pm3/language/modula3/m3tools/pp/src/lex-yacc/lex.yy.c diff -c m3/pm3/language/modula3/m3tools/pp/src/lex-yacc/lex.yy.c:1.1.1.1 m3/pm3/language/modula3/m3tools/pp/src/lex-yacc/lex.yy.c:1.2 *** m3/pm3/language/modula3/m3tools/pp/src/lex-yacc/lex.yy.c:1.1.1.1 Thu Jan 16 16:31:51 1997 --- m3/pm3/language/modula3/m3tools/pp/src/lex-yacc/lex.yy.c Thu Apr 29 23:53:50 1999 *************** *** 1,23 **** ! # include "stdio.h" ! # define U(x) ((x)&0377) # define NLSTATE yyprevious=YYNEWLINE # define BEGIN yybgin = yysvec + 1 + # define INITIAL 0 # define YYLERR yysvec # define YYSTATE (yyestate-yysvec-1) # define YYOPTIM 1 ! # define YYLMAX 200 ! # define output(c) putc(c,yyout) ! # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) # define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;} # define yymore() (yymorfg=1) ! # define ECHO fprintf(yyout, "%s",yytext) # define REJECT { nstr = yyreject(); goto yyfussy;} ! int yyleng; extern char yytext[]; int yymorfg; extern char *yysptr, yysbuf[]; int yytchar; ! FILE *yyin ={stdin}, *yyout ={stdout}; extern int yylineno; struct yysvf { struct yywork *yystoff; --- 1,73 ---- ! #include ! # define U(x) x # define NLSTATE yyprevious=YYNEWLINE # define BEGIN yybgin = yysvec + 1 + # define INITIAL 0 # define YYLERR yysvec # define YYSTATE (yyestate-yysvec-1) # define YYOPTIM 1 ! # define YYLMAX BUFSIZ ! #ifndef __cplusplus ! # define output(c) (void)putc(c,yyout) ! #else ! # define lex_output(c) (void)putc(c,yyout) ! #endif ! ! #if defined(__cplusplus) || defined(__STDC__) ! ! #if defined(__cplusplus) && defined(__EXTERN_C__) ! extern "C" { ! #endif ! int yyback(int *, int); ! int yyinput(void); ! int yylook(void); ! void yyoutput(int); ! int yyracc(int); ! int yyreject(void); ! void yyunput(int); ! int yylex(void); ! #ifdef YYLEX_E ! void yywoutput(wchar_t); ! wchar_t yywinput(void); ! #endif ! #ifndef yyless ! int yyless(int); ! #endif ! #ifndef yywrap ! int yywrap(void); ! #endif ! #ifdef LEXDEBUG ! void allprint(char); ! void sprint(char *); ! #endif ! #if defined(__cplusplus) && defined(__EXTERN_C__) ! } ! #endif ! ! #ifdef __cplusplus ! extern "C" { ! #endif ! void exit(int); ! #ifdef __cplusplus ! } ! #endif ! ! #endif # define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;} # define yymore() (yymorfg=1) ! #ifndef __cplusplus ! # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) ! #else ! # define lex_input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) ! #endif ! #define ECHO fprintf(yyout, "%s",yytext) # define REJECT { nstr = yyreject(); goto yyfussy;} ! int yyleng; ! char yytext[YYLMAX]; int yymorfg; extern char *yysptr, yysbuf[]; int yytchar; ! FILE *yyin = {stdin}, *yyout = {stdout}; extern int yylineno; struct yysvf { struct yywork *yystoff; *************** *** 25,37 **** --- 75,101 ---- int *yystops;}; struct yysvf *yyestate; extern struct yysvf yysvec[], *yybgin; + + # line 3 "../Parse.lex" /* Copyright (C) 1989, Digital Equipment Corporation */ + + # line 4 "../Parse.lex" /* All rights reserved. */ + + # line 5 "../Parse.lex" /* See the file COPYRIGHT for a full description. */ + + # line 7 "../Parse.lex" /* Last modified on Wed Aug 10 13:21:55 PDT 1994 by kalsow */ + + # line 8 "../Parse.lex" /* modified on Thu Apr 23 18:08:06 PDT 1992 by muller */ + + # line 9 "../Parse.lex" /* modified on Mon Apr 20 15:59:06 1992 by nichols@xerox.com */ + + # line 10 "../Parse.lex" /* modified on Mon Nov 25 17:41:09 PST 1991 by meehan */ # define Prog 2 # define Com 4 *************** *** 39,139 **** --- 103,270 ---- # define YYNEWLINE 10 yylex(){ int nstr; extern int yyprevious; + #ifdef __cplusplus + /* to avoid CC and lint complaining yyfussy not being used ...*/ + static int __lex_hack = 0; + if (__lex_hack) goto yyfussy; + #endif while((nstr = yylook()) >= 0) yyfussy: switch(nstr){ case 0: if(yywrap()) return(0); break; case 1: + + # line 16 "../Parse.lex" { return (HandleNPS()); } break; case 2: + + # line 17 "../Parse.lex" { return (HandleNPS()); } break; case 3: + + # line 18 "../Parse.lex" { return (HandleNPS()); } break; case 4: + + # line 19 "../Parse.lex" {BufferLexeme(1); return(PLUS);} break; case 5: + + # line 20 "../Parse.lex" {BufferLexeme(1); return(MINUS);} break; case 6: + + # line 21 "../Parse.lex" {BufferLexeme(1); return(ASTERISK);} break; case 7: + + # line 22 "../Parse.lex" {BufferLexeme(1); return(SLASH);} break; case 8: + + # line 23 "../Parse.lex" {BufferLexeme(1); return(ASSIGN);} break; case 9: + + # line 24 "../Parse.lex" {BufferLexeme(1); return(AMPERSAND);} break; case 10: + + # line 25 "../Parse.lex" {BufferLexeme(1); return(DOT);} break; case 11: + + # line 26 "../Parse.lex" {BufferLexeme(1); return(COMMA);} break; case 12: + + # line 27 "../Parse.lex" {BufferLexeme(1); return(SEMICOLON);} break; case 13: + + # line 28 "../Parse.lex" {BufferLexeme(1); return(LPAREN);} break; case 14: + + # line 29 "../Parse.lex" {BufferLexeme(1); return(LBRACKET);} break; case 15: + + # line 30 "../Parse.lex" {BufferLexeme(1); return(LBRACE);} break; case 16: + + # line 31 "../Parse.lex" {BufferLexeme(1); return(UPARROW);} break; case 17: + + # line 32 "../Parse.lex" {BufferLexeme(1); return(EQUAL);} break; case 18: + + # line 33 "../Parse.lex" {BufferLexeme(1); return(RARROW);} break; case 19: + + # line 34 "../Parse.lex" {BufferLexeme(1); return(SHARP);} break; case 20: + + # line 35 "../Parse.lex" {BufferLexeme(1); return(LESS);} break; case 21: + + # line 36 "../Parse.lex" {BufferLexeme(1); return(GREATER);} break; case 22: + + # line 37 "../Parse.lex" {BufferLexeme(1); return(LSEQUAL);} break; case 23: + + # line 38 "../Parse.lex" {BufferLexeme(1); return(SUBTYPE);} break; case 24: + + # line 39 "../Parse.lex" {BufferLexeme(1); return(GREQUAL);} break; case 25: + + # line 40 "../Parse.lex" {BufferLexeme(1); return(DOTDOT);} break; case 26: + + # line 41 "../Parse.lex" {BufferLexeme(1); return(COLON);} break; case 27: + + # line 42 "../Parse.lex" {BufferLexeme(1); return(RPAREN);} break; case 28: + + # line 43 "../Parse.lex" {BufferLexeme(1); return(RBRACKET);} break; case 29: + + # line 44 "../Parse.lex" {BufferLexeme(1); return(RBRACE);} break; case 30: + + # line 45 "../Parse.lex" {BufferLexeme(1); return(BAR);} break; case 31: + + # line 47 "../Parse.lex" {PTRKEYWORDENTRY tempp; if ((tempp=lookup(yytext))!=NULL){ CapBufferLexeme(1); *************** *** 141,160 **** --- 272,301 ---- else {BufferLexeme(1); return(IDENT);}} break; case 32: + + # line 53 "../Parse.lex" {BufferLexeme(1); return(CARD_CONST);} break; case 33: + + # line 55 "../Parse.lex" {BufferLexeme(1); return(REAL_CONST);} break; case 34: + + # line 57 "../Parse.lex" { BufferLexeme(1); return(STR_CONST);} break; case 35: + + # line 60 "../Parse.lex" { BufferLexeme(1); return(STR_CONST);} break; case 36: + + # line 63 "../Parse.lex" { BufferLexeme(0); /* Due to bison bug, we return 0 explicitly instead of ENDOFFILE. */ *************** *** 162,182 **** } break; case 37: {BufferLexeme(0);return(MODUNIT);} break; case 38: {BufferLexeme(0);return(DEFUNIT);} break; case 39: {BufferLexeme(1); return(BAD);} break; case -1: break; default: ! fprintf(yyout,"bad switch yylook %d",nstr); } return(0); } /* end of yylex */ ! int yyvstop[] ={ 0, 36, --- 303,329 ---- } break; case 37: + + # line 68 "../Parse.lex" {BufferLexeme(0);return(MODUNIT);} break; case 38: + + # line 69 "../Parse.lex" {BufferLexeme(0);return(DEFUNIT);} break; case 39: + + # line 70 "../Parse.lex" {BufferLexeme(1); return(BAD);} break; case -1: break; default: ! (void)fprintf(yyout,"bad switch yylook %d",nstr); } return(0); } /* end of yylex */ ! int yyvstop[] = { 0, 36, *************** *** 371,377 **** 0, 0}; # define YYTYPE unsigned char ! struct yywork { YYTYPE verify, advance; } yycrank[] ={ 0,0, 0,0, 1,9, 1,10, 1,11, 44,0, 1,12, 47,0, 0,0, 0,0, 1,13, 1,14, --- 518,524 ---- 0, 0}; # define YYTYPE unsigned char ! struct yywork { YYTYPE verify, advance; } yycrank[] = { 0,0, 0,0, 1,9, 1,10, 1,11, 44,0, 1,12, 47,0, 0,0, 0,0, 1,13, 1,14, *************** *** 535,541 **** 54,65, 54,65, 54,65, 54,65, 54,65, 0,0, 0,0, 0,0, 0,0}; ! struct yysvf yysvec[] ={ 0, 0, 0, yycrank+-1, 0, 0, yycrank+-39, yysvec+1, 0, --- 682,688 ---- 54,65, 54,65, 54,65, 54,65, 54,65, 0,0, 0,0, 0,0, 0,0}; ! struct yysvf yysvec[] = { 0, 0, 0, yycrank+-1, 0, 0, yycrank+-39, yysvec+1, 0, *************** *** 608,671 **** 0, 0, 0}; struct yywork *yytop = yycrank+644; struct yysvf *yybgin = yysvec+1; ! char yymatch[] ={ ! 00 ,01 ,02 ,03 ,03 ,05 ,03 ,03 , ! 03 ,011 ,012 ,03 ,011 ,011 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! ' ' ,03 ,'"' ,03 ,03 ,03 ,03 ,047 , ! 03 ,03 ,03 ,'+' ,03 ,'+' ,'.' ,03 , ! '0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' , ! '0' ,'0' ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,'A' ,'A' ,'A' ,'D' ,'D' ,'A' ,'G' , ! 'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' , ! 'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' , ! 'X' ,'G' ,'G' ,03 ,0134,03 ,03 ,'_' , ! 03 ,'A' ,'A' ,'A' ,'D' ,'D' ,'A' ,'G' , ! 'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' , ! 'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' ,'G' , ! 'X' ,'G' ,'G' ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , ! 03 ,03 ,03 ,03 ,03 ,03 ,03 ,03 , 0}; ! char yyextra[] ={ 0,1,1,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0, 0}; ! /* ncform 4.1 83/08/11 */ int yylineno =1; # define YYU(x) x # define NLSTATE yyprevious=YYNEWLINE - char yytext[YYLMAX]; struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; char yysbuf[YYLMAX]; char *yysptr = yysbuf; int *yyfnd; extern struct yysvf *yyestate; int yyprevious = YYNEWLINE; ! yylook(){ register struct yysvf *yystate, **lsp; register struct yywork *yyt; struct yysvf *yyz; ! int yych; struct yywork *yyr; # ifdef LEXDEBUG int debug; --- 755,829 ---- 0, 0, 0}; struct yywork *yytop = yycrank+644; struct yysvf *yybgin = yysvec+1; ! char yymatch[] = { ! 0, 1, 2, 3, 3, 5, 3, 3, ! 3, 9, 10, 3, 9, 9, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 32, 3, 34, 3, 3, 3, 3, 39, ! 3, 3, 3, 43, 3, 43, 46, 3, ! 48, 48, 48, 48, 48, 48, 48, 48, ! 48, 48, 3, 3, 3, 3, 3, 3, ! 3, 65, 65, 65, 68, 68, 65, 71, ! 71, 71, 71, 71, 71, 71, 71, 71, ! 71, 71, 71, 71, 71, 71, 71, 71, ! 88, 71, 71, 3, 92, 3, 3, 95, ! 3, 65, 65, 65, 68, 68, 65, 71, ! 71, 71, 71, 71, 71, 71, 71, 71, ! 71, 71, 71, 71, 71, 71, 71, 71, ! 88, 71, 71, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, ! 3, 3, 3, 3, 3, 3, 3, 3, 0}; ! char yyextra[] = { 0,1,1,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0, 0}; ! /* Copyright (c) 1989 AT&T */ ! /* All Rights Reserved */ ! ! /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ ! /* The copyright notice above does not evidence any */ ! /* actual or intended publication of such source code. */ + #pragma ident "@(#)ncform 6.8 95/02/11 SMI" + int yylineno =1; # define YYU(x) x # define NLSTATE yyprevious=YYNEWLINE struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; char yysbuf[YYLMAX]; char *yysptr = yysbuf; int *yyfnd; extern struct yysvf *yyestate; int yyprevious = YYNEWLINE; ! #if defined(__cplusplus) || defined(__STDC__) ! int yylook(void) ! #else ! yylook() ! #endif ! { register struct yysvf *yystate, **lsp; register struct yywork *yyt; struct yysvf *yyz; ! int yych, yyfirst; struct yywork *yyr; # ifdef LEXDEBUG int debug; *************** *** 675,680 **** --- 833,839 ---- # ifdef LEXDEBUG debug = 0; # endif + yyfirst=1; if (!yymorfg) yylastch = yytext; else { *************** *** 690,705 **** if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1); # endif yyt = yystate->yystoff; ! if(yyt == yycrank){ /* may not be any transitions */ yyz = yystate->yyother; if(yyz == 0)break; if(yyz->yystoff == yycrank)break; } *yylastch++ = yych = input(); tryagain: # ifdef LEXDEBUG if(debug){ ! fprintf(yyout,"unsigned char "); allprint(yych); putchar('\n'); } --- 849,873 ---- if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1); # endif yyt = yystate->yystoff; ! if(yyt == yycrank && !yyfirst){ /* may not be any transitions */ yyz = yystate->yyother; if(yyz == 0)break; if(yyz->yystoff == yycrank)break; } + #ifndef __cplusplus *yylastch++ = yych = input(); + #else + *yylastch++ = yych = lex_input(); + #endif + if(yylastch > &yytext[YYLMAX]) { + fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); + exit(1); + } + yyfirst=0; tryagain: # ifdef LEXDEBUG if(debug){ ! fprintf(yyout,"char "); allprint(yych); putchar('\n'); } *************** *** 711,716 **** --- 879,888 ---- if(yyt->advance+yysvec == YYLERR) /* error transitions */ {unput(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; + if(lsp > &yylstate[YYLMAX]) { + fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); + exit(1); + } goto contin; } } *************** *** 725,730 **** --- 897,906 ---- if(yyt->advance+yysvec == YYLERR) /* error transitions */ {unput(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; + if(lsp > &yylstate[YYLMAX]) { + fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); + exit(1); + } goto contin; } yyt = yyr + YYU(yymatch[yych]); *************** *** 739,744 **** --- 915,924 ---- if(yyt->advance+yysvec == YYLERR) /* error transition */ {unput(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; + if(lsp > &yylstate[YYLMAX]) { + fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); + exit(1); + } goto contin; } } *************** *** 798,832 **** yysptr=yysbuf; return(0); } yyprevious = yytext[0] = input(); if (yyprevious>0) output(yyprevious); yylastch=yytext; # ifdef LEXDEBUG if(debug)putchar('\n'); # endif } } yyback(p, m) int *p; { ! if (p==0) return(0); ! while (*p) ! { ! if (*p++ == m) ! return(1); } ! return(0); } /* the following are only used in the lex library */ ! yyinput(){ return(input()); } yyoutput(c) ! int c; { output(c); } yyunput(c) ! int c; { unput(c); } --- 978,1044 ---- yysptr=yysbuf; return(0); } + #ifndef __cplusplus yyprevious = yytext[0] = input(); if (yyprevious>0) output(yyprevious); + #else + yyprevious = yytext[0] = lex_input(); + if (yyprevious>0) + lex_output(yyprevious); + #endif yylastch=yytext; # ifdef LEXDEBUG if(debug)putchar('\n'); # endif } } + #if defined(__cplusplus) || defined(__STDC__) + int yyback(int *p, int m) + #else yyback(p, m) int *p; + #endif { ! if (p==0) return(0); ! while (*p) { ! if (*p++ == m) ! return(1); } ! return(0); } /* the following are only used in the lex library */ ! #if defined(__cplusplus) || defined(__STDC__) ! int yyinput(void) ! #else ! yyinput() ! #endif ! { ! #ifndef __cplusplus return(input()); + #else + return(lex_input()); + #endif } + #if defined(__cplusplus) || defined(__STDC__) + void yyoutput(int c) + #else yyoutput(c) ! int c; ! #endif ! { ! #ifndef __cplusplus output(c); + #else + lex_output(c); + #endif } + #if defined(__cplusplus) || defined(__STDC__) + void yyunput(int c) + #else yyunput(c) ! int c; ! #endif ! { unput(c); } Index: m3/pm3/language/modula3/m3tools/pp/src/lex-yacc/y.tab.c diff -c m3/pm3/language/modula3/m3tools/pp/src/lex-yacc/y.tab.c:1.1.1.1 m3/pm3/language/modula3/m3tools/pp/src/lex-yacc/y.tab.c:1.2 *** m3/pm3/language/modula3/m3tools/pp/src/lex-yacc/y.tab.c:1.1.1.1 Thu Jan 16 16:31:51 1997 --- m3/pm3/language/modula3/m3tools/pp/src/lex-yacc/y.tab.c Thu Apr 29 23:53:50 1999 *************** *** 1,114 **** ! /* A Bison parser, made from ../Parse.yacc with Bison version GNU Bison version 1.22 */ #define YYBISON 1 /* Identify Bison output. */ ! #define ENDOFFILE 258 ! #define AMPERSAND 259 ! #define ASSIGN 260 ! #define ASTERISK 261 ! #define BAR 262 ! #define COLON 263 ! #define COMMA 264 ! #define DOT 265 ! #define DOTDOT 266 ! #define EQUAL 267 ! #define GREATER 268 ! #define GREQUAL 269 ! #define LESS 270 ! #define LSEQUAL 271 ! #define MINUS 272 ! #define SHARP 273 ! #define PERIOD 274 ! #define PLUS 275 ! #define RARROW 276 ! #define RBRACE 277 ! #define RBRACKET 278 ! #define RPAREN 279 ! #define SEMICOLON 280 ! #define SLASH 281 ! #define SUBTYPE 282 ! #define UPARROW 283 ! #define LPAREN 284 ! #define LBRACKET 285 ! #define LBRACE 286 ! #define IDENT 287 ! #define CARD_CONST 288 ! #define REAL_CONST 289 ! #define CHAR_CONST 290 ! #define STR_CONST 291 ! #define PR_EXTERNAL 292 ! #define PR_INLINE 293 ! #define PR_OBSOLETE 294 ! #define PR_UNUSED 295 ! #define AND 296 ! #define ANY 297 ! #define ARRAY 298 ! #define AS 299 ! #define BGN 300 ! #define BITS 301 ! #define BRANDED 302 ! #define BY 303 ! #define CASE 304 ! #define CONST 305 ! #define DIV 306 ! #define DO 307 ! #define ELSE 308 ! #define ELSIF 309 ! #define END 310 ! #define EVAL 311 ! #define EXCEPT 312 ! #define EXCEPTION 313 ! #define EXIT 314 ! #define EXPORTS 315 ! #define FINALLY 316 ! #define FOR 317 ! #define FROM 318 ! #define GENERIC 319 ! #define IF 320 ! #define IMPORT 321 ! #define IN 322 ! #define INTERFACE 323 ! #define LOCK 324 ! #define LOOP 325 ! #define METHODS 326 ! #define MOD 327 ! #define MODULE 328 ! #define NOT 329 ! #define OBJECT 330 ! #define OF 331 ! #define OR 332 ! #define OVERRIDES 333 ! #define PROCEDURE 334 ! #define RAISE 335 ! #define RAISES 336 ! #define READONLY 337 ! #define RECORD 338 ! #define REF 339 ! #define REPEAT 340 ! #define RETURN 341 ! #define REVEAL 342 ! #define ROOT 343 ! #define SET 344 ! #define THEN 345 ! #define TO 346 ! #define TRY 347 ! #define TYPE 348 ! #define TYPECASE 349 ! #define UNSAFE 350 ! #define UNTIL 351 ! #define UNTRACED 352 ! #define VALUE 353 ! #define VAR 354 ! #define WHILE 355 ! #define WITH 356 ! #define BAD 357 ! #define WHITESPACE 358 ! #define MODUNIT 359 ! #define DEFUNIT 360 ! #line 91 "../Parse.yacc" #define lexbufsize 500 --- 1,115 ---- ! /* A Bison parser, made from ../Parse.yacc ! by GNU Bison version 1.27 */ #define YYBISON 1 /* Identify Bison output. */ ! #define ENDOFFILE 257 ! #define AMPERSAND 258 ! #define ASSIGN 259 ! #define ASTERISK 260 ! #define BAR 261 ! #define COLON 262 ! #define COMMA 263 ! #define DOT 264 ! #define DOTDOT 265 ! #define EQUAL 266 ! #define GREATER 267 ! #define GREQUAL 268 ! #define LESS 269 ! #define LSEQUAL 270 ! #define MINUS 271 ! #define SHARP 272 ! #define PERIOD 273 ! #define PLUS 274 ! #define RARROW 275 ! #define RBRACE 276 ! #define RBRACKET 277 ! #define RPAREN 278 ! #define SEMICOLON 279 ! #define SLASH 280 ! #define SUBTYPE 281 ! #define UPARROW 282 ! #define LPAREN 283 ! #define LBRACKET 284 ! #define LBRACE 285 ! #define IDENT 286 ! #define CARD_CONST 287 ! #define REAL_CONST 288 ! #define CHAR_CONST 289 ! #define STR_CONST 290 ! #define PR_EXTERNAL 291 ! #define PR_INLINE 292 ! #define PR_OBSOLETE 293 ! #define PR_UNUSED 294 ! #define AND 295 ! #define ANY 296 ! #define ARRAY 297 ! #define AS 298 ! #define BGN 299 ! #define BITS 300 ! #define BRANDED 301 ! #define BY 302 ! #define CASE 303 ! #define CONST 304 ! #define DIV 305 ! #define DO 306 ! #define ELSE 307 ! #define ELSIF 308 ! #define END 309 ! #define EVAL 310 ! #define EXCEPT 311 ! #define EXCEPTION 312 ! #define EXIT 313 ! #define EXPORTS 314 ! #define FINALLY 315 ! #define FOR 316 ! #define FROM 317 ! #define GENERIC 318 ! #define IF 319 ! #define IMPORT 320 ! #define IN 321 ! #define INTERFACE 322 ! #define LOCK 323 ! #define LOOP 324 ! #define METHODS 325 ! #define MOD 326 ! #define MODULE 327 ! #define NOT 328 ! #define OBJECT 329 ! #define OF 330 ! #define OR 331 ! #define OVERRIDES 332 ! #define PROCEDURE 333 ! #define RAISE 334 ! #define RAISES 335 ! #define READONLY 336 ! #define RECORD 337 ! #define REF 338 ! #define REPEAT 339 ! #define RETURN 340 ! #define REVEAL 341 ! #define ROOT 342 ! #define SET 343 ! #define THEN 344 ! #define TO 345 ! #define TRY 346 ! #define TYPE 347 ! #define TYPECASE 348 ! #define UNSAFE 349 ! #define UNTIL 350 ! #define UNTRACED 351 ! #define VALUE 352 ! #define VAR 353 ! #define WHILE 354 ! #define WITH 355 ! #define BAD 356 ! #define WHITESPACE 357 ! #define MODUNIT 358 ! #define DEFUNIT 359 ! #line 92 "../Parse.yacc" #define lexbufsize 500 *************** *** 182,204 **** typedef enum {NonOptimal, OptimalBreak, OptimalNoBreak} Formatter_BreakType; - - #ifndef YYLTYPE - typedef - struct yyltype - { - int timestamp; - int first_line; - int first_column; - int last_line; - int last_column; - char *text; - } - yyltype; - - #define YYLTYPE yyltype - #endif - #ifndef YYSTYPE #define YYSTYPE int #endif --- 183,188 ---- *************** *** 216,222 **** #define YYFLAG -32768 #define YYNTBASE 106 ! #define YYTRANSLATE(x) ((unsigned)(x) <= 360 ? yytranslate[x] : 488) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, --- 200,206 ---- #define YYFLAG -32768 #define YYNTBASE 106 ! #define YYTRANSLATE(x) ((unsigned)(x) <= 359 ? yytranslate[x] : 488) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, *************** *** 244,260 **** 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, ! 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ! 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, ! 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, ! 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, ! 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, ! 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, ! 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ! 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, ! 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, ! 96, 97, 98, 99, 100, 101, 102, 103, 104, 105 }; #if YYDEBUG != 0 --- 228,244 ---- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, ! 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ! 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, ! 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, ! 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, ! 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, ! 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, ! 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, ! 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, ! 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, ! 97, 98, 99, 100, 101, 102, 103, 104, 105 }; #if YYDEBUG != 0 *************** *** 574,642 **** #if YYDEBUG != 0 static const short yyrline[] = { 0, ! 206, 207, 208, 208, 209, 209, 212, 214, 217, 219, ! 222, 224, 225, 226, 229, 231, 234, 236, 237, 240, ! 242, 243, 244, 245, 246, 249, 254, 258, 262, 266, ! 273, 280, 282, 285, 287, 290, 292, 295, 297, 300, ! 302, 303, 304, 307, 311, 315, 317, 320, 322, 323, ! 324, 325, 326, 327, 328, 329, 330, 331, 332, 335, ! 337, 338, 339, 340, 343, 345, 348, 351, 354, 356, ! 359, 361, 364, 366, 369, 373, 376, 381, 384, 387, ! 390, 393, 397, 401, 403, 406, 408, 409, 412, 414, ! 415, 416, 419, 421, 424, 428, 432, 434, 435, 436, ! 439, 441, 442, 445, 447, 448, 453, 455, 456, 460, ! 462, 466, 468, 471, 473, 476, 478, 479, 480, 481, ! 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, ! 492, 493, 494, 497, 502, 506, 508, 511, 513, 516, ! 520, 522, 525, 527, 530, 534, 539, 546, 548, 551, ! 555, 557, 560, 562, 565, 569, 573, 577, 581, 585, ! 587, 590, 594, 596, 599, 601, 604, 606, 609, 611, ! 614, 616, 619, 621, 624, 628, 632, 634, 637, 641, ! 643, 646, 648, 651, 653, 658, 660, 663, 665, 666, ! 667, 668, 671, 675, 677, 680, 682, 683, 684, 685, ! 686, 687, 688, 689, 692, 694, 698, 700, 701, 702, ! 705, 707, 710, 714, 716, 719, 721, 724, 726, 727, ! 730, 732, 733, 734, 737, 739, 742, 745, 749, 751, ! 752, 753, 756, 758, 761, 763, 764, 767, 769, 770, ! 773, 775, 776, 777, 780, 782, 785, 789, 795, 796, ! 796, 798, 799, 799, 801, 801, 803, 804, 804, 805, ! 805, 805, 805, 805, 805, 805, 807, 808, 808, 809, ! 809, 809, 811, 812, 812, 813, 813, 813, 813, 815, ! 815, 815, 818, 820, 820, 820, 820, 820, 821, 821, ! 823, 825, 828, 830, 833, 834, 835, 836, 837, 843, ! 844, 844, 846, 847, 847, 849, 849, 851, 852, 852, ! 854, 855, 855, 857, 858, 858, 860, 860, 860, 862, ! 863, 864, 865, 866, 867, 868, 869, 870, 873, 873, ! 873, 873, 875, 877, 880, 882, 885, 886, 887, 888, ! 889, 892, 894, 901, 903, 904, 904, 906, 908, 909, ! 910, 911, 916, 918, 921, 923, 926, 928, 931, 933, ! 936, 938, 939, 942, 944, 947, 949, 952, 954, 960, ! 960, 961, 961, 962, 962, 963, 963, 964, 964, 965, ! 965, 966, 966, 967, 967, 968, 968, 969, 969, 970, ! 970, 971, 971, 972, 972, 973, 973, 974, 974, 975, ! 975, 976, 976, 977, 977, 978, 978, 979, 979, 980, ! 980, 981, 982, 982, 983, 983, 984, 984, 987, 987, ! 988, 988, 989, 989, 990, 990, 995, 995, 996, 996, ! 997, 997, 998, 998, 1000, 1000, 1001, 1001, 1002, 1002, ! 1003, 1003, 1004, 1004, 1005, 1005, 1007, 1007, 1008, 1008, ! 1009, 1009, 1010, 1010, 1011, 1011, 1012, 1012, 1013, 1013, ! 1014, 1014, 1015, 1015, 1016, 1016, 1017, 1017, 1018, 1018, ! 1019, 1019, 1020, 1020, 1021, 1021, 1022, 1022, 1023, 1023, ! 1024, 1024, 1025, 1025, 1026, 1026, 1027, 1027, 1028, 1028, ! 1029, 1029, 1030, 1030, 1031, 1031, 1032, 1032, 1033, 1033, ! 1034, 1034, 1035, 1035, 1036, 1036, 1037, 1037, 1038, 1038, ! 1039, 1039, 1040, 1040, 1041, 1041, 1042, 1042, 1043, 1043, ! 1044, 1044, 1045, 1045, 1046, 1046, 1049, 1049, 1050, 1050, ! 1051, 1051, 1052, 1052, 1053, 1053, 1054, 1054, 1055, 1055, ! 1056, 1056, 1057, 1057, 1058, 1058, 1059, 1059, 1060, 1060, ! 1061, 1061, 1062, 1062, 1063, 1063, 1064, 1064, 1065, 1065, ! 1066, 1066, 1067, 1067, 1068, 1068, 1069, 1069, 1073, 1077, ! 1079, 1084, 1085, 1086, 1087, 1088, 1089, 1091, 1092, 1093, ! 1095, 1096, 1097, 1099, 1100, 1101, 1103, 1105, 1106, 1107, ! 1108, 1110, 1112, 1113, 1114, 1116, 1117 }; ! static const char * const yytname[] = { "$","error","$illegal.","ENDOFFILE", "AMPERSAND","ASSIGN","ASTERISK","BAR","COLON","COMMA","DOT","DOTDOT","EQUAL", "GREATER","GREQUAL","LESS","LSEQUAL","MINUS","SHARP","PERIOD","PLUS","RARROW", "RBRACE","RBRACKET","RPAREN","SEMICOLON","SLASH","SUBTYPE","UPARROW","LPAREN", --- 558,630 ---- #if YYDEBUG != 0 static const short yyrline[] = { 0, ! 207, 208, 209, 209, 210, 210, 213, 215, 218, 220, ! 223, 225, 226, 227, 230, 232, 235, 237, 238, 241, ! 243, 244, 245, 246, 247, 250, 255, 259, 263, 267, ! 274, 281, 283, 286, 288, 291, 293, 296, 298, 301, ! 303, 304, 305, 308, 312, 316, 318, 321, 323, 324, ! 325, 326, 327, 328, 329, 330, 331, 332, 333, 336, ! 338, 339, 340, 341, 344, 346, 349, 352, 355, 357, ! 360, 362, 365, 367, 370, 374, 377, 382, 385, 388, ! 391, 394, 398, 402, 404, 407, 409, 410, 413, 415, ! 416, 417, 420, 422, 425, 429, 433, 435, 436, 437, ! 440, 442, 443, 446, 448, 449, 454, 456, 457, 461, ! 463, 467, 469, 472, 474, 477, 479, 480, 481, 482, ! 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, ! 493, 494, 495, 498, 503, 507, 509, 512, 514, 517, ! 521, 523, 526, 528, 531, 535, 540, 547, 549, 552, ! 556, 558, 561, 563, 566, 570, 574, 578, 582, 586, ! 588, 591, 595, 597, 600, 602, 605, 607, 610, 612, ! 615, 617, 620, 622, 625, 629, 633, 635, 638, 642, ! 644, 647, 649, 652, 654, 659, 661, 664, 666, 667, ! 668, 669, 672, 676, 678, 681, 683, 684, 685, 686, ! 687, 688, 689, 690, 693, 695, 699, 701, 702, 703, ! 706, 708, 711, 715, 717, 720, 722, 725, 727, 728, ! 731, 733, 734, 735, 738, 740, 743, 746, 750, 752, ! 753, 754, 757, 759, 762, 764, 765, 768, 770, 771, ! 774, 776, 777, 778, 781, 783, 786, 790, 796, 797, ! 797, 799, 800, 800, 802, 802, 804, 805, 805, 806, ! 806, 806, 806, 806, 806, 806, 808, 809, 809, 810, ! 810, 810, 812, 813, 813, 814, 814, 814, 814, 816, ! 816, 816, 819, 821, 821, 821, 821, 821, 822, 822, ! 824, 826, 829, 831, 834, 835, 836, 837, 838, 844, ! 845, 845, 847, 848, 848, 850, 850, 852, 853, 853, ! 855, 856, 856, 858, 859, 859, 861, 861, 861, 863, ! 864, 865, 866, 867, 868, 869, 870, 871, 874, 874, ! 874, 874, 876, 878, 881, 883, 886, 887, 888, 889, ! 890, 893, 895, 902, 904, 905, 905, 907, 909, 910, ! 911, 912, 917, 919, 922, 924, 927, 929, 932, 934, ! 937, 939, 940, 943, 945, 948, 950, 953, 955, 961, ! 961, 962, 962, 963, 963, 964, 964, 965, 965, 966, ! 966, 967, 967, 968, 968, 969, 969, 970, 970, 971, ! 971, 972, 972, 973, 973, 974, 974, 975, 975, 976, ! 976, 977, 977, 978, 978, 979, 979, 980, 980, 981, ! 981, 982, 983, 983, 984, 984, 985, 985, 988, 988, ! 989, 989, 990, 990, 991, 991, 996, 996, 997, 997, ! 998, 998, 999, 999, 1001, 1001, 1002, 1002, 1003, 1003, ! 1004, 1004, 1005, 1005, 1006, 1006, 1008, 1008, 1009, 1009, ! 1010, 1010, 1011, 1011, 1012, 1012, 1013, 1013, 1014, 1014, ! 1015, 1015, 1016, 1016, 1017, 1017, 1018, 1018, 1019, 1019, ! 1020, 1020, 1021, 1021, 1022, 1022, 1023, 1023, 1024, 1024, ! 1025, 1025, 1026, 1026, 1027, 1027, 1028, 1028, 1029, 1029, ! 1030, 1030, 1031, 1031, 1032, 1032, 1033, 1033, 1034, 1034, ! 1035, 1035, 1036, 1036, 1037, 1037, 1038, 1038, 1039, 1039, ! 1040, 1040, 1041, 1041, 1042, 1042, 1043, 1043, 1044, 1044, ! 1045, 1045, 1046, 1046, 1047, 1047, 1050, 1050, 1051, 1051, ! 1052, 1052, 1053, 1053, 1054, 1054, 1055, 1055, 1056, 1056, ! 1057, 1057, 1058, 1058, 1059, 1059, 1060, 1060, 1061, 1061, ! 1062, 1062, 1063, 1063, 1064, 1064, 1065, 1065, 1066, 1066, ! 1067, 1067, 1068, 1068, 1069, 1069, 1070, 1070, 1074, 1078, ! 1080, 1085, 1086, 1087, 1088, 1089, 1090, 1092, 1093, 1094, ! 1096, 1097, 1098, 1100, 1101, 1102, 1104, 1106, 1107, 1108, ! 1109, 1111, 1113, 1114, 1115, 1117, 1118 }; + #endif + + + #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) ! static const char * const yytname[] = { "$","error","$undefined.","ENDOFFILE", "AMPERSAND","ASSIGN","ASTERISK","BAR","COLON","COMMA","DOT","DOTDOT","EQUAL", "GREATER","GREQUAL","LESS","LSEQUAL","MINUS","SHARP","PERIOD","PLUS","RARROW", "RBRACE","RBRACKET","RPAREN","SEMICOLON","SLASH","SUBTYPE","UPARROW","LPAREN", *************** *** 689,695 **** "@93","Type","@94","Typecase","@95","Unsafe","@96","Until","@97","Untraced", "@98","Value","@99","Var","@100","While","@101","With","@102","InitialNPS","NPS", "G","B0","B","B2","E","EF","A","AO","AX","V","VZ","VC","Z","SP","XSP","BL","AL2", ! "AL3","ALZ5","EA","ALNL","SPNL","QSP","NL","Inc","Dec","" }; #endif --- 677,683 ---- "@93","Type","@94","Typecase","@95","Unsafe","@96","Until","@97","Untraced", "@98","Value","@99","Var","@100","While","@101","With","@102","InitialNPS","NPS", "G","B0","B","B2","E","EF","A","AO","AX","V","VZ","VC","Z","SP","XSP","BL","AL2", ! "AL3","ALZ5","EA","ALNL","SPNL","QSP","NL","Inc","Dec", NULL }; #endif *************** *** 1945,1958 **** -1, -1, 1411 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ ! #line 3 "/contrib/share/lib/bison.simple" /* Skeleton output parser for bison, ! Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, --- 1933,1947 ---- -1, -1, 1411 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ ! #line 3 "/p/gnu/lib/bison-1.27/bison.simple" ! /* This file comes from bison-1.27. */ /* Skeleton output parser for bison, ! Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, *************** *** 1962,2003 **** You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ ! #ifndef alloca #ifdef __GNUC__ #define alloca __builtin_alloca #else /* not GNU C. */ ! #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) #include #else /* not sparc */ ! #if defined (MSDOS) && !defined (__TURBOC__) #include #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) ! #include #pragma alloca ! #else /* not MSDOS, __TURBOC__, or _AIX */ ! #ifdef __hpux ! #ifdef __cplusplus ! extern "C" { ! void *alloca (unsigned int); ! }; ! #else /* not __cplusplus */ ! void *alloca (); ! #endif /* not __cplusplus */ #endif /* __hpux */ #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ ! #endif /* not sparc. */ ! #endif /* not GNU C. */ ! #endif /* alloca not defined. */ ! /* This is the parser code that is written into each bison parser ! when the %semantic_parser declaration is not specified in the grammar. ! It was written by Richard Stallman by simplifying the hairy parser ! used when %semantic_parser is specified. */ /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action --- 1951,2016 ---- You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, ! Boston, MA 02111-1307, USA. */ + /* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ ! /* This is the parser code that is written into each bison parser ! when the %semantic_parser declaration is not specified in the grammar. ! It was written by Richard Stallman by simplifying the hairy parser ! used when %semantic_parser is specified. */ ! ! #ifndef YYSTACK_USE_ALLOCA ! #ifdef alloca ! #define YYSTACK_USE_ALLOCA ! #else /* alloca not defined */ #ifdef __GNUC__ + #define YYSTACK_USE_ALLOCA #define alloca __builtin_alloca #else /* not GNU C. */ ! #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) ! #define YYSTACK_USE_ALLOCA #include #else /* not sparc */ ! /* We think this test detects Watcom and Microsoft C. */ ! /* This used to test MSDOS, but that is a bad idea ! since that symbol is in the user namespace. */ ! #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) ! #if 0 /* No need for malloc.h, which pollutes the namespace; ! instead, just don't use alloca. */ #include + #endif #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) ! /* I don't know what this was needed for, but it pollutes the namespace. ! So I turned it off. rms, 2 May 1997. */ ! /* #include */ #pragma alloca ! #define YYSTACK_USE_ALLOCA ! #else /* not MSDOS, or __TURBOC__, or _AIX */ ! #if 0 ! #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, ! and on HPUX 10. Eventually we can turn this on. */ ! #define YYSTACK_USE_ALLOCA ! #define alloca __builtin_alloca #endif /* __hpux */ + #endif #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ ! #endif /* not sparc */ ! #endif /* not GNU C */ ! #endif /* alloca not defined */ ! #endif /* YYSTACK_USE_ALLOCA not defined */ ! #ifdef YYSTACK_USE_ALLOCA ! #define YYSTACK_ALLOC alloca ! #else ! #define YYSTACK_ALLOC malloc ! #endif /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action *************** *** 2007,2014 **** #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 ! #define YYACCEPT return(0) ! #define YYABORT return(1) #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the --- 2020,2027 ---- #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 ! #define YYACCEPT goto yyacceptlab ! #define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the *************** *** 2037,2046 **** --- 2050,2067 ---- #ifdef YYPURE #ifdef YYLSP_NEEDED + #ifdef YYLEX_PARAM + #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) + #else #define YYLEX yylex(&yylval, &yylloc) + #endif + #else /* not YYLSP_NEEDED */ + #ifdef YYLEX_PARAM + #define YYLEX yylex(&yylval, YYLEX_PARAM) #else #define YYLEX yylex(&yylval) #endif + #endif /* not YYLSP_NEEDED */ #endif /* If nonreentrant, generate the variables here */ *************** *** 2081,2104 **** #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif - - /* Prevent warning if -Wstrict-prototypes. */ - #ifdef __GNUC__ - int yyparse (void); - #endif #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ ! #define __yy_bcopy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void ! __yy_bcopy (from, to, count) ! char *from; char *to; ! int count; { register char *f = from; register char *t = to; --- 2102,2125 ---- #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif + /* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ ! #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void ! __yy_memcpy (to, from, count) char *to; ! char *from; ! unsigned int count; { register char *f = from; register char *t = to; *************** *** 2113,2122 **** /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void ! __yy_bcopy (char *from, char *to, int count) { - register char *f = from; register char *t = to; register int i = count; while (i-- > 0) --- 2134,2143 ---- /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void ! __yy_memcpy (char *to, char *from, unsigned int count) { register char *t = to; + register char *f = from; register int i = count; while (i-- > 0) *************** *** 2126,2134 **** #endif #endif ! #line 184 "/contrib/share/lib/bison.simple" int ! yyparse() { register int yystate; register int yyn; --- 2147,2185 ---- #endif #endif ! #line 216 "/p/gnu/lib/bison-1.27/bison.simple" ! ! /* The user can define YYPARSE_PARAM as the name of an argument to be passed ! into yyparse. The argument should have type void *. ! It should actually point to an object. ! Grammar actions can access the variable by casting it ! to the proper pointer type. */ ! ! #ifdef YYPARSE_PARAM ! #ifdef __cplusplus ! #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM ! #define YYPARSE_PARAM_DECL ! #else /* not __cplusplus */ ! #define YYPARSE_PARAM_ARG YYPARSE_PARAM ! #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; ! #endif /* not __cplusplus */ ! #else /* not YYPARSE_PARAM */ ! #define YYPARSE_PARAM_ARG ! #define YYPARSE_PARAM_DECL ! #endif /* not YYPARSE_PARAM */ ! ! /* Prevent warning if -Wstrict-prototypes. */ ! #ifdef __GNUC__ ! #ifdef YYPARSE_PARAM ! int yyparse (void *); ! #else ! int yyparse (void); ! #endif ! #endif ! int ! yyparse(YYPARSE_PARAM_ARG) ! YYPARSE_PARAM_DECL { register int yystate; register int yyn; *************** *** 2154,2159 **** --- 2205,2211 ---- #endif int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; #ifdef YYPURE int yychar; *************** *** 2238,2255 **** if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; ! yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); ! __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); ! yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); ! __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); #ifdef YYLSP_NEEDED ! yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); ! __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp)); #endif #endif /* no yyoverflow */ --- 2290,2321 ---- if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); + #ifdef YYLSP_NEEDED + free (yyls); + #endif + } return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; ! #ifndef YYSTACK_USE_ALLOCA ! yyfree_stacks = 1; ! #endif ! yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); ! __yy_memcpy ((char *)yyss, (char *)yyss1, ! size * (unsigned int) sizeof (*yyssp)); ! yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); ! __yy_memcpy ((char *)yyvs, (char *)yyvs1, ! size * (unsigned int) sizeof (*yyvsp)); #ifdef YYLSP_NEEDED ! yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); ! __yy_memcpy ((char *)yyls, (char *)yyls1, ! size * (unsigned int) sizeof (*yylsp)); #endif #endif /* no yyoverflow */ *************** *** 2410,2953 **** switch (yyn) { case 1: ! #line 207 "../Parse.yacc" { depth=0; ; break;} case 3: ! #line 208 "../Parse.yacc" { depth=0; ; break;} case 4: ! #line 208 "../Parse.yacc" { Flush(); ; break;} case 5: ! #line 209 "../Parse.yacc" { depth=0; ; break;} case 6: ! #line 209 "../Parse.yacc" { Flush(); ; break;} case 370: ! #line 960 "../Parse.yacc" { PR ("&");; break;} case 372: ! #line 961 "../Parse.yacc" { PR (":=");; break;} case 374: ! #line 962 "../Parse.yacc" { PR ("*");; break;} case 376: ! #line 963 "../Parse.yacc" { PR ("|");; break;} case 378: ! #line 964 "../Parse.yacc" { PR (":");; break;} case 380: ! #line 965 "../Parse.yacc" { PR (",");; break;} case 382: ! #line 966 "../Parse.yacc" { PR (".");; break;} case 384: ! #line 967 "../Parse.yacc" { PR ("..");; break;} case 386: ! #line 968 "../Parse.yacc" { PR ("=");; break;} case 388: ! #line 969 "../Parse.yacc" { PR (">");; break;} case 390: ! #line 970 "../Parse.yacc" { PR (">=");; break;} case 392: ! #line 971 "../Parse.yacc" { PR ("<");; break;} case 394: ! #line 972 "../Parse.yacc" { PR ("<=");; break;} case 396: ! #line 973 "../Parse.yacc" { PR ("-");; break;} case 398: ! #line 974 "../Parse.yacc" { PR ("\043");; break;} case 400: ! #line 975 "../Parse.yacc" { PR ("+");; break;} case 402: ! #line 976 "../Parse.yacc" { PR ("=>");; break;} case 404: ! #line 977 "../Parse.yacc" { PR ("}");; break;} case 406: ! #line 978 "../Parse.yacc" { PR ("]");; break;} case 408: ! #line 979 "../Parse.yacc" { PR (")");; break;} case 410: ! #line 980 "../Parse.yacc" { PR (";");; break;} case 412: ! #line 981 "../Parse.yacc" { PR (";");; break;} case 413: ! #line 982 "../Parse.yacc" { PR ("/");; break;} case 415: ! #line 983 "../Parse.yacc" { PR ("<:");; break;} case 417: ! #line 984 "../Parse.yacc" { PR ("^");; break;} case 419: ! #line 987 "../Parse.yacc" { PR ("("); ; break;} case 421: ! #line 988 "../Parse.yacc" { PR ("("); ; break;} case 423: ! #line 989 "../Parse.yacc" { PR ("["); ; break;} case 425: ! #line 990 "../Parse.yacc" { PR ("{"); ; break;} case 427: ! #line 995 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->fixedComment);; break;} case 429: ! #line 996 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->fixedComment);; break;} case 431: ! #line 997 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->fixedComment);; break;} case 433: ! #line 998 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->fixedComment);; break;} case 435: ! #line 1000 "../Parse.yacc" { PRID (&lexbuf[yyvsp[0]]);; break;} case 437: ! #line 1001 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->procName);; break;} case 439: ! #line 1002 "../Parse.yacc" { PR (&lexbuf[yyvsp[0]]);; break;} case 441: ! #line 1003 "../Parse.yacc" { PR (&lexbuf[yyvsp[0]]);; break;} case 443: ! #line 1004 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->fixed);; break;} case 445: ! #line 1005 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->fixed);; break;} case 447: ! #line 1007 "../Parse.yacc" { PK ("AND");; break;} case 449: ! #line 1008 "../Parse.yacc" { PK ("ANY");; break;} case 451: ! #line 1009 "../Parse.yacc" { PK ("ARRAY");; break;} case 453: ! #line 1010 "../Parse.yacc" { PK ("AS");; break;} case 455: ! #line 1011 "../Parse.yacc" { PK ("BEGIN");; break;} case 457: ! #line 1012 "../Parse.yacc" { PK ("BITS");; break;} case 459: ! #line 1013 "../Parse.yacc" { PK ("BRANDED");; break;} case 461: ! #line 1014 "../Parse.yacc" { PK ("BY");; break;} case 463: ! #line 1015 "../Parse.yacc" { PK ("CASE");; break;} case 465: ! #line 1016 "../Parse.yacc" { PK ("CONST");; break;} case 467: ! #line 1017 "../Parse.yacc" { PR ("DIV");; break;} case 469: ! #line 1018 "../Parse.yacc" { PK ("DO");; break;} case 471: ! #line 1019 "../Parse.yacc" { PK ("ELSE");; break;} case 473: ! #line 1020 "../Parse.yacc" { PK ("ELSIF");; break;} case 475: ! #line 1021 "../Parse.yacc" { PK ("END");; break;} case 477: ! #line 1022 "../Parse.yacc" { PK ("EVAL");; break;} case 479: ! #line 1023 "../Parse.yacc" { PK ("EXCEPT");; break;} case 481: ! #line 1024 "../Parse.yacc" { PK ("EXCEPTION");; break;} case 483: ! #line 1025 "../Parse.yacc" { PK ("EXIT");; break;} case 485: ! #line 1026 "../Parse.yacc" { PK ("EXPORTS");; break;} case 487: ! #line 1027 "../Parse.yacc" { PK ("FINALLY");; break;} case 489: ! #line 1028 "../Parse.yacc" { PK ("FOR");; break;} case 491: ! #line 1029 "../Parse.yacc" { PK ("FROM");; break;} case 493: ! #line 1030 "../Parse.yacc" { PK ("GENERIC");; break;} case 495: ! #line 1031 "../Parse.yacc" { PK ("IF");; break;} case 497: ! #line 1032 "../Parse.yacc" { PK ("IMPORT");; break;} case 499: ! #line 1033 "../Parse.yacc" { PK ("IN");; break;} case 501: ! #line 1034 "../Parse.yacc" { PK ("INTERFACE");; break;} case 503: ! #line 1035 "../Parse.yacc" { PK ("LOCK");; break;} case 505: ! #line 1036 "../Parse.yacc" { PK ("LOOP");; break;} case 507: ! #line 1037 "../Parse.yacc" { PK ("METHODS");; break;} case 509: ! #line 1038 "../Parse.yacc" { PK ("MOD");; break;} case 511: ! #line 1039 "../Parse.yacc" { PK ("MODULE");; break;} case 513: ! #line 1040 "../Parse.yacc" { PK ("NOT");; break;} case 515: ! #line 1041 "../Parse.yacc" { PK ("OBJECT");; break;} case 517: ! #line 1042 "../Parse.yacc" { PK ("OF");; break;} case 519: ! #line 1043 "../Parse.yacc" { PK ("OR");; break;} case 521: ! #line 1044 "../Parse.yacc" { PK ("OVERRIDES");; break;} case 523: ! #line 1045 "../Parse.yacc" { PK ("PROCEDURE");; break;} case 525: ! #line 1046 "../Parse.yacc" { PK ("RAISE");; break;} case 527: ! #line 1049 "../Parse.yacc" { DoBreak(1, 2, 0.0); PK ("RAISES");; break;} case 529: ! #line 1050 "../Parse.yacc" { PK ("READONLY");; break;} case 531: ! #line 1051 "../Parse.yacc" { PK ("RECORD");; break;} case 533: ! #line 1052 "../Parse.yacc" { PK ("REF");; break;} case 535: ! #line 1053 "../Parse.yacc" { PK ("REPEAT");; break;} case 537: ! #line 1054 "../Parse.yacc" { PK ("RETURN");; break;} case 539: ! #line 1055 "../Parse.yacc" { PK ("REVEAL");; break;} case 541: ! #line 1056 "../Parse.yacc" { PK ("ROOT");; break;} case 543: ! #line 1057 "../Parse.yacc" { PK ("SET");; break;} case 545: ! #line 1058 "../Parse.yacc" { PK ("THEN");; break;} case 547: ! #line 1059 "../Parse.yacc" { PK ("TO");; break;} case 549: ! #line 1060 "../Parse.yacc" { PK ("TRY");; break;} case 551: ! #line 1061 "../Parse.yacc" { PK ("TYPE");; break;} case 553: ! #line 1062 "../Parse.yacc" { PK ("TYPECASE");; break;} case 555: ! #line 1063 "../Parse.yacc" { PK ("UNSAFE");; break;} case 557: ! #line 1064 "../Parse.yacc" { PK ("UNTIL");; break;} case 559: ! #line 1065 "../Parse.yacc" { PK ("UNTRACED");; break;} case 561: ! #line 1066 "../Parse.yacc" { PK ("VALUE");; break;} case 563: ! #line 1067 "../Parse.yacc" { PK ("VAR");; break;} case 565: ! #line 1068 "../Parse.yacc" { PK ("WHILE");; break;} case 567: ! #line 1069 "../Parse.yacc" { PK ("WITH");; break;} case 569: ! #line 1074 "../Parse.yacc" { blanklinep = 0; PrintNPS(1); ; break;} case 570: ! #line 1078 "../Parse.yacc" { blanklinep = 0; ; break;} case 571: ! #line 1079 "../Parse.yacc" { blanklinep = 0; PrintNPS(0); ; break;} case 572: ! #line 1084 "../Parse.yacc" { GR (); ; break;} case 573: ! #line 1085 "../Parse.yacc" { BE (0.0); ; break;} case 574: ! #line 1086 "../Parse.yacc" { BE (offset); ; break;} case 575: ! #line 1087 "../Parse.yacc" { BE (offset*2); ; break;} case 576: ! #line 1088 "../Parse.yacc" { EN (); ; break;} case 577: ! #line 1089 "../Parse.yacc" { ENF (); ; break;} case 578: ! #line 1091 "../Parse.yacc" { DoBreak (1, 2, 0.0); ; break;} case 579: ! #line 1092 "../Parse.yacc" { DoBreak (1, 3, 0.0); ; break;} case 580: ! #line 1093 "../Parse.yacc" { DoBreak (0, 3, 0.0); ; break;} case 581: ! #line 1095 "../Parse.yacc" { DoBreak (1, 1, 0.0); ; break;} case 582: ! #line 1096 "../Parse.yacc" { DoBreak (1, 1, -offset); ; break;} case 583: ! #line 1097 "../Parse.yacc" { DoBreak (1, 1, -offset + 2.0 * bodySpaceWidth); ; break;} case 584: ! #line 1099 "../Parse.yacc" { DoBreak (0, 0, 0.0); ; break;} case 585: ! #line 1100 "../Parse.yacc" { DoBreak (1, 0, 0.0); ; break;} case 586: ! #line 1101 "../Parse.yacc" { P2 (' '); ; break;} case 587: ! #line 1103 "../Parse.yacc" { BL (); ; break;} case 588: ! #line 1105 "../Parse.yacc" { DoAlign (2, 0); ; break;} case 589: ! #line 1106 "../Parse.yacc" { DoAlign (3, 0); ; break;} case 590: ! #line 1107 "../Parse.yacc" { DoAlign (5, 1); ; break;} case 591: ! #line 1108 "../Parse.yacc" { EndAlign (); ; break;} case 592: ! #line 1110 "../Parse.yacc" { ALNL(); ; break;} case 593: ! #line 1112 "../Parse.yacc" { DoSPNL (); ; break;} case 594: ! #line 1113 "../Parse.yacc" { DoQSP (); ; break;} case 595: ! #line 1114 "../Parse.yacc" { NL (); ; break;} case 596: ! #line 1116 "../Parse.yacc" { depth++; ; break;} case 597: ! #line 1117 "../Parse.yacc" { depth--; ; break;} } /* the action file gets copied in in place of this dollarsign */ ! #line 465 "/contrib/share/lib/bison.simple" yyvsp -= yylen; yyssp -= yylen; --- 2476,3019 ---- switch (yyn) { case 1: ! #line 208 "../Parse.yacc" { depth=0; ; break;} case 3: ! #line 209 "../Parse.yacc" { depth=0; ; break;} case 4: ! #line 209 "../Parse.yacc" { Flush(); ; break;} case 5: ! #line 210 "../Parse.yacc" { depth=0; ; break;} case 6: ! #line 210 "../Parse.yacc" { Flush(); ; break;} case 370: ! #line 961 "../Parse.yacc" { PR ("&");; break;} case 372: ! #line 962 "../Parse.yacc" { PR (":=");; break;} case 374: ! #line 963 "../Parse.yacc" { PR ("*");; break;} case 376: ! #line 964 "../Parse.yacc" { PR ("|");; break;} case 378: ! #line 965 "../Parse.yacc" { PR (":");; break;} case 380: ! #line 966 "../Parse.yacc" { PR (",");; break;} case 382: ! #line 967 "../Parse.yacc" { PR (".");; break;} case 384: ! #line 968 "../Parse.yacc" { PR ("..");; break;} case 386: ! #line 969 "../Parse.yacc" { PR ("=");; break;} case 388: ! #line 970 "../Parse.yacc" { PR (">");; break;} case 390: ! #line 971 "../Parse.yacc" { PR (">=");; break;} case 392: ! #line 972 "../Parse.yacc" { PR ("<");; break;} case 394: ! #line 973 "../Parse.yacc" { PR ("<=");; break;} case 396: ! #line 974 "../Parse.yacc" { PR ("-");; break;} case 398: ! #line 975 "../Parse.yacc" { PR ("\043");; break;} case 400: ! #line 976 "../Parse.yacc" { PR ("+");; break;} case 402: ! #line 977 "../Parse.yacc" { PR ("=>");; break;} case 404: ! #line 978 "../Parse.yacc" { PR ("}");; break;} case 406: ! #line 979 "../Parse.yacc" { PR ("]");; break;} case 408: ! #line 980 "../Parse.yacc" { PR (")");; break;} case 410: ! #line 981 "../Parse.yacc" { PR (";");; break;} case 412: ! #line 982 "../Parse.yacc" { PR (";");; break;} case 413: ! #line 983 "../Parse.yacc" { PR ("/");; break;} case 415: ! #line 984 "../Parse.yacc" { PR ("<:");; break;} case 417: ! #line 985 "../Parse.yacc" { PR ("^");; break;} case 419: ! #line 988 "../Parse.yacc" { PR ("("); ; break;} case 421: ! #line 989 "../Parse.yacc" { PR ("("); ; break;} case 423: ! #line 990 "../Parse.yacc" { PR ("["); ; break;} case 425: ! #line 991 "../Parse.yacc" { PR ("{"); ; break;} case 427: ! #line 996 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->fixedComment);; break;} case 429: ! #line 997 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->fixedComment);; break;} case 431: ! #line 998 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->fixedComment);; break;} case 433: ! #line 999 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->fixedComment);; break;} case 435: ! #line 1001 "../Parse.yacc" { PRID (&lexbuf[yyvsp[0]]);; break;} case 437: ! #line 1002 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->procName);; break;} case 439: ! #line 1003 "../Parse.yacc" { PR (&lexbuf[yyvsp[0]]);; break;} case 441: ! #line 1004 "../Parse.yacc" { PR (&lexbuf[yyvsp[0]]);; break;} case 443: ! #line 1005 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->fixed);; break;} case 445: ! #line 1006 "../Parse.yacc" { PF (&lexbuf[yyvsp[0]], fonts->fixed);; break;} case 447: ! #line 1008 "../Parse.yacc" { PK ("AND");; break;} case 449: ! #line 1009 "../Parse.yacc" { PK ("ANY");; break;} case 451: ! #line 1010 "../Parse.yacc" { PK ("ARRAY");; break;} case 453: ! #line 1011 "../Parse.yacc" { PK ("AS");; break;} case 455: ! #line 1012 "../Parse.yacc" { PK ("BEGIN");; break;} case 457: ! #line 1013 "../Parse.yacc" { PK ("BITS");; break;} case 459: ! #line 1014 "../Parse.yacc" { PK ("BRANDED");; break;} case 461: ! #line 1015 "../Parse.yacc" { PK ("BY");; break;} case 463: ! #line 1016 "../Parse.yacc" { PK ("CASE");; break;} case 465: ! #line 1017 "../Parse.yacc" { PK ("CONST");; break;} case 467: ! #line 1018 "../Parse.yacc" { PR ("DIV");; break;} case 469: ! #line 1019 "../Parse.yacc" { PK ("DO");; break;} case 471: ! #line 1020 "../Parse.yacc" { PK ("ELSE");; break;} case 473: ! #line 1021 "../Parse.yacc" { PK ("ELSIF");; break;} case 475: ! #line 1022 "../Parse.yacc" { PK ("END");; break;} case 477: ! #line 1023 "../Parse.yacc" { PK ("EVAL");; break;} case 479: ! #line 1024 "../Parse.yacc" { PK ("EXCEPT");; break;} case 481: ! #line 1025 "../Parse.yacc" { PK ("EXCEPTION");; break;} case 483: ! #line 1026 "../Parse.yacc" { PK ("EXIT");; break;} case 485: ! #line 1027 "../Parse.yacc" { PK ("EXPORTS");; break;} case 487: ! #line 1028 "../Parse.yacc" { PK ("FINALLY");; break;} case 489: ! #line 1029 "../Parse.yacc" { PK ("FOR");; break;} case 491: ! #line 1030 "../Parse.yacc" { PK ("FROM");; break;} case 493: ! #line 1031 "../Parse.yacc" { PK ("GENERIC");; break;} case 495: ! #line 1032 "../Parse.yacc" { PK ("IF");; break;} case 497: ! #line 1033 "../Parse.yacc" { PK ("IMPORT");; break;} case 499: ! #line 1034 "../Parse.yacc" { PK ("IN");; break;} case 501: ! #line 1035 "../Parse.yacc" { PK ("INTERFACE");; break;} case 503: ! #line 1036 "../Parse.yacc" { PK ("LOCK");; break;} case 505: ! #line 1037 "../Parse.yacc" { PK ("LOOP");; break;} case 507: ! #line 1038 "../Parse.yacc" { PK ("METHODS");; break;} case 509: ! #line 1039 "../Parse.yacc" { PK ("MOD");; break;} case 511: ! #line 1040 "../Parse.yacc" { PK ("MODULE");; break;} case 513: ! #line 1041 "../Parse.yacc" { PK ("NOT");; break;} case 515: ! #line 1042 "../Parse.yacc" { PK ("OBJECT");; break;} case 517: ! #line 1043 "../Parse.yacc" { PK ("OF");; break;} case 519: ! #line 1044 "../Parse.yacc" { PK ("OR");; break;} case 521: ! #line 1045 "../Parse.yacc" { PK ("OVERRIDES");; break;} case 523: ! #line 1046 "../Parse.yacc" { PK ("PROCEDURE");; break;} case 525: ! #line 1047 "../Parse.yacc" { PK ("RAISE");; break;} case 527: ! #line 1050 "../Parse.yacc" { DoBreak(1, 2, 0.0); PK ("RAISES");; break;} case 529: ! #line 1051 "../Parse.yacc" { PK ("READONLY");; break;} case 531: ! #line 1052 "../Parse.yacc" { PK ("RECORD");; break;} case 533: ! #line 1053 "../Parse.yacc" { PK ("REF");; break;} case 535: ! #line 1054 "../Parse.yacc" { PK ("REPEAT");; break;} case 537: ! #line 1055 "../Parse.yacc" { PK ("RETURN");; break;} case 539: ! #line 1056 "../Parse.yacc" { PK ("REVEAL");; break;} case 541: ! #line 1057 "../Parse.yacc" { PK ("ROOT");; break;} case 543: ! #line 1058 "../Parse.yacc" { PK ("SET");; break;} case 545: ! #line 1059 "../Parse.yacc" { PK ("THEN");; break;} case 547: ! #line 1060 "../Parse.yacc" { PK ("TO");; break;} case 549: ! #line 1061 "../Parse.yacc" { PK ("TRY");; break;} case 551: ! #line 1062 "../Parse.yacc" { PK ("TYPE");; break;} case 553: ! #line 1063 "../Parse.yacc" { PK ("TYPECASE");; break;} case 555: ! #line 1064 "../Parse.yacc" { PK ("UNSAFE");; break;} case 557: ! #line 1065 "../Parse.yacc" { PK ("UNTIL");; break;} case 559: ! #line 1066 "../Parse.yacc" { PK ("UNTRACED");; break;} case 561: ! #line 1067 "../Parse.yacc" { PK ("VALUE");; break;} case 563: ! #line 1068 "../Parse.yacc" { PK ("VAR");; break;} case 565: ! #line 1069 "../Parse.yacc" { PK ("WHILE");; break;} case 567: ! #line 1070 "../Parse.yacc" { PK ("WITH");; break;} case 569: ! #line 1075 "../Parse.yacc" { blanklinep = 0; PrintNPS(1); ; break;} case 570: ! #line 1079 "../Parse.yacc" { blanklinep = 0; ; break;} case 571: ! #line 1080 "../Parse.yacc" { blanklinep = 0; PrintNPS(0); ; break;} case 572: ! #line 1085 "../Parse.yacc" { GR (); ; break;} case 573: ! #line 1086 "../Parse.yacc" { BE (0.0); ; break;} case 574: ! #line 1087 "../Parse.yacc" { BE (offset); ; break;} case 575: ! #line 1088 "../Parse.yacc" { BE (offset*2); ; break;} case 576: ! #line 1089 "../Parse.yacc" { EN (); ; break;} case 577: ! #line 1090 "../Parse.yacc" { ENF (); ; break;} case 578: ! #line 1092 "../Parse.yacc" { DoBreak (1, 2, 0.0); ; break;} case 579: ! #line 1093 "../Parse.yacc" { DoBreak (1, 3, 0.0); ; break;} case 580: ! #line 1094 "../Parse.yacc" { DoBreak (0, 3, 0.0); ; break;} case 581: ! #line 1096 "../Parse.yacc" { DoBreak (1, 1, 0.0); ; break;} case 582: ! #line 1097 "../Parse.yacc" { DoBreak (1, 1, -offset); ; break;} case 583: ! #line 1098 "../Parse.yacc" { DoBreak (1, 1, -offset + 2.0 * bodySpaceWidth); ; break;} case 584: ! #line 1100 "../Parse.yacc" { DoBreak (0, 0, 0.0); ; break;} case 585: ! #line 1101 "../Parse.yacc" { DoBreak (1, 0, 0.0); ; break;} case 586: ! #line 1102 "../Parse.yacc" { P2 (' '); ; break;} case 587: ! #line 1104 "../Parse.yacc" { BL (); ; break;} case 588: ! #line 1106 "../Parse.yacc" { DoAlign (2, 0); ; break;} case 589: ! #line 1107 "../Parse.yacc" { DoAlign (3, 0); ; break;} case 590: ! #line 1108 "../Parse.yacc" { DoAlign (5, 1); ; break;} case 591: ! #line 1109 "../Parse.yacc" { EndAlign (); ; break;} case 592: ! #line 1111 "../Parse.yacc" { ALNL(); ; break;} case 593: ! #line 1113 "../Parse.yacc" { DoSPNL (); ; break;} case 594: ! #line 1114 "../Parse.yacc" { DoQSP (); ; break;} case 595: ! #line 1115 "../Parse.yacc" { NL (); ; break;} case 596: ! #line 1117 "../Parse.yacc" { depth++; ; break;} case 597: ! #line 1118 "../Parse.yacc" { depth--; ; break;} } /* the action file gets copied in in place of this dollarsign */ ! #line 542 "/p/gnu/lib/bison-1.27/bison.simple" yyvsp -= yylen; yyssp -= yylen; *************** *** 3142,3149 **** yystate = yyn; goto yynewstate; } ! #line 1119 "../Parse.yacc" /*-------- additional C code to implement the semantic routines -----------*/ --- 3208,3239 ---- yystate = yyn; goto yynewstate; + + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); + #ifdef YYLSP_NEEDED + free (yyls); + #endif + } + return 0; + + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); + #ifdef YYLSP_NEEDED + free (yyls); + #endif + } + return 1; } ! #line 1120 "../Parse.yacc" /*-------- additional C code to implement the semantic routines -----------*/ *************** *** 3385,3390 **** --- 3475,3481 ---- #define PRODUCE(x) {fprintf (stderr, "%d ", x); return (x); } #include + #include #include "hash.h" #include "lex.yy.c" #include "lex_help.h" *************** *** 3467,3475 **** temp2 = input(); /* input comes from the lex library. */ if ((calledFromEmacs && (temp2 == '\001')) || (temp2 == 0)) return; temp = input(); ! while ((temp != 0) && (!calledFromEmacs || (temp != '\001'))) {P (temp2); temp2 = temp; temp = input();} ! if ((temp2 != '\n') || (temp != 0)) P(temp2); } /* Print out first comment. Hidden down here so it can see the comment --- 3558,3566 ---- temp2 = input(); /* input comes from the lex library. */ if ((calledFromEmacs && (temp2 == '\001')) || (temp2 == 0)) return; temp = input(); ! while ((temp > 0) && (!calledFromEmacs || (temp != '\001'))) {P (temp2); temp2 = temp; temp = input();} ! if ((temp2 != '\n') || (temp > 0)) P(temp2); } /* Print out first comment. Hidden down here so it can see the comment Index: m3/pm3/libs/libm3/src/os/POSIX/FilePosix.m3 diff -c m3/pm3/libs/libm3/src/os/POSIX/FilePosix.m3:1.3 m3/pm3/libs/libm3/src/os/POSIX/FilePosix.m3:1.4 *** m3/pm3/libs/libm3/src/os/POSIX/FilePosix.m3:1.3 Fri Sep 26 08:41:41 1997 --- m3/pm3/libs/libm3/src/os/POSIX/FilePosix.m3 Thu Apr 29 11:38:48 1999 *************** *** 233,239 **** ELSIF status = -1 AND errno # Uerror.EWOULDBLOCK AND errno # Uerror.EAGAIN THEN ! OSErrorPosix.Raise() ELSIF NOT mayBlock THEN RETURN -1 END; --- 233,239 ---- ELSIF status = -1 AND errno # Uerror.EWOULDBLOCK AND errno # Uerror.EAGAIN THEN ! OSErrorPosix.Raise0(errno) ELSIF NOT mayBlock THEN RETURN -1 END; *************** *** 276,282 **** ELSIF status = -1 AND errno # Uerror.EWOULDBLOCK AND errno # Uerror.EAGAIN THEN ! OSErrorPosix.Raise() END; EVAL SchedulerPosix.IOWait(h.fd, FALSE) --- 276,282 ---- ELSIF status = -1 AND errno # Uerror.EWOULDBLOCK AND errno # Uerror.EAGAIN THEN ! OSErrorPosix.Raise0(errno) END; EVAL SchedulerPosix.IOWait(h.fd, FALSE) Index: m3/pm3/libs/libm3/src/random/m3makefile diff -c m3/pm3/libs/libm3/src/random/m3makefile:1.5 m3/pm3/libs/libm3/src/random/m3makefile:1.6 *** m3/pm3/libs/libm3/src/random/m3makefile:1.5 Tue Apr 28 16:01:50 1998 --- m3/pm3/libs/libm3/src/random/m3makefile Mon Jun 7 13:13:26 1999 *************** *** 17,24 **** --- 17,26 ---- "ARM" : [ _LittleEndian ], "DS3100" : [ _LittleEndian ], "DS3100_OSF" : [ _LittleEndian ], + "FBSD_ALPHA" : [ _LittleEndian ], "FreeBSD" : [ _LittleEndian ], "FreeBSD2" : [ _LittleEndian ], + "FreeBSD3" : [ _LittleEndian ], "HP300" : [ _BigEndian ], "HPPA" : [ _BigEndian ], "IBMR2" : [ _BigEndian ], Index: m3/pm3/libs/m3core/src/C/FBSD_ALPHA/COPYRIGHT diff -c /dev/null m3/pm3/libs/m3core/src/C/FBSD_ALPHA/COPYRIGHT:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FBSD_ALPHA/COPYRIGHT Mon Jun 7 13:13:36 1999 *************** *** 0 **** --- 1,93 ---- + + Digital License Agreement + + SRC Modula-3 + + 1. Grant Of License. Digital Equipment Corporation, having a principal + office at 146 Main Street, Maynard, MA 01754 ("DIGITAL") grants to + you ("LICENSEE") the non-exclusive, non-transferable, royalty free + right to use, modify, reproduce and distribute SRC Modula-3 ("SOFTWARE") + subject to the terms set forth herein. Any distribution of SOFTWARE + shall include this Digital License Agreement in human readable form. + + 2. Title to Intellectual Property and Software. Subject to the limited + rights and licenses granted under this License Agreement, all rights, + title and interests including patent, copyright, and trademark rights + in SOFTWARE are and shall remain vested in DIGITAL to the exclusion + of LICENSEE. DIGITAL represents and warrants that DIGITAL has the + legal right to grant such licenses as are expressly granted under + this Agreement. + + 3. Copyright. The SOFTWARE is owned by DIGITAL or its suppliers and is + protected by United States copyright laws and international treaty + provisions. Therefore, you must treat the SOFTWARE like any other + copyrighted material (e.g., a book or musical recording) except + that you may use the SOFTWARE as provided in this Digital License + Agreement. + + 4. Improvements. LICENSEE hereby grants to DIGITAL a non-exclusive, + non-transferable, royalty free right to use, modify, reproduce + and distribute with the right to sublicense at any tier, any + improvements, enhancements, extensions, or modifications that + LICENSEE make to SOFTWARE, provided such are returned to DIGITAL + by LICENSEE. + + 5. DISCLAIMER OF WARRANTY. Because the SOFTWARE is a research work and + not a released product, it is provided "AS IS" WITHOUT WARRANTY OF ANY + KIND AND WITHOUT ANY SUPPORT SERVICES. EXCEPT AS SPECIFICALLY PROVIDED + ABOVE IN SECTION 2, DIGITAL FURTHER DISCLAIMS ALL OTHER EXPRESS OR + IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS FOR A PARTICULAR + PURPOSE. THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF + THE SOFTWARE REMAINS WITH YOU. + + 6. Limitation of Liability. IN NO EVENT SHALL DIGITAL OR ITS SUPPLIERS BE + LIABLE IN AN AMOUNT THAT EXCEEDS THE LICENSE FEE PAID BY LICENSEE FOR + ANY DAMAGES (INCLUDING, WITH LIMITATION, DAMAGES FOR LOSS OF BUSINESS + PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER + PECUNIARY LOSS), REGARDLESS OF THE FORM OF CLAIM OR ACTIONS, ARISING + OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, + EVEN IF DIGITAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY + FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT + APPLY TO YOU. + + 7. Acknowledgement of Allocation of Risk. LICENSEE acknowledges and agrees + that the fees charged by DIGITAL in this Agreement reflect the allocation + of risks provided by the foregoing limitation of liability. LICENSEE + acknowledges and represents that it has read and understands these + allocations of risk limiting the liability of DIGITAL and that it + understands that a modification of the allocation of risks set forth + in this agreement would affect the fees charged by DIGITAL, and that + LICENSEE, in consideration of such fees, agrees to such allocations + of risk. + + 8. LICENSEE INDEMNIFICATION. LICENSEE SHALL INDEMNIFY DIGITAL AGAINST + ALL COSTS AND DAMAGE JUDGEMENTS, INCLUDING ATTORNEY'S FEES AND COSTS + OF DEFENSE, INCURRED BECAUSE OF CLAIMS OF DAMAGE ARISING FROM LICENSEE'S + POSSESSION OR USE OR INABILITY TO USE SOFTWARE. + + 9. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE and documentation are provided + with RESTRICTED RIGHTS. Use duplication, or disclosure by the Government + is subject restrictions as set forth in subparagraph (c)(1)(ii) of The + Rights in Technical Data and Computer Software clause in DFARS + 252.227-7013, or subparagraphs (c)(i) and (2) of the Commercial Computer + Software -- Restricted Rights at 48 CFR 52.227-19, as applicable. + Manufacturer is Digital Equipment Corporation, 130 Lytton Avenue, + Palo Alto, CA 94301-1044. + + 10. Severability. If any provision of the Agreement is held illegal or + unenforceable by any court of competent jurisdiction, such provision + shall be deemed separable from the remaining provisions of this Agreement + and shall not affect or impair the validity or enforceability of the + remaining provisions of this Agreement. + + 11. Governing Law. This Agreement is governed by the laws of the + Commonwealth of Massachusetts. + + 12. Publicity. You my not use the name of DIGITAL in any advertisement, + press release or other publicity with reference to SRC Modula-3 + without prior written consent of DIGITAL. + + 13. Should you have any questions concerning this Agreement, or if you + desire to contact Digital for any reason, please do so via E-mail: + M3-REQUEST@SRC.DEC.COM. Index: m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Csetjmp.i3 diff -c /dev/null m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Csetjmp.i3:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Csetjmp.i3 Mon Jun 7 13:13:36 1999 *************** *** 0 **** --- 1,23 ---- + (* Copyright (C) 1990, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Tue Oct 18 08:40:23 PDT 1994 by kalsow *) + (* modified on Fri Apr 30 16:25:40 PDT 1993 by muller *) + (* Olaf Wagner 12.09.1994 *) + + INTERFACE Csetjmp; (* for FreeBSD *) + + FROM Ctypes IMPORT int, long; + + TYPE + jmp_buf = ARRAY [0..81] OF long; + + <*EXTERNAL "setjmp" *> PROCEDURE setjmp (VAR env: jmp_buf): int; + <*EXTERNAL "longjmp" *> PROCEDURE longjmp (VAR env: jmp_buf; val: int); + + <*EXTERNAL "_setjmp" *> PROCEDURE usetjmp (VAR env: jmp_buf): int; + <*EXTERNAL "_longjmp" *> PROCEDURE ulongjmp (VAR env: jmp_buf; val: int); + + END Csetjmp. + Index: m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Csignal.i3 diff -c /dev/null m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Csignal.i3:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Csignal.i3 Mon Jun 7 13:13:36 1999 *************** *** 0 **** --- 1,18 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Mon Oct 17 09:12:23 PDT 1994 by kalsow *) + (* modified on Tue May 4 10:06:17 PDT 1993 by muller *) + + INTERFACE Csignal; + + FROM Ctypes IMPORT int; + + TYPE + Handler = PROCEDURE (s: int); + + <*EXTERNAL*> + PROCEDURE signal (sig: int; func: Handler): Handler; + + END Csignal. Index: m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Cstdio.i3 diff -c /dev/null m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Cstdio.i3:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Cstdio.i3 Mon Jun 7 13:13:36 1999 *************** *** 0 **** --- 1,74 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Sat Jan 7 13:12:39 PST 1995 by kalsow *) + (* modified on Thu May 6 09:18:19 PDT 1993 by muller *) + (* Olaf Wagner 16.09.1994 *) + + INTERFACE Cstdio; + + FROM Ctypes IMPORT int, void_star, char_star, + unsigned_char_star, short_int, unsigned_char; + + FROM Utypes IMPORT off_t; + + CONST + NIOBRW = 100; + NSTDBUF= 3; + EOF = VAL(-1, int); + + TYPE + SBUF = RECORD + base : unsigned_char_star; + size : int; + END; + + FILE = RECORD + p : unsigned_char_star; (* current position in (some) buffer *) + r : int; (* read space left for getc() *) + w : int; (* write space left for putc() *) + flags : short_int; (* flags, below; this FILE is free if 0 *) + file : short_int; (* fileno, if Unix descriptor, else -1 *) + bf : SBUF; (* the buffer (at least 1 byte, if !NULL) *) + lbfsize : int; (* 0 or -_bf._size, for inline putc *) + + (* operations *) + cookie : void_star; (* cookie passed to io functions *) + xxclose: void_star; + xxread : void_star; + xxseek : void_star; + xxwrite: void_star; + + (* separate buffer for long sequences of ungetc() *) + ub : SBUF; (* ungetc buffer *) + up : unsigned_char_star; (* saved _p when _p is doing ungetc data *) + ur : int; (* saved _r when _r is counting ungetc data *) + + (* tricks to meet minimum requirements even when malloc() fails *) + ubuf : ARRAY[0..2] OF unsigned_char; (* guarantee an ungetc() buffer *) + nbuf : ARRAY[0..0] OF unsigned_char; (* guarantee a getc() buffer *) + + (* separate buffer for fgetln() when line crosses buffer boundary *) + lb : SBUF; (* buffer for fgetln() *) + + (* Unix stdio files get aligned to block boundaries on fseek() *) + blksize : int; (* stat.st_blksize (may be != _bf._size) *) + offset : off_t; (* current lseek offset *) + + END; + + FILE_star = UNTRACED REF FILE; + + <*EXTERNAL "__sF"*> VAR sF : ARRAY [0..NSTDBUF-1] OF FILE; + VAR iF : ARRAY [0..NIOBRW-1] OF FILE_star; + + <*EXTERNAL fbsd_feof*> PROCEDURE feof (f: FILE_star): int; + <*EXTERNAL fbsd_getc*> PROCEDURE getc (f: FILE_star): int; + <*EXTERNAL fbsd_ungetc*> PROCEDURE ungetc (c: int; f: FILE_star): int; + <*EXTERNAL fbsd_putc*> PROCEDURE putc (c: int; f: FILE_star): int; + <*EXTERNAL fbsd_fflush*> PROCEDURE fflush (f: FILE_star): int; + <*EXTERNAL fbsd_fdopen*> PROCEDURE fdopen (fd: int; mode: char_star): FILE_star; + <*EXTERNAL fbsd_fclose*> PROCEDURE fclose (f: FILE_star): int; + + END Cstdio. Index: m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Cstdio.m3 diff -c /dev/null m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Cstdio.m3:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Cstdio.m3 Mon Jun 7 13:13:36 1999 *************** *** 0 **** --- 1,17 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Mon Oct 17 09:17:55 PDT 1994 by kalsow *) + (* Olaf Wagner 16.09.1994 *) + + UNSAFE MODULE Cstdio; + + BEGIN + iF[0] := ADR(sF[0]); + iF[1] := ADR(sF[1]); + iF[2] := ADR(sF[2]); + FOR i := NSTDBUF TO NIOBRW-1 DO + iF[i] := NIL; + END; + END Cstdio. Index: m3/pm3/libs/m3core/src/C/FBSD_ALPHA/CstdioC.c diff -c /dev/null m3/pm3/libs/m3core/src/C/FBSD_ALPHA/CstdioC.c:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FBSD_ALPHA/CstdioC.c Mon Jun 7 13:13:36 1999 *************** *** 0 **** --- 1,42 ---- + /* Copyright (C) 1994, Digital Equipment Corporation */ + /* All rights reserved. */ + /* See the file COPYRIGHT for a full description. */ + /* */ + /* Last modified on Mon Oct 17 09:17:31 PDT 1994 by kalsow */ + /* Olaf Wagner 16.09.1994 */ + + #include + + int fbsd_feof(FILE *f){ + return feof(f); + }; + + int fbsd_getc(FILE *f){ + return fgetc(f); + }; + + int fbsd_ungetc(int c, FILE *f){ + return ungetc(c, f); + }; + + int fbsd_putc(int c, FILE *f){ + return fputc(c, f); + }; + + int fbsd_fflush(FILE *f){ + return fflush(f); + }; + + FILE* fbsd_fdopen(int fildes, char *mode){ + FILE* f; + f = fdopen(fildes, mode); + if (f == NULL){ + fprintf(stderr, "fd: %d, mode: %s\n", fildes, mode); + perror("fdopen failed "); + } + return f; + } + + int fbsd_fclose(FILE *f){ + return fclose(f); + }; Index: m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Cstring.i3 diff -c /dev/null m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Cstring.i3:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FBSD_ALPHA/Cstring.i3 Mon Jun 7 13:13:36 1999 *************** *** 0 **** --- 1,89 ---- + (* Copyright (C) 1989, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* File: Cstring.i3 *) + (* Last modified on Mon Oct 17 09:19:10 PDT 1994 by kalsow *) + (* modified on Tue Apr 20 20:16:18 PDT 1993 by muller *) + (* modified on Sat Jan 20 22:31:44 1990 by jerome *) + (* Olaf Wagner 16.09.1994 *) + + + INTERFACE Cstring; + + FROM Ctypes IMPORT char_star, const_char_star, const_void_star, + int, void_star, unsigned_long; + + TYPE + size_t = unsigned_long; + + <*EXTERNAL*> + PROCEDURE memchr (s: const_void_star; c: int; n: size_t): void_star; + + <*EXTERNAL*> + PROCEDURE memcpy (s1: void_star; s2: const_void_star; n: size_t): void_star; + + <*EXTERNAL*> + PROCEDURE memset (s: void_star; c: int; n: size_t): void_star; + + <*EXTERNAL*> + PROCEDURE memcmp (s1: const_void_star; s2: const_void_star; n: size_t): int; + + <*EXTERNAL*> + PROCEDURE strcpy (s1: char_star; s2: const_char_star): char_star; + + <*EXTERNAL*> + PROCEDURE strncpy (s1: char_star; s2: const_char_star; n: size_t): char_star; + + <*EXTERNAL*> + PROCEDURE strcat (s1: char_star; s2: const_char_star): char_star; + + <*EXTERNAL*> + PROCEDURE strncat (s1: char_star; s2: const_char_star; n: size_t): char_star; + + <*EXTERNAL*> + PROCEDURE strchr (s: const_char_star; c: int): char_star; + + <*EXTERNAL*> + PROCEDURE strrchr (s: const_char_star; c: int): char_star; + + <*EXTERNAL*> + PROCEDURE strpbrk (s1: const_char_star; s2: const_char_star): char_star; + + <*EXTERNAL*> + PROCEDURE strtok (s1: char_star; s2: const_char_star): char_star; + + <*EXTERNAL*> + PROCEDURE strcmp (s1: const_char_star; s2: const_char_star): int; + + <*EXTERNAL*> + PROCEDURE strncmp (s1: const_char_star; s2: const_char_star; n: size_t): int; + + <*EXTERNAL*> + PROCEDURE strlen (s: const_char_star): size_t; + + <*EXTERNAL*> + PROCEDURE strspn (s1: const_char_star; s2: const_char_star): int; + + <*EXTERNAL*> + PROCEDURE strcspn (s1: const_char_star; s2: const_char_star): size_t; + + <*EXTERNAL*> + PROCEDURE memmove (s1: void_star; s2: const_void_star; n: size_t): void_star; + + <*EXTERNAL*> + PROCEDURE strcoll (s1: const_char_star; s2: const_char_star): int; + + (* + <*EXTERNAL*> + PROCEDURE strxrfm (s1: char_star; s2: const_char_star; n: size_t): size_t; + *) + + <*EXTERNAL*> + PROCEDURE strstr (s1: const_char_star; s2: const_char_star): char_star; + + <*EXTERNAL*> + PROCEDURE strerror (errnum: int): char_star; + + END Cstring. + Index: m3/pm3/libs/m3core/src/C/FBSD_ALPHA/m3makefile diff -c /dev/null m3/pm3/libs/m3core/src/C/FBSD_ALPHA/m3makefile:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FBSD_ALPHA/m3makefile Mon Jun 7 13:13:36 1999 *************** *** 0 **** --- 1,17 ---- + % Copyright (C) 1994, Digital Equipment Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + % + % Last modified on Mon Oct 17 09:20:03 PDT 1994 by kalsow + % modified on Fri Jun 18 13:20:32 PDT 1993 by harrison + % modified on Thu May 6 13:16:32 PDT 1993 by muller + % Olaf Wagner 16.09.1994 + + Interface ("Csetjmp") + Interface ("Csignal") + Interface ("Cstring") + Module ("Cstdio") + + c_source ("CstdioC") + + Index: m3/pm3/libs/m3core/src/C/FreeBSD2/Cstdio.i3 diff -c m3/pm3/libs/m3core/src/C/FreeBSD2/Cstdio.i3:1.1.1.1 m3/pm3/libs/m3core/src/C/FreeBSD2/Cstdio.i3:1.2 *** m3/pm3/libs/m3core/src/C/FreeBSD2/Cstdio.i3:1.1.1.1 Thu Jan 16 16:29:59 1997 --- m3/pm3/libs/m3core/src/C/FreeBSD2/Cstdio.i3 Mon Jun 7 13:13:41 1999 *************** *** 55,60 **** --- 55,61 ---- (* Unix stdio files get aligned to block boundaries on fseek() *) blksize : int; (* stat.st_blksize (may be != _bf._size) *) offset : off_t; (* current lseek offset *) + pad1 : int; (* assume high 4 bytes of offset are 0 *) END; Index: m3/pm3/libs/m3core/src/C/FreeBSD3/COPYRIGHT diff -c /dev/null m3/pm3/libs/m3core/src/C/FreeBSD3/COPYRIGHT:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FreeBSD3/COPYRIGHT Mon Jun 7 13:13:45 1999 *************** *** 0 **** --- 1,93 ---- + + Digital License Agreement + + SRC Modula-3 + + 1. Grant Of License. Digital Equipment Corporation, having a principal + office at 146 Main Street, Maynard, MA 01754 ("DIGITAL") grants to + you ("LICENSEE") the non-exclusive, non-transferable, royalty free + right to use, modify, reproduce and distribute SRC Modula-3 ("SOFTWARE") + subject to the terms set forth herein. Any distribution of SOFTWARE + shall include this Digital License Agreement in human readable form. + + 2. Title to Intellectual Property and Software. Subject to the limited + rights and licenses granted under this License Agreement, all rights, + title and interests including patent, copyright, and trademark rights + in SOFTWARE are and shall remain vested in DIGITAL to the exclusion + of LICENSEE. DIGITAL represents and warrants that DIGITAL has the + legal right to grant such licenses as are expressly granted under + this Agreement. + + 3. Copyright. The SOFTWARE is owned by DIGITAL or its suppliers and is + protected by United States copyright laws and international treaty + provisions. Therefore, you must treat the SOFTWARE like any other + copyrighted material (e.g., a book or musical recording) except + that you may use the SOFTWARE as provided in this Digital License + Agreement. + + 4. Improvements. LICENSEE hereby grants to DIGITAL a non-exclusive, + non-transferable, royalty free right to use, modify, reproduce + and distribute with the right to sublicense at any tier, any + improvements, enhancements, extensions, or modifications that + LICENSEE make to SOFTWARE, provided such are returned to DIGITAL + by LICENSEE. + + 5. DISCLAIMER OF WARRANTY. Because the SOFTWARE is a research work and + not a released product, it is provided "AS IS" WITHOUT WARRANTY OF ANY + KIND AND WITHOUT ANY SUPPORT SERVICES. EXCEPT AS SPECIFICALLY PROVIDED + ABOVE IN SECTION 2, DIGITAL FURTHER DISCLAIMS ALL OTHER EXPRESS OR + IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS FOR A PARTICULAR + PURPOSE. THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF + THE SOFTWARE REMAINS WITH YOU. + + 6. Limitation of Liability. IN NO EVENT SHALL DIGITAL OR ITS SUPPLIERS BE + LIABLE IN AN AMOUNT THAT EXCEEDS THE LICENSE FEE PAID BY LICENSEE FOR + ANY DAMAGES (INCLUDING, WITH LIMITATION, DAMAGES FOR LOSS OF BUSINESS + PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER + PECUNIARY LOSS), REGARDLESS OF THE FORM OF CLAIM OR ACTIONS, ARISING + OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, + EVEN IF DIGITAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY + FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT + APPLY TO YOU. + + 7. Acknowledgement of Allocation of Risk. LICENSEE acknowledges and agrees + that the fees charged by DIGITAL in this Agreement reflect the allocation + of risks provided by the foregoing limitation of liability. LICENSEE + acknowledges and represents that it has read and understands these + allocations of risk limiting the liability of DIGITAL and that it + understands that a modification of the allocation of risks set forth + in this agreement would affect the fees charged by DIGITAL, and that + LICENSEE, in consideration of such fees, agrees to such allocations + of risk. + + 8. LICENSEE INDEMNIFICATION. LICENSEE SHALL INDEMNIFY DIGITAL AGAINST + ALL COSTS AND DAMAGE JUDGEMENTS, INCLUDING ATTORNEY'S FEES AND COSTS + OF DEFENSE, INCURRED BECAUSE OF CLAIMS OF DAMAGE ARISING FROM LICENSEE'S + POSSESSION OR USE OR INABILITY TO USE SOFTWARE. + + 9. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE and documentation are provided + with RESTRICTED RIGHTS. Use duplication, or disclosure by the Government + is subject restrictions as set forth in subparagraph (c)(1)(ii) of The + Rights in Technical Data and Computer Software clause in DFARS + 252.227-7013, or subparagraphs (c)(i) and (2) of the Commercial Computer + Software -- Restricted Rights at 48 CFR 52.227-19, as applicable. + Manufacturer is Digital Equipment Corporation, 130 Lytton Avenue, + Palo Alto, CA 94301-1044. + + 10. Severability. If any provision of the Agreement is held illegal or + unenforceable by any court of competent jurisdiction, such provision + shall be deemed separable from the remaining provisions of this Agreement + and shall not affect or impair the validity or enforceability of the + remaining provisions of this Agreement. + + 11. Governing Law. This Agreement is governed by the laws of the + Commonwealth of Massachusetts. + + 12. Publicity. You my not use the name of DIGITAL in any advertisement, + press release or other publicity with reference to SRC Modula-3 + without prior written consent of DIGITAL. + + 13. Should you have any questions concerning this Agreement, or if you + desire to contact Digital for any reason, please do so via E-mail: + M3-REQUEST@SRC.DEC.COM. Index: m3/pm3/libs/m3core/src/C/FreeBSD3/Csetjmp.i3 diff -c /dev/null m3/pm3/libs/m3core/src/C/FreeBSD3/Csetjmp.i3:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FreeBSD3/Csetjmp.i3 Mon Jun 7 13:13:45 1999 *************** *** 0 **** --- 1,32 ---- + (* Copyright (C) 1990, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Tue Oct 18 08:40:23 PDT 1994 by kalsow *) + (* modified on Fri Apr 30 16:25:40 PDT 1993 by muller *) + (* Olaf Wagner 12.09.1994 *) + + INTERFACE Csetjmp; (* for FreeBSD *) + + FROM Ctypes IMPORT int; + + TYPE + jmp_buf = ARRAY [0..10] OF int; (* actually, this is a sigjmp_buf, + just in case *) + + fpjmp_buf = ARRAY [0..36] OF int; (* this is needed to hold the + fpu state, which the ordinary + versions of setjmp/longjmp + do not save and restore *) + + <*EXTERNAL "setjmp" *> PROCEDURE setjmp (VAR env: jmp_buf): int; + <*EXTERNAL "longjmp" *> PROCEDURE longjmp (VAR env: jmp_buf; val: int); + + <*EXTERNAL "_setjmp" *> PROCEDURE usetjmp (VAR env: jmp_buf): int; + <*EXTERNAL "_longjmp" *> PROCEDURE ulongjmp (VAR env: jmp_buf; val: int); + + <*EXTERNAL "_fpsetjmp" *> PROCEDURE fpsetjmp (VAR env: fpjmp_buf): int; + <*EXTERNAL "_fplongjmp" *> PROCEDURE fplongjmp (VAR env: fpjmp_buf; val: int); + + END Csetjmp. + Index: m3/pm3/libs/m3core/src/C/FreeBSD3/Csignal.i3 diff -c /dev/null m3/pm3/libs/m3core/src/C/FreeBSD3/Csignal.i3:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FreeBSD3/Csignal.i3 Mon Jun 7 13:13:45 1999 *************** *** 0 **** --- 1,18 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Mon Oct 17 09:12:23 PDT 1994 by kalsow *) + (* modified on Tue May 4 10:06:17 PDT 1993 by muller *) + + INTERFACE Csignal; + + FROM Ctypes IMPORT int; + + TYPE + Handler = PROCEDURE (s: int); + + <*EXTERNAL*> + PROCEDURE signal (sig: int; func: Handler): Handler; + + END Csignal. Index: m3/pm3/libs/m3core/src/C/FreeBSD3/Cstdio.i3 diff -c /dev/null m3/pm3/libs/m3core/src/C/FreeBSD3/Cstdio.i3:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FreeBSD3/Cstdio.i3 Mon Jun 7 13:13:45 1999 *************** *** 0 **** --- 1,75 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Sat Jan 7 13:12:39 PST 1995 by kalsow *) + (* modified on Thu May 6 09:18:19 PDT 1993 by muller *) + (* Olaf Wagner 16.09.1994 *) + + INTERFACE Cstdio; + + FROM Ctypes IMPORT int, void_star, char_star, + unsigned_char_star, short_int, unsigned_char; + + FROM Utypes IMPORT off_t; + + CONST + NIOBRW = 100; + NSTDBUF= 3; + EOF = VAL(-1, int); + + TYPE + SBUF = RECORD + base : unsigned_char_star; + size : int; + END; + + FILE = RECORD + p : unsigned_char_star; (* current position in (some) buffer *) + r : int; (* read space left for getc() *) + w : int; (* write space left for putc() *) + flags : short_int; (* flags, below; this FILE is free if 0 *) + file : short_int; (* fileno, if Unix descriptor, else -1 *) + bf : SBUF; (* the buffer (at least 1 byte, if !NULL) *) + lbfsize : int; (* 0 or -_bf._size, for inline putc *) + + (* operations *) + cookie : void_star; (* cookie passed to io functions *) + xxclose: void_star; + xxread : void_star; + xxseek : void_star; + xxwrite: void_star; + + (* separate buffer for long sequences of ungetc() *) + ub : SBUF; (* ungetc buffer *) + up : unsigned_char_star; (* saved _p when _p is doing ungetc data *) + ur : int; (* saved _r when _r is counting ungetc data *) + + (* tricks to meet minimum requirements even when malloc() fails *) + ubuf : ARRAY[0..2] OF unsigned_char; (* guarantee an ungetc() buffer *) + nbuf : ARRAY[0..0] OF unsigned_char; (* guarantee a getc() buffer *) + + (* separate buffer for fgetln() when line crosses buffer boundary *) + lb : SBUF; (* buffer for fgetln() *) + + (* Unix stdio files get aligned to block boundaries on fseek() *) + blksize : int; (* stat.st_blksize (may be != _bf._size) *) + offset : off_t; (* current lseek offset *) + pad1 : int; (* assume high 4 bytes of offset are 0 *) + + END; + + FILE_star = UNTRACED REF FILE; + + <*EXTERNAL "__sF"*> VAR sF : ARRAY [0..NSTDBUF-1] OF FILE; + VAR iF : ARRAY [0..NIOBRW-1] OF FILE_star; + + <*EXTERNAL fbsd_feof*> PROCEDURE feof (f: FILE_star): int; + <*EXTERNAL fbsd_getc*> PROCEDURE getc (f: FILE_star): int; + <*EXTERNAL fbsd_ungetc*> PROCEDURE ungetc (c: int; f: FILE_star): int; + <*EXTERNAL fbsd_putc*> PROCEDURE putc (c: int; f: FILE_star): int; + <*EXTERNAL fbsd_fflush*> PROCEDURE fflush (f: FILE_star): int; + <*EXTERNAL fbsd_fdopen*> PROCEDURE fdopen (fd: int; mode: char_star): FILE_star; + <*EXTERNAL fbsd_fclose*> PROCEDURE fclose (f: FILE_star): int; + + END Cstdio. Index: m3/pm3/libs/m3core/src/C/FreeBSD3/Cstdio.i3.orig diff -c /dev/null m3/pm3/libs/m3core/src/C/FreeBSD3/Cstdio.i3.orig:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FreeBSD3/Cstdio.i3.orig Mon Jun 7 13:13:45 1999 *************** *** 0 **** --- 1,74 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Sat Jan 7 13:12:39 PST 1995 by kalsow *) + (* modified on Thu May 6 09:18:19 PDT 1993 by muller *) + (* Olaf Wagner 16.09.1994 *) + + INTERFACE Cstdio; + + FROM Ctypes IMPORT int, void_star, char_star, + unsigned_char_star, short_int, unsigned_char; + + FROM Utypes IMPORT off_t; + + CONST + NIOBRW = 100; + NSTDBUF= 3; + EOF = VAL(-1, int); + + TYPE + SBUF = RECORD + base : unsigned_char_star; + size : int; + END; + + FILE = RECORD + p : unsigned_char_star; (* current position in (some) buffer *) + r : int; (* read space left for getc() *) + w : int; (* write space left for putc() *) + flags : short_int; (* flags, below; this FILE is free if 0 *) + file : short_int; (* fileno, if Unix descriptor, else -1 *) + bf : SBUF; (* the buffer (at least 1 byte, if !NULL) *) + lbfsize : int; (* 0 or -_bf._size, for inline putc *) + + (* operations *) + cookie : void_star; (* cookie passed to io functions *) + xxclose: void_star; + xxread : void_star; + xxseek : void_star; + xxwrite: void_star; + + (* separate buffer for long sequences of ungetc() *) + ub : SBUF; (* ungetc buffer *) + up : unsigned_char_star; (* saved _p when _p is doing ungetc data *) + ur : int; (* saved _r when _r is counting ungetc data *) + + (* tricks to meet minimum requirements even when malloc() fails *) + ubuf : ARRAY[0..2] OF unsigned_char; (* guarantee an ungetc() buffer *) + nbuf : ARRAY[0..0] OF unsigned_char; (* guarantee a getc() buffer *) + + (* separate buffer for fgetln() when line crosses buffer boundary *) + lb : SBUF; (* buffer for fgetln() *) + + (* Unix stdio files get aligned to block boundaries on fseek() *) + blksize : int; (* stat.st_blksize (may be != _bf._size) *) + offset : off_t; (* current lseek offset *) + + END; + + FILE_star = UNTRACED REF FILE; + + <*EXTERNAL "__sF"*> VAR sF : ARRAY [0..NSTDBUF-1] OF FILE; + VAR iF : ARRAY [0..NIOBRW-1] OF FILE_star; + + <*EXTERNAL fbsd_feof*> PROCEDURE feof (f: FILE_star): int; + <*EXTERNAL fbsd_getc*> PROCEDURE getc (f: FILE_star): int; + <*EXTERNAL fbsd_ungetc*> PROCEDURE ungetc (c: int; f: FILE_star): int; + <*EXTERNAL fbsd_putc*> PROCEDURE putc (c: int; f: FILE_star): int; + <*EXTERNAL fbsd_fflush*> PROCEDURE fflush (f: FILE_star): int; + <*EXTERNAL fbsd_fdopen*> PROCEDURE fdopen (fd: int; mode: char_star): FILE_star; + <*EXTERNAL fbsd_fclose*> PROCEDURE fclose (f: FILE_star): int; + + END Cstdio. Index: m3/pm3/libs/m3core/src/C/FreeBSD3/Cstdio.m3 diff -c /dev/null m3/pm3/libs/m3core/src/C/FreeBSD3/Cstdio.m3:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FreeBSD3/Cstdio.m3 Mon Jun 7 13:13:45 1999 *************** *** 0 **** --- 1,17 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Mon Oct 17 09:17:55 PDT 1994 by kalsow *) + (* Olaf Wagner 16.09.1994 *) + + UNSAFE MODULE Cstdio; + + BEGIN + iF[0] := ADR(sF[0]); + iF[1] := ADR(sF[1]); + iF[2] := ADR(sF[2]); + FOR i := NSTDBUF TO NIOBRW-1 DO + iF[i] := NIL; + END; + END Cstdio. Index: m3/pm3/libs/m3core/src/C/FreeBSD3/CstdioC.c diff -c /dev/null m3/pm3/libs/m3core/src/C/FreeBSD3/CstdioC.c:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FreeBSD3/CstdioC.c Mon Jun 7 13:13:45 1999 *************** *** 0 **** --- 1,42 ---- + /* Copyright (C) 1994, Digital Equipment Corporation */ + /* All rights reserved. */ + /* See the file COPYRIGHT for a full description. */ + /* */ + /* Last modified on Mon Oct 17 09:17:31 PDT 1994 by kalsow */ + /* Olaf Wagner 16.09.1994 */ + + #include + + int fbsd_feof(FILE *f){ + return feof(f); + }; + + int fbsd_getc(FILE *f){ + return fgetc(f); + }; + + int fbsd_ungetc(int c, FILE *f){ + return ungetc(c, f); + }; + + int fbsd_putc(int c, FILE *f){ + return fputc(c, f); + }; + + int fbsd_fflush(FILE *f){ + return fflush(f); + }; + + FILE* fbsd_fdopen(int fildes, char *mode){ + FILE* f; + f = fdopen(fildes, mode); + if (f == NULL){ + fprintf(stderr, "fd: %d, mode: %s\n", fildes, mode); + perror("fdopen failed "); + } + return f; + } + + int fbsd_fclose(FILE *f){ + return fclose(f); + }; Index: m3/pm3/libs/m3core/src/C/FreeBSD3/Cstring.i3 diff -c /dev/null m3/pm3/libs/m3core/src/C/FreeBSD3/Cstring.i3:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FreeBSD3/Cstring.i3 Mon Jun 7 13:13:45 1999 *************** *** 0 **** --- 1,89 ---- + (* Copyright (C) 1989, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* File: Cstring.i3 *) + (* Last modified on Mon Oct 17 09:19:10 PDT 1994 by kalsow *) + (* modified on Tue Apr 20 20:16:18 PDT 1993 by muller *) + (* modified on Sat Jan 20 22:31:44 1990 by jerome *) + (* Olaf Wagner 16.09.1994 *) + + + INTERFACE Cstring; + + FROM Ctypes IMPORT char_star, const_char_star, const_void_star, + int, void_star, unsigned_long; + + TYPE + size_t = unsigned_long; + + <*EXTERNAL*> + PROCEDURE memchr (s: const_void_star; c: int; n: size_t): void_star; + + <*EXTERNAL*> + PROCEDURE memcpy (s1: void_star; s2: const_void_star; n: size_t): void_star; + + <*EXTERNAL*> + PROCEDURE memset (s: void_star; c: int; n: size_t): void_star; + + <*EXTERNAL*> + PROCEDURE memcmp (s1: const_void_star; s2: const_void_star; n: size_t): int; + + <*EXTERNAL*> + PROCEDURE strcpy (s1: char_star; s2: const_char_star): char_star; + + <*EXTERNAL*> + PROCEDURE strncpy (s1: char_star; s2: const_char_star; n: size_t): char_star; + + <*EXTERNAL*> + PROCEDURE strcat (s1: char_star; s2: const_char_star): char_star; + + <*EXTERNAL*> + PROCEDURE strncat (s1: char_star; s2: const_char_star; n: size_t): char_star; + + <*EXTERNAL*> + PROCEDURE strchr (s: const_char_star; c: int): char_star; + + <*EXTERNAL*> + PROCEDURE strrchr (s: const_char_star; c: int): char_star; + + <*EXTERNAL*> + PROCEDURE strpbrk (s1: const_char_star; s2: const_char_star): char_star; + + <*EXTERNAL*> + PROCEDURE strtok (s1: char_star; s2: const_char_star): char_star; + + <*EXTERNAL*> + PROCEDURE strcmp (s1: const_char_star; s2: const_char_star): int; + + <*EXTERNAL*> + PROCEDURE strncmp (s1: const_char_star; s2: const_char_star; n: size_t): int; + + <*EXTERNAL*> + PROCEDURE strlen (s: const_char_star): size_t; + + <*EXTERNAL*> + PROCEDURE strspn (s1: const_char_star; s2: const_char_star): int; + + <*EXTERNAL*> + PROCEDURE strcspn (s1: const_char_star; s2: const_char_star): size_t; + + <*EXTERNAL*> + PROCEDURE memmove (s1: void_star; s2: const_void_star; n: size_t): void_star; + + <*EXTERNAL*> + PROCEDURE strcoll (s1: const_char_star; s2: const_char_star): int; + + (* + <*EXTERNAL*> + PROCEDURE strxrfm (s1: char_star; s2: const_char_star; n: size_t): size_t; + *) + + <*EXTERNAL*> + PROCEDURE strstr (s1: const_char_star; s2: const_char_star): char_star; + + <*EXTERNAL*> + PROCEDURE strerror (errnum: int): char_star; + + END Cstring. + Index: m3/pm3/libs/m3core/src/C/FreeBSD3/m3makefile diff -c /dev/null m3/pm3/libs/m3core/src/C/FreeBSD3/m3makefile:1.1 *** /dev/null Mon Jun 7 17:09:05 1999 --- m3/pm3/libs/m3core/src/C/FreeBSD3/m3makefile Mon Jun 7 13:13:46 1999 *************** *** 0 **** --- 1,17 ---- + % Copyright (C) 1994, Digital Equipment Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + % + % Last modified on Mon Oct 17 09:20:03 PDT 1994 by kalsow + % modified on Fri Jun 18 13:20:32 PDT 1993 by harrison + % modified on Thu May 6 13:16:32 PDT 1993 by muller + % Olaf Wagner 16.09.1994 + + Interface ("Csetjmp") + Interface ("Csignal") + Interface ("Cstring") + Module ("Cstdio") + + c_source ("CstdioC") + + Index: m3/pm3/libs/m3core/src/Csupport/FBSD_ALPHA/COPYRIGHT diff -c /dev/null m3/pm3/libs/m3core/src/Csupport/FBSD_ALPHA/COPYRIGHT:1.1 *** /dev/null Mon Jun 7 17:09:06 1999 --- m3/pm3/libs/m3core/src/Csupport/FBSD_ALPHA/COPYRIGHT Mon Jun 7 13:13:52 1999 *************** *** 0 **** --- 1,93 ---- + + Digital License Agreement + + SRC Modula-3 + + 1. Grant Of License. Digital Equipment Corporation, having a principal + office at 146 Main Street, Maynard, MA 01754 ("DIGITAL") grants to + you ("LICENSEE") the non-exclusive, non-transferable, royalty free + right to use, modify, reproduce and distribute SRC Modula-3 ("SOFTWARE") + subject to the terms set forth herein. Any distribution of SOFTWARE + shall include this Digital License Agreement in human readable form. + + 2. Title to Intellectual Property and Software. Subject to the limited + rights and licenses granted under this License Agreement, all rights, + title and interests including patent, copyright, and trademark rights + in SOFTWARE are and shall remain vested in DIGITAL to the exclusion + of LICENSEE. DIGITAL represents and warrants that DIGITAL has the + legal right to grant such licenses as are expressly granted under + this Agreement. + + 3. Copyright. The SOFTWARE is owned by DIGITAL or its suppliers and is + protected by United States copyright laws and international treaty + provisions. Therefore, you must treat the SOFTWARE like any other + copyrighted material (e.g., a book or musical recording) except + that you may use the SOFTWARE as provided in this Digital License + Agreement. + + 4. Improvements. LICENSEE hereby grants to DIGITAL a non-exclusive, + non-transferable, royalty free right to use, modify, reproduce + and distribute with the right to sublicense at any tier, any + improvements, enhancements, extensions, or modifications that + LICENSEE make to SOFTWARE, provided such are returned to DIGITAL + by LICENSEE. + + 5. DISCLAIMER OF WARRANTY. Because the SOFTWARE is a research work and + not a released product, it is provided "AS IS" WITHOUT WARRANTY OF ANY + KIND AND WITHOUT ANY SUPPORT SERVICES. EXCEPT AS SPECIFICALLY PROVIDED + ABOVE IN SECTION 2, DIGITAL FURTHER DISCLAIMS ALL OTHER EXPRESS OR + IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS FOR A PARTICULAR + PURPOSE. THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF + THE SOFTWARE REMAINS WITH YOU. + + 6. Limitation of Liability. IN NO EVENT SHALL DIGITAL OR ITS SUPPLIERS BE + LIABLE IN AN AMOUNT THAT EXCEEDS THE LICENSE FEE PAID BY LICENSEE FOR + ANY DAMAGES (INCLUDING, WITH LIMITATION, DAMAGES FOR LOSS OF BUSINESS + PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER + PECUNIARY LOSS), REGARDLESS OF THE FORM OF CLAIM OR ACTIONS, ARISING + OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, + EVEN IF DIGITAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY + FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT + APPLY TO YOU. + + 7. Acknowledgement of Allocation of Risk. LICENSEE acknowledges and agrees + that the fees charged by DIGITAL in this Agreement reflect the allocation + of risks provided by the foregoing limitation of liability. LICENSEE + acknowledges and represents that it has read and understands these + allocations of risk limiting the liability of DIGITAL and that it + understands that a modification of the allocation of risks set forth + in this agreement would affect the fees charged by DIGITAL, and that + LICENSEE, in consideration of such fees, agrees to such allocations + of risk. + + 8. LICENSEE INDEMNIFICATION. LICENSEE SHALL INDEMNIFY DIGITAL AGAINST + ALL COSTS AND DAMAGE JUDGEMENTS, INCLUDING ATTORNEY'S FEES AND COSTS + OF DEFENSE, INCURRED BECAUSE OF CLAIMS OF DAMAGE ARISING FROM LICENSEE'S + POSSESSION OR USE OR INABILITY TO USE SOFTWARE. + + 9. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE and documentation are provided + with RESTRICTED RIGHTS. Use duplication, or disclosure by the Government + is subject restrictions as set forth in subparagraph (c)(1)(ii) of The + Rights in Technical Data and Computer Software clause in DFARS + 252.227-7013, or subparagraphs (c)(i) and (2) of the Commercial Computer + Software -- Restricted Rights at 48 CFR 52.227-19, as applicable. + Manufacturer is Digital Equipment Corporation, 130 Lytton Avenue, + Palo Alto, CA 94301-1044. + + 10. Severability. If any provision of the Agreement is held illegal or + unenforceable by any court of competent jurisdiction, such provision + shall be deemed separable from the remaining provisions of this Agreement + and shall not affect or impair the validity or enforceability of the + remaining provisions of this Agreement. + + 11. Governing Law. This Agreement is governed by the laws of the + Commonwealth of Massachusetts. + + 12. Publicity. You my not use the name of DIGITAL in any advertisement, + press release or other publicity with reference to SRC Modula-3 + without prior written consent of DIGITAL. + + 13. Should you have any questions concerning this Agreement, or if you + desire to contact Digital for any reason, please do so via E-mail: + M3-REQUEST@SRC.DEC.COM. Index: m3/pm3/libs/m3core/src/Csupport/FBSD_ALPHA/dtoa.c diff -c /dev/null m3/pm3/libs/m3core/src/Csupport/FBSD_ALPHA/dtoa.c:1.1 *** /dev/null Mon Jun 7 17:09:06 1999 --- m3/pm3/libs/m3core/src/Csupport/FBSD_ALPHA/dtoa.c Mon Jun 7 13:13:52 1999 *************** *** 0 **** --- 1,28 ---- + /* Copyright (C) 1992, Digital Equipment Corporation */ + /* All rights reserved. */ + /* See the file COPYRIGHT for a full description. */ + + /* Last modified on Fri Aug 13 09:02:20 PDT 1993 by kalsow */ + /* modified on Tue Feb 11 14:23:53 PST 1992 by muller */ + + #ifndef IEEE_8087 + #define IEEE_8087 + #endif + + #define Int_32 int + + + #include "dtoa.h" + + /* Apparently libc defines both "__dtoa" and "dtoa". ??? */ + + char * __dtoa + #ifdef KR_headers + (d, mode, ndigits, decpt, sign, rve) + double d; int mode, ndigits, *decpt, *sign; char **rve; + #else + (double d, int mode, int ndigits, int *decpt, int *sign, char **rve) + #endif + { + return dtoa(d, mode, ndigits, decpt, sign, rve); + } Index: m3/pm3/libs/m3core/src/Csupport/FBSD_ALPHA/m3makefile diff -c /dev/null m3/pm3/libs/m3core/src/Csupport/FBSD_ALPHA/m3makefile:1.1 *** /dev/null Mon Jun 7 17:09:06 1999 --- m3/pm3/libs/m3core/src/Csupport/FBSD_ALPHA/m3makefile Mon Jun 7 13:13:52 1999 *************** *** 0 **** --- 1,10 ---- + % Copyright (C) 1992, Digital Equipment Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + % + % Last modified on Mon Oct 17 09:28:11 PDT 1994 by kalsow + % modified on Fri Jun 18 13:18:18 PDT 1993 by harrison + % modified on Thu Feb 4 15:58:38 PST 1993 by mjordan + % modified on Mon Oct 12 13:51:24 PDT 1992 by muller + + c_source ("dtoa") Index: m3/pm3/libs/m3core/src/Csupport/FreeBSD3/COPYRIGHT diff -c /dev/null m3/pm3/libs/m3core/src/Csupport/FreeBSD3/COPYRIGHT:1.1 *** /dev/null Mon Jun 7 17:09:06 1999 --- m3/pm3/libs/m3core/src/Csupport/FreeBSD3/COPYRIGHT Mon Jun 7 13:13:56 1999 *************** *** 0 **** --- 1,93 ---- + + Digital License Agreement + + SRC Modula-3 + + 1. Grant Of License. Digital Equipment Corporation, having a principal + office at 146 Main Street, Maynard, MA 01754 ("DIGITAL") grants to + you ("LICENSEE") the non-exclusive, non-transferable, royalty free + right to use, modify, reproduce and distribute SRC Modula-3 ("SOFTWARE") + subject to the terms set forth herein. Any distribution of SOFTWARE + shall include this Digital License Agreement in human readable form. + + 2. Title to Intellectual Property and Software. Subject to the limited + rights and licenses granted under this License Agreement, all rights, + title and interests including patent, copyright, and trademark rights + in SOFTWARE are and shall remain vested in DIGITAL to the exclusion + of LICENSEE. DIGITAL represents and warrants that DIGITAL has the + legal right to grant such licenses as are expressly granted under + this Agreement. + + 3. Copyright. The SOFTWARE is owned by DIGITAL or its suppliers and is + protected by United States copyright laws and international treaty + provisions. Therefore, you must treat the SOFTWARE like any other + copyrighted material (e.g., a book or musical recording) except + that you may use the SOFTWARE as provided in this Digital License + Agreement. + + 4. Improvements. LICENSEE hereby grants to DIGITAL a non-exclusive, + non-transferable, royalty free right to use, modify, reproduce + and distribute with the right to sublicense at any tier, any + improvements, enhancements, extensions, or modifications that + LICENSEE make to SOFTWARE, provided such are returned to DIGITAL + by LICENSEE. + + 5. DISCLAIMER OF WARRANTY. Because the SOFTWARE is a research work and + not a released product, it is provided "AS IS" WITHOUT WARRANTY OF ANY + KIND AND WITHOUT ANY SUPPORT SERVICES. EXCEPT AS SPECIFICALLY PROVIDED + ABOVE IN SECTION 2, DIGITAL FURTHER DISCLAIMS ALL OTHER EXPRESS OR + IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS FOR A PARTICULAR + PURPOSE. THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF + THE SOFTWARE REMAINS WITH YOU. + + 6. Limitation of Liability. IN NO EVENT SHALL DIGITAL OR ITS SUPPLIERS BE + LIABLE IN AN AMOUNT THAT EXCEEDS THE LICENSE FEE PAID BY LICENSEE FOR + ANY DAMAGES (INCLUDING, WITH LIMITATION, DAMAGES FOR LOSS OF BUSINESS + PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER + PECUNIARY LOSS), REGARDLESS OF THE FORM OF CLAIM OR ACTIONS, ARISING + OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, + EVEN IF DIGITAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY + FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT + APPLY TO YOU. + + 7. Acknowledgement of Allocation of Risk. LICENSEE acknowledges and agrees + that the fees charged by DIGITAL in this Agreement reflect the allocation + of risks provided by the foregoing limitation of liability. LICENSEE + acknowledges and represents that it has read and understands these + allocations of risk limiting the liability of DIGITAL and that it + understands that a modification of the allocation of risks set forth + in this agreement would affect the fees charged by DIGITAL, and that + LICENSEE, in consideration of such fees, agrees to such allocations + of risk. + + 8. LICENSEE INDEMNIFICATION. LICENSEE SHALL INDEMNIFY DIGITAL AGAINST + ALL COSTS AND DAMAGE JUDGEMENTS, INCLUDING ATTORNEY'S FEES AND COSTS + OF DEFENSE, INCURRED BECAUSE OF CLAIMS OF DAMAGE ARISING FROM LICENSEE'S + POSSESSION OR USE OR INABILITY TO USE SOFTWARE. + + 9. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE and documentation are provided + with RESTRICTED RIGHTS. Use duplication, or disclosure by the Government + is subject restrictions as set forth in subparagraph (c)(1)(ii) of The + Rights in Technical Data and Computer Software clause in DFARS + 252.227-7013, or subparagraphs (c)(i) and (2) of the Commercial Computer + Software -- Restricted Rights at 48 CFR 52.227-19, as applicable. + Manufacturer is Digital Equipment Corporation, 130 Lytton Avenue, + Palo Alto, CA 94301-1044. + + 10. Severability. If any provision of the Agreement is held illegal or + unenforceable by any court of competent jurisdiction, such provision + shall be deemed separable from the remaining provisions of this Agreement + and shall not affect or impair the validity or enforceability of the + remaining provisions of this Agreement. + + 11. Governing Law. This Agreement is governed by the laws of the + Commonwealth of Massachusetts. + + 12. Publicity. You my not use the name of DIGITAL in any advertisement, + press release or other publicity with reference to SRC Modula-3 + without prior written consent of DIGITAL. + + 13. Should you have any questions concerning this Agreement, or if you + desire to contact Digital for any reason, please do so via E-mail: + M3-REQUEST@SRC.DEC.COM. Index: m3/pm3/libs/m3core/src/Csupport/FreeBSD3/dtoa.c diff -c /dev/null m3/pm3/libs/m3core/src/Csupport/FreeBSD3/dtoa.c:1.1 *** /dev/null Mon Jun 7 17:09:06 1999 --- m3/pm3/libs/m3core/src/Csupport/FreeBSD3/dtoa.c Mon Jun 7 13:13:56 1999 *************** *** 0 **** --- 1,29 ---- + /* Copyright (C) 1992, Digital Equipment Corporation */ + /* All rights reserved. */ + /* See the file COPYRIGHT for a full description. */ + + /* Last modified on Wed Apr 5 08:44:12 PDT 1995 by kalsow */ + /* modified on Mon Oct 12 13:50:54 PDT 1992 by muller */ + + #ifndef KR_headers + #define KR_headers + #endif + + #ifndef IEEE_8087 + #define IEEE_8087 + #endif + + #include "dtoa.h" + + /* Apparently libc defines both "__dtoa" and "dtoa". ??? */ + + char * __dtoa + #ifdef KR_headers + (d, mode, ndigits, decpt, sign, rve) + double d; int mode, ndigits, *decpt, *sign; char **rve; + #else + (double d, int mode, int ndigits, int *decpt, int *sign, char **rve) + #endif + { + return dtoa(d, mode, ndigits, decpt, sign, rve); + } Index: m3/pm3/libs/m3core/src/Csupport/FreeBSD3/m3makefile diff -c /dev/null m3/pm3/libs/m3core/src/Csupport/FreeBSD3/m3makefile:1.1 *** /dev/null Mon Jun 7 17:09:06 1999 --- m3/pm3/libs/m3core/src/Csupport/FreeBSD3/m3makefile Mon Jun 7 13:13:56 1999 *************** *** 0 **** --- 1,10 ---- + % Copyright (C) 1992, Digital Equipment Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + % + % Last modified on Mon Oct 17 09:28:11 PDT 1994 by kalsow + % modified on Fri Jun 18 13:18:18 PDT 1993 by harrison + % modified on Thu Feb 4 15:58:38 PST 1993 by mjordan + % modified on Mon Oct 12 13:51:24 PDT 1992 by muller + + c_source ("dtoa") Index: m3/pm3/libs/m3core/src/float/m3makefile diff -c m3/pm3/libs/m3core/src/float/m3makefile:1.3 m3/pm3/libs/m3core/src/float/m3makefile:1.4 *** m3/pm3/libs/m3core/src/float/m3makefile:1.3 Tue Apr 28 16:26:54 1998 --- m3/pm3/libs/m3core/src/float/m3makefile Mon Jun 7 13:14:04 1999 *************** *** 17,24 **** --- 17,26 ---- "ARM" : _float_le, "DS3100" : [ "IEEE", "IEEE-le", "DS3100" ], "DS3100_OSF" : [ "IEEE", "IEEE-le", "DS3100" ], + "FBSD_ALPHA" : _float_le, "FreeBSD" : _float_le, "FreeBSD2" : _float_le, + "FreeBSD3" : _float_le, "HP300" : _float_be, "HPPA" : _float_be, "IBMR2" : _float_be, Index: m3/pm3/libs/m3core/src/runtime/m3makefile diff -c m3/pm3/libs/m3core/src/runtime/m3makefile:1.5 m3/pm3/libs/m3core/src/runtime/m3makefile:1.6 *** m3/pm3/libs/m3core/src/runtime/m3makefile:1.5 Tue Apr 28 16:26:58 1998 --- m3/pm3/libs/m3core/src/runtime/m3makefile Mon Jun 7 13:14:14 1999 *************** *** 11,18 **** --- 11,20 ---- "AP3000" : "ex_frame", "ARM" : "ex_frame", "DS3100" : "ex_stack", % has a working stack walker + "FBSD_ALPHA" : "ex_frame", "FreeBSD" : "ex_frame", "FreeBSD2" : "ex_frame", + "FreeBSD3" : "ex_frame", "HP300" : "ex_frame", "HPPA" : "ex_frame", "IBMR2" : "ex_frame", Index: m3/pm3/libs/m3core/src/runtime/ALPHA_OSF/RTHeapDepC.c diff -c m3/pm3/libs/m3core/src/runtime/ALPHA_OSF/RTHeapDepC.c:1.4 m3/pm3/libs/m3core/src/runtime/ALPHA_OSF/RTHeapDepC.c:1.5 *** m3/pm3/libs/m3core/src/runtime/ALPHA_OSF/RTHeapDepC.c:1.4 Fri Sep 26 08:35:35 1997 --- m3/pm3/libs/m3core/src/runtime/ALPHA_OSF/RTHeapDepC.c Mon Jun 7 13:14:19 1999 *************** *** 145,151 **** #include #include /* for quotactl(2) */ ! extern int RT0u__inCritical; #define ENTER_CRITICAL RT0u__inCritical++ #define EXIT_CRITICAL RT0u__inCritical-- --- 145,151 ---- #include #include /* for quotactl(2) */ ! extern long RT0u__inCritical; #define ENTER_CRITICAL RT0u__inCritical++ #define EXIT_CRITICAL RT0u__inCritical-- Index: m3/pm3/libs/m3core/src/runtime/ALPHA_OSF/RTThreadC.c diff -c m3/pm3/libs/m3core/src/runtime/ALPHA_OSF/RTThreadC.c:1.1.1.1 m3/pm3/libs/m3core/src/runtime/ALPHA_OSF/RTThreadC.c:1.2 *** m3/pm3/libs/m3core/src/runtime/ALPHA_OSF/RTThreadC.c:1.1.1.1 Thu Jan 16 16:29:55 1997 --- m3/pm3/libs/m3core/src/runtime/ALPHA_OSF/RTThreadC.c Mon Jun 7 13:14:20 1999 *************** *** 19,25 **** int ThreadF__myId = 1; /* low-level runtime lock */ ! int RT0u__inCritical = 0; /* global, per-thread linked list of exception handlers */ void* RTThread__handlerStack = 0; --- 19,25 ---- int ThreadF__myId = 1; /* low-level runtime lock */ ! long RT0u__inCritical = 0; /* global, per-thread linked list of exception handlers */ void* RTThread__handlerStack = 0; Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/COPYRIGHT diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/COPYRIGHT:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/COPYRIGHT Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,93 ---- + + Digital License Agreement + + SRC Modula-3 + + 1. Grant Of License. Digital Equipment Corporation, having a principal + office at 146 Main Street, Maynard, MA 01754 ("DIGITAL") grants to + you ("LICENSEE") the non-exclusive, non-transferable, royalty free + right to use, modify, reproduce and distribute SRC Modula-3 ("SOFTWARE") + subject to the terms set forth herein. Any distribution of SOFTWARE + shall include this Digital License Agreement in human readable form. + + 2. Title to Intellectual Property and Software. Subject to the limited + rights and licenses granted under this License Agreement, all rights, + title and interests including patent, copyright, and trademark rights + in SOFTWARE are and shall remain vested in DIGITAL to the exclusion + of LICENSEE. DIGITAL represents and warrants that DIGITAL has the + legal right to grant such licenses as are expressly granted under + this Agreement. + + 3. Copyright. The SOFTWARE is owned by DIGITAL or its suppliers and is + protected by United States copyright laws and international treaty + provisions. Therefore, you must treat the SOFTWARE like any other + copyrighted material (e.g., a book or musical recording) except + that you may use the SOFTWARE as provided in this Digital License + Agreement. + + 4. Improvements. LICENSEE hereby grants to DIGITAL a non-exclusive, + non-transferable, royalty free right to use, modify, reproduce + and distribute with the right to sublicense at any tier, any + improvements, enhancements, extensions, or modifications that + LICENSEE make to SOFTWARE, provided such are returned to DIGITAL + by LICENSEE. + + 5. DISCLAIMER OF WARRANTY. Because the SOFTWARE is a research work and + not a released product, it is provided "AS IS" WITHOUT WARRANTY OF ANY + KIND AND WITHOUT ANY SUPPORT SERVICES. EXCEPT AS SPECIFICALLY PROVIDED + ABOVE IN SECTION 2, DIGITAL FURTHER DISCLAIMS ALL OTHER EXPRESS OR + IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS FOR A PARTICULAR + PURPOSE. THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF + THE SOFTWARE REMAINS WITH YOU. + + 6. Limitation of Liability. IN NO EVENT SHALL DIGITAL OR ITS SUPPLIERS BE + LIABLE IN AN AMOUNT THAT EXCEEDS THE LICENSE FEE PAID BY LICENSEE FOR + ANY DAMAGES (INCLUDING, WITH LIMITATION, DAMAGES FOR LOSS OF BUSINESS + PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER + PECUNIARY LOSS), REGARDLESS OF THE FORM OF CLAIM OR ACTIONS, ARISING + OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, + EVEN IF DIGITAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY + FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT + APPLY TO YOU. + + 7. Acknowledgement of Allocation of Risk. LICENSEE acknowledges and agrees + that the fees charged by DIGITAL in this Agreement reflect the allocation + of risks provided by the foregoing limitation of liability. LICENSEE + acknowledges and represents that it has read and understands these + allocations of risk limiting the liability of DIGITAL and that it + understands that a modification of the allocation of risks set forth + in this agreement would affect the fees charged by DIGITAL, and that + LICENSEE, in consideration of such fees, agrees to such allocations + of risk. + + 8. LICENSEE INDEMNIFICATION. LICENSEE SHALL INDEMNIFY DIGITAL AGAINST + ALL COSTS AND DAMAGE JUDGEMENTS, INCLUDING ATTORNEY'S FEES AND COSTS + OF DEFENSE, INCURRED BECAUSE OF CLAIMS OF DAMAGE ARISING FROM LICENSEE'S + POSSESSION OR USE OR INABILITY TO USE SOFTWARE. + + 9. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE and documentation are provided + with RESTRICTED RIGHTS. Use duplication, or disclosure by the Government + is subject restrictions as set forth in subparagraph (c)(1)(ii) of The + Rights in Technical Data and Computer Software clause in DFARS + 252.227-7013, or subparagraphs (c)(i) and (2) of the Commercial Computer + Software -- Restricted Rights at 48 CFR 52.227-19, as applicable. + Manufacturer is Digital Equipment Corporation, 130 Lytton Avenue, + Palo Alto, CA 94301-1044. + + 10. Severability. If any provision of the Agreement is held illegal or + unenforceable by any court of competent jurisdiction, such provision + shall be deemed separable from the remaining provisions of this Agreement + and shall not affect or impair the validity or enforceability of the + remaining provisions of this Agreement. + + 11. Governing Law. This Agreement is governed by the laws of the + Commonwealth of Massachusetts. + + 12. Publicity. You my not use the name of DIGITAL in any advertisement, + press release or other publicity with reference to SRC Modula-3 + without prior written consent of DIGITAL. + + 13. Should you have any questions concerning this Agreement, or if you + desire to contact Digital for any reason, please do so via E-mail: + M3-REQUEST@SRC.DEC.COM. Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTHeapDep.m3 diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTHeapDep.m3:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTHeapDep.m3 Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,172 ---- + (* Copyright (C) 1994, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (*| Last modified on Fri Jan 20 09:41:09 PST 1995 by kalsow *) + (*| modified on Mon Oct 31 00:04:38 MET 1994 by Olaf Wagner *) + (*| modified on Thu Jan 28 19:24:55 PST 1993 by jdd *) + + UNSAFE MODULE RTHeapDep; + + IMPORT RT0u, RTMachine, RTHeapRep, RTCollectorSRC; + IMPORT Cstdlib, Ctypes, Umman, Unix, Uresource, Usignal, Utypes, Word; + + VAR + initialized := FALSE; + defaultSIGSEGV: Usignal.SignalHandler := NIL; (* previous handler *) + defaultSIGBUS: Usignal.SignalHandler := NIL; (* previous handler *) + + PROCEDURE Protect (p: Page; n: CARDINAL; readable, writable: BOOLEAN) = + BEGIN + IF NOT initialized THEN Init(); initialized := TRUE; END; + IF NOT readable THEN writable := FALSE; END; (* processor limitation *) + VAR prot: Ctypes.int := 0; + BEGIN + IF readable THEN prot := Word.Or(prot, Umman.PROT_READ); END; + IF writable THEN prot := Word.Or(prot, Umman.PROT_WRITE); END; + VAR + ret := Umman.mprotect(LOOPHOLE(p * BytesPerPage, Utypes.caddr_t), + n * BytesPerPage, prot); + BEGIN + (* + <* ASSERT ret = n * BytesPerPage *> + *) + <* ASSERT ret = 0 *> + END; + END; + END Protect; + + (* Init establishes a handler for SIGSEGV, caused by VM faults, and for all + other signals that cause core dumps. *) + + PROCEDURE Init () = + BEGIN + (* sanity check *) + VAR vmPageBytes := Unix.getpagesize(); + BEGIN + <* ASSERT BytesPerPage >= vmPageBytes *> + <* ASSERT BytesPerPage MOD vmPageBytes = 0 *> + END; + + (* establish SIGSEGV handler; remember previous handler *) + VAR + vec := Usignal.struct_sigvec{ + sv_handler := Fault, sv_mask := + Word.LeftShift(1, Usignal.SIGVTALRM - 1), sv_flags := 0}; + ovec: Usignal.struct_sigvec; + ret := Usignal.sigvec(Usignal.SIGSEGV, vec, ovec); + vecb := Usignal.struct_sigvec{ + sv_handler := Fault, sv_mask := + Word.LeftShift(1, Usignal.SIGVTALRM - 1), sv_flags := 0}; + ovecb: Usignal.struct_sigvec; + retb := Usignal.sigvec(Usignal.SIGBUS, vecb, ovecb); + BEGIN + <* ASSERT ret = 0 *> + <* ASSERT retb = 0 *> + defaultSIGSEGV := ovec.sv_handler; + defaultSIGBUS := ovecb.sv_handler; + END; + + (* establish signal handler for all other signals that dump core, if no + handler exists *) + PROCEDURE OverrideDefault (sig: Ctypes.int) = + VAR + vec := Usignal.struct_sigvec{ + sv_handler := Core, sv_mask := + Word.LeftShift(1, Usignal.SIGVTALRM - 1), sv_flags := 0}; + ovec: Usignal.struct_sigvec; + ret := Usignal.sigvec(sig, vec, ovec); + BEGIN + <* ASSERT ret = 0 *> + IF ovec.sv_handler # Usignal.SIG_DFL THEN + ret := Usignal.sigvec(sig, ovec, vec); + <* ASSERT ret = 0 *> + END; + END OverrideDefault; + BEGIN + OverrideDefault(Usignal.SIGQUIT); + OverrideDefault(Usignal.SIGILL); + OverrideDefault(Usignal.SIGTRAP); + OverrideDefault(Usignal.SIGIOT); + OverrideDefault(Usignal.SIGEMT); + OverrideDefault(Usignal.SIGFPE); + OverrideDefault(Usignal.SIGSYS); + END; + END Init; + + (* Fault is called upon a SIGSEGV or SIGBUS signal, caused by a VM fault. + If RTHeapRep.Fault is not able to handle the fault, it invokes the previous + action. *) + + PROCEDURE Fault (sig : Ctypes.int; + code: Ctypes.int; + scp : UNTRACED REF Usignal.struct_sigcontext) = + VAR + sf_addr := LOOPHOLE(scp.sc_traparg_a0, ADDRESS); + + BEGIN + IF RTHeapRep.Fault(sf_addr) THEN + RETURN; + END; + IF defaultSIGSEGV = Usignal.SIG_IGN THEN RETURN; END; + IF defaultSIGSEGV = Usignal.SIG_DFL THEN + Core(sig, code, scp); + ELSE + defaultSIGSEGV(sig, code, scp); + END; + END Fault; + + (* Core is a signal handler for signals that dump core, to complete the + current collection before dumping core. This makes core files easier to + debug, and avoids an Ultrix bug that creates incomplete core files if + heap pages are read-protected. *) + + VAR dumped_core := FALSE; + + PROCEDURE Core ( sig : Ctypes.int; + <* UNUSED *> code: Ctypes.int; + <* UNUSED *> scp : UNTRACED REF Usignal.struct_sigcontext) = + VAR + ovec: Usignal.struct_sigvec; + vec := Usignal.struct_sigvec{sv_handler := Usignal.SIG_DFL, + sv_mask := 0, sv_flags := 0}; + BEGIN + INC(RT0u.inCritical); + IF NOT dumped_core THEN + dumped_core := TRUE; + EVAL RTHeapRep.Crash(); (* clean up the heap *) + EVAL Usignal.sigvec(sig, vec, ovec); (* establish default action *) + EVAL Usignal.sigsetmask(0); + (** EVAL Usignal.kill(Uprocess.getpid(), sig); (* dump core *) **) + Cstdlib.abort (); (* dump core *) + <* ASSERT FALSE *> + END; + DEC(RT0u.inCritical); + END Core; + + (* System-call faults are handled in RTHeapDepC.c *) + + PROCEDURE TimeUsed (): REAL = + VAR usage: Uresource.struct_rusage; + BEGIN + VAR ret := Uresource.getrusage(Uresource.RUSAGE_SELF, ADR(usage)); + BEGIN + <* ASSERT ret # -1 *> + END; + RETURN (FLOAT(usage.ru_utime.tv_sec) + + FLOAT(usage.ru_utime.tv_usec) / 1000000.0) + + (FLOAT(usage.ru_utime.tv_sec) + + FLOAT(usage.ru_utime.tv_usec) / 1000000.0); + END TimeUsed; + + PROCEDURE VMFaultTime (): REAL = + BEGIN + RETURN 0.010; (* guess 10ms to handle a page fault *) + END VMFaultTime; + + BEGIN + IF VM THEN + RTMachine.RTHeapRep_Fault := LOOPHOLE (RTHeapRep.Fault, ADDRESS); + RTMachine.RTCSRC_FinishVM := LOOPHOLE (RTCollectorSRC.FinishVM, ADDRESS); + END; + END RTHeapDep. Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTHeapDepC.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTHeapDepC.c:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTHeapDepC.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,1391 ---- + /* Copyright (C) 1992, Digital Equipment Corporation */ + /* All rights reserved. */ + /* See the file COPYRIGHT for a full description. */ + + /* modified on Tue Feb 2 11:15:57 PST 1993 by jdd */ + + /* This is RTHeapDepC.c for FreeBSD running on 386/486 processors. */ + /* + * ow Sat Oct 29 14:10:19 MET 1994 + * ow Sun Nov 6 16:39:26 MET 1994 + * ow Sun Dec 4 17:58:49 1994 changes for FreeBSD 2.0 + * + * I just tried to check the calls implemented for Ultrix, + * (almost) nothing else has been changed or added. + * So be careful to use any other system calls, some are + * probably missing. + */ + /* This file implements wrappers for almost all Ultrix system calls + that take pointers as arguments. These wrappers allow the system + calls to take arguments that might point to the traced heap, which + may be VM-protected in the Ultrix implementation of the collector. + The wrappers read and write the referents of all pointers about to + passed to the system call, which ensures that the pages are not + protected when the call is made. + + Each wrapper is a critical section, with RT0u__inCritical non-zero, + so that another thread cannot cause the pages to become reprotected + before the system call is performed. + + A few system calls are not handled here, or are handled only + partially. This restricts the system calls that can be made from + Modula-3, or from libraries that are passed pointers into the + Modula-3 traced heap. These system calls are: + + 1) sigvec. Sigvec takes 3 arguments, but passes 4 to the kernel. + The extra argument is the address of the sigtramp code, which is + copyrighted. The sigtramp code appears in the the standard .o + file that also defines sigvec, so that sigvec cannot be + redefined here without including sigtramp. Rewriting sigtramp + seemed too error-prone, so sigvec is not supported here, meaning + that sigvec cannot be called with arguments on the heap. + + 2) syscall. Implementing syscall would require a huge case + statement, with one case per system call. This seemed too + error-prone, so syscall cannot take arguments that point into + the traced heap. + + 3) ioctl. Ioctl's third argument may be a pointer, and some device + drivers might interpret the referent as containing more + pointers. These second-level pointers are not handled here, so + they must not point into the traced heap if they exist. + Handling this problem in general is impossible, since the set of + device drivers is open-ended. + + 4) profil. The memory referenced by the "buff" argument is updated + after the call returns, and there is no mechanism to permanently + unprotect it. + + 5) Undocumented system calls. There are private system calls with + no manual pages, so it was impossible to write wrappers. + + 6) audgen, whose manpage is incomprehensible. + + (Some calls in Section 2 are already wrappers for other system + calls; it is not necessary to reimplement them here.) + + Also, longjmp must not be used from a signal handler to abnormally + exit from a system call. + + Finally, if a system call references an object on the heap, each + pointer must reference only one object. Therefore, it is not + possible to write the heap contents with a single write. */ + + #define MFS + #define NFS + #include + #include + #include + #include + #include + #include + #if __FreeBSD__ >= 2 + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #if __FreeBSD__ >= 3 + #include + #include + #include + #include + #include + #endif + + #include + #include + + #ifdef NULL + #undef NULL + #endif + #define NULL (void *)(0) + extern long RT0u__inCritical; + #define ENTER_CRITICAL RT0u__inCritical++ + #define EXIT_CRITICAL RT0u__inCritical-- + + void (*RTHeapRep_Fault)(char*); + void (*RTCSRC_FinishVM)(); + + static char RTHeapDepC__c; + #define MAKE_READABLE(x) if (x != 0) { RTHeapDepC__c = *(char*)(x); } + #define MAKE_WRITABLE(x) if (x != 0) { *(char*)(x) = RTHeapDepC__c = *(char*)(x); } + + /* + * Modula-3 compilation units are always compiled PIC. This causes + * the a.out linker to complain that there is no reference to + * _DYNAMIC if the program is linked with "-static". Provide a + * weak reference to it here so that static linking will work. + * + * This has nothing to do with the heap, so it doesn't really belong + * here. But it needs to be someplace that is guaranteed to be pulled + * into every executable. + */ + #pragma weak _DYNAMIC + extern int _DYNAMIC; + static int *i __unused = &_DYNAMIC; + + /* Unless otherwise noted, all the following wrappers have the same + structure. */ + + int access(path, mode) /* ok */ + const char *path; + int mode; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_access, path, mode); + EXIT_CRITICAL; + return result; + } + + int acct(file) /* ok */ + const char *file; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(file); + result = syscall(SYS_acct, file); + EXIT_CRITICAL; + return result; + } + + int adjtime(delta, olddelta) /* ok */ + #if __FreeBSD__ >= 2 + const struct timeval *delta; + #else + struct timeval *delta; + #endif + struct timeval *olddelta; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(delta); + MAKE_WRITABLE(olddelta); + result = syscall(SYS_adjtime, delta, olddelta); + EXIT_CRITICAL; + return result; + } + + /* not implemented + int atomic_op(op, addr) + int op; + int *addr; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(addr); + result = syscall(SYS_atomic_op, op, addr); + EXIT_CRITICAL; + return result; + } + */ + + /* not implemented + int audcntl(request, argp, len, flag, audit_id) + int request; + char *argp; + int len; + int flag; + audit_ID_t audit_id; + { int result; + + ENTER_CRITICAL; + switch (request) { + case GET_SYS_AMASK: + case GET_TRUSTED_AMASK: + case GET_PROC_AMASK: + MAKE_WRITABLE(argp); + break; + case SET_SYS_AMASK: + case SET_TRUSTED_AMASK: + case SET_PROC_AMASK: + MAKE_READABLE(argp); + break; + default: + break; + } + result = syscall(SYS_audcntl, request, argp, len, flag, audit_id); + EXIT_CRITICAL; + return result; + } + + int audgen(event, tokenp, argv) + int event; + char *tokenp, *argv[]; + { int result; + + ENTER_CRITICAL; + + { char *t, **a; + + for (t = tokenp, a = argv; t; t++, a++) { + if (A_TOKEN_PTR(*t)) { + MAKE_READABLE(*a); + } + } + } + result = syscall(SYS_audgen, tokenp, argv); + EXIT_CRITICAL; + return result; + } + */ + + /* not implemented + int cachectl(addr, nbytes, op) + char *addr; + int nbytes, op; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(addr); + result = syscall(SYS_cachectl, addr, nbytes, op); + EXIT_CRITICAL; + return result; + } + + int cacheflush(addr, nbytes, cache) + char *addr; + int nbytes, cache; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(addr); + result = syscall(SYS_cacheflush, addr, nbytes, cache); + EXIT_CRITICAL; + return result; + } + */ + + int chdir(path) /* ok */ + const char *path; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_chdir, path); + EXIT_CRITICAL; + return result; + } + + int chflags(path, flags) + const char *path; + u_long flags; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_chflags, path, flags); + EXIT_CRITICAL; + return result; + } + + int chmod(path, mode) /* ok */ + const char *path; + mode_t mode; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_chmod, path, mode); + EXIT_CRITICAL; + return result; + } + + int chown(path, owner, group) /* ok */ + const char *path; + uid_t owner; + gid_t group; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_chown, path, owner, group); + EXIT_CRITICAL; + return result; + } + + int chroot(dirname) /* ok */ + const char *dirname; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(dirname); + result = syscall(SYS_chroot, dirname); + EXIT_CRITICAL; + return result; + } + + /* not implemented (obsolete) + int creat(name, mode) + const char *name; + mode_t mode; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = syscall(SYS_creat, name, mode); + EXIT_CRITICAL; + return result; + } + */ + + /* execve is implemented differently since it does not return, which + would leave RT0u__inCritical set in the parent if called in the child + of a vfork. Many calls leave the process in an undefined state in the + case of EFAULT, but we assume that execve is not one of these. */ + + int execve(name, argv, envp) /* ok */ + const char *name; + char * const argv[]; + char * const envp[]; + { int result; + + for (;;) { + result = syscall(SYS_execve, name, argv, envp); + if (result == -1 && errno == EFAULT) { + MAKE_READABLE(name); + { char * const *a; for (a = argv; *a; a++) MAKE_READABLE(*a); } + { char * const *e; for (e = envp; *e; e++) MAKE_READABLE(*e); } + } else { + return result; + } + } + } + + /* not implemented + int exportfs(name, rootuid, exflags) + char *name; + int rootuid, exflags; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = syscall(SYS_exportfs, name, rootuid, exflags); + EXIT_CRITICAL; + return result; + } + */ + + int ufcntl(int fd, int request, int arg) /* ok */ + { int result; + /* int arg; + va_list ap; + + va_start(ap, request); + arg = va_arg(ap, int); + va_end(ap); + */ + + ENTER_CRITICAL; + switch (request) { + case F_GETLK: + MAKE_WRITABLE(arg); + break; + case F_SETLK: + case F_SETLKW: + MAKE_READABLE(arg); + break; + default: + break; + } + result = syscall(SYS_fcntl, fd, request, arg); + EXIT_CRITICAL; + return result; + } + + int fstat(fd, buf) /* ok */ + int fd; + struct stat *buf; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + result = syscall(SYS_fstat, fd, buf); + EXIT_CRITICAL; + return result; + } + + int getdirentries(fd, buf, nbytes, basep) /* ok */ + int fd; + char *buf; + int nbytes; + long *basep; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + MAKE_WRITABLE(basep); + result = syscall(SYS_getdirentries, fd, buf, nbytes, basep); + EXIT_CRITICAL; + return result; + } + + int getdomainname(name, namelen) /* ok */ + char *name; + int namelen; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(name); + result = syscall(SYS_getdomainname, name, namelen); + EXIT_CRITICAL; + return result; + } + + int gethostname(name, namelen) /* ok */ + char *name; + int namelen; + { int result; + #if __FreeBSD__ >= 2 + int mib[2]; + size_t size; + #endif + + ENTER_CRITICAL; + MAKE_WRITABLE(name); + #if __FreeBSD__ >= 2 + mib[0] = CTL_KERN; + mib[1] = KERN_HOSTNAME; + size = namelen; + if (sysctl(mib, 2, name, &size, NULL, 0) == -1){ + result = -1; + }else{ + result = 0; + } + #else + result = syscall(SYS_gethostname, name, namelen); + #endif + EXIT_CRITICAL; + return result; + } + + int getgroups(gidsetsize, grouplist) /* ok */ + int gidsetsize; + gid_t grouplist[]; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(grouplist); + result = syscall(SYS_getgroups, gidsetsize, grouplist); + EXIT_CRITICAL; + return result; + } + + int getitimer(which, value) /* ok */ + int which; + struct itimerval *value; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(value); + result = syscall(SYS_getitimer, which, value); + EXIT_CRITICAL; + return result; + } + + /* not implemented + int getmnt(start, buffer, nbytes, mode, path) + int *start; + struct fs_data *buffer; + int nbytes, mode; + char *path; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(start); + MAKE_WRITABLE(buffer); + MAKE_READABLE(path); + result = syscall(SYS_getmnt, start, buffer, nbytes, mode, path); + EXIT_CRITICAL; + return result; + } + */ + + int getrlimit(resource, rlp) /* ok */ + int resource; + struct rlimit *rlp; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(rlp); + result = syscall(SYS_getrlimit, resource, rlp); + EXIT_CRITICAL; + return result; + } + + int getrusage(who, rusage) /* ok */ + int who; + struct rusage *rusage; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(rusage); + result = syscall(SYS_getrusage, who, rusage); + EXIT_CRITICAL; + return result; + } + + int getsockopt(s, level, optname, optval, optlen) /* ok */ + int s, level, optname; + void *optval; + int *optlen; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(optval); + MAKE_WRITABLE(optlen); + result = syscall(SYS_getsockopt, s, level, optname, optval, optlen); + EXIT_CRITICAL; + return result; + } + /* not implemented + int getsysinfo(op, buffer, nbytes, start, arg) + unsigned op; + char *buffer; + unsigned nbytes; + int *start; + char *arg; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buffer); + MAKE_WRITABLE(start); + MAKE_WRITABLE(arg); + result = syscall(SYS_getsysinfo, op, buffer, nbytes, start, arg); + EXIT_CRITICAL; + return result; + } + */ + + int gettimeofday(tp, tzp) /* ok */ + struct timeval *tp; + struct timezone *tzp; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(tp); + MAKE_WRITABLE(tzp); + result = syscall(SYS_gettimeofday, tp, tzp); + EXIT_CRITICAL; + return result; + } + + /* ioctl must test the argp argument carefully. It may be a pointer, + or maybe not. At a slight expense, we call RTHeapRep.Fault to + unprotect the page if it's in the traced heap, but do nothing + otherwise. */ + + int ioctl(d, request, argp) /* ok */ + int d; + unsigned long request; + char *argp; + { int result; + + ENTER_CRITICAL; + if (RTHeapRep_Fault) RTHeapRep_Fault(argp); /* make it readable */ + if (RTHeapRep_Fault) RTHeapRep_Fault(argp); /* make it writable */ + result = syscall(SYS_ioctl, d, request, argp); + EXIT_CRITICAL; + return result; + } + + #ifdef SYS_lchown + int lchown(path, owner, group) /* ok */ + const char *path; + uid_t owner; + gid_t group; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_lchown, path, owner, group); + EXIT_CRITICAL; + return result; + } + #endif /* SYS_lchown */ + + int link(name1, name2) /* ok */ + const char *name1; + const char *name2; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(name1); + MAKE_READABLE(name2); + result = syscall(SYS_link, name1, name2); + EXIT_CRITICAL; + return result; + } + + int lstat(path, buf) /* ok */ + const char *path; + struct stat *buf; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + MAKE_WRITABLE(buf); + result = syscall(SYS_lstat, path, buf); + EXIT_CRITICAL; + return result; + } + + int mkdir(path, mode) /* ok */ + const char *path; + mode_t mode; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_mkdir, path, mode); + EXIT_CRITICAL; + return result; + } + + int mkfifo(path, mode) /* ok */ + const char *path; + mode_t mode; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_mkfifo, path, mode); + EXIT_CRITICAL; + return result; + } + + int mknod(path, mode, dev) /* ok */ + const char *path; + mode_t mode; + dev_t dev; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_mknod, path, mode, dev); + EXIT_CRITICAL; + return result; + } + + #if __FreeBSD_version >= 300001 /* New form of mount(2) */ + int + mount(type, dir, flags, data) + const char *type; + const char *dir; + int flags; + void *data; + { int result; + struct ufs_args *u_data; + struct mfs_args *m_data; + struct nfs_args *n_data; + + ENTER_CRITICAL; + MAKE_READABLE(type); + MAKE_READABLE(dir); + if (strcmp(type, "ufs") == 0) { + u_data = (struct ufs_args*) data; + MAKE_READABLE(u_data); + MAKE_READABLE(u_data->fspec); + result = syscall(SYS_mount, type, dir, flags, data); + } else if (strcmp(type, "mfs") == 0) { + m_data = (struct mfs_args*) data; + MAKE_READABLE(m_data); + MAKE_READABLE(m_data->fspec); + result = syscall(SYS_mount, type, dir, flags, data); + } else if (strcmp(type, "nfs") == 0) { + n_data = (struct nfs_args*) data; + MAKE_READABLE(n_data); + MAKE_READABLE(n_data->addr); + MAKE_READABLE(n_data->fh); + MAKE_READABLE(n_data->hostname); + result = syscall(SYS_mount, type, dir, flags, data); + } else { /* Not anything we recognize. */ + MAKE_READABLE(data); + result = syscall(SYS_mount, type, dir, flags, data); + } + EXIT_CRITICAL; + if (result != -1) { + result = 0; + } + return result; + } + + #else /* __FreeBSD_version >= 300001 */ + + int mount(type, dir, flags, data) + int type; + const char *dir; + int flags; + void *data; + { int result; + struct ufs_args *u_data; + struct mfs_args *m_data; + struct nfs_args *n_data; + + ENTER_CRITICAL; + MAKE_READABLE(dir); + switch(type) { + case MOUNT_UFS: u_data = (struct ufs_args*) data; + MAKE_READABLE(u_data); + MAKE_READABLE(u_data->fspec); break; + case MOUNT_MFS: m_data = (struct mfs_args*) data; + MAKE_READABLE(m_data); + #if __FreeBSD__ >= 2 + MAKE_READABLE(m_data->fspec); break; + #else + MAKE_READABLE(m_data->name); break; + #endif + case MOUNT_NFS: n_data = (struct nfs_args*) data; + MAKE_READABLE(n_data); + MAKE_READABLE(n_data->addr); + MAKE_READABLE(n_data->fh); + MAKE_READABLE(n_data->hostname); break; + } + result = syscall(SYS_mount, type, dir, flags, data); + EXIT_CRITICAL; + if (result != -1) { + result = 0; + } + return result; + } + #endif /* __FreeBSD_version >= 300001 */ + + int msgctl(msqid, cmd, buf) /* ok */ + int msqid, cmd; + struct msqid_ds *buf; + { int result; + + ENTER_CRITICAL; + switch (cmd) { + case IPC_SET: + MAKE_READABLE(buf); + break; + case IPC_STAT: + MAKE_WRITABLE(buf); + break; + default: + break; + } + result = syscall(SYS_msgsys, 0, msqid, cmd, buf); + EXIT_CRITICAL; + return result; + } + + int msgrcv(msqid, msgp, msgsz, msgtyp, msgflg) /* ok */ + int msqid; + void *msgp; + size_t msgsz; + long msgtyp; + int msgflg; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(msgp); + result = syscall(SYS_msgsys, 3, msqid, msgp, msgsz, msgtyp, msgflg); + EXIT_CRITICAL; + return result; + } + + int msgsnd(msqid, msgp, msgsz, msgflg) /* ok */ + int msqid; + void *msgp; + size_t msgsz; + int msgflg; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(msgp); + result = syscall(SYS_msgsys, 2, msqid, msgp, msgsz, msgflg); + EXIT_CRITICAL; + return result; + } + + int uopen(const char* path, int flags, mode_t mode) /* ok */ + { int result; + /* mode_t mode; + va_list ap; + + va_start(ap, flags); + mode = va_arg(ap, mode_t); + va_end(ap); + this does not work. Why? + */ + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_open, path, flags, mode); + EXIT_CRITICAL; + return result; + } + + int quotactl(path, cmd, uid, addr) /* ok */ + const char *path; + int cmd, uid; + #if __FreeBSD_version >= 400002 + void *addr; + #else + char *addr; + #endif + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + switch (cmd) { + case Q_QUOTAON: + case Q_QUOTAOFF: + case Q_SETUSE: + case Q_SETQUOTA: + case Q_GETQUOTA: + MAKE_READABLE(addr); + break; + /* + case Q_GETDLIM: + MAKE_WRITABLE(addr); + break; + */ + default: + break; + } + result = syscall(SYS_quotactl, path, cmd, uid, addr); + EXIT_CRITICAL; + return result; + } + + int readlink(path, buf, bufsiz) /* ok */ + const char *path; + char *buf; + int bufsiz; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + MAKE_WRITABLE(buf); + result = syscall(SYS_readlink, path, buf, bufsiz); + EXIT_CRITICAL; + return result; + } + + ssize_t readv(d, iov, iovcnt) /* ok */ + int d; + const struct iovec *iov; + int iovcnt; + { int result; + + ENTER_CRITICAL; + { int i; + for (i = 0; i < iovcnt; i++) { + MAKE_WRITABLE(iov[i].iov_base); + } + } + result = syscall(SYS_readv, d, iov, iovcnt); + EXIT_CRITICAL; + return result; + } + + ssize_t recvmsg(s, msg, flags) /* ok */ + int s; + struct msghdr msg[]; + int flags; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(msg->msg_name); + { int i; + for (i = 0; i < msg->msg_iovlen; i++) { + if (msg->msg_iov[i].iov_len > 0) { + MAKE_WRITABLE(msg->msg_iov[i].iov_base); + } + } + } + MAKE_WRITABLE(msg->msg_control); + result = syscall(SYS_recvmsg, s, msg, flags); + EXIT_CRITICAL; + return result; + } + + int rename(from, to) /* ok */ + char *from; + char *to; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(from); + MAKE_READABLE(to); + result = syscall(SYS_rename, from, to); + EXIT_CRITICAL; + return result; + } + + int rmdir(path) /* ok */ + const char *path; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_rmdir, path); + EXIT_CRITICAL; + return result; + } + + int + #if (227002 <= __FreeBSD_version && __FreeBSD_version < 300000) || \ + __FreeBSD_version >= 300002 + semctl(int semid, int semnum, int cmd, ...) + #else + semctl(int semid, int semnum, int cmd, union semun arg) + #endif + { + int result; + #if (227002 <= __FreeBSD_version && __FreeBSD_version < 300000) || \ + __FreeBSD_version >= 300002 + union semun arg; + va_list ap; + + va_start(ap, cmd); + arg = va_arg(ap, union semun); + va_end(ap); + #endif + + ENTER_CRITICAL; + switch (cmd) { + + case IPC_SET: + MAKE_READABLE(arg.buf); + break; + + case SETALL: + MAKE_READABLE(arg.array); + break; + + case IPC_STAT: + MAKE_WRITABLE(arg.buf); + break; + + case GETALL: + MAKE_WRITABLE(arg.array); + break; + } + result = syscall(SYS_semsys, 0, semid, semnum, cmd, arg); + EXIT_CRITICAL; + return result; + } + + int semop(semid, sops, nsops) /* ok ? */ + int semid; + struct sembuf *sops; + unsigned int nsops; + { int result; + + ENTER_CRITICAL; + { unsigned int i; + for (i = 0; i < nsops; i++) { + MAKE_READABLE(sops); + } + } + result = syscall(SYS_semsys, 2, semid, sops, nsops); + EXIT_CRITICAL; + return result; + } + + ssize_t sendmsg(s, msg, flags) /* ok */ + int s; + const struct msghdr msg[]; + int flags; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(msg->msg_name); + { int i; + for (i = 0; i < msg->msg_iovlen; i++) { + if (msg->msg_iov[i].iov_len > 0) { + MAKE_READABLE(msg->msg_iov[i].iov_base); + } + } + } + MAKE_WRITABLE(msg->msg_control); + result = syscall(SYS_sendmsg, s, msg, flags); + EXIT_CRITICAL; + return result; + } + + int setdomainname(name, namelen) /* ok */ + const char *name; + int namelen; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = syscall(SYS_setdomainname, name, namelen); + EXIT_CRITICAL; + return result; + } + + int setgroups(ngroups, gidset) /* ok */ + int ngroups; + const gid_t *gidset; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(gidset); + result = syscall(SYS_setgroups, ngroups, gidset); + EXIT_CRITICAL; + return result; + } + + int sethostname(name, namelen) /* ok */ + const char *name; + int namelen; + { int result; + #if __FreeBSD__ >= 2 + int mib[2]; + #endif + + ENTER_CRITICAL; + MAKE_READABLE(name); + #if __FreeBSD__ >= 2 + mib[0] = CTL_KERN; + mib[1] = KERN_HOSTNAME; + if (sysctl(mib, 2, NULL, NULL, (void *)name, namelen) == -1){ + result = -1; + }else{ + result = 0; + } + #else + result = syscall(SYS_sethostname, name, namelen); + #endif + EXIT_CRITICAL; + return result; + } + + int setitimer(which, value, ovalue) /* ok */ + int which; + #if __FreeBSD__ >= 2 + const struct itimerval *value; + #else + struct itimerval *value; + #endif + struct itimerval *ovalue; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(value); + MAKE_WRITABLE(ovalue); + result = syscall(SYS_setitimer, which, value, ovalue); + EXIT_CRITICAL; + return result; + } + /* not implemented + int setquota(special, file) + char *special; + char *file; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(special); + MAKE_READABLE(file); + result = syscall(SYS_setquota, special, file); + EXIT_CRITICAL; + return result; + } + */ + + int setrlimit(resource, rlp) /* ok */ + int resource; + struct rlimit *rlp; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(rlp); + result = syscall(SYS_setrlimit, resource, rlp); + EXIT_CRITICAL; + return result; + } + + int setsockopt(s, level, optname, optval, optlen) /* ok */ + int s, level, optname; + const void *optval; + int optlen; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(optval); + result = syscall(SYS_setsockopt, s, level, optname, optval, optlen); + EXIT_CRITICAL; + return result; + } + + /* not implemented + int setsysinfo(op, buffer, nbytes, arg, flag) + unsigned op; + char *buffer; + unsigned nbytes; + unsigned arg; + unsigned flag; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(buffer); + result = syscall(SYS_setsysinfo, op, buffer, nbytes, arg, flag); + EXIT_CRITICAL; + return result; + } + */ + + int settimeofday(tp, tzp) /* ok */ + #if __FreeBSD__ >= 2 + const struct timeval *tp; + const struct timezone *tzp; + #else + struct timeval *tp; + struct timezone *tzp; + #endif + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(tp); + MAKE_READABLE(tzp); + result = syscall(SYS_settimeofday, tp, tzp); + EXIT_CRITICAL; + return result; + } + + int sigaction(sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(act); + MAKE_WRITABLE(oact); + result = syscall(SYS_sigaction, sig, act, oact); + EXIT_CRITICAL; + return result; + } + + int sigaltstack(ss, oss) /* ok */ + const struct sigaltstack *ss; + struct sigaltstack *oss; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(ss); + MAKE_WRITABLE(oss); + result = syscall(SYS_sigaltstack, ss, oss); + EXIT_CRITICAL; + return result; + } + + int socketpair(d, type, protocol, sv) /* ok */ + int d, type, protocol; + int sv[2]; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(sv); + result = syscall(SYS_socketpair, d, type, protocol, sv); + EXIT_CRITICAL; + return result; + } + + int stat(path, buf) /* ok */ + const char *path; + struct stat *buf; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + MAKE_WRITABLE(buf); + result = syscall(SYS_stat, path, buf); + EXIT_CRITICAL; + return result; + } + + int swapon(special) /* ok */ + const char *special; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(special); + result = syscall(SYS_swapon, special); + EXIT_CRITICAL; + return result; + } + + int symlink(name1, name2) /* ok */ + const char *name1; + const char *name2; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(name1); + MAKE_READABLE(name2); + result = syscall(SYS_symlink, name1, name2); + EXIT_CRITICAL; + return result; + } + + int truncate(path, length) /* ok */ + const char *path; + off_t length; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + /* The casts below pad "path" out to a 64-bit value as required. */ + result = __syscall(SYS_truncate, (u_quad_t)(u_long)path, length); + EXIT_CRITICAL; + return result; + } + + int uname(name) /* ok */ + struct utsname *name; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(name); + result = syscall(SYS_uname, name); + EXIT_CRITICAL; + return result; + } + + int unlink(path) /* ok */ + const char *path; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_unlink, path); + EXIT_CRITICAL; + return result; + } + + /* not implemented + int ustat(dev, buf) + dev_t dev; + struct ustat *buf; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + result = syscall(SYS_ustat, dev, buf); + EXIT_CRITICAL; + return result; + } + */ + + int utimes(file, tvp) /* ok */ + #if __FreeBSD__ >= 2 + const char *file; + const struct timeval *tvp; + #else + char *file; + struct timeval *tvp; + #endif + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(file); + MAKE_READABLE(tvp); + result = syscall(SYS_utimes, file, tvp); + EXIT_CRITICAL; + return result; + } + + pid_t wait(status) /* ok */ + int *status; + { + return wait3(status, 0, 0); + } + + pid_t wait3(status, options, rusage) /* ok */ + int *status; + int options; + struct rusage *rusage; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(status); + MAKE_WRITABLE(rusage); + result = syscall(SYS_wait4, -1, status, options, rusage); + EXIT_CRITICAL; + return result; + } + + pid_t wait4(wpid, status, options, rusage) /* ok */ + pid_t wpid; + int *status; + int options; + struct rusage *rusage; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(status); + MAKE_WRITABLE(rusage); + result = syscall(SYS_wait4, wpid, status, options, rusage); + EXIT_CRITICAL; + return result; + } + + pid_t waitpid(pid, status, options) /* ok */ + pid_t pid; + int *status; + int options; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(status); + result = syscall(SYS_wait4, pid, status, options, NULL); + EXIT_CRITICAL; + return result; + } + + ssize_t writev(fd, iov, ioveclen) /* ok */ + int fd; + const struct iovec *iov; + int ioveclen; + { int result; + + ENTER_CRITICAL; + { int i; + for (i = 0; i < ioveclen; i++) { + if (iov[i].iov_len > 0) { + MAKE_READABLE(iov[i].iov_base); + } + } + } + result = syscall(SYS_writev, fd, iov, ioveclen); + EXIT_CRITICAL; + return result; + } + + /* fork also requires special treatment, although it takes no + argument. fork crashes Ultrix if some pages are unreadable, so we + must unprotect the heap before calling fork */ + /* I don't know what happens in FreeBSD, so I just leave it in here */ + pid_t fork() + { + pid_t result; + pid_t me = getpid(); + + ENTER_CRITICAL; + if (RTCSRC_FinishVM) RTCSRC_FinishVM(); + result = syscall(SYS_fork); + EXIT_CRITICAL; + if (result == me) { + result = 0; + } + return result; + } + Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTMachine.i3 diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTMachine.i3:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTMachine.i3 Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,85 ---- + (* Copyright (C) 1994, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Tue May 2 11:41:23 PDT 1995 by kalsow *) + + (* This interface defines platform (machine + OS) dependent + types and constants. *) + + INTERFACE RTMachine; + + IMPORT Csetjmp; + + (*--------------------------------------------------------- thread state ---*) + + TYPE + State = Csetjmp.jmp_buf; + (* The machine state is saved in a "State". This type is really + opaque to the client, i.e. it does not need to be an array. *) + + <*EXTERNAL "_setjmp" *> + PROCEDURE SaveState (VAR s: State): INTEGER; + (* Capture the currently running thread's state *) + + CONST + FramePadBottom = 20; + FramePadTop = 20; + (* Additional padding words from above and below an existing + thread's stack pointer to copy when creating a new thread *) + + (*------------------------------------------------------------------ heap ---*) + + (* The heap page size is machine-dependent, since it might depend on the + architecture's VM page size (if VM is TRUE). Otherwise, 8192 bytes is a + reasonable page size. The page size must be a power of two. *) + + CONST + BytesPerHeapPage = 8192; (* bytes per page *) + LogBytesPerHeapPage = 13; + AdrPerHeapPage = 8192; (* addresses per page *) + LogAdrPerHeapPage = 13; + + (* The collector supports the use of VM protection to achieve incremental, + generational collection. This is not possible on all architectures, and + it may not be implemented in all cases where it is possible. The + boolean constant "VMHeap" is "TRUE" iff all necessary support is + present for this architecture. "VMHeap" is "TRUE" for the DS3100, + whose implementation you might use as a reference. *) + + CONST + VMHeap = TRUE; + + (*** hooks for the C wrapper functions ***) + + <*EXTERNAL*> VAR RTHeapRep_Fault: ADDRESS; (* => RTHeapRep.Fault *) + <*EXTERNAL*> VAR RTCSRC_FinishVM: ADDRESS; (* => RTCollectorSRC.FinishVM *) + + (*--------------------------------------------------------- thread stacks ---*) + + CONST + PointerAlignment = 8; + (* The C compiler allocates all pointers on 'PointerAlignment'-byte + boundaries. The garbage collector scans thread stacks, but only + looks at these possible pointer locations. Setting this value + smaller than is needed will only make your system run slower. + Setting it too large will cause the collector to collect storage + that is not free. *) + + CONST + StackFrameAlignment = 8; + (* Stack frames must be aligned to this constraint (in ADRSIZE units). + It's not a big deal if this value is too large, but it may break + the thread mechanism to make it too small. *) + + (*----------------------------------------------- exception stack walking ---*) + (* The "FrameInfo" type must minimally include fields named "pc" and "sp". *) + + CONST + Has_stack_walker = FALSE; + (* Indicates whether this platform supports the stack walking functions + defined in the "RTStack" interface. *) + + TYPE FrameInfo = RECORD pc, sp: ADDRESS END; + + END RTMachine. Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTSignal.m3 diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTSignal.m3:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTSignal.m3 Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,101 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Mon Nov 21 10:31:19 PST 1994 by kalsow *) + (* modified on Mon Mar 16 18:10:15 PST 1992 by muller *) + + UNSAFE MODULE RTSignal; + + IMPORT RTMisc, RTProcess, Usignal, Uprocess; + FROM Ctypes IMPORT int; + + TYPE + SigInfo = UNTRACED REF Usignal.struct_sigcontext; + + VAR + DefaultHandler : Usignal.SignalHandler; + IgnoreSignal : Usignal.SignalHandler; + initial_handlers : ARRAY [0..5] OF Usignal.struct_sigaction; + + PROCEDURE InstallHandlers () = + BEGIN + DefaultHandler := LOOPHOLE (0, Usignal.SignalHandler); + IgnoreSignal := LOOPHOLE (1, Usignal.SignalHandler); + + SetHandler (0, Usignal.SIGHUP, Shutdown); + SetHandler (1, Usignal.SIGINT, Interrupt); + SetHandler (2, Usignal.SIGQUIT, Quit); + SetHandler (3, Usignal.SIGSEGV, SegV); + SetHandler (4, Usignal.SIGPIPE, IgnoreSignal); + SetHandler (5, Usignal.SIGTERM, Shutdown); + END InstallHandlers; + + PROCEDURE SetHandler (id: INTEGER; sig: int; handler: Usignal.SignalHandler) = + (* Note: we use the LOOPHOLE to prevent the runtime check for + nested procedure. The runtime check crashes when + handler = IgnoreSignal = 1. *) + VAR new: Usignal.struct_sigaction; + BEGIN + new.sa_handler := LOOPHOLE (handler, Usignal.SignalHandler); + new.sa_flags := 0; + EVAL Usignal.sigaction (sig, ADR(new), ADR(initial_handlers[id])); + IF (initial_handlers[id].sa_handler # DefaultHandler) THEN + (* don't override inherited, non-default handlers *) + EVAL Usignal.sigaction (sig, ADR(initial_handlers[id]), ADR(new)); + END; + END SetHandler; + + PROCEDURE RestoreHandlers () = + BEGIN + RestoreHandler (0, Usignal.SIGHUP); + RestoreHandler (1, Usignal.SIGINT); + RestoreHandler (2, Usignal.SIGQUIT); + RestoreHandler (3, Usignal.SIGSEGV); + RestoreHandler (4, Usignal.SIGPIPE); + RestoreHandler (5, Usignal.SIGTERM); + END RestoreHandlers; + + PROCEDURE RestoreHandler (id: INTEGER; sig: int) = + BEGIN + EVAL Usignal.sigaction (sig, ADR(initial_handlers[id]), NIL); + END RestoreHandler; + + PROCEDURE Shutdown (sig: int; <*UNUSED*> code: int; <*UNUSED*> scp: SigInfo) = + VAR new, old: Usignal.struct_sigaction; + BEGIN + new.sa_handler := DefaultHandler; + new.sa_flags := 0; + RTProcess.InvokeExitors (); (* flush stdio... *) + EVAL Usignal.sigaction (sig, ADR(new), ADR(old)); (* restore default handler *) + EVAL Usignal.kill (Uprocess.getpid (), sig); (* and resend the signal *) + END Shutdown; + + PROCEDURE Interrupt (sig: int; code: int; scp: SigInfo) = + VAR h := RTProcess.OnInterrupt (NIL); + BEGIN + IF (h = NIL) THEN + Shutdown (sig, code, scp); + ELSE + EVAL RTProcess.OnInterrupt (h); (* reinstall the handler *) + h (); + END; + END Interrupt; + + PROCEDURE Quit (<*UNUSED*> sig, code: int; scp: SigInfo) = + VAR pc := 0; + BEGIN + IF (scp # NIL) THEN pc := scp.sc_pc END; + RTMisc.FatalErrorPC (pc, "aborted"); + END Quit; + + PROCEDURE SegV (<*UNUSED*> sig, code: int; scp: SigInfo) = + VAR pc := 0; + BEGIN + IF (scp # NIL) THEN pc := scp.sc_pc END; + RTMisc.FatalErrorPC (pc, + "Segmentation violation - possible attempt to dereference NIL"); + END SegV; + + BEGIN + END RTSignal. Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTThread.m3 diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTThread.m3:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTThread.m3 Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,115 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Wed Nov 23 13:01:14 PST 1994 by kalsow *) + (* modified on Tue May 4 18:49:28 PDT 1993 by muller *) + (* ow 16.09.1994 *) + (* ow 11.10.1994 *) + + UNSAFE MODULE RTThread; + + IMPORT Usignal, Unix, Umman, RTMisc; + + CONST + SP_pos = 34; (* Index of stack pointer in jmp_buf array *) + FP_pos = 19; (* Index of frame pointer in jmp_buf array *) + + PROCEDURE SP (READONLY s: State): ADDRESS = + BEGIN + RETURN LOOPHOLE (s [SP_pos], ADDRESS); + END SP; + + (*--------------------------------------------------------- thread stacks ---*) + + VAR page_bytes : CARDINAL := 0; + VAR stack_slop : CARDINAL; + + PROCEDURE NewStack (size: INTEGER; VAR(*OUT*)s: Stack) = + VAR i: INTEGER; start: ADDRESS; + BEGIN + IF (page_bytes = 0) THEN + page_bytes := Unix.getpagesize (); + stack_slop := 2 * (page_bytes DIV BYTESIZE (INTEGER)); + END; + + (* allocate enough so that we're guaranteed to get a full, aligned page *) + INC (size, stack_slop); + s.words := NEW (StackSpace, size); + + (* find the aligned page and unmap it *) + start := RTMisc.Align (ADR (s.words[0]), page_bytes); + i := Umman.mprotect (start, page_bytes, Umman.PROT_READ); + <* ASSERT i = 0 *> + + (* finally, set the bounds of the usable region *) + s.first := start + page_bytes; + s.last := ADR (s.words[0]) + size * ADRSIZE (s.words[0]); + END NewStack; + + PROCEDURE DisposeStack (VAR s: Stack) = + VAR i: INTEGER; start := RTMisc.Align (ADR (s.words[0]), page_bytes); + BEGIN + (* find the aligned page and re-map it *) + i := Umman.mprotect (start, page_bytes, Umman.PROT_READ+Umman.PROT_WRITE); + <* ASSERT i = 0 *> + + (* and finally, free the storage *) + DISPOSE (s.words); + s.words := NIL; + s.first := NIL; + s.last := NIL; + END DisposeStack; + + PROCEDURE FlushStackCache () = + VAR d: State; + BEGIN + Transfer (d, d); + END FlushStackCache; + + (*-------------------------------------------------- modifying the models ---*) + + PROCEDURE UpdateStateForNewSP (VAR s: State; offset: INTEGER) = + BEGIN + INC (s [SP_pos], offset); + INC (s [FP_pos], offset); + END UpdateStateForNewSP; + + PROCEDURE UpdateFrameForNewSP (<*UNUSED*> a: ADDRESS; + <*UNUSED*> offset: INTEGER) = + BEGIN + END UpdateFrameForNewSP; + + (*------------------------------------ manipulating the SIGVTALRM handler ---*) + + PROCEDURE setup_sigvtalrm (handler: Usignal.SignalHandler) = + VAR sv, osv: Usignal.struct_sigvec; i: INTEGER; + BEGIN + sv.sv_handler := handler; + sv.sv_mask := Usignal.empty_sv_mask; + sv.sv_flags := 0; + i := Usignal.sigvec (Usignal.SIGVTALRM, sv, osv); + <*ASSERT i = 0*> + END setup_sigvtalrm; + + PROCEDURE allow_sigvtalrm () = + VAR svt : Usignal.sigset_t := Usignal.sigmask(Usignal.SIGVTALRM); + old : Usignal.sigset_t; + i : INTEGER; + BEGIN + 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; + BEGIN + i := Usignal.sigprocmask(Usignal.SIG_BLOCK, svt, old); + <*ASSERT i = 0 *> + END disallow_sigvtalrm; + + BEGIN + END RTThread. + Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTThreadC.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTThreadC.c:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/RTThreadC.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,28 ---- + /* Copyright (C) 1994, Digital Equipment Corporation */ + /* All rights reserved. */ + /* See the file COPYRIGHT for a full description. */ + /* */ + /* Last modified on Mon Nov 7 13:23:14 PST 1994 by kalsow */ + /* modified on Tue Jan 19 15:20:48 PST 1993 by burrows */ + + /* This file implements the coroutine transfer: RTThread.Transfer */ + + #include + + + RTThread__Transfer (from, to) + jmp_buf *from, *to; + { + if (_setjmp(*from) == 0) _longjmp (*to, 1); + } + + + /* global thread ID used by 'etp' */ + long ThreadF__myId = 1; + + /* low-level runtime lock */ + long RT0u__inCritical = 0; + + /* global, per-thread linked list of exception handlers */ + void* RTThread__handlerStack = 0; + Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/accept.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/accept.c:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/accept.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,16 ---- + #include "wrap.h" + #include + #include + + int + m3_accept(int s, struct sockaddr *addr, int *addrlen) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(addr); + MAKE_WRITABLE(addrlen); + result = accept(s, addr, addrlen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/bind.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/bind.c:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/bind.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + int + m3_bind(int s, const struct sockaddr *name, int namelen) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = bind(s, name, namelen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/close.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/close.c:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/close.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,13 ---- + #include "wrap.h" + #include + + int + m3_close(int d) + { + int result; + + ENTER_CRITICAL; + result = close(d); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/connect.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/connect.c:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/connect.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + int + m3_connect(int s, const struct sockaddr *name, int namelen) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = connect(s, name, namelen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/dup.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/dup.c:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/dup.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,13 ---- + #include "wrap.h" + #include + + int + m3_dup(int oldd) + { + int result; + + ENTER_CRITICAL; + result = dup(oldd); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/dup2.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/dup2.c:1.1 *** /dev/null Mon Jun 7 17:09:10 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/dup2.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,13 ---- + #include "wrap.h" + #include + + int + m3_dup2(int oldd, int newd) + { + int result; + + ENTER_CRITICAL; + result = dup2(oldd, newd); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/gethostbyaddr.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/gethostbyaddr.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/gethostbyaddr.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + + struct hostent * + m3_gethostbyaddr(const char *addr, int len, int type) + { + struct hostent *result; + + ENTER_CRITICAL; + MAKE_READABLE(addr); + result = gethostbyaddr(addr, len, type); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/gethostbyname.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/gethostbyname.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/gethostbyname.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + + struct hostent * + m3_gethostbyname(const char *name) + { + struct hostent *result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = gethostbyname(name); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/getpeername.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/getpeername.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/getpeername.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,16 ---- + #include "wrap.h" + #include + #include + + int + m3_getpeername(int s, struct sockaddr *name, int *namelen) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(name); + MAKE_WRITABLE(namelen); + result = getpeername(s, name, namelen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/getsockname.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/getsockname.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/getsockname.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,16 ---- + #include "wrap.h" + #include + #include + + int + m3_getsockname(int s, struct sockaddr *name, int *namelen) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(name); + MAKE_WRITABLE(namelen); + result = getsockname(s, name, namelen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/listen.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/listen.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/listen.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + #include + + int + m3_listen(int s, int backlog) + { + int result; + + ENTER_CRITICAL; + result = listen(s, backlog); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/m3makefile diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/m3makefile:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/m3makefile Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,40 ---- + % Copyright (C) 1994, Digital Equipment Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + % + % Last modified on Mon Nov 21 10:43:13 PST 1994 by kalsow + % modified on Mon Dec 14 19:59:03 PST 1992 by jdd + % modified on Wed May 20 17:21:29 PDT 1992 by muller + + Interface ("RTMachine") + implementation ("RTHeapDep") + implementation ("RTSignal") + implementation ("RTThread") + c_source ("RTThreadC") + c_source ("RTHeapDepC") + c_source ("malloc") + + % These wrappers were extracted from RTHeapDepC.c and modified slightly, + % in order to make it possible to support SOCKS. + h_source ("socksconf") + h_source ("wrap") + c_source ("accept") + c_source ("bind") + c_source ("close") + c_source ("connect") + c_source ("dup") + c_source ("dup2") + c_source ("gethostbyaddr") + c_source ("gethostbyname") + c_source ("getpeername") + c_source ("getsockname") + c_source ("listen") + c_source ("read") + c_source ("recv") + c_source ("recvfrom") + c_source ("select") + c_source ("send") + c_source ("sendto") + c_source ("shutdown") + c_source ("socket") + c_source ("write") Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/malloc.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/malloc.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/malloc.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,1153 ---- + /* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + * + * From FreeBSD: malloc.c,v 1.32 1997/08/31 05:59:39 phk Exp + * Modified for Modula-3 thread safety by jdp@polstra.com (John Polstra). + * + */ + + #define _THREAD_SAFE 1 /* Turn on thread safety for Modula-3 */ + + /* + * Defining EXTRA_SANITY will enable extra checks which are related + * to internal conditions and consistency in malloc.c. This has a + * noticeable runtime performance hit, and generally will not do you + * any good unless you fiddle with the internals of malloc or want + * to catch random pointer corruption as early as possible. + */ + #ifndef MALLOC_EXTRA_SANITY + #undef MALLOC_EXTRA_SANITY + #endif + + /* + * What to use for Junk. This is the byte value we use to fill with + * when the 'J' option is enabled. + */ + #define SOME_JUNK 0xd0 /* as in "Duh" :-) */ + + /* + * The basic parameters you can tweak. + * + * malloc_pageshift pagesize = 1 << malloc_pageshift + * It's probably best if this is the native + * page size, but it doesn't have to be. + * + * malloc_minsize minimum size of an allocation in bytes. + * If this is too small it's too much work + * to manage them. This is also the smallest + * unit of alignment used for the storage + * returned by malloc/realloc. + * + */ + + #if defined(__FreeBSD__) + # if defined(__i386__) + # define malloc_pageshift 12U + # define malloc_minsize 16U + # endif + #endif /* __FreeBSD__ */ + + #if defined(__sparc__) && defined(sun) + # define malloc_pageshift 12U + # define malloc_minsize 16U + # define MAP_ANON (0) + static int fdzero; + # define MMAP_FD fdzero + # define INIT_MMAP() \ + { if ((fdzero=open("/dev/zero", O_RDWR, 0000)) == -1) \ + wrterror("open of /dev/zero"); } + # define MADV_FREE MADV_DONTNEED + #endif /* __sparc__ */ + + #if defined(__linux__) + # if defined(__i386__) + # define malloc_pageshift 12U + # define malloc_minsize 16U + # endif + #endif /* __linux__ */ + + #if defined(__alpha) + # define malloc_pageshift 13U + # define malloc_minsize 16U + #endif /* __alpha */ + + /* Insert your combination here... */ + #if defined(__FOOCPU__) && defined(__BAROS__) + # define malloc_pageshift 12U + # define malloc_minsize 16U + #endif /* __FOOCPU__ && __BAROS__ */ + + + /* + * No user serviceable parts behind this point. + */ + #include + #include + #include + #include + #include + #include + #include + #include + #include + + /* + * This structure describes a page worth of chunks. + */ + + struct pginfo { + struct pginfo *next; /* next on the free list */ + void *page; /* Pointer to the page */ + u_short size; /* size of this page's chunks */ + u_short shift; /* How far to shift for this size chunks */ + u_short free; /* How many free chunks */ + u_short total; /* How many chunk */ + u_int bits[1]; /* Which chunks are free */ + }; + + /* + * This structure describes a number of free pages. + */ + + struct pgfree { + struct pgfree *next; /* next run of free pages */ + struct pgfree *prev; /* prev run of free pages */ + void *page; /* pointer to free pages */ + void *end; /* pointer to end of free pages */ + size_t size; /* number of bytes free */ + }; + + /* + * How many bits per u_int in the bitmap. + * Change only if not 8 bits/byte + */ + #define MALLOC_BITS (8*sizeof(u_int)) + + /* + * Magic values to put in the page_directory + */ + #define MALLOC_NOT_MINE ((struct pginfo*) 0) + #define MALLOC_FREE ((struct pginfo*) 1) + #define MALLOC_FIRST ((struct pginfo*) 2) + #define MALLOC_FOLLOW ((struct pginfo*) 3) + #define MALLOC_MAGIC ((struct pginfo*) 4) + + #ifndef malloc_pageshift + #define malloc_pageshift 12U + #endif + + #ifndef malloc_minsize + #define malloc_minsize 16U + #endif + + #if !defined(malloc_pagesize) + #define malloc_pagesize (1UL<>1) + #endif + + /* A mask for the offset inside a page. */ + #define malloc_pagemask ((malloc_pagesize)-1) + + #define pageround(foo) (((foo) + (malloc_pagemask))&(~(malloc_pagemask))) + #define ptr2index(foo) (((u_long)(foo) >> malloc_pageshift)-malloc_origo) + + #ifdef _THREAD_SAFE + extern long RT0u__inCritical; /* Flag set when in a critical region */ + #define THREAD_LOCK() (++RT0u__inCritical) + #define THREAD_UNLOCK() (--RT0u__inCritical) + #endif + + #ifndef THREAD_LOCK + #define THREAD_LOCK() + #endif + + #ifndef THREAD_UNLOCK + #define THREAD_UNLOCK() + #endif + + #ifndef MMAP_FD + #define MMAP_FD (-1) + #endif + + #ifndef INIT_MMAP + #define INIT_MMAP() + #endif + + /* This is needed at least by HP-UX 10.20 */ + #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS) + #define MAP_ANON MAP_ANONYMOUS + #endif + + /* Set when initialization has been done */ + static unsigned malloc_started; + + /* Recusion flag for public interface. */ + static int malloc_active; + + /* Number of free pages we cache */ + static unsigned malloc_cache = 16; + + /* The offset from pagenumber to index into the page directory */ + static u_long malloc_origo; + + /* The last index in the page directory we care about */ + static u_long last_index; + + /* Pointer to page directory. Allocated "as if with" malloc */ + static struct pginfo **page_dir; + + /* How many slots in the page directory */ + static unsigned malloc_ninfo; + + /* Free pages line up here */ + static struct pgfree free_list; + + /* Abort(), user doesn't handle problems. */ + static int malloc_abort; + + /* Are we trying to die ? */ + static int suicide; + + /* always realloc ? */ + static int malloc_realloc; + + /* pass the kernel a hint on free pages ? */ + static int malloc_hint = 1; + + /* xmalloc behaviour ? */ + static int malloc_xmalloc; + + /* sysv behaviour for malloc(0) ? */ + static int malloc_sysv; + + /* zero fill ? */ + static int malloc_zero; + + /* junk fill ? */ + static int malloc_junk; + + #ifdef HAS_UTRACE + + /* utrace ? */ + static int malloc_utrace; + + struct ut { void *p; size_t s; void *r; }; + + void utrace __P((struct ut *, int)); + + #define UTRACE(a, b, c) \ + if (malloc_utrace) \ + {struct ut u; u.p=a; u.s = b; u.r=c; utrace(&u, sizeof u);} + #else /* !HAS_UTRACE */ + #define UTRACE(a,b,c) + #endif /* HAS_UTRACE */ + + /* my last break. */ + static void *malloc_brk; + + /* one location cache for free-list holders */ + static struct pgfree *px; + + /* compile-time options */ + char *malloc_options; + + /* Name of the current public function */ + static char *malloc_func; + + /* Macro for mmap */ + #define MMAP(size) \ + mmap((caddr_t)0, (size), PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, \ + MMAP_FD, 0); + + /* + * Necessary function declarations + */ + static int extend_pgdir(u_long index); + static void *imalloc(size_t size); + static void ifree(void *ptr); + static void *irealloc(void *ptr, size_t size); + + static void + wrterror(char *p) + { + char *q = " error: "; + write(STDERR_FILENO, malloc_func, strlen(malloc_func)); + write(STDERR_FILENO, q, strlen(q)); + write(STDERR_FILENO, p, strlen(p)); + suicide = 1; + abort(); + } + + static void + wrtwarning(char *p) + { + char *q = " warning: "; + if (malloc_abort) + wrterror(p); + write(STDERR_FILENO, malloc_func, strlen(malloc_func)); + write(STDERR_FILENO, q, strlen(q)); + write(STDERR_FILENO, p, strlen(p)); + } + + + /* + * Allocate a number of pages from the OS + */ + static caddr_t + map_pages(int pages) + { + caddr_t result, tail; + + result = (caddr_t)pageround((u_long)sbrk(0)); + tail = result + (pages << malloc_pageshift); + + if (brk(tail)) { + #ifdef EXTRA_SANITY + wrterror("(ES): map_pages fails\n"); + #endif /* EXTRA_SANITY */ + return 0; + } + + last_index = ptr2index(tail) - 1; + malloc_brk = tail; + + if ((last_index+1) >= malloc_ninfo && !extend_pgdir(last_index)) + return 0;; + + return result; + } + + /* + * Extend page directory + */ + static int + extend_pgdir(u_long index) + { + struct pginfo **new, **old; + int i, oldlen; + + /* Make it this many pages */ + i = index * sizeof *page_dir; + i /= malloc_pagesize; + i += 2; + + /* remember the old mapping size */ + oldlen = malloc_ninfo * sizeof *page_dir; + + /* + * NOTE: we allocate new pages and copy the directory rather than tempt + * fate by trying to "grow" the region.. There is nothing to prevent + * us from accidently re-mapping space that's been allocated by our caller + * via dlopen() or other mmap(). + * + * The copy problem is not too bad, as there is 4K of page index per + * 4MB of malloc arena. + * + * We can totally avoid the copy if we open a file descriptor to associate + * the anon mappings with. Then, when we remap the pages at the new + * address, the old pages will be "magically" remapped.. But this means + * keeping open a "secret" file descriptor..... + */ + + /* Get new pages */ + new = (struct pginfo**) MMAP(i * malloc_pagesize); + if (new == (struct pginfo **)-1) + return 0; + + /* Copy the old stuff */ + memcpy(new, page_dir, + malloc_ninfo * sizeof *page_dir); + + /* register the new size */ + malloc_ninfo = i * malloc_pagesize / sizeof *page_dir; + + /* swap the pointers */ + old = page_dir; + page_dir = new; + + /* Now free the old stuff */ + munmap((caddr_t)old, oldlen); + return 1; + } + + /* + * Initialize the world + */ + static void + malloc_init () + { + char *p, b[64]; + int i, j; + + INIT_MMAP(); + + #ifdef EXTRA_SANITY + malloc_junk = 1; + #endif /* EXTRA_SANITY */ + + for (i = 0; i < 3; i++) { + if (i == 0) { + j = readlink("/etc/malloc.conf", b, sizeof b - 1); + if (j <= 0) + continue; + b[j] = '\0'; + p = b; + } else if (i == 1) { + p = getenv("MALLOC_OPTIONS"); + } else { + p = malloc_options; + } + for (; p && *p; p++) { + switch (*p) { + case '>': malloc_cache <<= 1; break; + case '<': malloc_cache >>= 1; break; + case 'a': malloc_abort = 0; break; + case 'A': malloc_abort = 1; break; + case 'h': malloc_hint = 0; break; + case 'H': malloc_hint = 1; break; + case 'r': malloc_realloc = 0; break; + case 'R': malloc_realloc = 1; break; + case 'j': malloc_junk = 0; break; + case 'J': malloc_junk = 1; break; + #ifdef HAS_UTRACE + case 'u': malloc_utrace = 0; break; + case 'U': malloc_utrace = 1; break; + #endif + case 'v': malloc_sysv = 0; break; + case 'V': malloc_sysv = 1; break; + case 'x': malloc_xmalloc = 0; break; + case 'X': malloc_xmalloc = 1; break; + case 'z': malloc_zero = 0; break; + case 'Z': malloc_zero = 1; break; + default: + j = malloc_abort; + malloc_abort = 0; + wrtwarning("unknown char in MALLOC_OPTIONS\n"); + malloc_abort = j; + break; + } + } + } + + UTRACE(0, 0, 0); + + /* + * We want junk in the entire allocation, and zero only in the part + * the user asked for. + */ + if (malloc_zero) + malloc_junk=1; + + /* + * If we run with junk (or implicitly from above: zero), we want to + * force realloc() to get new storage, so we can DTRT with it. + */ + if (malloc_junk) + malloc_realloc=1; + + /* Allocate one page for the page directory */ + page_dir = (struct pginfo **) MMAP(malloc_pagesize); + + if (page_dir == (struct pginfo **) -1) + wrterror("mmap(2) failed, check limits.\n"); + + /* + * We need a maximum of malloc_pageshift buckets, steal these from the + * front of the page_directory; + */ + malloc_origo = ((u_long)pageround((u_long)sbrk(0))) >> malloc_pageshift; + malloc_origo -= malloc_pageshift; + + malloc_ninfo = malloc_pagesize / sizeof *page_dir; + + /* Recalculate the cache size in bytes, and make sure it's nonzero */ + + if (!malloc_cache) + malloc_cache++; + + malloc_cache <<= malloc_pageshift; + + /* + * This is a nice hack from Kaleb Keithly (kaleb@x.org). + * We can sbrk(2) further back when we keep this on a low address. + */ + px = (struct pgfree *) imalloc (sizeof *px); + + /* Been here, done that */ + malloc_started++; + } + + /* + * Allocate a number of complete pages + */ + static void * + malloc_pages(size_t size) + { + void *p, *delay_free = 0; + int i; + struct pgfree *pf; + u_long index; + + size = pageround(size); + + p = 0; + + /* Look for free pages before asking for more */ + for(pf = free_list.next; pf; pf = pf->next) { + + #ifdef EXTRA_SANITY + if (pf->size & malloc_pagemask) + wrterror("(ES): junk length entry on free_list\n"); + if (!pf->size) + wrterror("(ES): zero length entry on free_list\n"); + if (pf->page == pf->end) + wrterror("(ES): zero entry on free_list\n"); + if (pf->page > pf->end) + wrterror("(ES): sick entry on free_list\n"); + if ((void*)pf->page >= (void*)sbrk(0)) + wrterror("(ES): entry on free_list past brk\n"); + if (page_dir[ptr2index(pf->page)] != MALLOC_FREE) + wrterror("(ES): non-free first page on free-list\n"); + if (page_dir[ptr2index(pf->end)-1] != MALLOC_FREE) + wrterror("(ES): non-free last page on free-list\n"); + #endif /* EXTRA_SANITY */ + + if (pf->size < size) + continue; + + if (pf->size == size) { + p = pf->page; + if (pf->next) + pf->next->prev = pf->prev; + pf->prev->next = pf->next; + delay_free = pf; + break; + } + + p = pf->page; + pf->page = (char *)pf->page + size; + pf->size -= size; + break; + } + + #ifdef EXTRA_SANITY + if (p && page_dir[ptr2index(p)] != MALLOC_FREE) + wrterror("(ES): allocated non-free page on free-list\n"); + #endif /* EXTRA_SANITY */ + + size >>= malloc_pageshift; + + /* Map new pages */ + if (!p) + p = map_pages(size); + + if (p) { + + index = ptr2index(p); + page_dir[index] = MALLOC_FIRST; + for (i=1;ibits[0] * + (((malloc_pagesize >> bits)+MALLOC_BITS-1) / MALLOC_BITS); + + /* Don't waste more than two chunks on this */ + if ((1<<(bits)) <= l+l) { + bp = (struct pginfo *)pp; + } else { + bp = (struct pginfo *)imalloc(l); + if (!bp) { + ifree(pp); + return 0; + } + } + + bp->size = (1<shift = bits; + bp->total = bp->free = malloc_pagesize >> bits; + bp->page = pp; + + /* set all valid bits in the bitmap */ + k = bp->total; + i = 0; + + /* Do a bunch at a time */ + for(;k-i >= MALLOC_BITS; i += MALLOC_BITS) + bp->bits[i / MALLOC_BITS] = ~0; + + for(; i < k; i++) + bp->bits[i/MALLOC_BITS] |= 1<<(i%MALLOC_BITS); + + if (bp == bp->page) { + /* Mark the ones we stole for ourselves */ + for(i=0;l > 0;i++) { + bp->bits[i/MALLOC_BITS] &= ~(1<<(i%MALLOC_BITS)); + bp->free--; + bp->total--; + l -= (1 << bits); + } + } + + /* MALLOC_LOCK */ + + page_dir[ptr2index(pp)] = bp; + + bp->next = page_dir[bits]; + page_dir[bits] = bp; + + /* MALLOC_UNLOCK */ + + return 1; + } + + /* + * Allocate a fragment + */ + static void * + malloc_bytes(size_t size) + { + int i,j; + u_int u; + struct pginfo *bp; + int k; + u_int *lp; + + /* Don't bother with anything less than this */ + if (size < malloc_minsize) + size = malloc_minsize; + + /* Find the right bucket */ + j = 1; + i = size-1; + while (i >>= 1) + j++; + + /* If it's empty, make a page more of that size chunks */ + if (!page_dir[j] && !malloc_make_chunks(j)) + return 0; + + bp = page_dir[j]; + + /* Find first word of bitmap which isn't empty */ + for (lp = bp->bits; !*lp; lp++) + ; + + /* Find that bit, and tweak it */ + u = 1; + k = 0; + while (!(*lp & u)) { + u += u; + k++; + } + *lp ^= u; + + /* If there are no more free, remove from free-list */ + if (!--bp->free) { + page_dir[j] = bp->next; + bp->next = 0; + } + + /* Adjust to the real offset of that chunk */ + k += (lp-bp->bits)*MALLOC_BITS; + k <<= bp->shift; + + if (malloc_junk) + memset((u_char*)bp->page + k, SOME_JUNK, bp->size); + + return (u_char *)bp->page + k; + } + + /* + * Allocate a piece of memory + */ + static void * + imalloc(size_t size) + { + void *result; + + if (suicide) + abort(); + + if ((size + malloc_pagesize) < size) /* Check for overflow */ + result = 0; + else if (size <= malloc_maxsize) + result = malloc_bytes(size); + else + result = malloc_pages(size); + + if (malloc_abort && !result) + wrterror("allocation failed.\n"); + + if (malloc_zero && result) + memset(result, 0, size); + + return result; + } + + /* + * Change the size of an allocation. + */ + static void * + irealloc(void *ptr, size_t size) + { + void *p; + u_long osize, index; + struct pginfo **mp; + int i; + + if (suicide) + abort(); + + index = ptr2index(ptr); + + if (index < malloc_pageshift) { + wrtwarning("junk pointer, too low to make sense.\n"); + return 0; + } + + if (index > last_index) { + wrtwarning("junk pointer, too high to make sense.\n"); + return 0; + } + + mp = &page_dir[index]; + + if (*mp == MALLOC_FIRST) { /* Page allocation */ + + /* Check the pointer */ + if ((u_long)ptr & malloc_pagemask) { + wrtwarning("modified (page-) pointer.\n"); + return 0; + } + + /* Find the size in bytes */ + for (osize = malloc_pagesize; *++mp == MALLOC_FOLLOW;) + osize += malloc_pagesize; + + if (!malloc_realloc && /* unless we have to, */ + size <= osize && /* .. or are too small, */ + size > (osize - malloc_pagesize)) { /* .. or can free a page, */ + return ptr; /* don't do anything. */ + } + + } else if (*mp >= MALLOC_MAGIC) { /* Chunk allocation */ + + /* Check the pointer for sane values */ + if (((u_long)ptr & ((*mp)->size-1))) { + wrtwarning("modified (chunk-) pointer.\n"); + return 0; + } + + /* Find the chunk index in the page */ + i = ((u_long)ptr & malloc_pagemask) >> (*mp)->shift; + + /* Verify that it isn't a free chunk already */ + if ((*mp)->bits[i/MALLOC_BITS] & (1<<(i%MALLOC_BITS))) { + wrtwarning("chunk is already free.\n"); + return 0; + } + + osize = (*mp)->size; + + if (!malloc_realloc && /* Unless we have to, */ + size < osize && /* ..or are too small, */ + (size > osize/2 || /* ..or could use a smaller size, */ + osize == malloc_minsize)) { /* ..(if there is one) */ + return ptr; /* ..Don't do anything */ + } + + } else { + wrtwarning("pointer to wrong page.\n"); + return 0; + } + + p = imalloc(size); + + if (p) { + /* copy the lesser of the two sizes, and free the old one */ + if (!size || !osize) + ; + else if (osize < size) + memcpy(p, ptr, osize); + else + memcpy(p, ptr, size); + ifree(ptr); + } + return p; + } + + /* + * Free a sequence of pages + */ + + static __inline__ void + free_pages(void *ptr, int index, struct pginfo *info) + { + int i; + struct pgfree *pf, *pt=0; + u_long l; + void *tail; + + if (info == MALLOC_FREE) { + wrtwarning("page is already free.\n"); + return; + } + + if (info != MALLOC_FIRST) { + wrtwarning("pointer to wrong page.\n"); + return; + } + + if ((u_long)ptr & malloc_pagemask) { + wrtwarning("modified (page-) pointer.\n"); + return; + } + + /* Count how many pages and mark them free at the same time */ + page_dir[index] = MALLOC_FREE; + for (i = 1; page_dir[index+i] == MALLOC_FOLLOW; i++) + page_dir[index + i] = MALLOC_FREE; + + l = i << malloc_pageshift; + + if (malloc_junk) + memset(ptr, SOME_JUNK, l); + + #ifdef MADV_FREE + if (malloc_hint) + madvise(ptr, l, MADV_FREE); + #endif + + tail = (char *)ptr+l; + + /* add to free-list */ + if (!px) + px = imalloc(sizeof *pt); /* This cannot fail... */ + px->page = ptr; + px->end = tail; + px->size = l; + if (!free_list.next) { + + /* Nothing on free list, put this at head */ + px->next = free_list.next; + px->prev = &free_list; + free_list.next = px; + pf = px; + px = 0; + + } else { + + /* Find the right spot, leave pf pointing to the modified entry. */ + tail = (char *)ptr+l; + + for(pf = free_list.next; pf->end < ptr && pf->next; pf = pf->next) + ; /* Race ahead here */ + + if (pf->page > tail) { + /* Insert before entry */ + px->next = pf; + px->prev = pf->prev; + pf->prev = px; + px->prev->next = px; + pf = px; + px = 0; + } else if (pf->end == ptr ) { + /* Append to the previous entry */ + pf->end = (char *)pf->end + l; + pf->size += l; + if (pf->next && pf->end == pf->next->page ) { + /* And collapse the next too. */ + pt = pf->next; + pf->end = pt->end; + pf->size += pt->size; + pf->next = pt->next; + if (pf->next) + pf->next->prev = pf; + } + } else if (pf->page == tail) { + /* Prepend to entry */ + pf->size += l; + pf->page = ptr; + } else if (!pf->next) { + /* Append at tail of chain */ + px->next = 0; + px->prev = pf; + pf->next = px; + pf = px; + px = 0; + } else { + wrterror("freelist is destroyed.\n"); + } + } + + /* Return something to OS ? */ + if (!pf->next && /* If we're the last one, */ + pf->size > malloc_cache && /* ..and the cache is full, */ + pf->end == malloc_brk && /* ..and none behind us, */ + malloc_brk == sbrk(0)) { /* ..and it's OK to do... */ + + /* + * Keep the cache intact. Notice that the '>' above guarantees that + * the pf will always have at least one page afterwards. + */ + pf->end = (char *)pf->page + malloc_cache; + pf->size = malloc_cache; + + brk(pf->end); + malloc_brk = pf->end; + + index = ptr2index(pf->end); + last_index = index - 1; + + for(i=index;i <= last_index;) + page_dir[i++] = MALLOC_NOT_MINE; + + /* XXX: We could realloc/shrink the pagedir here I guess. */ + } + if (pt) + ifree(pt); + } + + /* + * Free a chunk, and possibly the page it's on, if the page becomes empty. + */ + + static __inline__ void + free_bytes(void *ptr, int index, struct pginfo *info) + { + int i; + struct pginfo **mp; + void *vp; + + /* Find the chunk number on the page */ + i = ((u_long)ptr & malloc_pagemask) >> info->shift; + + if (((u_long)ptr & (info->size-1))) { + wrtwarning("modified (chunk-) pointer.\n"); + return; + } + + if (info->bits[i/MALLOC_BITS] & (1<<(i%MALLOC_BITS))) { + wrtwarning("chunk is already free.\n"); + return; + } + + if (malloc_junk) + memset(ptr, SOME_JUNK, info->size); + + info->bits[i/MALLOC_BITS] |= 1<<(i%MALLOC_BITS); + info->free++; + + mp = page_dir + info->shift; + + if (info->free == 1) { + + /* Page became non-full */ + + mp = page_dir + info->shift; + /* Insert in address order */ + while (*mp && (*mp)->next && (*mp)->next->page < info->page) + mp = &(*mp)->next; + info->next = *mp; + *mp = info; + return; + } + + if (info->free != info->total) + return; + + /* Find & remove this page in the queue */ + while (*mp != info) { + mp = &((*mp)->next); + #ifdef EXTRA_SANITY + if (!*mp) + wrterror("(ES): Not on queue\n"); + #endif /* EXTRA_SANITY */ + } + *mp = info->next; + + /* Free the page & the info structure if need be */ + page_dir[ptr2index(info->page)] = MALLOC_FIRST; + vp = info->page; /* Order is important ! */ + if(vp != (void*)info) + ifree(info); + ifree(vp); + } + + static void + ifree(void *ptr) + { + struct pginfo *info; + int index; + + /* This is legal */ + if (!ptr) + return; + + if (!malloc_started) { + wrtwarning("malloc() has never been called.\n"); + return; + } + + /* If we're already sinking, don't make matters any worse. */ + if (suicide) + return; + + index = ptr2index(ptr); + + if (index < malloc_pageshift) { + wrtwarning("junk pointer, too low to make sense.\n"); + return; + } + + if (index > last_index) { + wrtwarning("junk pointer, too high to make sense.\n"); + return; + } + + info = page_dir[index]; + + if (info < MALLOC_MAGIC) + free_pages(ptr, index, info); + else + free_bytes(ptr, index, info); + return; + } + + /* + * These are the public exported interface routines. + */ + + + void * + malloc(size_t size) + { + register void *r; + + malloc_func = " in malloc():"; + THREAD_LOCK(); + if (malloc_active++) { + wrtwarning("recursive call.\n"); + malloc_active--; + return (0); + } + if (!malloc_started) + malloc_init(); + if (malloc_sysv && !size) + r = 0; + else + r = imalloc(size); + UTRACE(0, size, r); + malloc_active--; + THREAD_UNLOCK(); + if (malloc_xmalloc && !r) + wrterror("out of memory.\n"); + return (r); + } + + void + free(void *ptr) + { + malloc_func = " in free():"; + THREAD_LOCK(); + if (malloc_active++) { + wrtwarning("recursive call.\n"); + malloc_active--; + return; + } + ifree(ptr); + UTRACE(ptr, 0, 0); + malloc_active--; + THREAD_UNLOCK(); + return; + } + + void * + realloc(void *ptr, size_t size) + { + register void *r; + + malloc_func = " in realloc():"; + THREAD_LOCK(); + if (malloc_active++) { + wrtwarning("recursive call.\n"); + malloc_active--; + return (0); + } + if (ptr && !malloc_started) { + wrtwarning("malloc() has never been called.\n"); + ptr = 0; + } + if (!malloc_started) + malloc_init(); + if (malloc_sysv && !size) { + ifree(ptr); + r = 0; + } else if (!ptr) { + r = imalloc(size); + } else { + r = irealloc(ptr, size); + } + UTRACE(ptr, size, r); + malloc_active--; + THREAD_UNLOCK(); + if (malloc_xmalloc && !r) + wrterror("out of memory.\n"); + return (r); + } + + void * + calloc(size_t num, size_t size) + { + register void *r; + + size *= num; + r = malloc(size); + if (r) + memset(r, 0, size); + return (r); + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/read.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/read.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/read.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_read(int d, void *buf, size_t nbytes) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + result = read(d, buf, nbytes); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/recv.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/recv.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/recv.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_recv(int s, void *buf, size_t len, int flags) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + result = recv(s, buf, len, flags); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/recvfrom.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/recvfrom.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/recvfrom.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,18 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_recvfrom(int s, void *buf, size_t len, int flags, + struct sockaddr *from, int *fromlen) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + MAKE_WRITABLE(from); + MAKE_WRITABLE(fromlen); + result = recvfrom(s, buf, len, flags, from, fromlen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/select.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/select.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/select.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,20 ---- + #include "wrap.h" + #include + #include + #include + + int + m3_select(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(readfds); + MAKE_WRITABLE(writefds); + MAKE_WRITABLE(exceptfds); + MAKE_READABLE(timeout); + result = select(nfds, readfds, writefds, exceptfds, timeout); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/send.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/send.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/send.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_send(int s, const void *msg, size_t len, int flags) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(msg); + result = send(s, msg, len, flags); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/sendto.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/sendto.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/sendto.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,17 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_sendto(int s, const void *msg, size_t len, int flags, + const struct sockaddr *to, int tolen) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(msg); + MAKE_READABLE(to); + result = sendto(s, msg, len, flags, to, tolen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/shutdown.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/shutdown.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/shutdown.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + #include + + int + m3_shutdown(int s, int how) + { + int result; + + ENTER_CRITICAL; + result = shutdown(s, how); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/socket.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/socket.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/socket.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + #include + + int + m3_socket(int domain, int type, int protocol) + { + int result; + + ENTER_CRITICAL; + result = socket(domain, type, protocol); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/socksconf.h diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/socksconf.h:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/socksconf.h Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,6 ---- + /* + * Define 0 or 1 of these, to select the variety of SOCKS support you want. + */ + #undef HPSOCKS + #undef SOCKS4 + #undef SOCKS5 Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/wrap.h diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/wrap.h:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/wrap.h Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,61 ---- + #include "socksconf.h" + + #if defined(HPSOCKS) /* { */ + #define accept Raccept + #define bind Rxbind + #define close Rclose + #define connect Rconnect + #define dup Rdup + #define dup2 Rdup2 + #define gethostbyaddr Rgethostbyaddr + #define gethostbyname Rgethostbyname + #define getpeername Rgetpeername + #define getsockname Rgetsockname + #define listen Rlisten + #define recv Rrecv + #define recvfrom Rrecvfrom + #define send Rsend + #define sendto Rsendto + #define shutdown Rshutdown + #define socket Rsocket + #elif defined(SOCKS4) /* } { */ + #define accept Raccept + #define bind Rbind + #define connect Rconnect + #define getpeername Rgetpeername + #define getsockname Rgetsockname + #define listen Rlisten + #define select Rselect + #elif defined(SOCKS5) /* } { */ + #define accept SOCKSaccept + #define bind SOCKSbind + #define close SOCKSclose + #define connect SOCKSconnect + #define dup SOCKSdup + #define dup2 SOCKSdup2 + #define fclose SOCKSfclose + #define gethostbyname SOCKSgethostbyname + #define getpeername SOCKSgetpeername + #define getsockname SOCKSgetsockname + #define listen SOCKSlisten + #define read SOCKSread + #define recv SOCKSrecv + #define recvfrom SOCKSrecvfrom + #define rresvport SOCKSrresvport + #define select SOCKSselect + #define send SOCKSsend + #define sendto SOCKSsendto + #define shutdown SOCKSshutdown + #define write SOCKSwrite + #endif /* } */ + + extern long RT0u__inCritical; + #define ENTER_CRITICAL RT0u__inCritical++ + #define EXIT_CRITICAL RT0u__inCritical-- + + static char RTHeapDepC__c; + #define MAKE_READABLE(x) \ + if (x != 0) { RTHeapDepC__c = *(char*)(x); } + + #define MAKE_WRITABLE(x) \ + if (x != 0) { *(char*)(x) = RTHeapDepC__c = *(char*)(x); } Index: m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/write.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/write.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FBSD_ALPHA/write.c Mon Jun 7 13:14:28 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + size_t + m3_write(int fd, const void *buf, int nbytes) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(buf); + result = write(fd, buf, nbytes); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTHeapDepC.c diff -c m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTHeapDepC.c:1.1.1.1 m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTHeapDepC.c:1.2 *** m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTHeapDepC.c:1.1.1.1 Thu Jan 16 16:29:56 1997 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTHeapDepC.c Mon Jun 7 13:14:32 1999 *************** *** 80,86 **** #include #include #if __FreeBSD__ >= 2 ! # include #endif #include #include --- 80,87 ---- #include #include #if __FreeBSD__ >= 2 ! #include ! #include #endif #include #include *************** *** 89,102 **** #include #include #include #include #include #ifdef NULL #undef NULL #endif #define NULL (void *)(0) ! extern int RT0u__inCritical; #define ENTER_CRITICAL RT0u__inCritical++ #define EXIT_CRITICAL RT0u__inCritical-- --- 90,115 ---- #include #include #include + #include #include #include + #if __FreeBSD__ >= 3 + #include + #include + #include + #include + #include + #endif + + #include + #include + #ifdef NULL #undef NULL #endif #define NULL (void *)(0) ! extern long RT0u__inCritical; #define ENTER_CRITICAL RT0u__inCritical++ #define EXIT_CRITICAL RT0u__inCritical-- *************** *** 104,131 **** void (*RTCSRC_FinishVM)(); static char RTHeapDepC__c; ! #define MAKE_READABLE(x) if ((int)x) { RTHeapDepC__c = *(char*)(x); } ! #define MAKE_WRITABLE(x) if ((int)x) { *(char*)(x) = RTHeapDepC__c = *(char*)(x); } /* Unless otherwise noted, all the following wrappers have the same structure. */ - int accept(s, addr, addrlen) /* ok */ - int s; - struct sockaddr *addr; - int *addrlen; - { int result; - - ENTER_CRITICAL; - MAKE_WRITABLE(addr); - MAKE_WRITABLE(addrlen); - result = syscall(SYS_accept, s, addr, addrlen); - EXIT_CRITICAL; - return result; - } - int access(path, mode) /* ok */ ! char *path; int mode; { int result; --- 117,144 ---- void (*RTCSRC_FinishVM)(); static char RTHeapDepC__c; ! #define MAKE_READABLE(x) if (x != 0) { RTHeapDepC__c = *(char*)(x); } ! #define MAKE_WRITABLE(x) if (x != 0) { *(char*)(x) = RTHeapDepC__c = *(char*)(x); } ! ! /* ! * Modula-3 compilation units are always compiled PIC. This causes ! * the a.out linker to complain that there is no reference to ! * _DYNAMIC if the program is linked with "-static". Provide a ! * weak reference to it here so that static linking will work. ! * ! * This has nothing to do with the heap, so it doesn't really belong ! * here. But it needs to be someplace that is guaranteed to be pulled ! * into every executable. ! */ ! #pragma weak _DYNAMIC ! extern int _DYNAMIC; ! static int *i __unused = &_DYNAMIC; /* Unless otherwise noted, all the following wrappers have the same structure. */ int access(path, mode) /* ok */ ! const char *path; int mode; { int result; *************** *** 137,143 **** } int acct(file) /* ok */ ! char *file; { int result; ENTER_CRITICAL; --- 150,156 ---- } int acct(file) /* ok */ ! const char *file; { int result; ENTER_CRITICAL; *************** *** 228,246 **** } */ - int bind(s, name, namelen) /* ok */ - int s; - const struct sockaddr *name; - int namelen; - { int result; - - ENTER_CRITICAL; - MAKE_READABLE(name); - result = syscall(SYS_bind, s, name, namelen); - EXIT_CRITICAL; - return result; - } - /* not implemented int cachectl(addr, nbytes, op) char *addr; --- 241,246 ---- *************** *** 268,274 **** */ int chdir(path) /* ok */ ! char *path; { int result; ENTER_CRITICAL; --- 268,274 ---- */ int chdir(path) /* ok */ ! const char *path; { int result; ENTER_CRITICAL; *************** *** 278,285 **** return result; } int chmod(path, mode) /* ok */ ! char *path; mode_t mode; { int result; --- 278,297 ---- return result; } + int chflags(path, flags) + const char *path; + u_long flags; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_chflags, path, flags); + EXIT_CRITICAL; + return result; + } + int chmod(path, mode) /* ok */ ! const char *path; mode_t mode; { int result; *************** *** 291,297 **** } int chown(path, owner, group) /* ok */ ! char *path; uid_t owner; gid_t group; { int result; --- 303,309 ---- } int chown(path, owner, group) /* ok */ ! const char *path; uid_t owner; gid_t group; { int result; *************** *** 304,310 **** } int chroot(dirname) /* ok */ ! char *dirname; { int result; ENTER_CRITICAL; --- 316,322 ---- } int chroot(dirname) /* ok */ ! const char *dirname; { int result; ENTER_CRITICAL; *************** *** 314,332 **** return result; } - int connect(s, name, namelen) /* ok */ - int s; - const struct sockaddr *name; - int namelen; - { int result; - - ENTER_CRITICAL; - MAKE_READABLE(name); - result = syscall(SYS_connect, s, name, namelen); - EXIT_CRITICAL; - return result; - } - /* not implemented (obsolete) int creat(name, mode) const char *name; --- 326,331 ---- *************** *** 356,363 **** result = syscall(SYS_execve, name, argv, envp); if (result == -1 && errno == EFAULT) { MAKE_READABLE(name); ! { char **a; for (a = argv; *a; a++) MAKE_READABLE(*a); } ! { char **e; for (e = envp; *e; e++) MAKE_READABLE(*e); } } else { return result; } --- 355,362 ---- result = syscall(SYS_execve, name, argv, envp); if (result == -1 && errno == EFAULT) { MAKE_READABLE(name); ! { char * const *a; for (a = argv; *a; a++) MAKE_READABLE(*a); } ! { char * const *e; for (e = envp; *e; e++) MAKE_READABLE(*e); } } else { return result; } *************** *** 473,479 **** int getgroups(gidsetsize, grouplist) /* ok */ int gidsetsize; ! int grouplist[]; { int result; ENTER_CRITICAL; --- 472,478 ---- int getgroups(gidsetsize, grouplist) /* ok */ int gidsetsize; ! gid_t grouplist[]; { int result; ENTER_CRITICAL; *************** *** 513,532 **** } */ - int getpeername(s, name, namelen) /* ok */ - int s; - struct sockaddr *name; - int *namelen; - { int result; - - ENTER_CRITICAL; - MAKE_WRITABLE(name); - MAKE_WRITABLE(namelen); - result = syscall(SYS_getpeername, s, name, namelen); - EXIT_CRITICAL; - return result; - } - int getrlimit(resource, rlp) /* ok */ int resource; struct rlimit *rlp; --- 512,517 ---- *************** *** 551,570 **** return result; } - int getsockname(s, name, namelen) /* ok */ - int s; - struct sockaddr *name; - int *namelen; - { int result; - - ENTER_CRITICAL; - MAKE_WRITABLE(name); - MAKE_WRITABLE(namelen); - result = syscall(SYS_getsockname, s, name, namelen); - EXIT_CRITICAL; - return result; - } - int getsockopt(s, level, optname, optval, optlen) /* ok */ int s, level, optname; void *optval; --- 536,541 ---- *************** *** 629,637 **** return result; } int link(name1, name2) /* ok */ ! char *name1; ! char *name2; { int result; ENTER_CRITICAL; --- 600,623 ---- return result; } + #ifdef SYS_lchown + int lchown(path, owner, group) /* ok */ + const char *path; + uid_t owner; + gid_t group; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_lchown, path, owner, group); + EXIT_CRITICAL; + return result; + } + #endif /* SYS_lchown */ + int link(name1, name2) /* ok */ ! const char *name1; ! const char *name2; { int result; ENTER_CRITICAL; *************** *** 643,649 **** } int lstat(path, buf) /* ok */ ! char *path; struct stat *buf; { int result; --- 629,635 ---- } int lstat(path, buf) /* ok */ ! const char *path; struct stat *buf; { int result; *************** *** 656,662 **** } int mkdir(path, mode) /* ok */ ! char *path; mode_t mode; { int result; --- 642,648 ---- } int mkdir(path, mode) /* ok */ ! const char *path; mode_t mode; { int result; *************** *** 667,674 **** return result; } int mknod(path, mode, dev) /* ok */ ! char *path; mode_t mode; dev_t dev; { int result; --- 653,672 ---- return result; } + int mkfifo(path, mode) /* ok */ + const char *path; + mode_t mode; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_mkfifo, path, mode); + EXIT_CRITICAL; + return result; + } + int mknod(path, mode, dev) /* ok */ ! const char *path; mode_t mode; dev_t dev; { int result; *************** *** 680,692 **** return result; } ! /* quite different ... ! int mount(special, name, rwflag, type, options) ! char *special; ! char *name; ! int rwflag, type; ! char *options; ! */ int mount(type, dir, flags, data) int type; const char *dir; --- 678,728 ---- return result; } ! #if __FreeBSD_version >= 300001 /* New form of mount(2) */ ! int ! mount(type, dir, flags, data) ! const char *type; ! const char *dir; ! int flags; ! void *data; ! { int result; ! struct ufs_args *u_data; ! struct mfs_args *m_data; ! struct nfs_args *n_data; ! ! ENTER_CRITICAL; ! MAKE_READABLE(type); ! MAKE_READABLE(dir); ! if (strcmp(type, "ufs") == 0) { ! u_data = (struct ufs_args*) data; ! MAKE_READABLE(u_data); ! MAKE_READABLE(u_data->fspec); ! result = syscall(SYS_mount, type, dir, flags, data); ! } else if (strcmp(type, "mfs") == 0) { ! m_data = (struct mfs_args*) data; ! MAKE_READABLE(m_data); ! MAKE_READABLE(m_data->fspec); ! result = syscall(SYS_mount, type, dir, flags, data); ! } else if (strcmp(type, "nfs") == 0) { ! n_data = (struct nfs_args*) data; ! MAKE_READABLE(n_data); ! MAKE_READABLE(n_data->addr); ! MAKE_READABLE(n_data->fh); ! MAKE_READABLE(n_data->hostname); ! result = syscall(SYS_mount, type, dir, flags, data); ! } else { /* Not anything we recognize. */ ! MAKE_READABLE(data); ! result = syscall(SYS_mount, type, dir, flags, data); ! } ! EXIT_CRITICAL; ! if (result != -1) { ! result = 0; ! } ! return result; ! } ! ! #else /* __FreeBSD_version >= 300001 */ ! int mount(type, dir, flags, data) int type; const char *dir; *************** *** 723,728 **** --- 759,765 ---- } return result; } + #endif /* __FreeBSD_version >= 300001 */ int msgctl(msqid, cmd, buf) /* ok */ int msqid, cmd; *************** *** 793,801 **** } int quotactl(path, cmd, uid, addr) /* ok */ ! const char *path; ! int cmd, uid; ! char *addr; { int result; ENTER_CRITICAL; --- 830,842 ---- } int quotactl(path, cmd, uid, addr) /* ok */ ! const char *path; ! int cmd, uid; ! #if __FreeBSD_version >= 400002 ! void *addr; ! #else ! char *addr; ! #endif { int result; ENTER_CRITICAL; *************** *** 821,841 **** return result; } - int read(d, buf, nbytes) /* ok */ - int d; - char *buf; - size_t nbytes; - { int result; - - ENTER_CRITICAL; - MAKE_WRITABLE(buf); - result = syscall(SYS_read, d, buf, nbytes); - EXIT_CRITICAL; - return result; - } - int readlink(path, buf, bufsiz) /* ok */ ! char *path; char *buf; int bufsiz; { int result; --- 862,869 ---- return result; } int readlink(path, buf, bufsiz) /* ok */ ! const char *path; char *buf; int bufsiz; { int result; *************** *** 848,854 **** return result; } ! int readv(d, iov, iovcnt) /* ok */ int d; const struct iovec *iov; int iovcnt; --- 876,882 ---- return result; } ! ssize_t readv(d, iov, iovcnt) /* ok */ int d; const struct iovec *iov; int iovcnt; *************** *** 865,912 **** return result; } ! int recv(s, buf, len, flags) /* ok */ int s; - void *buf; - #if __FreeBSD__ >=2 - size_t len; - #else - int len; - #endif - int flags; - { int result; - - ENTER_CRITICAL; - MAKE_WRITABLE(buf); - result = syscall(SYS_recvfrom, s, buf, len, flags, NULL, 0); - EXIT_CRITICAL; - return result; - } - - int recvfrom(s, buf, len, flags, from, fromlen) /* ok */ - int s; - void *buf; - #if __FreeBSD__ >=2 - size_t len; - #else - int len; - #endif - int flags; - struct sockaddr *from; - int *fromlen; - { int result; - - ENTER_CRITICAL; - MAKE_WRITABLE(buf); - MAKE_WRITABLE(from); - MAKE_WRITABLE(fromlen); - result = syscall(SYS_recvfrom, s, buf, len, flags, from, fromlen); - EXIT_CRITICAL; - return result; - } - - int recvmsg(s, msg, flags) /* ok */ - int s; struct msghdr msg[]; int flags; { int result; --- 893,900 ---- return result; } ! ssize_t recvmsg(s, msg, flags) /* ok */ int s; struct msghdr msg[]; int flags; { int result; *************** *** 940,946 **** } int rmdir(path) /* ok */ ! char *path; { int result; ENTER_CRITICAL; --- 928,934 ---- } int rmdir(path) /* ok */ ! const char *path; { int result; ENTER_CRITICAL; *************** *** 950,993 **** return result; } ! int select(nfds, readfds, writefds, exceptfds, timeout) /* ok */ ! int nfds; ! fd_set *readfds; ! fd_set *writefds; ! fd_set *exceptfds; ! struct timeval *timeout; ! { int result; ! ! ENTER_CRITICAL; ! MAKE_WRITABLE(readfds); ! MAKE_WRITABLE(writefds); ! MAKE_WRITABLE(exceptfds); ! MAKE_READABLE(timeout); ! result = syscall(SYS_select, nfds, readfds, writefds, exceptfds, timeout); ! EXIT_CRITICAL; ! return result; ! } ! int semctl(semid, semnum, cmd, arg) /* ok ? */ ! int semid, cmd; ! int semnum; ! union semun arg; ! { int result; ENTER_CRITICAL; switch (cmd) { ! case GETNCNT: ! case GETPID: ! case GETVAL: ! case GETALL: ! case GETZCNT: MAKE_READABLE(arg.buf); break; case SETALL: ! case SETVAL: MAKE_WRITABLE(arg.buf); break; ! default: break; } result = syscall(SYS_semsys, 0, semid, semnum, cmd, arg); --- 938,979 ---- return result; } ! int ! #if (227002 <= __FreeBSD_version && __FreeBSD_version < 300000) || \ ! __FreeBSD_version >= 300002 ! semctl(int semid, int semnum, int cmd, ...) ! #else ! semctl(int semid, int semnum, int cmd, union semun arg) ! #endif ! { ! int result; ! #if (227002 <= __FreeBSD_version && __FreeBSD_version < 300000) || \ ! __FreeBSD_version >= 300002 ! union semun arg; ! va_list ap; ! va_start(ap, cmd); ! arg = va_arg(ap, union semun); ! va_end(ap); ! #endif ENTER_CRITICAL; switch (cmd) { ! ! case IPC_SET: MAKE_READABLE(arg.buf); break; + case SETALL: ! MAKE_READABLE(arg.array); ! break; ! ! case IPC_STAT: MAKE_WRITABLE(arg.buf); break; ! ! case GETALL: ! MAKE_WRITABLE(arg.array); break; } result = syscall(SYS_semsys, 0, semid, semnum, cmd, arg); *************** *** 1012,1037 **** return result; } ! int send(s, msg, len, flags) /* ok */ int s; - const void *msg; - #if __FreeBSD__ >=2 - size_t len; - #else - int len; - #endif - int flags; - { int result; - - ENTER_CRITICAL; - MAKE_READABLE(msg); - result = syscall(SYS_sendto, s, msg, len, flags, NULL, 0); - EXIT_CRITICAL; - return result; - } - - int sendmsg(s, msg, flags) /* ok */ - int s; const struct msghdr msg[]; int flags; { int result; --- 998,1005 ---- return result; } ! ssize_t sendmsg(s, msg, flags) /* ok */ int s; const struct msghdr msg[]; int flags; { int result; *************** *** 1051,1079 **** return result; } - int sendto(s, msg, len, flags, to, tolen) /* ok */ - int s; - const void *msg; - #if __FreeBSD__ >=2 - size_t len; - #else - int len; - #endif - int flags; - const struct sockaddr *to; - int tolen; - { int result; - - ENTER_CRITICAL; - MAKE_READABLE(msg); - MAKE_READABLE(to); - result = syscall(SYS_sendto, s, msg, len, flags, to, tolen); - EXIT_CRITICAL; - return result; - } - int setdomainname(name, namelen) /* ok */ ! char *name; int namelen; { int result; --- 1019,1026 ---- return result; } int setdomainname(name, namelen) /* ok */ ! const char *name; int namelen; { int result; *************** *** 1086,1092 **** int setgroups(ngroups, gidset) /* ok */ int ngroups; ! int *gidset; { int result; ENTER_CRITICAL; --- 1033,1039 ---- int setgroups(ngroups, gidset) /* ok */ int ngroups; ! const gid_t *gidset; { int result; ENTER_CRITICAL; *************** *** 1097,1103 **** } int sethostname(name, namelen) /* ok */ ! char *name; int namelen; { int result; #if __FreeBSD__ >= 2 --- 1044,1050 ---- } int sethostname(name, namelen) /* ok */ ! const char *name; int namelen; { int result; #if __FreeBSD__ >= 2 *************** *** 1213,1232 **** return result; } ! /* not implemented ! int sigpending(set) ! sigset_t *set; { int result; ENTER_CRITICAL; ! MAKE_WRITABLE(set); ! result = syscall(SYS_sigpending, set); EXIT_CRITICAL; return result; } - */ - #if __FreeBSD__ >= 2 int sigaltstack(ss, oss) /* ok */ const struct sigaltstack *ss; struct sigaltstack *oss; --- 1160,1179 ---- return result; } ! int sigaction(sig, act, oact) ! int sig; ! const struct sigaction *act; ! struct sigaction *oact; { int result; ENTER_CRITICAL; ! MAKE_READABLE(act); ! MAKE_WRITABLE(oact); ! result = syscall(SYS_sigaction, sig, act, oact); EXIT_CRITICAL; return result; } int sigaltstack(ss, oss) /* ok */ const struct sigaltstack *ss; struct sigaltstack *oss; *************** *** 1239,1259 **** EXIT_CRITICAL; return result; } - #else - int sigstack(ss, oss) /* ok */ - const struct sigstack *ss; - struct sigstack *oss; - { int result; - ENTER_CRITICAL; - MAKE_READABLE(ss); - MAKE_WRITABLE(oss); - result = syscall(SYS_sigstack, ss, oss); - EXIT_CRITICAL; - return result; - } - #endif - int socketpair(d, type, protocol, sv) /* ok */ int d, type, protocol; int sv[2]; --- 1186,1192 ---- *************** *** 1267,1273 **** } int stat(path, buf) /* ok */ ! char *path; struct stat *buf; { int result; --- 1200,1206 ---- } int stat(path, buf) /* ok */ ! const char *path; struct stat *buf; { int result; *************** *** 1280,1286 **** } int swapon(special) /* ok */ ! char *special; { int result; ENTER_CRITICAL; --- 1213,1219 ---- } int swapon(special) /* ok */ ! const char *special; { int result; ENTER_CRITICAL; *************** *** 1291,1298 **** } int symlink(name1, name2) /* ok */ ! char *name1; ! char *name2; { int result; ENTER_CRITICAL; --- 1224,1231 ---- } int symlink(name1, name2) /* ok */ ! const char *name1; ! const char *name2; { int result; ENTER_CRITICAL; *************** *** 1304,1317 **** } int truncate(path, length) /* ok */ ! char *path; ! long length; { int result; - off_t len = (off_t)length; ENTER_CRITICAL; MAKE_READABLE(path); ! result = syscall(SYS_truncate, path, len); EXIT_CRITICAL; return result; } --- 1237,1250 ---- } int truncate(path, length) /* ok */ ! const char *path; ! off_t length; { int result; ENTER_CRITICAL; MAKE_READABLE(path); ! /* The casts below pad "path" out to a 64-bit value as required. */ ! result = __syscall(SYS_truncate, (u_quad_t)(u_long)path, length); EXIT_CRITICAL; return result; } *************** *** 1328,1334 **** } int unlink(path) /* ok */ ! char *path; { int result; ENTER_CRITICAL; --- 1261,1267 ---- } int unlink(path) /* ok */ ! const char *path; { int result; ENTER_CRITICAL; *************** *** 1417,1437 **** EXIT_CRITICAL; return result; } - - int write(fd, buf, nbytes) /* ok */ - int fd; - char *buf; - int nbytes; - { int result; - - ENTER_CRITICAL; - MAKE_READABLE(buf); - result = syscall(SYS_write, fd, buf, nbytes); - EXIT_CRITICAL; - return result; - } ! int writev(fd, iov, ioveclen) /* ok */ int fd; const struct iovec *iov; int ioveclen; --- 1350,1357 ---- EXIT_CRITICAL; return result; } ! ssize_t writev(fd, iov, ioveclen) /* ok */ int fd; const struct iovec *iov; int ioveclen; Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTSignal.m3 diff -c m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTSignal.m3:1.1.1.1 m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTSignal.m3:1.2 *** m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTSignal.m3:1.1.1.1 Thu Jan 16 16:29:56 1997 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTSignal.m3 Mon Jun 7 13:14:33 1999 *************** *** 7,24 **** UNSAFE MODULE RTSignal; ! IMPORT RTMisc, RTProcess, Csignal, Usignal, Uprocess; FROM Ctypes IMPORT int; VAR ! DefaultHandler : Csignal.Handler; ! IgnoreSignal : Csignal.Handler; ! initial_handlers : ARRAY [0..5] OF Csignal.Handler; PROCEDURE InstallHandlers () = BEGIN ! DefaultHandler := LOOPHOLE (0, Csignal.Handler); ! IgnoreSignal := LOOPHOLE (1, Csignal.Handler); SetHandler (0, Usignal.SIGHUP, Shutdown); SetHandler (1, Usignal.SIGINT, Interrupt); --- 7,27 ---- UNSAFE MODULE RTSignal; ! IMPORT RTMisc, RTProcess, Usignal, Uprocess; FROM Ctypes IMPORT int; + TYPE + SigInfo = UNTRACED REF Usignal.struct_sigcontext; + VAR ! DefaultHandler : Usignal.SignalHandler; ! IgnoreSignal : Usignal.SignalHandler; ! initial_handlers : ARRAY [0..5] OF Usignal.struct_sigaction; PROCEDURE InstallHandlers () = BEGIN ! DefaultHandler := LOOPHOLE (0, Usignal.SignalHandler); ! IgnoreSignal := LOOPHOLE (1, Usignal.SignalHandler); SetHandler (0, Usignal.SIGHUP, Shutdown); SetHandler (1, Usignal.SIGINT, Interrupt); *************** *** 28,40 **** SetHandler (5, Usignal.SIGTERM, Shutdown); END InstallHandlers; ! PROCEDURE SetHandler (id: INTEGER; sig: int; handler: Csignal.Handler) = ! VAR old := Csignal.signal (sig, handler); ! BEGIN ! initial_handlers[id] := old; ! IF (old # DefaultHandler) THEN (* don't override inherited, non-default handlers *) ! EVAL Csignal.signal (sig, old); END; END SetHandler; --- 31,48 ---- SetHandler (5, Usignal.SIGTERM, Shutdown); END InstallHandlers; ! PROCEDURE SetHandler (id: INTEGER; sig: int; handler: Usignal.SignalHandler) = ! (* Note: we use the LOOPHOLE to prevent the runtime check for ! nested procedure. The runtime check crashes when ! handler = IgnoreSignal = 1. *) ! VAR new: Usignal.struct_sigaction; ! BEGIN ! new.sa_handler := LOOPHOLE (handler, Usignal.SignalHandler); ! new.sa_flags := 0; ! EVAL Usignal.sigaction (sig, ADR(new), ADR(initial_handlers[id])); ! IF (initial_handlers[id].sa_handler # DefaultHandler) THEN (* don't override inherited, non-default handlers *) ! EVAL Usignal.sigaction (sig, ADR(initial_handlers[id]), ADR(new)); END; END SetHandler; *************** *** 50,85 **** PROCEDURE RestoreHandler (id: INTEGER; sig: int) = BEGIN ! EVAL Csignal.signal (sig, initial_handlers[id]); END RestoreHandler; ! PROCEDURE Shutdown (sig: int) = BEGIN RTProcess.InvokeExitors (); (* flush stdio... *) ! EVAL Csignal.signal (sig, DefaultHandler); (* restore default handler *) EVAL Usignal.kill (Uprocess.getpid (), sig); (* and resend the signal *) END Shutdown; ! PROCEDURE Interrupt (sig: int) = VAR h := RTProcess.OnInterrupt (NIL); BEGIN IF (h = NIL) THEN ! Shutdown (sig); ELSE EVAL RTProcess.OnInterrupt (h); (* reinstall the handler *) h (); END; END Interrupt; ! PROCEDURE Quit (<*UNUSED*> sig: int) = BEGIN ! RTMisc.FatalErrorI ("aborted", 0); END Quit; ! PROCEDURE SegV (<*UNUSED*> sig: int) = BEGIN ! RTMisc.FatalErrorI ( ! "Segmentation violation - possible attempt to dereference NIL", 0); END SegV; BEGIN --- 58,100 ---- PROCEDURE RestoreHandler (id: INTEGER; sig: int) = BEGIN ! EVAL Usignal.sigaction (sig, ADR(initial_handlers[id]), NIL); END RestoreHandler; ! PROCEDURE Shutdown (sig: int; <*UNUSED*> code: int; <*UNUSED*> scp: SigInfo) = ! VAR new, old: Usignal.struct_sigaction; BEGIN + new.sa_handler := DefaultHandler; + new.sa_flags := 0; RTProcess.InvokeExitors (); (* flush stdio... *) ! EVAL Usignal.sigaction (sig, ADR(new), ADR(old)); (* restore default handler *) EVAL Usignal.kill (Uprocess.getpid (), sig); (* and resend the signal *) END Shutdown; ! PROCEDURE Interrupt (sig: int; code: int; scp: SigInfo) = VAR h := RTProcess.OnInterrupt (NIL); BEGIN IF (h = NIL) THEN ! Shutdown (sig, code, scp); ELSE EVAL RTProcess.OnInterrupt (h); (* reinstall the handler *) h (); END; END Interrupt; ! PROCEDURE Quit (<*UNUSED*> sig, code: int; scp: SigInfo) = ! VAR pc := 0; BEGIN ! IF (scp # NIL) THEN pc := scp.sc_eip END; ! RTMisc.FatalErrorPC (pc, "aborted"); END Quit; ! PROCEDURE SegV (<*UNUSED*> sig, code: int; scp: SigInfo) = ! VAR pc := 0; BEGIN ! IF (scp # NIL) THEN pc := scp.sc_eip END; ! RTMisc.FatalErrorPC (pc, ! "Segmentation violation - possible attempt to dereference NIL"); END SegV; BEGIN Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTStackASM.s diff -c m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTStackASM.s:1.1.1.1 m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTStackASM.s:1.2 *** m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTStackASM.s:1.1.1.1 Thu Jan 16 16:29:56 1997 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/RTStackASM.s Mon Jun 7 13:14:33 1999 *************** *** 3,8 **** --- 3,10 ---- .globl _RTStack__CurrentFrame _RTStack__CurrentFrame: + .globl RTStack__CurrentFrame + RTStack__CurrentFrame: # STACK = ret frame popl %eax # STACK = frame pushl %eax *************** *** 19,24 **** --- 21,28 ---- .globl _RTStack__PreviousFrame _RTStack__PreviousFrame: + .globl RTStack__PreviousFrame + RTStack__PreviousFrame: movl 4(%esp), %eax # eax = ^callee movl 4(%eax), %eax # eax = callee.ebp pushl 0(%eax) # push bp of caller *************** *** 33,38 **** --- 37,44 ---- .globl _RTStack__Unwind _RTStack__Unwind: + .globl RTStack__Unwind + RTStack__Unwind: movl 4(%esp), %eax # eax = ^to movl 8(%eax), %esp movl 4(%eax), %ebp Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/_fpsetjmp.s diff -c m3/pm3/libs/m3core/src/runtime/FreeBSD2/_fpsetjmp.s:1.1.1.1 m3/pm3/libs/m3core/src/runtime/FreeBSD2/_fpsetjmp.s:1.2 *** m3/pm3/libs/m3core/src/runtime/FreeBSD2/_fpsetjmp.s:1.1.1.1 Thu Jan 16 16:29:56 1997 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/_fpsetjmp.s Mon Jun 7 13:14:33 1999 *************** *** 55,60 **** --- 55,63 ---- .globl __fpsetjmp; .type __fpsetjmp,@function; __fpsetjmp: + .globl _fpsetjmp; + .type _fpsetjmp,@function; + _fpsetjmp: movl 4(%esp),%eax movl 0(%esp),%edx movl %edx, 0(%eax) *************** *** 71,76 **** --- 74,82 ---- .globl __fplongjmp; .type __fplongjmp,@function; __fplongjmp: + .globl _fplongjmp; + .type _fplongjmp,@function; + _fplongjmp: movl 4(%esp),%edx movl 8(%esp),%eax movl 0(%edx),%ecx Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/accept.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/accept.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/accept.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,16 ---- + #include "wrap.h" + #include + #include + + int + m3_accept(int s, struct sockaddr *addr, int *addrlen) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(addr); + MAKE_WRITABLE(addrlen); + result = accept(s, addr, addrlen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/bind.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/bind.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/bind.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + int + m3_bind(int s, const struct sockaddr *name, int namelen) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = bind(s, name, namelen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/close.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/close.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/close.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,13 ---- + #include "wrap.h" + #include + + int + m3_close(int d) + { + int result; + + ENTER_CRITICAL; + result = close(d); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/connect.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/connect.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/connect.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + int + m3_connect(int s, const struct sockaddr *name, int namelen) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = connect(s, name, namelen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/dup.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/dup.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/dup.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,13 ---- + #include "wrap.h" + #include + + int + m3_dup(int oldd) + { + int result; + + ENTER_CRITICAL; + result = dup(oldd); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/dup2.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/dup2.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/dup2.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,13 ---- + #include "wrap.h" + #include + + int + m3_dup2(int oldd, int newd) + { + int result; + + ENTER_CRITICAL; + result = dup2(oldd, newd); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/gethostbyaddr.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/gethostbyaddr.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/gethostbyaddr.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + + struct hostent * + m3_gethostbyaddr(const char *addr, int len, int type) + { + struct hostent *result; + + ENTER_CRITICAL; + MAKE_READABLE(addr); + result = gethostbyaddr(addr, len, type); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/gethostbyname.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/gethostbyname.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/gethostbyname.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + + struct hostent * + m3_gethostbyname(const char *name) + { + struct hostent *result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = gethostbyname(name); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/getpeername.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/getpeername.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/getpeername.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,16 ---- + #include "wrap.h" + #include + #include + + int + m3_getpeername(int s, struct sockaddr *name, int *namelen) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(name); + MAKE_WRITABLE(namelen); + result = getpeername(s, name, namelen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/getsockname.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/getsockname.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/getsockname.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,16 ---- + #include "wrap.h" + #include + #include + + int + m3_getsockname(int s, struct sockaddr *name, int *namelen) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(name); + MAKE_WRITABLE(namelen); + result = getsockname(s, name, namelen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/listen.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/listen.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/listen.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + #include + + int + m3_listen(int s, int backlog) + { + int result; + + ENTER_CRITICAL; + result = listen(s, backlog); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/m3makefile diff -c m3/pm3/libs/m3core/src/runtime/FreeBSD2/m3makefile:1.1.1.1 m3/pm3/libs/m3core/src/runtime/FreeBSD2/m3makefile:1.2 *** m3/pm3/libs/m3core/src/runtime/FreeBSD2/m3makefile:1.1.1.1 Thu Jan 16 16:29:56 1997 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/m3makefile Mon Jun 7 13:14:33 1999 *************** *** 13,18 **** --- 13,44 ---- c_source ("RTThreadC") c_source ("RTHeapDepC") s_source ("_fpsetjmp") + c_source ("malloc") + + % These wrappers were extracted from RTHeapDepC.c and modified slightly, + % in order to make it possible to support SOCKS. + h_source ("socksconf") + h_source ("wrap") + c_source ("accept") + c_source ("bind") + c_source ("close") + c_source ("connect") + c_source ("dup") + c_source ("dup2") + c_source ("gethostbyaddr") + c_source ("gethostbyname") + c_source ("getpeername") + c_source ("getsockname") + c_source ("listen") + c_source ("read") + c_source ("recv") + c_source ("recvfrom") + c_source ("select") + c_source ("send") + c_source ("sendto") + c_source ("shutdown") + c_source ("socket") + c_source ("write") %% s_source (RTStackASM) Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/malloc.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/malloc.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/malloc.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,1153 ---- + /* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + * + * From FreeBSD: malloc.c,v 1.32 1997/08/31 05:59:39 phk Exp + * Modified for Modula-3 thread safety by jdp@polstra.com (John Polstra). + * + */ + + #define _THREAD_SAFE 1 /* Turn on thread safety for Modula-3 */ + + /* + * Defining EXTRA_SANITY will enable extra checks which are related + * to internal conditions and consistency in malloc.c. This has a + * noticeable runtime performance hit, and generally will not do you + * any good unless you fiddle with the internals of malloc or want + * to catch random pointer corruption as early as possible. + */ + #ifndef MALLOC_EXTRA_SANITY + #undef MALLOC_EXTRA_SANITY + #endif + + /* + * What to use for Junk. This is the byte value we use to fill with + * when the 'J' option is enabled. + */ + #define SOME_JUNK 0xd0 /* as in "Duh" :-) */ + + /* + * The basic parameters you can tweak. + * + * malloc_pageshift pagesize = 1 << malloc_pageshift + * It's probably best if this is the native + * page size, but it doesn't have to be. + * + * malloc_minsize minimum size of an allocation in bytes. + * If this is too small it's too much work + * to manage them. This is also the smallest + * unit of alignment used for the storage + * returned by malloc/realloc. + * + */ + + #if defined(__FreeBSD__) + # if defined(__i386__) + # define malloc_pageshift 12U + # define malloc_minsize 16U + # endif + #endif /* __FreeBSD__ */ + + #if defined(__sparc__) && defined(sun) + # define malloc_pageshift 12U + # define malloc_minsize 16U + # define MAP_ANON (0) + static int fdzero; + # define MMAP_FD fdzero + # define INIT_MMAP() \ + { if ((fdzero=open("/dev/zero", O_RDWR, 0000)) == -1) \ + wrterror("open of /dev/zero"); } + # define MADV_FREE MADV_DONTNEED + #endif /* __sparc__ */ + + #if defined(__linux__) + # if defined(__i386__) + # define malloc_pageshift 12U + # define malloc_minsize 16U + # endif + #endif /* __linux__ */ + + #if defined(__alpha) + # define malloc_pageshift 13U + # define malloc_minsize 16U + #endif /* __alpha */ + + /* Insert your combination here... */ + #if defined(__FOOCPU__) && defined(__BAROS__) + # define malloc_pageshift 12U + # define malloc_minsize 16U + #endif /* __FOOCPU__ && __BAROS__ */ + + + /* + * No user serviceable parts behind this point. + */ + #include + #include + #include + #include + #include + #include + #include + #include + #include + + /* + * This structure describes a page worth of chunks. + */ + + struct pginfo { + struct pginfo *next; /* next on the free list */ + void *page; /* Pointer to the page */ + u_short size; /* size of this page's chunks */ + u_short shift; /* How far to shift for this size chunks */ + u_short free; /* How many free chunks */ + u_short total; /* How many chunk */ + u_int bits[1]; /* Which chunks are free */ + }; + + /* + * This structure describes a number of free pages. + */ + + struct pgfree { + struct pgfree *next; /* next run of free pages */ + struct pgfree *prev; /* prev run of free pages */ + void *page; /* pointer to free pages */ + void *end; /* pointer to end of free pages */ + size_t size; /* number of bytes free */ + }; + + /* + * How many bits per u_int in the bitmap. + * Change only if not 8 bits/byte + */ + #define MALLOC_BITS (8*sizeof(u_int)) + + /* + * Magic values to put in the page_directory + */ + #define MALLOC_NOT_MINE ((struct pginfo*) 0) + #define MALLOC_FREE ((struct pginfo*) 1) + #define MALLOC_FIRST ((struct pginfo*) 2) + #define MALLOC_FOLLOW ((struct pginfo*) 3) + #define MALLOC_MAGIC ((struct pginfo*) 4) + + #ifndef malloc_pageshift + #define malloc_pageshift 12U + #endif + + #ifndef malloc_minsize + #define malloc_minsize 16U + #endif + + #if !defined(malloc_pagesize) + #define malloc_pagesize (1UL<>1) + #endif + + /* A mask for the offset inside a page. */ + #define malloc_pagemask ((malloc_pagesize)-1) + + #define pageround(foo) (((foo) + (malloc_pagemask))&(~(malloc_pagemask))) + #define ptr2index(foo) (((u_long)(foo) >> malloc_pageshift)-malloc_origo) + + #ifdef _THREAD_SAFE + extern int RT0u__inCritical; /* Flag set when in a critical region */ + #define THREAD_LOCK() (++RT0u__inCritical) + #define THREAD_UNLOCK() (--RT0u__inCritical) + #endif + + #ifndef THREAD_LOCK + #define THREAD_LOCK() + #endif + + #ifndef THREAD_UNLOCK + #define THREAD_UNLOCK() + #endif + + #ifndef MMAP_FD + #define MMAP_FD (-1) + #endif + + #ifndef INIT_MMAP + #define INIT_MMAP() + #endif + + /* This is needed at least by HP-UX 10.20 */ + #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS) + #define MAP_ANON MAP_ANONYMOUS + #endif + + /* Set when initialization has been done */ + static unsigned malloc_started; + + /* Recusion flag for public interface. */ + static int malloc_active; + + /* Number of free pages we cache */ + static unsigned malloc_cache = 16; + + /* The offset from pagenumber to index into the page directory */ + static u_long malloc_origo; + + /* The last index in the page directory we care about */ + static u_long last_index; + + /* Pointer to page directory. Allocated "as if with" malloc */ + static struct pginfo **page_dir; + + /* How many slots in the page directory */ + static unsigned malloc_ninfo; + + /* Free pages line up here */ + static struct pgfree free_list; + + /* Abort(), user doesn't handle problems. */ + static int malloc_abort; + + /* Are we trying to die ? */ + static int suicide; + + /* always realloc ? */ + static int malloc_realloc; + + /* pass the kernel a hint on free pages ? */ + static int malloc_hint = 1; + + /* xmalloc behaviour ? */ + static int malloc_xmalloc; + + /* sysv behaviour for malloc(0) ? */ + static int malloc_sysv; + + /* zero fill ? */ + static int malloc_zero; + + /* junk fill ? */ + static int malloc_junk; + + #ifdef HAS_UTRACE + + /* utrace ? */ + static int malloc_utrace; + + struct ut { void *p; size_t s; void *r; }; + + void utrace __P((struct ut *, int)); + + #define UTRACE(a, b, c) \ + if (malloc_utrace) \ + {struct ut u; u.p=a; u.s = b; u.r=c; utrace(&u, sizeof u);} + #else /* !HAS_UTRACE */ + #define UTRACE(a,b,c) + #endif /* HAS_UTRACE */ + + /* my last break. */ + static void *malloc_brk; + + /* one location cache for free-list holders */ + static struct pgfree *px; + + /* compile-time options */ + char *malloc_options; + + /* Name of the current public function */ + static char *malloc_func; + + /* Macro for mmap */ + #define MMAP(size) \ + mmap((caddr_t)0, (size), PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, \ + MMAP_FD, 0); + + /* + * Necessary function declarations + */ + static int extend_pgdir(u_long index); + static void *imalloc(size_t size); + static void ifree(void *ptr); + static void *irealloc(void *ptr, size_t size); + + static void + wrterror(char *p) + { + char *q = " error: "; + write(STDERR_FILENO, malloc_func, strlen(malloc_func)); + write(STDERR_FILENO, q, strlen(q)); + write(STDERR_FILENO, p, strlen(p)); + suicide = 1; + abort(); + } + + static void + wrtwarning(char *p) + { + char *q = " warning: "; + if (malloc_abort) + wrterror(p); + write(STDERR_FILENO, malloc_func, strlen(malloc_func)); + write(STDERR_FILENO, q, strlen(q)); + write(STDERR_FILENO, p, strlen(p)); + } + + + /* + * Allocate a number of pages from the OS + */ + static caddr_t + map_pages(int pages) + { + caddr_t result, tail; + + result = (caddr_t)pageround((u_long)sbrk(0)); + tail = result + (pages << malloc_pageshift); + + if (brk(tail)) { + #ifdef EXTRA_SANITY + wrterror("(ES): map_pages fails\n"); + #endif /* EXTRA_SANITY */ + return 0; + } + + last_index = ptr2index(tail) - 1; + malloc_brk = tail; + + if ((last_index+1) >= malloc_ninfo && !extend_pgdir(last_index)) + return 0;; + + return result; + } + + /* + * Extend page directory + */ + static int + extend_pgdir(u_long index) + { + struct pginfo **new, **old; + int i, oldlen; + + /* Make it this many pages */ + i = index * sizeof *page_dir; + i /= malloc_pagesize; + i += 2; + + /* remember the old mapping size */ + oldlen = malloc_ninfo * sizeof *page_dir; + + /* + * NOTE: we allocate new pages and copy the directory rather than tempt + * fate by trying to "grow" the region.. There is nothing to prevent + * us from accidently re-mapping space that's been allocated by our caller + * via dlopen() or other mmap(). + * + * The copy problem is not too bad, as there is 4K of page index per + * 4MB of malloc arena. + * + * We can totally avoid the copy if we open a file descriptor to associate + * the anon mappings with. Then, when we remap the pages at the new + * address, the old pages will be "magically" remapped.. But this means + * keeping open a "secret" file descriptor..... + */ + + /* Get new pages */ + new = (struct pginfo**) MMAP(i * malloc_pagesize); + if (new == (struct pginfo **)-1) + return 0; + + /* Copy the old stuff */ + memcpy(new, page_dir, + malloc_ninfo * sizeof *page_dir); + + /* register the new size */ + malloc_ninfo = i * malloc_pagesize / sizeof *page_dir; + + /* swap the pointers */ + old = page_dir; + page_dir = new; + + /* Now free the old stuff */ + munmap((caddr_t)old, oldlen); + return 1; + } + + /* + * Initialize the world + */ + static void + malloc_init () + { + char *p, b[64]; + int i, j; + + INIT_MMAP(); + + #ifdef EXTRA_SANITY + malloc_junk = 1; + #endif /* EXTRA_SANITY */ + + for (i = 0; i < 3; i++) { + if (i == 0) { + j = readlink("/etc/malloc.conf", b, sizeof b - 1); + if (j <= 0) + continue; + b[j] = '\0'; + p = b; + } else if (i == 1) { + p = getenv("MALLOC_OPTIONS"); + } else { + p = malloc_options; + } + for (; p && *p; p++) { + switch (*p) { + case '>': malloc_cache <<= 1; break; + case '<': malloc_cache >>= 1; break; + case 'a': malloc_abort = 0; break; + case 'A': malloc_abort = 1; break; + case 'h': malloc_hint = 0; break; + case 'H': malloc_hint = 1; break; + case 'r': malloc_realloc = 0; break; + case 'R': malloc_realloc = 1; break; + case 'j': malloc_junk = 0; break; + case 'J': malloc_junk = 1; break; + #ifdef HAS_UTRACE + case 'u': malloc_utrace = 0; break; + case 'U': malloc_utrace = 1; break; + #endif + case 'v': malloc_sysv = 0; break; + case 'V': malloc_sysv = 1; break; + case 'x': malloc_xmalloc = 0; break; + case 'X': malloc_xmalloc = 1; break; + case 'z': malloc_zero = 0; break; + case 'Z': malloc_zero = 1; break; + default: + j = malloc_abort; + malloc_abort = 0; + wrtwarning("unknown char in MALLOC_OPTIONS\n"); + malloc_abort = j; + break; + } + } + } + + UTRACE(0, 0, 0); + + /* + * We want junk in the entire allocation, and zero only in the part + * the user asked for. + */ + if (malloc_zero) + malloc_junk=1; + + /* + * If we run with junk (or implicitly from above: zero), we want to + * force realloc() to get new storage, so we can DTRT with it. + */ + if (malloc_junk) + malloc_realloc=1; + + /* Allocate one page for the page directory */ + page_dir = (struct pginfo **) MMAP(malloc_pagesize); + + if (page_dir == (struct pginfo **) -1) + wrterror("mmap(2) failed, check limits.\n"); + + /* + * We need a maximum of malloc_pageshift buckets, steal these from the + * front of the page_directory; + */ + malloc_origo = ((u_long)pageround((u_long)sbrk(0))) >> malloc_pageshift; + malloc_origo -= malloc_pageshift; + + malloc_ninfo = malloc_pagesize / sizeof *page_dir; + + /* Recalculate the cache size in bytes, and make sure it's nonzero */ + + if (!malloc_cache) + malloc_cache++; + + malloc_cache <<= malloc_pageshift; + + /* + * This is a nice hack from Kaleb Keithly (kaleb@x.org). + * We can sbrk(2) further back when we keep this on a low address. + */ + px = (struct pgfree *) imalloc (sizeof *px); + + /* Been here, done that */ + malloc_started++; + } + + /* + * Allocate a number of complete pages + */ + static void * + malloc_pages(size_t size) + { + void *p, *delay_free = 0; + int i; + struct pgfree *pf; + u_long index; + + size = pageround(size); + + p = 0; + + /* Look for free pages before asking for more */ + for(pf = free_list.next; pf; pf = pf->next) { + + #ifdef EXTRA_SANITY + if (pf->size & malloc_pagemask) + wrterror("(ES): junk length entry on free_list\n"); + if (!pf->size) + wrterror("(ES): zero length entry on free_list\n"); + if (pf->page == pf->end) + wrterror("(ES): zero entry on free_list\n"); + if (pf->page > pf->end) + wrterror("(ES): sick entry on free_list\n"); + if ((void*)pf->page >= (void*)sbrk(0)) + wrterror("(ES): entry on free_list past brk\n"); + if (page_dir[ptr2index(pf->page)] != MALLOC_FREE) + wrterror("(ES): non-free first page on free-list\n"); + if (page_dir[ptr2index(pf->end)-1] != MALLOC_FREE) + wrterror("(ES): non-free last page on free-list\n"); + #endif /* EXTRA_SANITY */ + + if (pf->size < size) + continue; + + if (pf->size == size) { + p = pf->page; + if (pf->next) + pf->next->prev = pf->prev; + pf->prev->next = pf->next; + delay_free = pf; + break; + } + + p = pf->page; + pf->page = (char *)pf->page + size; + pf->size -= size; + break; + } + + #ifdef EXTRA_SANITY + if (p && page_dir[ptr2index(p)] != MALLOC_FREE) + wrterror("(ES): allocated non-free page on free-list\n"); + #endif /* EXTRA_SANITY */ + + size >>= malloc_pageshift; + + /* Map new pages */ + if (!p) + p = map_pages(size); + + if (p) { + + index = ptr2index(p); + page_dir[index] = MALLOC_FIRST; + for (i=1;ibits[0] * + (((malloc_pagesize >> bits)+MALLOC_BITS-1) / MALLOC_BITS); + + /* Don't waste more than two chunks on this */ + if ((1<<(bits)) <= l+l) { + bp = (struct pginfo *)pp; + } else { + bp = (struct pginfo *)imalloc(l); + if (!bp) { + ifree(pp); + return 0; + } + } + + bp->size = (1<shift = bits; + bp->total = bp->free = malloc_pagesize >> bits; + bp->page = pp; + + /* set all valid bits in the bitmap */ + k = bp->total; + i = 0; + + /* Do a bunch at a time */ + for(;k-i >= MALLOC_BITS; i += MALLOC_BITS) + bp->bits[i / MALLOC_BITS] = ~0; + + for(; i < k; i++) + bp->bits[i/MALLOC_BITS] |= 1<<(i%MALLOC_BITS); + + if (bp == bp->page) { + /* Mark the ones we stole for ourselves */ + for(i=0;l > 0;i++) { + bp->bits[i/MALLOC_BITS] &= ~(1<<(i%MALLOC_BITS)); + bp->free--; + bp->total--; + l -= (1 << bits); + } + } + + /* MALLOC_LOCK */ + + page_dir[ptr2index(pp)] = bp; + + bp->next = page_dir[bits]; + page_dir[bits] = bp; + + /* MALLOC_UNLOCK */ + + return 1; + } + + /* + * Allocate a fragment + */ + static void * + malloc_bytes(size_t size) + { + int i,j; + u_int u; + struct pginfo *bp; + int k; + u_int *lp; + + /* Don't bother with anything less than this */ + if (size < malloc_minsize) + size = malloc_minsize; + + /* Find the right bucket */ + j = 1; + i = size-1; + while (i >>= 1) + j++; + + /* If it's empty, make a page more of that size chunks */ + if (!page_dir[j] && !malloc_make_chunks(j)) + return 0; + + bp = page_dir[j]; + + /* Find first word of bitmap which isn't empty */ + for (lp = bp->bits; !*lp; lp++) + ; + + /* Find that bit, and tweak it */ + u = 1; + k = 0; + while (!(*lp & u)) { + u += u; + k++; + } + *lp ^= u; + + /* If there are no more free, remove from free-list */ + if (!--bp->free) { + page_dir[j] = bp->next; + bp->next = 0; + } + + /* Adjust to the real offset of that chunk */ + k += (lp-bp->bits)*MALLOC_BITS; + k <<= bp->shift; + + if (malloc_junk) + memset((u_char*)bp->page + k, SOME_JUNK, bp->size); + + return (u_char *)bp->page + k; + } + + /* + * Allocate a piece of memory + */ + static void * + imalloc(size_t size) + { + void *result; + + if (suicide) + abort(); + + if ((size + malloc_pagesize) < size) /* Check for overflow */ + result = 0; + else if (size <= malloc_maxsize) + result = malloc_bytes(size); + else + result = malloc_pages(size); + + if (malloc_abort && !result) + wrterror("allocation failed.\n"); + + if (malloc_zero && result) + memset(result, 0, size); + + return result; + } + + /* + * Change the size of an allocation. + */ + static void * + irealloc(void *ptr, size_t size) + { + void *p; + u_long osize, index; + struct pginfo **mp; + int i; + + if (suicide) + abort(); + + index = ptr2index(ptr); + + if (index < malloc_pageshift) { + wrtwarning("junk pointer, too low to make sense.\n"); + return 0; + } + + if (index > last_index) { + wrtwarning("junk pointer, too high to make sense.\n"); + return 0; + } + + mp = &page_dir[index]; + + if (*mp == MALLOC_FIRST) { /* Page allocation */ + + /* Check the pointer */ + if ((u_long)ptr & malloc_pagemask) { + wrtwarning("modified (page-) pointer.\n"); + return 0; + } + + /* Find the size in bytes */ + for (osize = malloc_pagesize; *++mp == MALLOC_FOLLOW;) + osize += malloc_pagesize; + + if (!malloc_realloc && /* unless we have to, */ + size <= osize && /* .. or are too small, */ + size > (osize - malloc_pagesize)) { /* .. or can free a page, */ + return ptr; /* don't do anything. */ + } + + } else if (*mp >= MALLOC_MAGIC) { /* Chunk allocation */ + + /* Check the pointer for sane values */ + if (((u_long)ptr & ((*mp)->size-1))) { + wrtwarning("modified (chunk-) pointer.\n"); + return 0; + } + + /* Find the chunk index in the page */ + i = ((u_long)ptr & malloc_pagemask) >> (*mp)->shift; + + /* Verify that it isn't a free chunk already */ + if ((*mp)->bits[i/MALLOC_BITS] & (1<<(i%MALLOC_BITS))) { + wrtwarning("chunk is already free.\n"); + return 0; + } + + osize = (*mp)->size; + + if (!malloc_realloc && /* Unless we have to, */ + size < osize && /* ..or are too small, */ + (size > osize/2 || /* ..or could use a smaller size, */ + osize == malloc_minsize)) { /* ..(if there is one) */ + return ptr; /* ..Don't do anything */ + } + + } else { + wrtwarning("pointer to wrong page.\n"); + return 0; + } + + p = imalloc(size); + + if (p) { + /* copy the lesser of the two sizes, and free the old one */ + if (!size || !osize) + ; + else if (osize < size) + memcpy(p, ptr, osize); + else + memcpy(p, ptr, size); + ifree(ptr); + } + return p; + } + + /* + * Free a sequence of pages + */ + + static __inline__ void + free_pages(void *ptr, int index, struct pginfo *info) + { + int i; + struct pgfree *pf, *pt=0; + u_long l; + void *tail; + + if (info == MALLOC_FREE) { + wrtwarning("page is already free.\n"); + return; + } + + if (info != MALLOC_FIRST) { + wrtwarning("pointer to wrong page.\n"); + return; + } + + if ((u_long)ptr & malloc_pagemask) { + wrtwarning("modified (page-) pointer.\n"); + return; + } + + /* Count how many pages and mark them free at the same time */ + page_dir[index] = MALLOC_FREE; + for (i = 1; page_dir[index+i] == MALLOC_FOLLOW; i++) + page_dir[index + i] = MALLOC_FREE; + + l = i << malloc_pageshift; + + if (malloc_junk) + memset(ptr, SOME_JUNK, l); + + #ifdef MADV_FREE + if (malloc_hint) + madvise(ptr, l, MADV_FREE); + #endif + + tail = (char *)ptr+l; + + /* add to free-list */ + if (!px) + px = imalloc(sizeof *pt); /* This cannot fail... */ + px->page = ptr; + px->end = tail; + px->size = l; + if (!free_list.next) { + + /* Nothing on free list, put this at head */ + px->next = free_list.next; + px->prev = &free_list; + free_list.next = px; + pf = px; + px = 0; + + } else { + + /* Find the right spot, leave pf pointing to the modified entry. */ + tail = (char *)ptr+l; + + for(pf = free_list.next; pf->end < ptr && pf->next; pf = pf->next) + ; /* Race ahead here */ + + if (pf->page > tail) { + /* Insert before entry */ + px->next = pf; + px->prev = pf->prev; + pf->prev = px; + px->prev->next = px; + pf = px; + px = 0; + } else if (pf->end == ptr ) { + /* Append to the previous entry */ + pf->end = (char *)pf->end + l; + pf->size += l; + if (pf->next && pf->end == pf->next->page ) { + /* And collapse the next too. */ + pt = pf->next; + pf->end = pt->end; + pf->size += pt->size; + pf->next = pt->next; + if (pf->next) + pf->next->prev = pf; + } + } else if (pf->page == tail) { + /* Prepend to entry */ + pf->size += l; + pf->page = ptr; + } else if (!pf->next) { + /* Append at tail of chain */ + px->next = 0; + px->prev = pf; + pf->next = px; + pf = px; + px = 0; + } else { + wrterror("freelist is destroyed.\n"); + } + } + + /* Return something to OS ? */ + if (!pf->next && /* If we're the last one, */ + pf->size > malloc_cache && /* ..and the cache is full, */ + pf->end == malloc_brk && /* ..and none behind us, */ + malloc_brk == sbrk(0)) { /* ..and it's OK to do... */ + + /* + * Keep the cache intact. Notice that the '>' above guarantees that + * the pf will always have at least one page afterwards. + */ + pf->end = (char *)pf->page + malloc_cache; + pf->size = malloc_cache; + + brk(pf->end); + malloc_brk = pf->end; + + index = ptr2index(pf->end); + last_index = index - 1; + + for(i=index;i <= last_index;) + page_dir[i++] = MALLOC_NOT_MINE; + + /* XXX: We could realloc/shrink the pagedir here I guess. */ + } + if (pt) + ifree(pt); + } + + /* + * Free a chunk, and possibly the page it's on, if the page becomes empty. + */ + + static __inline__ void + free_bytes(void *ptr, int index, struct pginfo *info) + { + int i; + struct pginfo **mp; + void *vp; + + /* Find the chunk number on the page */ + i = ((u_long)ptr & malloc_pagemask) >> info->shift; + + if (((u_long)ptr & (info->size-1))) { + wrtwarning("modified (chunk-) pointer.\n"); + return; + } + + if (info->bits[i/MALLOC_BITS] & (1<<(i%MALLOC_BITS))) { + wrtwarning("chunk is already free.\n"); + return; + } + + if (malloc_junk) + memset(ptr, SOME_JUNK, info->size); + + info->bits[i/MALLOC_BITS] |= 1<<(i%MALLOC_BITS); + info->free++; + + mp = page_dir + info->shift; + + if (info->free == 1) { + + /* Page became non-full */ + + mp = page_dir + info->shift; + /* Insert in address order */ + while (*mp && (*mp)->next && (*mp)->next->page < info->page) + mp = &(*mp)->next; + info->next = *mp; + *mp = info; + return; + } + + if (info->free != info->total) + return; + + /* Find & remove this page in the queue */ + while (*mp != info) { + mp = &((*mp)->next); + #ifdef EXTRA_SANITY + if (!*mp) + wrterror("(ES): Not on queue\n"); + #endif /* EXTRA_SANITY */ + } + *mp = info->next; + + /* Free the page & the info structure if need be */ + page_dir[ptr2index(info->page)] = MALLOC_FIRST; + vp = info->page; /* Order is important ! */ + if(vp != (void*)info) + ifree(info); + ifree(vp); + } + + static void + ifree(void *ptr) + { + struct pginfo *info; + int index; + + /* This is legal */ + if (!ptr) + return; + + if (!malloc_started) { + wrtwarning("malloc() has never been called.\n"); + return; + } + + /* If we're already sinking, don't make matters any worse. */ + if (suicide) + return; + + index = ptr2index(ptr); + + if (index < malloc_pageshift) { + wrtwarning("junk pointer, too low to make sense.\n"); + return; + } + + if (index > last_index) { + wrtwarning("junk pointer, too high to make sense.\n"); + return; + } + + info = page_dir[index]; + + if (info < MALLOC_MAGIC) + free_pages(ptr, index, info); + else + free_bytes(ptr, index, info); + return; + } + + /* + * These are the public exported interface routines. + */ + + + void * + malloc(size_t size) + { + register void *r; + + malloc_func = " in malloc():"; + THREAD_LOCK(); + if (malloc_active++) { + wrtwarning("recursive call.\n"); + malloc_active--; + return (0); + } + if (!malloc_started) + malloc_init(); + if (malloc_sysv && !size) + r = 0; + else + r = imalloc(size); + UTRACE(0, size, r); + malloc_active--; + THREAD_UNLOCK(); + if (malloc_xmalloc && !r) + wrterror("out of memory.\n"); + return (r); + } + + void + free(void *ptr) + { + malloc_func = " in free():"; + THREAD_LOCK(); + if (malloc_active++) { + wrtwarning("recursive call.\n"); + malloc_active--; + return; + } + ifree(ptr); + UTRACE(ptr, 0, 0); + malloc_active--; + THREAD_UNLOCK(); + return; + } + + void * + realloc(void *ptr, size_t size) + { + register void *r; + + malloc_func = " in realloc():"; + THREAD_LOCK(); + if (malloc_active++) { + wrtwarning("recursive call.\n"); + malloc_active--; + return (0); + } + if (ptr && !malloc_started) { + wrtwarning("malloc() has never been called.\n"); + ptr = 0; + } + if (!malloc_started) + malloc_init(); + if (malloc_sysv && !size) { + ifree(ptr); + r = 0; + } else if (!ptr) { + r = imalloc(size); + } else { + r = irealloc(ptr, size); + } + UTRACE(ptr, size, r); + malloc_active--; + THREAD_UNLOCK(); + if (malloc_xmalloc && !r) + wrterror("out of memory.\n"); + return (r); + } + + void * + calloc(size_t num, size_t size) + { + register void *r; + + size *= num; + r = malloc(size); + if (r) + memset(r, 0, size); + return (r); + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/read.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/read.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/read.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_read(int d, void *buf, size_t nbytes) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + result = read(d, buf, nbytes); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/recv.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/recv.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/recv.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_recv(int s, void *buf, size_t len, int flags) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + result = recv(s, buf, len, flags); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/recvfrom.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/recvfrom.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/recvfrom.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,18 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_recvfrom(int s, void *buf, size_t len, int flags, + struct sockaddr *from, int *fromlen) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + MAKE_WRITABLE(from); + MAKE_WRITABLE(fromlen); + result = recvfrom(s, buf, len, flags, from, fromlen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/select.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/select.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/select.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,20 ---- + #include "wrap.h" + #include + #include + #include + + int + m3_select(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(readfds); + MAKE_WRITABLE(writefds); + MAKE_WRITABLE(exceptfds); + MAKE_READABLE(timeout); + result = select(nfds, readfds, writefds, exceptfds, timeout); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/send.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/send.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/send.c Mon Jun 7 13:14:33 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_send(int s, const void *msg, size_t len, int flags) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(msg); + result = send(s, msg, len, flags); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/sendto.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/sendto.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/sendto.c Mon Jun 7 13:14:34 1999 *************** *** 0 **** --- 1,17 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_sendto(int s, const void *msg, size_t len, int flags, + const struct sockaddr *to, int tolen) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(msg); + MAKE_READABLE(to); + result = sendto(s, msg, len, flags, to, tolen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/shutdown.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/shutdown.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/shutdown.c Mon Jun 7 13:14:34 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + #include + + int + m3_shutdown(int s, int how) + { + int result; + + ENTER_CRITICAL; + result = shutdown(s, how); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/socket.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/socket.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/socket.c Mon Jun 7 13:14:34 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + #include + + int + m3_socket(int domain, int type, int protocol) + { + int result; + + ENTER_CRITICAL; + result = socket(domain, type, protocol); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/socksconf.h diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/socksconf.h:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/socksconf.h Mon Jun 7 13:14:34 1999 *************** *** 0 **** --- 1,6 ---- + /* + * Define 0 or 1 of these, to select the variety of SOCKS support you want. + */ + #undef HPSOCKS + #undef SOCKS4 + #undef SOCKS5 Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/wrap.h diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/wrap.h:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/wrap.h Mon Jun 7 13:14:34 1999 *************** *** 0 **** --- 1,61 ---- + #include "socksconf.h" + + #if defined(HPSOCKS) /* { */ + #define accept Raccept + #define bind Rxbind + #define close Rclose + #define connect Rconnect + #define dup Rdup + #define dup2 Rdup2 + #define gethostbyaddr Rgethostbyaddr + #define gethostbyname Rgethostbyname + #define getpeername Rgetpeername + #define getsockname Rgetsockname + #define listen Rlisten + #define recv Rrecv + #define recvfrom Rrecvfrom + #define send Rsend + #define sendto Rsendto + #define shutdown Rshutdown + #define socket Rsocket + #elif defined(SOCKS4) /* } { */ + #define accept Raccept + #define bind Rbind + #define connect Rconnect + #define getpeername Rgetpeername + #define getsockname Rgetsockname + #define listen Rlisten + #define select Rselect + #elif defined(SOCKS5) /* } { */ + #define accept SOCKSaccept + #define bind SOCKSbind + #define close SOCKSclose + #define connect SOCKSconnect + #define dup SOCKSdup + #define dup2 SOCKSdup2 + #define fclose SOCKSfclose + #define gethostbyname SOCKSgethostbyname + #define getpeername SOCKSgetpeername + #define getsockname SOCKSgetsockname + #define listen SOCKSlisten + #define read SOCKSread + #define recv SOCKSrecv + #define recvfrom SOCKSrecvfrom + #define rresvport SOCKSrresvport + #define select SOCKSselect + #define send SOCKSsend + #define sendto SOCKSsendto + #define shutdown SOCKSshutdown + #define write SOCKSwrite + #endif /* } */ + + extern int RT0u__inCritical; + #define ENTER_CRITICAL RT0u__inCritical++ + #define EXIT_CRITICAL RT0u__inCritical-- + + static char RTHeapDepC__c; + #define MAKE_READABLE(x) \ + if ((int)x) { RTHeapDepC__c = *(char*)(x); } + + #define MAKE_WRITABLE(x) \ + if ((int)x) { *(char*)(x) = RTHeapDepC__c = *(char*)(x); } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD2/write.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD2/write.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD2/write.c Mon Jun 7 13:14:34 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + size_t + m3_write(int fd, const void *buf, int nbytes) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(buf); + result = write(fd, buf, nbytes); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/COPYRIGHT diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/COPYRIGHT:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/COPYRIGHT Mon Jun 7 13:14:38 1999 *************** *** 0 **** --- 1,93 ---- + + Digital License Agreement + + SRC Modula-3 + + 1. Grant Of License. Digital Equipment Corporation, having a principal + office at 146 Main Street, Maynard, MA 01754 ("DIGITAL") grants to + you ("LICENSEE") the non-exclusive, non-transferable, royalty free + right to use, modify, reproduce and distribute SRC Modula-3 ("SOFTWARE") + subject to the terms set forth herein. Any distribution of SOFTWARE + shall include this Digital License Agreement in human readable form. + + 2. Title to Intellectual Property and Software. Subject to the limited + rights and licenses granted under this License Agreement, all rights, + title and interests including patent, copyright, and trademark rights + in SOFTWARE are and shall remain vested in DIGITAL to the exclusion + of LICENSEE. DIGITAL represents and warrants that DIGITAL has the + legal right to grant such licenses as are expressly granted under + this Agreement. + + 3. Copyright. The SOFTWARE is owned by DIGITAL or its suppliers and is + protected by United States copyright laws and international treaty + provisions. Therefore, you must treat the SOFTWARE like any other + copyrighted material (e.g., a book or musical recording) except + that you may use the SOFTWARE as provided in this Digital License + Agreement. + + 4. Improvements. LICENSEE hereby grants to DIGITAL a non-exclusive, + non-transferable, royalty free right to use, modify, reproduce + and distribute with the right to sublicense at any tier, any + improvements, enhancements, extensions, or modifications that + LICENSEE make to SOFTWARE, provided such are returned to DIGITAL + by LICENSEE. + + 5. DISCLAIMER OF WARRANTY. Because the SOFTWARE is a research work and + not a released product, it is provided "AS IS" WITHOUT WARRANTY OF ANY + KIND AND WITHOUT ANY SUPPORT SERVICES. EXCEPT AS SPECIFICALLY PROVIDED + ABOVE IN SECTION 2, DIGITAL FURTHER DISCLAIMS ALL OTHER EXPRESS OR + IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS FOR A PARTICULAR + PURPOSE. THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF + THE SOFTWARE REMAINS WITH YOU. + + 6. Limitation of Liability. IN NO EVENT SHALL DIGITAL OR ITS SUPPLIERS BE + LIABLE IN AN AMOUNT THAT EXCEEDS THE LICENSE FEE PAID BY LICENSEE FOR + ANY DAMAGES (INCLUDING, WITH LIMITATION, DAMAGES FOR LOSS OF BUSINESS + PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER + PECUNIARY LOSS), REGARDLESS OF THE FORM OF CLAIM OR ACTIONS, ARISING + OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, + EVEN IF DIGITAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY + FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT + APPLY TO YOU. + + 7. Acknowledgement of Allocation of Risk. LICENSEE acknowledges and agrees + that the fees charged by DIGITAL in this Agreement reflect the allocation + of risks provided by the foregoing limitation of liability. LICENSEE + acknowledges and represents that it has read and understands these + allocations of risk limiting the liability of DIGITAL and that it + understands that a modification of the allocation of risks set forth + in this agreement would affect the fees charged by DIGITAL, and that + LICENSEE, in consideration of such fees, agrees to such allocations + of risk. + + 8. LICENSEE INDEMNIFICATION. LICENSEE SHALL INDEMNIFY DIGITAL AGAINST + ALL COSTS AND DAMAGE JUDGEMENTS, INCLUDING ATTORNEY'S FEES AND COSTS + OF DEFENSE, INCURRED BECAUSE OF CLAIMS OF DAMAGE ARISING FROM LICENSEE'S + POSSESSION OR USE OR INABILITY TO USE SOFTWARE. + + 9. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE and documentation are provided + with RESTRICTED RIGHTS. Use duplication, or disclosure by the Government + is subject restrictions as set forth in subparagraph (c)(1)(ii) of The + Rights in Technical Data and Computer Software clause in DFARS + 252.227-7013, or subparagraphs (c)(i) and (2) of the Commercial Computer + Software -- Restricted Rights at 48 CFR 52.227-19, as applicable. + Manufacturer is Digital Equipment Corporation, 130 Lytton Avenue, + Palo Alto, CA 94301-1044. + + 10. Severability. If any provision of the Agreement is held illegal or + unenforceable by any court of competent jurisdiction, such provision + shall be deemed separable from the remaining provisions of this Agreement + and shall not affect or impair the validity or enforceability of the + remaining provisions of this Agreement. + + 11. Governing Law. This Agreement is governed by the laws of the + Commonwealth of Massachusetts. + + 12. Publicity. You my not use the name of DIGITAL in any advertisement, + press release or other publicity with reference to SRC Modula-3 + without prior written consent of DIGITAL. + + 13. Should you have any questions concerning this Agreement, or if you + desire to contact Digital for any reason, please do so via E-mail: + M3-REQUEST@SRC.DEC.COM. Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTHeapDep.m3 diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTHeapDep.m3:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTHeapDep.m3 Mon Jun 7 13:14:38 1999 *************** *** 0 **** --- 1,186 ---- + (* Copyright (C) 1994, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (*| Last modified on Fri Jan 20 09:41:09 PST 1995 by kalsow *) + (*| modified on Mon Oct 31 00:04:38 MET 1994 by Olaf Wagner *) + (*| modified on Thu Jan 28 19:24:55 PST 1993 by jdd *) + + UNSAFE MODULE RTHeapDep; + + IMPORT RT0u, RTMachine, RTHeapRep, RTCollectorSRC; + IMPORT Cstdlib, Ctypes, Umman, Unix, Uresource, Usignal, Utypes, Word; + + VAR + initialized := FALSE; + defaultSIGSEGV: Usignal.SignalHandler := NIL; (* previous handler *) + defaultSIGBUS: Usignal.SignalHandler := NIL; (* previous handler *) + + PROCEDURE Protect (p: Page; n: CARDINAL; readable, writable: BOOLEAN) = + BEGIN + IF NOT initialized THEN Init(); initialized := TRUE; END; + IF NOT readable THEN writable := FALSE; END; (* processor limitation *) + VAR prot: Ctypes.int := 0; + BEGIN + IF readable THEN prot := Word.Or(prot, Umman.PROT_READ); END; + IF writable THEN prot := Word.Or(prot, Umman.PROT_WRITE); END; + VAR + ret := Umman.mprotect(LOOPHOLE(p * BytesPerPage, Utypes.caddr_t), + n * BytesPerPage, prot); + BEGIN + (* + <* ASSERT ret = n * BytesPerPage *> + *) + <* ASSERT ret = 0 *> + END; + END; + END Protect; + + (* Init establishes a handler for SIGSEGV, caused by VM faults, and for all + other signals that cause core dumps. *) + + PROCEDURE Init () = + BEGIN + (* sanity check *) + VAR vmPageBytes := Unix.getpagesize(); + BEGIN + <* ASSERT BytesPerPage >= vmPageBytes *> + <* ASSERT BytesPerPage MOD vmPageBytes = 0 *> + END; + + (* establish SIGSEGV handler; remember previous handler *) + VAR + vec := Usignal.struct_sigvec{ + sv_handler := Fault, sv_mask := + Word.LeftShift(1, Usignal.SIGVTALRM - 1), sv_flags := 0}; + ovec: Usignal.struct_sigvec; + ret := Usignal.sigvec(Usignal.SIGSEGV, vec, ovec); + vecb := Usignal.struct_sigvec{ + sv_handler := Fault, sv_mask := + Word.LeftShift(1, Usignal.SIGVTALRM - 1), sv_flags := 0}; + ovecb: Usignal.struct_sigvec; + retb := Usignal.sigvec(Usignal.SIGBUS, vecb, ovecb); + BEGIN + <* ASSERT ret = 0 *> + <* ASSERT retb = 0 *> + defaultSIGSEGV := ovec.sv_handler; + defaultSIGBUS := ovecb.sv_handler; + END; + + (* establish signal handler for all other signals that dump core, if no + handler exists *) + PROCEDURE OverrideDefault (sig: Ctypes.int) = + VAR + vec := Usignal.struct_sigvec{ + sv_handler := Core, sv_mask := + Word.LeftShift(1, Usignal.SIGVTALRM - 1), sv_flags := 0}; + ovec: Usignal.struct_sigvec; + ret := Usignal.sigvec(sig, vec, ovec); + BEGIN + <* ASSERT ret = 0 *> + IF ovec.sv_handler # Usignal.SIG_DFL THEN + ret := Usignal.sigvec(sig, ovec, vec); + <* ASSERT ret = 0 *> + END; + END OverrideDefault; + BEGIN + OverrideDefault(Usignal.SIGQUIT); + OverrideDefault(Usignal.SIGILL); + OverrideDefault(Usignal.SIGTRAP); + OverrideDefault(Usignal.SIGIOT); + OverrideDefault(Usignal.SIGEMT); + OverrideDefault(Usignal.SIGFPE); + OverrideDefault(Usignal.SIGSYS); + END; + END Init; + + (* Fault is called upon a SIGSEGV signal, caused by a VM fault. If + RTHeapRep.Fault is not able to handle the fault, it invokes the previous + action. *) + + 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 + * }; + *) + + BEGIN + sf_addr_addr := scp - ( 2 * BYTESIZE(ADDRESS)); + sf_addr := sf_addr_addr[0]; + IF scp # NIL AND RTHeapRep.Fault(sf_addr) THEN + RETURN; + END; + IF defaultSIGSEGV = Usignal.SIG_IGN THEN RETURN; END; + IF defaultSIGSEGV = Usignal.SIG_DFL THEN + Core(sig, code, scp); + ELSE + defaultSIGSEGV(sig, code, scp); + END; + END Fault; + + (* Core is a signal handler for signals that dump core, to complete the + current collection before dumping core. This makes core files easier to + debug, and avoids an Ultrix bug that creates incomplete core files if + heap pages are read-protected. *) + + VAR dumped_core := FALSE; + + PROCEDURE Core ( sig : Ctypes.int; + <* UNUSED *> code: Ctypes.int; + <* UNUSED *> scp : UNTRACED REF Usignal.struct_sigcontext) = + VAR + ovec: Usignal.struct_sigvec; + vec := Usignal.struct_sigvec{sv_handler := Usignal.SIG_DFL, + sv_mask := 0, sv_flags := 0}; + BEGIN + INC(RT0u.inCritical); + IF NOT dumped_core THEN + dumped_core := TRUE; + EVAL RTHeapRep.Crash(); (* clean up the heap *) + EVAL Usignal.sigvec(sig, vec, ovec); (* establish default action *) + EVAL Usignal.sigsetmask(0); + (** EVAL Usignal.kill(Uprocess.getpid(), sig); (* dump core *) **) + Cstdlib.abort (); (* dump core *) + <* ASSERT FALSE *> + END; + DEC(RT0u.inCritical); + END Core; + + (* System-call faults are handled in RTHeapDepC.c *) + + PROCEDURE TimeUsed (): REAL = + VAR usage: Uresource.struct_rusage; + BEGIN + VAR ret := Uresource.getrusage(Uresource.RUSAGE_SELF, ADR(usage)); + BEGIN + <* ASSERT ret # -1 *> + END; + RETURN (FLOAT(usage.ru_utime.tv_sec) + + FLOAT(usage.ru_utime.tv_usec) / 1000000.0) + + (FLOAT(usage.ru_utime.tv_sec) + + FLOAT(usage.ru_utime.tv_usec) / 1000000.0); + END TimeUsed; + + PROCEDURE VMFaultTime (): REAL = + BEGIN + RETURN 0.010; (* guess 10ms to handle a page fault *) + END VMFaultTime; + + BEGIN + IF VM THEN + RTMachine.RTHeapRep_Fault := LOOPHOLE (RTHeapRep.Fault, ADDRESS); + RTMachine.RTCSRC_FinishVM := LOOPHOLE (RTCollectorSRC.FinishVM, ADDRESS); + END; + END RTHeapDep. Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTHeapDepC.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTHeapDepC.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTHeapDepC.c Mon Jun 7 13:14:38 1999 *************** *** 0 **** --- 1,1391 ---- + /* Copyright (C) 1992, Digital Equipment Corporation */ + /* All rights reserved. */ + /* See the file COPYRIGHT for a full description. */ + + /* modified on Tue Feb 2 11:15:57 PST 1993 by jdd */ + + /* This is RTHeapDepC.c for FreeBSD running on 386/486 processors. */ + /* + * ow Sat Oct 29 14:10:19 MET 1994 + * ow Sun Nov 6 16:39:26 MET 1994 + * ow Sun Dec 4 17:58:49 1994 changes for FreeBSD 2.0 + * + * I just tried to check the calls implemented for Ultrix, + * (almost) nothing else has been changed or added. + * So be careful to use any other system calls, some are + * probably missing. + */ + /* This file implements wrappers for almost all Ultrix system calls + that take pointers as arguments. These wrappers allow the system + calls to take arguments that might point to the traced heap, which + may be VM-protected in the Ultrix implementation of the collector. + The wrappers read and write the referents of all pointers about to + passed to the system call, which ensures that the pages are not + protected when the call is made. + + Each wrapper is a critical section, with RT0u__inCritical non-zero, + so that another thread cannot cause the pages to become reprotected + before the system call is performed. + + A few system calls are not handled here, or are handled only + partially. This restricts the system calls that can be made from + Modula-3, or from libraries that are passed pointers into the + Modula-3 traced heap. These system calls are: + + 1) sigvec. Sigvec takes 3 arguments, but passes 4 to the kernel. + The extra argument is the address of the sigtramp code, which is + copyrighted. The sigtramp code appears in the the standard .o + file that also defines sigvec, so that sigvec cannot be + redefined here without including sigtramp. Rewriting sigtramp + seemed too error-prone, so sigvec is not supported here, meaning + that sigvec cannot be called with arguments on the heap. + + 2) syscall. Implementing syscall would require a huge case + statement, with one case per system call. This seemed too + error-prone, so syscall cannot take arguments that point into + the traced heap. + + 3) ioctl. Ioctl's third argument may be a pointer, and some device + drivers might interpret the referent as containing more + pointers. These second-level pointers are not handled here, so + they must not point into the traced heap if they exist. + Handling this problem in general is impossible, since the set of + device drivers is open-ended. + + 4) profil. The memory referenced by the "buff" argument is updated + after the call returns, and there is no mechanism to permanently + unprotect it. + + 5) Undocumented system calls. There are private system calls with + no manual pages, so it was impossible to write wrappers. + + 6) audgen, whose manpage is incomprehensible. + + (Some calls in Section 2 are already wrappers for other system + calls; it is not necessary to reimplement them here.) + + Also, longjmp must not be used from a signal handler to abnormally + exit from a system call. + + Finally, if a system call references an object on the heap, each + pointer must reference only one object. Therefore, it is not + possible to write the heap contents with a single write. */ + + #define MFS + #define NFS + #include + #include + #include + #include + #include + #include + #if __FreeBSD__ >= 2 + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #if __FreeBSD__ >= 3 + #include + #include + #include + #include + #include + #endif + + #include + #include + + #ifdef NULL + #undef NULL + #endif + #define NULL (void *)(0) + extern long RT0u__inCritical; + #define ENTER_CRITICAL RT0u__inCritical++ + #define EXIT_CRITICAL RT0u__inCritical-- + + void (*RTHeapRep_Fault)(char*); + void (*RTCSRC_FinishVM)(); + + static char RTHeapDepC__c; + #define MAKE_READABLE(x) if (x != 0) { RTHeapDepC__c = *(char*)(x); } + #define MAKE_WRITABLE(x) if (x != 0) { *(char*)(x) = RTHeapDepC__c = *(char*)(x); } + + /* + * Modula-3 compilation units are always compiled PIC. This causes + * the a.out linker to complain that there is no reference to + * _DYNAMIC if the program is linked with "-static". Provide a + * weak reference to it here so that static linking will work. + * + * This has nothing to do with the heap, so it doesn't really belong + * here. But it needs to be someplace that is guaranteed to be pulled + * into every executable. + */ + #pragma weak _DYNAMIC + extern int _DYNAMIC; + static int *i __unused = &_DYNAMIC; + + /* Unless otherwise noted, all the following wrappers have the same + structure. */ + + int access(path, mode) /* ok */ + const char *path; + int mode; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_access, path, mode); + EXIT_CRITICAL; + return result; + } + + int acct(file) /* ok */ + const char *file; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(file); + result = syscall(SYS_acct, file); + EXIT_CRITICAL; + return result; + } + + int adjtime(delta, olddelta) /* ok */ + #if __FreeBSD__ >= 2 + const struct timeval *delta; + #else + struct timeval *delta; + #endif + struct timeval *olddelta; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(delta); + MAKE_WRITABLE(olddelta); + result = syscall(SYS_adjtime, delta, olddelta); + EXIT_CRITICAL; + return result; + } + + /* not implemented + int atomic_op(op, addr) + int op; + int *addr; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(addr); + result = syscall(SYS_atomic_op, op, addr); + EXIT_CRITICAL; + return result; + } + */ + + /* not implemented + int audcntl(request, argp, len, flag, audit_id) + int request; + char *argp; + int len; + int flag; + audit_ID_t audit_id; + { int result; + + ENTER_CRITICAL; + switch (request) { + case GET_SYS_AMASK: + case GET_TRUSTED_AMASK: + case GET_PROC_AMASK: + MAKE_WRITABLE(argp); + break; + case SET_SYS_AMASK: + case SET_TRUSTED_AMASK: + case SET_PROC_AMASK: + MAKE_READABLE(argp); + break; + default: + break; + } + result = syscall(SYS_audcntl, request, argp, len, flag, audit_id); + EXIT_CRITICAL; + return result; + } + + int audgen(event, tokenp, argv) + int event; + char *tokenp, *argv[]; + { int result; + + ENTER_CRITICAL; + + { char *t, **a; + + for (t = tokenp, a = argv; t; t++, a++) { + if (A_TOKEN_PTR(*t)) { + MAKE_READABLE(*a); + } + } + } + result = syscall(SYS_audgen, tokenp, argv); + EXIT_CRITICAL; + return result; + } + */ + + /* not implemented + int cachectl(addr, nbytes, op) + char *addr; + int nbytes, op; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(addr); + result = syscall(SYS_cachectl, addr, nbytes, op); + EXIT_CRITICAL; + return result; + } + + int cacheflush(addr, nbytes, cache) + char *addr; + int nbytes, cache; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(addr); + result = syscall(SYS_cacheflush, addr, nbytes, cache); + EXIT_CRITICAL; + return result; + } + */ + + int chdir(path) /* ok */ + const char *path; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_chdir, path); + EXIT_CRITICAL; + return result; + } + + int chflags(path, flags) + const char *path; + u_long flags; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_chflags, path, flags); + EXIT_CRITICAL; + return result; + } + + int chmod(path, mode) /* ok */ + const char *path; + mode_t mode; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_chmod, path, mode); + EXIT_CRITICAL; + return result; + } + + int chown(path, owner, group) /* ok */ + const char *path; + uid_t owner; + gid_t group; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_chown, path, owner, group); + EXIT_CRITICAL; + return result; + } + + int chroot(dirname) /* ok */ + const char *dirname; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(dirname); + result = syscall(SYS_chroot, dirname); + EXIT_CRITICAL; + return result; + } + + /* not implemented (obsolete) + int creat(name, mode) + const char *name; + mode_t mode; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = syscall(SYS_creat, name, mode); + EXIT_CRITICAL; + return result; + } + */ + + /* execve is implemented differently since it does not return, which + would leave RT0u__inCritical set in the parent if called in the child + of a vfork. Many calls leave the process in an undefined state in the + case of EFAULT, but we assume that execve is not one of these. */ + + int execve(name, argv, envp) /* ok */ + const char *name; + char * const argv[]; + char * const envp[]; + { int result; + + for (;;) { + result = syscall(SYS_execve, name, argv, envp); + if (result == -1 && errno == EFAULT) { + MAKE_READABLE(name); + { char * const *a; for (a = argv; *a; a++) MAKE_READABLE(*a); } + { char * const *e; for (e = envp; *e; e++) MAKE_READABLE(*e); } + } else { + return result; + } + } + } + + /* not implemented + int exportfs(name, rootuid, exflags) + char *name; + int rootuid, exflags; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = syscall(SYS_exportfs, name, rootuid, exflags); + EXIT_CRITICAL; + return result; + } + */ + + int ufcntl(int fd, int request, int arg) /* ok */ + { int result; + /* int arg; + va_list ap; + + va_start(ap, request); + arg = va_arg(ap, int); + va_end(ap); + */ + + ENTER_CRITICAL; + switch (request) { + case F_GETLK: + MAKE_WRITABLE(arg); + break; + case F_SETLK: + case F_SETLKW: + MAKE_READABLE(arg); + break; + default: + break; + } + result = syscall(SYS_fcntl, fd, request, arg); + EXIT_CRITICAL; + return result; + } + + int fstat(fd, buf) /* ok */ + int fd; + struct stat *buf; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + result = syscall(SYS_fstat, fd, buf); + EXIT_CRITICAL; + return result; + } + + int getdirentries(fd, buf, nbytes, basep) /* ok */ + int fd; + char *buf; + int nbytes; + long *basep; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + MAKE_WRITABLE(basep); + result = syscall(SYS_getdirentries, fd, buf, nbytes, basep); + EXIT_CRITICAL; + return result; + } + + int getdomainname(name, namelen) /* ok */ + char *name; + int namelen; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(name); + result = syscall(SYS_getdomainname, name, namelen); + EXIT_CRITICAL; + return result; + } + + int gethostname(name, namelen) /* ok */ + char *name; + int namelen; + { int result; + #if __FreeBSD__ >= 2 + int mib[2]; + size_t size; + #endif + + ENTER_CRITICAL; + MAKE_WRITABLE(name); + #if __FreeBSD__ >= 2 + mib[0] = CTL_KERN; + mib[1] = KERN_HOSTNAME; + size = namelen; + if (sysctl(mib, 2, name, &size, NULL, 0) == -1){ + result = -1; + }else{ + result = 0; + } + #else + result = syscall(SYS_gethostname, name, namelen); + #endif + EXIT_CRITICAL; + return result; + } + + int getgroups(gidsetsize, grouplist) /* ok */ + int gidsetsize; + gid_t grouplist[]; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(grouplist); + result = syscall(SYS_getgroups, gidsetsize, grouplist); + EXIT_CRITICAL; + return result; + } + + int getitimer(which, value) /* ok */ + int which; + struct itimerval *value; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(value); + result = syscall(SYS_getitimer, which, value); + EXIT_CRITICAL; + return result; + } + + /* not implemented + int getmnt(start, buffer, nbytes, mode, path) + int *start; + struct fs_data *buffer; + int nbytes, mode; + char *path; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(start); + MAKE_WRITABLE(buffer); + MAKE_READABLE(path); + result = syscall(SYS_getmnt, start, buffer, nbytes, mode, path); + EXIT_CRITICAL; + return result; + } + */ + + int getrlimit(resource, rlp) /* ok */ + int resource; + struct rlimit *rlp; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(rlp); + result = syscall(SYS_getrlimit, resource, rlp); + EXIT_CRITICAL; + return result; + } + + int getrusage(who, rusage) /* ok */ + int who; + struct rusage *rusage; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(rusage); + result = syscall(SYS_getrusage, who, rusage); + EXIT_CRITICAL; + return result; + } + + int getsockopt(s, level, optname, optval, optlen) /* ok */ + int s, level, optname; + void *optval; + int *optlen; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(optval); + MAKE_WRITABLE(optlen); + result = syscall(SYS_getsockopt, s, level, optname, optval, optlen); + EXIT_CRITICAL; + return result; + } + /* not implemented + int getsysinfo(op, buffer, nbytes, start, arg) + unsigned op; + char *buffer; + unsigned nbytes; + int *start; + char *arg; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buffer); + MAKE_WRITABLE(start); + MAKE_WRITABLE(arg); + result = syscall(SYS_getsysinfo, op, buffer, nbytes, start, arg); + EXIT_CRITICAL; + return result; + } + */ + + int gettimeofday(tp, tzp) /* ok */ + struct timeval *tp; + struct timezone *tzp; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(tp); + MAKE_WRITABLE(tzp); + result = syscall(SYS_gettimeofday, tp, tzp); + EXIT_CRITICAL; + return result; + } + + /* ioctl must test the argp argument carefully. It may be a pointer, + or maybe not. At a slight expense, we call RTHeapRep.Fault to + unprotect the page if it's in the traced heap, but do nothing + otherwise. */ + + int ioctl(d, request, argp) /* ok */ + int d; + unsigned long request; + char *argp; + { int result; + + ENTER_CRITICAL; + if (RTHeapRep_Fault) RTHeapRep_Fault(argp); /* make it readable */ + if (RTHeapRep_Fault) RTHeapRep_Fault(argp); /* make it writable */ + result = syscall(SYS_ioctl, d, request, argp); + EXIT_CRITICAL; + return result; + } + + #ifdef SYS_lchown + int lchown(path, owner, group) /* ok */ + const char *path; + uid_t owner; + gid_t group; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_lchown, path, owner, group); + EXIT_CRITICAL; + return result; + } + #endif /* SYS_lchown */ + + int link(name1, name2) /* ok */ + const char *name1; + const char *name2; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(name1); + MAKE_READABLE(name2); + result = syscall(SYS_link, name1, name2); + EXIT_CRITICAL; + return result; + } + + int lstat(path, buf) /* ok */ + const char *path; + struct stat *buf; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + MAKE_WRITABLE(buf); + result = syscall(SYS_lstat, path, buf); + EXIT_CRITICAL; + return result; + } + + int mkdir(path, mode) /* ok */ + const char *path; + mode_t mode; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_mkdir, path, mode); + EXIT_CRITICAL; + return result; + } + + int mkfifo(path, mode) /* ok */ + const char *path; + mode_t mode; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_mkfifo, path, mode); + EXIT_CRITICAL; + return result; + } + + int mknod(path, mode, dev) /* ok */ + const char *path; + mode_t mode; + dev_t dev; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_mknod, path, mode, dev); + EXIT_CRITICAL; + return result; + } + + #if __FreeBSD_version >= 300001 /* New form of mount(2) */ + int + mount(type, dir, flags, data) + const char *type; + const char *dir; + int flags; + void *data; + { int result; + struct ufs_args *u_data; + struct mfs_args *m_data; + struct nfs_args *n_data; + + ENTER_CRITICAL; + MAKE_READABLE(type); + MAKE_READABLE(dir); + if (strcmp(type, "ufs") == 0) { + u_data = (struct ufs_args*) data; + MAKE_READABLE(u_data); + MAKE_READABLE(u_data->fspec); + result = syscall(SYS_mount, type, dir, flags, data); + } else if (strcmp(type, "mfs") == 0) { + m_data = (struct mfs_args*) data; + MAKE_READABLE(m_data); + MAKE_READABLE(m_data->fspec); + result = syscall(SYS_mount, type, dir, flags, data); + } else if (strcmp(type, "nfs") == 0) { + n_data = (struct nfs_args*) data; + MAKE_READABLE(n_data); + MAKE_READABLE(n_data->addr); + MAKE_READABLE(n_data->fh); + MAKE_READABLE(n_data->hostname); + result = syscall(SYS_mount, type, dir, flags, data); + } else { /* Not anything we recognize. */ + MAKE_READABLE(data); + result = syscall(SYS_mount, type, dir, flags, data); + } + EXIT_CRITICAL; + if (result != -1) { + result = 0; + } + return result; + } + + #else /* __FreeBSD_version >= 300001 */ + + int mount(type, dir, flags, data) + int type; + const char *dir; + int flags; + void *data; + { int result; + struct ufs_args *u_data; + struct mfs_args *m_data; + struct nfs_args *n_data; + + ENTER_CRITICAL; + MAKE_READABLE(dir); + switch(type) { + case MOUNT_UFS: u_data = (struct ufs_args*) data; + MAKE_READABLE(u_data); + MAKE_READABLE(u_data->fspec); break; + case MOUNT_MFS: m_data = (struct mfs_args*) data; + MAKE_READABLE(m_data); + #if __FreeBSD__ >= 2 + MAKE_READABLE(m_data->fspec); break; + #else + MAKE_READABLE(m_data->name); break; + #endif + case MOUNT_NFS: n_data = (struct nfs_args*) data; + MAKE_READABLE(n_data); + MAKE_READABLE(n_data->addr); + MAKE_READABLE(n_data->fh); + MAKE_READABLE(n_data->hostname); break; + } + result = syscall(SYS_mount, type, dir, flags, data); + EXIT_CRITICAL; + if (result != -1) { + result = 0; + } + return result; + } + #endif /* __FreeBSD_version >= 300001 */ + + int msgctl(msqid, cmd, buf) /* ok */ + int msqid, cmd; + struct msqid_ds *buf; + { int result; + + ENTER_CRITICAL; + switch (cmd) { + case IPC_SET: + MAKE_READABLE(buf); + break; + case IPC_STAT: + MAKE_WRITABLE(buf); + break; + default: + break; + } + result = syscall(SYS_msgsys, 0, msqid, cmd, buf); + EXIT_CRITICAL; + return result; + } + + int msgrcv(msqid, msgp, msgsz, msgtyp, msgflg) /* ok */ + int msqid; + void *msgp; + size_t msgsz; + long msgtyp; + int msgflg; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(msgp); + result = syscall(SYS_msgsys, 3, msqid, msgp, msgsz, msgtyp, msgflg); + EXIT_CRITICAL; + return result; + } + + int msgsnd(msqid, msgp, msgsz, msgflg) /* ok */ + int msqid; + void *msgp; + size_t msgsz; + int msgflg; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(msgp); + result = syscall(SYS_msgsys, 2, msqid, msgp, msgsz, msgflg); + EXIT_CRITICAL; + return result; + } + + int uopen(const char* path, int flags, mode_t mode) /* ok */ + { int result; + /* mode_t mode; + va_list ap; + + va_start(ap, flags); + mode = va_arg(ap, mode_t); + va_end(ap); + this does not work. Why? + */ + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_open, path, flags, mode); + EXIT_CRITICAL; + return result; + } + + int quotactl(path, cmd, uid, addr) /* ok */ + const char *path; + int cmd, uid; + #if __FreeBSD_version >= 400002 + void *addr; + #else + char *addr; + #endif + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + switch (cmd) { + case Q_QUOTAON: + case Q_QUOTAOFF: + case Q_SETUSE: + case Q_SETQUOTA: + case Q_GETQUOTA: + MAKE_READABLE(addr); + break; + /* + case Q_GETDLIM: + MAKE_WRITABLE(addr); + break; + */ + default: + break; + } + result = syscall(SYS_quotactl, path, cmd, uid, addr); + EXIT_CRITICAL; + return result; + } + + int readlink(path, buf, bufsiz) /* ok */ + const char *path; + char *buf; + int bufsiz; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + MAKE_WRITABLE(buf); + result = syscall(SYS_readlink, path, buf, bufsiz); + EXIT_CRITICAL; + return result; + } + + ssize_t readv(d, iov, iovcnt) /* ok */ + int d; + const struct iovec *iov; + int iovcnt; + { int result; + + ENTER_CRITICAL; + { int i; + for (i = 0; i < iovcnt; i++) { + MAKE_WRITABLE(iov[i].iov_base); + } + } + result = syscall(SYS_readv, d, iov, iovcnt); + EXIT_CRITICAL; + return result; + } + + ssize_t recvmsg(s, msg, flags) /* ok */ + int s; + struct msghdr msg[]; + int flags; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(msg->msg_name); + { int i; + for (i = 0; i < msg->msg_iovlen; i++) { + if (msg->msg_iov[i].iov_len > 0) { + MAKE_WRITABLE(msg->msg_iov[i].iov_base); + } + } + } + MAKE_WRITABLE(msg->msg_control); + result = syscall(SYS_recvmsg, s, msg, flags); + EXIT_CRITICAL; + return result; + } + + int rename(from, to) /* ok */ + char *from; + char *to; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(from); + MAKE_READABLE(to); + result = syscall(SYS_rename, from, to); + EXIT_CRITICAL; + return result; + } + + int rmdir(path) /* ok */ + const char *path; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_rmdir, path); + EXIT_CRITICAL; + return result; + } + + int + #if (227002 <= __FreeBSD_version && __FreeBSD_version < 300000) || \ + __FreeBSD_version >= 300002 + semctl(int semid, int semnum, int cmd, ...) + #else + semctl(int semid, int semnum, int cmd, union semun arg) + #endif + { + int result; + #if (227002 <= __FreeBSD_version && __FreeBSD_version < 300000) || \ + __FreeBSD_version >= 300002 + union semun arg; + va_list ap; + + va_start(ap, cmd); + arg = va_arg(ap, union semun); + va_end(ap); + #endif + + ENTER_CRITICAL; + switch (cmd) { + + case IPC_SET: + MAKE_READABLE(arg.buf); + break; + + case SETALL: + MAKE_READABLE(arg.array); + break; + + case IPC_STAT: + MAKE_WRITABLE(arg.buf); + break; + + case GETALL: + MAKE_WRITABLE(arg.array); + break; + } + result = syscall(SYS_semsys, 0, semid, semnum, cmd, arg); + EXIT_CRITICAL; + return result; + } + + int semop(semid, sops, nsops) /* ok ? */ + int semid; + struct sembuf *sops; + unsigned int nsops; + { int result; + + ENTER_CRITICAL; + { unsigned int i; + for (i = 0; i < nsops; i++) { + MAKE_READABLE(sops); + } + } + result = syscall(SYS_semsys, 2, semid, sops, nsops); + EXIT_CRITICAL; + return result; + } + + ssize_t sendmsg(s, msg, flags) /* ok */ + int s; + const struct msghdr msg[]; + int flags; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(msg->msg_name); + { int i; + for (i = 0; i < msg->msg_iovlen; i++) { + if (msg->msg_iov[i].iov_len > 0) { + MAKE_READABLE(msg->msg_iov[i].iov_base); + } + } + } + MAKE_WRITABLE(msg->msg_control); + result = syscall(SYS_sendmsg, s, msg, flags); + EXIT_CRITICAL; + return result; + } + + int setdomainname(name, namelen) /* ok */ + const char *name; + int namelen; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = syscall(SYS_setdomainname, name, namelen); + EXIT_CRITICAL; + return result; + } + + int setgroups(ngroups, gidset) /* ok */ + int ngroups; + const gid_t *gidset; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(gidset); + result = syscall(SYS_setgroups, ngroups, gidset); + EXIT_CRITICAL; + return result; + } + + int sethostname(name, namelen) /* ok */ + const char *name; + int namelen; + { int result; + #if __FreeBSD__ >= 2 + int mib[2]; + #endif + + ENTER_CRITICAL; + MAKE_READABLE(name); + #if __FreeBSD__ >= 2 + mib[0] = CTL_KERN; + mib[1] = KERN_HOSTNAME; + if (sysctl(mib, 2, NULL, NULL, (void *)name, namelen) == -1){ + result = -1; + }else{ + result = 0; + } + #else + result = syscall(SYS_sethostname, name, namelen); + #endif + EXIT_CRITICAL; + return result; + } + + int setitimer(which, value, ovalue) /* ok */ + int which; + #if __FreeBSD__ >= 2 + const struct itimerval *value; + #else + struct itimerval *value; + #endif + struct itimerval *ovalue; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(value); + MAKE_WRITABLE(ovalue); + result = syscall(SYS_setitimer, which, value, ovalue); + EXIT_CRITICAL; + return result; + } + /* not implemented + int setquota(special, file) + char *special; + char *file; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(special); + MAKE_READABLE(file); + result = syscall(SYS_setquota, special, file); + EXIT_CRITICAL; + return result; + } + */ + + int setrlimit(resource, rlp) /* ok */ + int resource; + struct rlimit *rlp; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(rlp); + result = syscall(SYS_setrlimit, resource, rlp); + EXIT_CRITICAL; + return result; + } + + int setsockopt(s, level, optname, optval, optlen) /* ok */ + int s, level, optname; + const void *optval; + int optlen; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(optval); + result = syscall(SYS_setsockopt, s, level, optname, optval, optlen); + EXIT_CRITICAL; + return result; + } + + /* not implemented + int setsysinfo(op, buffer, nbytes, arg, flag) + unsigned op; + char *buffer; + unsigned nbytes; + unsigned arg; + unsigned flag; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(buffer); + result = syscall(SYS_setsysinfo, op, buffer, nbytes, arg, flag); + EXIT_CRITICAL; + return result; + } + */ + + int settimeofday(tp, tzp) /* ok */ + #if __FreeBSD__ >= 2 + const struct timeval *tp; + const struct timezone *tzp; + #else + struct timeval *tp; + struct timezone *tzp; + #endif + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(tp); + MAKE_READABLE(tzp); + result = syscall(SYS_settimeofday, tp, tzp); + EXIT_CRITICAL; + return result; + } + + int sigaction(sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(act); + MAKE_WRITABLE(oact); + result = syscall(SYS_sigaction, sig, act, oact); + EXIT_CRITICAL; + return result; + } + + int sigaltstack(ss, oss) /* ok */ + const struct sigaltstack *ss; + struct sigaltstack *oss; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(ss); + MAKE_WRITABLE(oss); + result = syscall(SYS_sigaltstack, ss, oss); + EXIT_CRITICAL; + return result; + } + + int socketpair(d, type, protocol, sv) /* ok */ + int d, type, protocol; + int sv[2]; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(sv); + result = syscall(SYS_socketpair, d, type, protocol, sv); + EXIT_CRITICAL; + return result; + } + + int stat(path, buf) /* ok */ + const char *path; + struct stat *buf; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + MAKE_WRITABLE(buf); + result = syscall(SYS_stat, path, buf); + EXIT_CRITICAL; + return result; + } + + int swapon(special) /* ok */ + const char *special; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(special); + result = syscall(SYS_swapon, special); + EXIT_CRITICAL; + return result; + } + + int symlink(name1, name2) /* ok */ + const char *name1; + const char *name2; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(name1); + MAKE_READABLE(name2); + result = syscall(SYS_symlink, name1, name2); + EXIT_CRITICAL; + return result; + } + + int truncate(path, length) /* ok */ + const char *path; + off_t length; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + /* The casts below pad "path" out to a 64-bit value as required. */ + result = __syscall(SYS_truncate, (u_quad_t)(u_long)path, length); + EXIT_CRITICAL; + return result; + } + + int uname(name) /* ok */ + struct utsname *name; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(name); + result = syscall(SYS_uname, name); + EXIT_CRITICAL; + return result; + } + + int unlink(path) /* ok */ + const char *path; + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(path); + result = syscall(SYS_unlink, path); + EXIT_CRITICAL; + return result; + } + + /* not implemented + int ustat(dev, buf) + dev_t dev; + struct ustat *buf; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + result = syscall(SYS_ustat, dev, buf); + EXIT_CRITICAL; + return result; + } + */ + + int utimes(file, tvp) /* ok */ + #if __FreeBSD__ >= 2 + const char *file; + const struct timeval *tvp; + #else + char *file; + struct timeval *tvp; + #endif + { int result; + + ENTER_CRITICAL; + MAKE_READABLE(file); + MAKE_READABLE(tvp); + result = syscall(SYS_utimes, file, tvp); + EXIT_CRITICAL; + return result; + } + + pid_t wait(status) /* ok */ + int *status; + { + return wait3(status, 0, 0); + } + + pid_t wait3(status, options, rusage) /* ok */ + int *status; + int options; + struct rusage *rusage; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(status); + MAKE_WRITABLE(rusage); + result = syscall(SYS_wait4, -1, status, options, rusage); + EXIT_CRITICAL; + return result; + } + + pid_t wait4(wpid, status, options, rusage) /* ok */ + pid_t wpid; + int *status; + int options; + struct rusage *rusage; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(status); + MAKE_WRITABLE(rusage); + result = syscall(SYS_wait4, wpid, status, options, rusage); + EXIT_CRITICAL; + return result; + } + + pid_t waitpid(pid, status, options) /* ok */ + pid_t pid; + int *status; + int options; + { int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(status); + result = syscall(SYS_wait4, pid, status, options, NULL); + EXIT_CRITICAL; + return result; + } + + ssize_t writev(fd, iov, ioveclen) /* ok */ + int fd; + const struct iovec *iov; + int ioveclen; + { int result; + + ENTER_CRITICAL; + { int i; + for (i = 0; i < ioveclen; i++) { + if (iov[i].iov_len > 0) { + MAKE_READABLE(iov[i].iov_base); + } + } + } + result = syscall(SYS_writev, fd, iov, ioveclen); + EXIT_CRITICAL; + return result; + } + + /* fork also requires special treatment, although it takes no + argument. fork crashes Ultrix if some pages are unreadable, so we + must unprotect the heap before calling fork */ + /* I don't know what happens in FreeBSD, so I just leave it in here */ + pid_t fork() + { + pid_t result; + pid_t me = getpid(); + + ENTER_CRITICAL; + if (RTCSRC_FinishVM) RTCSRC_FinishVM(); + result = syscall(SYS_fork); + EXIT_CRITICAL; + if (result == me) { + result = 0; + } + return result; + } + Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTMachine.i3 diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTMachine.i3:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTMachine.i3 Mon Jun 7 13:14:38 1999 *************** *** 0 **** --- 1,86 ---- + (* Copyright (C) 1994, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Tue May 2 11:41:23 PDT 1995 by kalsow *) + + (* This interface defines platform (machine + OS) dependent + types and constants. *) + + INTERFACE RTMachine; + + IMPORT Csetjmp; + + (*--------------------------------------------------------- thread state ---*) + + TYPE + State = Csetjmp.fpjmp_buf; + (* The machine state is saved in a "State". This type is really + opaque to the client, i.e. it does not need to be an array. *) + + <*EXTERNAL "_fpsetjmp" *> + PROCEDURE SaveState (VAR s: State): INTEGER; + (* Capture the currently running thread's state *) + + CONST + FramePadBottom = 2; + FramePadTop = 0; + (* Additional padding words from above and below an existing + thread's stack pointer to copy when creating a new thread *) + + (*------------------------------------------------------------------ heap ---*) + + (* The heap page size is machine-dependent, since it might depend on the + architecture's VM page size (if VM is TRUE). Otherwise, 8192 bytes is a + reasonable page size. The page size must be a power of two. *) + + CONST + BytesPerHeapPage = 4096; (* bytes per page *) + LogBytesPerHeapPage = 12; + AdrPerHeapPage = 4096; (* addresses per page *) + LogAdrPerHeapPage = 12; + + (* The collector supports the use of VM protection to achieve incremental, + generational collection. This is not possible on all architectures, and + it may not be implemented in all cases where it is possible. The + boolean constant "VMHeap" is "TRUE" iff all necessary support is + present for this architecture. "VMHeap" is "TRUE" for the DS3100, + whose implementation you might use as a reference. *) + + CONST + VMHeap = TRUE; + + (*** hooks for the C wrapper functions ***) + + <*EXTERNAL *> VAR RTHeapRep_Fault: ADDRESS; (* => RTHeapRep.Fault *) + <*EXTERNAL *> VAR RTCSRC_FinishVM: ADDRESS; (* => RTCollectorSRC.FinishVM *) + + (*--------------------------------------------------------- thread stacks ---*) + + CONST + PointerAlignment = 4; + (* The C compiler allocates all pointers on 'PointerAlignment'-byte + boundaries. The garbage collector scans thread stacks, but only + looks at these possible pointer locations. Setting this value + smaller than is needed will only make your system run slower. + Setting it too large will cause the collector to collect storage + that is not free. *) + + CONST + StackFrameAlignment = 16; + (* Stack frames must be aligned to this constraint (in ADRSIZE units). + It's not a big deal if this value is too large, but it may break + the thread mechanism to make it too small. *) + + (*----------------------------------------------- exception stack walking ---*) + (* The "FrameInfo" type must minimally include fields named "pc" and "sp". *) + + CONST + Has_stack_walker = FALSE; + (* Indicates whether this platform supports the stack walking functions + defined in the "RTStack" interface. *) + + TYPE FrameInfo = RECORD pc, sp: ADDRESS END; + + END RTMachine. + Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTSignal.m3 diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTSignal.m3:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTSignal.m3 Mon Jun 7 13:14:38 1999 *************** *** 0 **** --- 1,101 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Mon Nov 21 10:31:19 PST 1994 by kalsow *) + (* modified on Mon Mar 16 18:10:15 PST 1992 by muller *) + + UNSAFE MODULE RTSignal; + + IMPORT RTMisc, RTProcess, Usignal, Uprocess; + FROM Ctypes IMPORT int; + + TYPE + SigInfo = UNTRACED REF Usignal.struct_sigcontext; + + VAR + DefaultHandler : Usignal.SignalHandler; + IgnoreSignal : Usignal.SignalHandler; + initial_handlers : ARRAY [0..5] OF Usignal.struct_sigaction; + + PROCEDURE InstallHandlers () = + BEGIN + DefaultHandler := LOOPHOLE (0, Usignal.SignalHandler); + IgnoreSignal := LOOPHOLE (1, Usignal.SignalHandler); + + SetHandler (0, Usignal.SIGHUP, Shutdown); + SetHandler (1, Usignal.SIGINT, Interrupt); + SetHandler (2, Usignal.SIGQUIT, Quit); + SetHandler (3, Usignal.SIGSEGV, SegV); + SetHandler (4, Usignal.SIGPIPE, IgnoreSignal); + SetHandler (5, Usignal.SIGTERM, Shutdown); + END InstallHandlers; + + PROCEDURE SetHandler (id: INTEGER; sig: int; handler: Usignal.SignalHandler) = + (* Note: we use the LOOPHOLE to prevent the runtime check for + nested procedure. The runtime check crashes when + handler = IgnoreSignal = 1. *) + VAR new: Usignal.struct_sigaction; + BEGIN + new.sa_handler := LOOPHOLE (handler, Usignal.SignalHandler); + new.sa_flags := 0; + EVAL Usignal.sigaction (sig, ADR(new), ADR(initial_handlers[id])); + IF (initial_handlers[id].sa_handler # DefaultHandler) THEN + (* don't override inherited, non-default handlers *) + EVAL Usignal.sigaction (sig, ADR(initial_handlers[id]), ADR(new)); + END; + END SetHandler; + + PROCEDURE RestoreHandlers () = + BEGIN + RestoreHandler (0, Usignal.SIGHUP); + RestoreHandler (1, Usignal.SIGINT); + RestoreHandler (2, Usignal.SIGQUIT); + RestoreHandler (3, Usignal.SIGSEGV); + RestoreHandler (4, Usignal.SIGPIPE); + RestoreHandler (5, Usignal.SIGTERM); + END RestoreHandlers; + + PROCEDURE RestoreHandler (id: INTEGER; sig: int) = + BEGIN + EVAL Usignal.sigaction (sig, ADR(initial_handlers[id]), NIL); + END RestoreHandler; + + PROCEDURE Shutdown (sig: int; <*UNUSED*> code: int; <*UNUSED*> scp: SigInfo) = + VAR new, old: Usignal.struct_sigaction; + BEGIN + new.sa_handler := DefaultHandler; + new.sa_flags := 0; + RTProcess.InvokeExitors (); (* flush stdio... *) + EVAL Usignal.sigaction (sig, ADR(new), ADR(old)); (* restore default handler *) + EVAL Usignal.kill (Uprocess.getpid (), sig); (* and resend the signal *) + END Shutdown; + + PROCEDURE Interrupt (sig: int; code: int; scp: SigInfo) = + VAR h := RTProcess.OnInterrupt (NIL); + BEGIN + IF (h = NIL) THEN + Shutdown (sig, code, scp); + ELSE + EVAL RTProcess.OnInterrupt (h); (* reinstall the handler *) + h (); + END; + END Interrupt; + + PROCEDURE Quit (<*UNUSED*> sig, code: int; scp: SigInfo) = + VAR pc := 0; + BEGIN + IF (scp # NIL) THEN pc := scp.sc_eip END; + RTMisc.FatalErrorPC (pc, "aborted"); + END Quit; + + PROCEDURE SegV (<*UNUSED*> sig, code: int; scp: SigInfo) = + VAR pc := 0; + BEGIN + IF (scp # NIL) THEN pc := scp.sc_eip END; + RTMisc.FatalErrorPC (pc, + "Segmentation violation - possible attempt to dereference NIL"); + END SegV; + + BEGIN + END RTSignal. Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTStackASM.s diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTStackASM.s:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTStackASM.s Mon Jun 7 13:14:38 1999 *************** *** 0 **** --- 1,46 ---- + .text + .align 2 + + .globl _RTStack__CurrentFrame + _RTStack__CurrentFrame: + .globl RTStack__CurrentFrame + RTStack__CurrentFrame: + # STACK = ret frame + popl %eax # STACK = frame + pushl %eax + pushl %eax # STACK = PC ret frame + movl %esp, %eax + addl $8, %eax # correct for the thing we have pushed + # and our return address + pushl %eax # STACK = SP PC ret frame + movl 12(%esp), %eax # grab the address were to put the values + popl 8(%eax) # stuff our caller SP + popl 0(%eax) # stuff our caller PC + movl %ebp, 4(%eax) # stuff our caller BP + ret + + .globl _RTStack__PreviousFrame + _RTStack__PreviousFrame: + .globl RTStack__PreviousFrame + RTStack__PreviousFrame: + movl 4(%esp), %eax # eax = ^callee + movl 4(%eax), %eax # eax = callee.ebp + pushl 0(%eax) # push bp of caller + pushl 4(%eax) # push pc of caller + addl $4, %eax + pushl %eax # push sp of caller + movl 20(%esp), %eax + popl 8(%eax) + popl 0(%eax) + popl 4(%eax) + ret + + .globl _RTStack__Unwind + _RTStack__Unwind: + .globl RTStack__Unwind + RTStack__Unwind: + movl 4(%esp), %eax # eax = ^to + movl 8(%eax), %esp + movl 4(%eax), %ebp + jmp *(%eax) + Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTThread.m3 diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTThread.m3:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTThread.m3 Mon Jun 7 13:14:38 1999 *************** *** 0 **** --- 1,115 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Wed Nov 23 13:01:14 PST 1994 by kalsow *) + (* modified on Tue May 4 18:49:28 PDT 1993 by muller *) + (* ow 16.09.1994 *) + (* ow 11.10.1994 *) + + UNSAFE MODULE RTThread; + + IMPORT Usignal, Unix, Umman, RTMisc; + + CONST + SP_pos = 2; + FP_pos = 3; + + PROCEDURE SP (READONLY s: State): ADDRESS = + BEGIN + RETURN LOOPHOLE (s [SP_pos], ADDRESS); + END SP; + + (*--------------------------------------------------------- thread stacks ---*) + + VAR page_bytes : CARDINAL := 0; + VAR stack_slop : CARDINAL; + + PROCEDURE NewStack (size: INTEGER; VAR(*OUT*)s: Stack) = + VAR i: INTEGER; start: ADDRESS; + BEGIN + IF (page_bytes = 0) THEN + page_bytes := Unix.getpagesize (); + stack_slop := 2 * (page_bytes DIV BYTESIZE (INTEGER)); + END; + + (* allocate enough so that we're guaranteed to get a full, aligned page *) + INC (size, stack_slop); + s.words := NEW (StackSpace, size); + + (* find the aligned page and unmap it *) + start := RTMisc.Align (ADR (s.words[0]), page_bytes); + i := Umman.mprotect (start, page_bytes, Umman.PROT_READ); + <* ASSERT i = 0 *> + + (* finally, set the bounds of the usable region *) + s.first := start + page_bytes; + s.last := ADR (s.words[0]) + size * ADRSIZE (s.words[0]); + END NewStack; + + PROCEDURE DisposeStack (VAR s: Stack) = + VAR i: INTEGER; start := RTMisc.Align (ADR (s.words[0]), page_bytes); + BEGIN + (* find the aligned page and re-map it *) + i := Umman.mprotect (start, page_bytes, Umman.PROT_READ+Umman.PROT_WRITE); + <* ASSERT i = 0 *> + + (* and finally, free the storage *) + DISPOSE (s.words); + s.words := NIL; + s.first := NIL; + s.last := NIL; + END DisposeStack; + + PROCEDURE FlushStackCache () = + VAR d: State; + BEGIN + Transfer (d, d); + END FlushStackCache; + + (*-------------------------------------------------- modifying the models ---*) + + PROCEDURE UpdateStateForNewSP (VAR s: State; offset: INTEGER) = + BEGIN + INC (s [SP_pos], offset); + INC (s [FP_pos], offset); + END UpdateStateForNewSP; + + PROCEDURE UpdateFrameForNewSP (<*UNUSED*> a: ADDRESS; + <*UNUSED*> offset: INTEGER) = + BEGIN + END UpdateFrameForNewSP; + + (*------------------------------------ manipulating the SIGVTALRM handler ---*) + + PROCEDURE setup_sigvtalrm (handler: Usignal.SignalHandler) = + VAR sv, osv: Usignal.struct_sigvec; i: INTEGER; + BEGIN + sv.sv_handler := handler; + sv.sv_mask := Usignal.empty_sv_mask; + sv.sv_flags := 0; + i := Usignal.sigvec (Usignal.SIGVTALRM, sv, osv); + <*ASSERT i = 0*> + END setup_sigvtalrm; + + PROCEDURE allow_sigvtalrm () = + VAR svt : Usignal.sigset_t := Usignal.sigmask(Usignal.SIGVTALRM); + old : Usignal.sigset_t; + i : INTEGER; + BEGIN + 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; + BEGIN + i := Usignal.sigprocmask(Usignal.SIG_BLOCK, svt, old); + <*ASSERT i = 0 *> + END disallow_sigvtalrm; + + BEGIN + END RTThread. + Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTThreadC.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTThreadC.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/RTThreadC.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,28 ---- + /* Copyright (C) 1994, Digital Equipment Corporation */ + /* All rights reserved. */ + /* See the file COPYRIGHT for a full description. */ + /* */ + /* Last modified on Mon Nov 7 13:23:14 PST 1994 by kalsow */ + /* modified on Tue Jan 19 15:20:48 PST 1993 by burrows */ + + /* This file implements the coroutine transfer: RTThread.Transfer */ + + #include + + + RTThread__Transfer (from, to) + jmp_buf *from, *to; + { + if (_fpsetjmp(*from) == 0) _fplongjmp (*to, 1); + } + + + /* global thread ID used by 'etp' */ + int ThreadF__myId = 1; + + /* low-level runtime lock */ + int RT0u__inCritical = 0; + + /* global, per-thread linked list of exception handlers */ + void* RTThread__handlerStack = 0; + Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/_fpsetjmp.s diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/_fpsetjmp.s:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/_fpsetjmp.s Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,94 ---- + /*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #if defined(LIBC_SCCS) && !defined(lint) + .asciz "@(#)_setjmp.s 5.1 (Berkeley) 4/23/90" + .align 2,0x90 + #endif /* LIBC_SCCS and not lint */ + + /* + * _fpsetjmp, _fplongjmp + * + * _fplongjmp(a,v) + * will generate a "return(v)" from the last call to + * _fpsetjmp(a) + * by restoring registers from the environment 'a'. + * The previous signal state is NOT restored. + * The state of the floating point unit is saved. + */ + + + .align 2,0x90; + .globl __fpsetjmp; + .type __fpsetjmp,@function; + __fpsetjmp: + .globl _fpsetjmp; + .type _fpsetjmp,@function; + _fpsetjmp: + movl 4(%esp),%eax + movl 0(%esp),%edx + movl %edx, 0(%eax) + movl %ebx, 4(%eax) + movl %esp, 8(%eax) + movl %ebp,12(%eax) + movl %esi,16(%eax) + movl %edi,20(%eax) + fnsave 28(%eax) + xorl %eax,%eax + ret + + .align 2,0x90; + .globl __fplongjmp; + .type __fplongjmp,@function; + __fplongjmp: + .globl _fplongjmp; + .type _fplongjmp,@function; + _fplongjmp: + movl 4(%esp),%edx + movl 8(%esp),%eax + movl 0(%edx),%ecx + movl 4(%edx),%ebx + movl 8(%edx),%esp + movl 12(%edx),%ebp + movl 16(%edx),%esi + movl 20(%edx),%edi + frstor 28(%edx) + testl %eax,%eax + jnz 1f + incl %eax + 1: movl %ecx,0(%esp) + ret + Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/accept.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/accept.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/accept.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,16 ---- + #include "wrap.h" + #include + #include + + int + m3_accept(int s, struct sockaddr *addr, int *addrlen) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(addr); + MAKE_WRITABLE(addrlen); + result = accept(s, addr, addrlen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/bind.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/bind.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/bind.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + int + m3_bind(int s, const struct sockaddr *name, int namelen) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = bind(s, name, namelen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/close.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/close.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/close.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,13 ---- + #include "wrap.h" + #include + + int + m3_close(int d) + { + int result; + + ENTER_CRITICAL; + result = close(d); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/connect.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/connect.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/connect.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + int + m3_connect(int s, const struct sockaddr *name, int namelen) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = connect(s, name, namelen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/dup.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/dup.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/dup.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,13 ---- + #include "wrap.h" + #include + + int + m3_dup(int oldd) + { + int result; + + ENTER_CRITICAL; + result = dup(oldd); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/dup2.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/dup2.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/dup2.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,13 ---- + #include "wrap.h" + #include + + int + m3_dup2(int oldd, int newd) + { + int result; + + ENTER_CRITICAL; + result = dup2(oldd, newd); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/gethostbyaddr.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/gethostbyaddr.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/gethostbyaddr.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + + struct hostent * + m3_gethostbyaddr(const char *addr, int len, int type) + { + struct hostent *result; + + ENTER_CRITICAL; + MAKE_READABLE(addr); + result = gethostbyaddr(addr, len, type); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/gethostbyname.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/gethostbyname.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/gethostbyname.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + + struct hostent * + m3_gethostbyname(const char *name) + { + struct hostent *result; + + ENTER_CRITICAL; + MAKE_READABLE(name); + result = gethostbyname(name); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/getpeername.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/getpeername.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/getpeername.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,16 ---- + #include "wrap.h" + #include + #include + + int + m3_getpeername(int s, struct sockaddr *name, int *namelen) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(name); + MAKE_WRITABLE(namelen); + result = getpeername(s, name, namelen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/getsockname.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/getsockname.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/getsockname.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,16 ---- + #include "wrap.h" + #include + #include + + int + m3_getsockname(int s, struct sockaddr *name, int *namelen) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(name); + MAKE_WRITABLE(namelen); + result = getsockname(s, name, namelen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/listen.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/listen.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/listen.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + #include + + int + m3_listen(int s, int backlog) + { + int result; + + ENTER_CRITICAL; + result = listen(s, backlog); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/m3makefile diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/m3makefile:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/m3makefile Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,44 ---- + % Copyright (C) 1994, Digital Equipment Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + % + % Last modified on Mon Nov 21 10:43:13 PST 1994 by kalsow + % modified on Mon Dec 14 19:59:03 PST 1992 by jdd + % modified on Wed May 20 17:21:29 PDT 1992 by muller + + Interface ("RTMachine") + implementation ("RTHeapDep") + implementation ("RTSignal") + implementation ("RTThread") + c_source ("RTThreadC") + c_source ("RTHeapDepC") + s_source ("_fpsetjmp") + c_source ("malloc") + + % These wrappers were extracted from RTHeapDepC.c and modified slightly, + % in order to make it possible to support SOCKS. + h_source ("socksconf") + h_source ("wrap") + c_source ("accept") + c_source ("bind") + c_source ("close") + c_source ("connect") + c_source ("dup") + c_source ("dup2") + c_source ("gethostbyaddr") + c_source ("gethostbyname") + c_source ("getpeername") + c_source ("getsockname") + c_source ("listen") + c_source ("read") + c_source ("recv") + c_source ("recvfrom") + c_source ("select") + c_source ("send") + c_source ("sendto") + c_source ("shutdown") + c_source ("socket") + c_source ("write") + + %% s_source (RTStackASM) + Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/malloc.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/malloc.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/malloc.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,1153 ---- + /* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + * + * From FreeBSD: malloc.c,v 1.32 1997/08/31 05:59:39 phk Exp + * Modified for Modula-3 thread safety by jdp@polstra.com (John Polstra). + * + */ + + #define _THREAD_SAFE 1 /* Turn on thread safety for Modula-3 */ + + /* + * Defining EXTRA_SANITY will enable extra checks which are related + * to internal conditions and consistency in malloc.c. This has a + * noticeable runtime performance hit, and generally will not do you + * any good unless you fiddle with the internals of malloc or want + * to catch random pointer corruption as early as possible. + */ + #ifndef MALLOC_EXTRA_SANITY + #undef MALLOC_EXTRA_SANITY + #endif + + /* + * What to use for Junk. This is the byte value we use to fill with + * when the 'J' option is enabled. + */ + #define SOME_JUNK 0xd0 /* as in "Duh" :-) */ + + /* + * The basic parameters you can tweak. + * + * malloc_pageshift pagesize = 1 << malloc_pageshift + * It's probably best if this is the native + * page size, but it doesn't have to be. + * + * malloc_minsize minimum size of an allocation in bytes. + * If this is too small it's too much work + * to manage them. This is also the smallest + * unit of alignment used for the storage + * returned by malloc/realloc. + * + */ + + #if defined(__FreeBSD__) + # if defined(__i386__) + # define malloc_pageshift 12U + # define malloc_minsize 16U + # endif + #endif /* __FreeBSD__ */ + + #if defined(__sparc__) && defined(sun) + # define malloc_pageshift 12U + # define malloc_minsize 16U + # define MAP_ANON (0) + static int fdzero; + # define MMAP_FD fdzero + # define INIT_MMAP() \ + { if ((fdzero=open("/dev/zero", O_RDWR, 0000)) == -1) \ + wrterror("open of /dev/zero"); } + # define MADV_FREE MADV_DONTNEED + #endif /* __sparc__ */ + + #if defined(__linux__) + # if defined(__i386__) + # define malloc_pageshift 12U + # define malloc_minsize 16U + # endif + #endif /* __linux__ */ + + #if defined(__alpha) + # define malloc_pageshift 13U + # define malloc_minsize 16U + #endif /* __alpha */ + + /* Insert your combination here... */ + #if defined(__FOOCPU__) && defined(__BAROS__) + # define malloc_pageshift 12U + # define malloc_minsize 16U + #endif /* __FOOCPU__ && __BAROS__ */ + + + /* + * No user serviceable parts behind this point. + */ + #include + #include + #include + #include + #include + #include + #include + #include + #include + + /* + * This structure describes a page worth of chunks. + */ + + struct pginfo { + struct pginfo *next; /* next on the free list */ + void *page; /* Pointer to the page */ + u_short size; /* size of this page's chunks */ + u_short shift; /* How far to shift for this size chunks */ + u_short free; /* How many free chunks */ + u_short total; /* How many chunk */ + u_int bits[1]; /* Which chunks are free */ + }; + + /* + * This structure describes a number of free pages. + */ + + struct pgfree { + struct pgfree *next; /* next run of free pages */ + struct pgfree *prev; /* prev run of free pages */ + void *page; /* pointer to free pages */ + void *end; /* pointer to end of free pages */ + size_t size; /* number of bytes free */ + }; + + /* + * How many bits per u_int in the bitmap. + * Change only if not 8 bits/byte + */ + #define MALLOC_BITS (8*sizeof(u_int)) + + /* + * Magic values to put in the page_directory + */ + #define MALLOC_NOT_MINE ((struct pginfo*) 0) + #define MALLOC_FREE ((struct pginfo*) 1) + #define MALLOC_FIRST ((struct pginfo*) 2) + #define MALLOC_FOLLOW ((struct pginfo*) 3) + #define MALLOC_MAGIC ((struct pginfo*) 4) + + #ifndef malloc_pageshift + #define malloc_pageshift 12U + #endif + + #ifndef malloc_minsize + #define malloc_minsize 16U + #endif + + #if !defined(malloc_pagesize) + #define malloc_pagesize (1UL<>1) + #endif + + /* A mask for the offset inside a page. */ + #define malloc_pagemask ((malloc_pagesize)-1) + + #define pageround(foo) (((foo) + (malloc_pagemask))&(~(malloc_pagemask))) + #define ptr2index(foo) (((u_long)(foo) >> malloc_pageshift)-malloc_origo) + + #ifdef _THREAD_SAFE + extern int RT0u__inCritical; /* Flag set when in a critical region */ + #define THREAD_LOCK() (++RT0u__inCritical) + #define THREAD_UNLOCK() (--RT0u__inCritical) + #endif + + #ifndef THREAD_LOCK + #define THREAD_LOCK() + #endif + + #ifndef THREAD_UNLOCK + #define THREAD_UNLOCK() + #endif + + #ifndef MMAP_FD + #define MMAP_FD (-1) + #endif + + #ifndef INIT_MMAP + #define INIT_MMAP() + #endif + + /* This is needed at least by HP-UX 10.20 */ + #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS) + #define MAP_ANON MAP_ANONYMOUS + #endif + + /* Set when initialization has been done */ + static unsigned malloc_started; + + /* Recusion flag for public interface. */ + static int malloc_active; + + /* Number of free pages we cache */ + static unsigned malloc_cache = 16; + + /* The offset from pagenumber to index into the page directory */ + static u_long malloc_origo; + + /* The last index in the page directory we care about */ + static u_long last_index; + + /* Pointer to page directory. Allocated "as if with" malloc */ + static struct pginfo **page_dir; + + /* How many slots in the page directory */ + static unsigned malloc_ninfo; + + /* Free pages line up here */ + static struct pgfree free_list; + + /* Abort(), user doesn't handle problems. */ + static int malloc_abort; + + /* Are we trying to die ? */ + static int suicide; + + /* always realloc ? */ + static int malloc_realloc; + + /* pass the kernel a hint on free pages ? */ + static int malloc_hint = 1; + + /* xmalloc behaviour ? */ + static int malloc_xmalloc; + + /* sysv behaviour for malloc(0) ? */ + static int malloc_sysv; + + /* zero fill ? */ + static int malloc_zero; + + /* junk fill ? */ + static int malloc_junk; + + #ifdef HAS_UTRACE + + /* utrace ? */ + static int malloc_utrace; + + struct ut { void *p; size_t s; void *r; }; + + void utrace __P((struct ut *, int)); + + #define UTRACE(a, b, c) \ + if (malloc_utrace) \ + {struct ut u; u.p=a; u.s = b; u.r=c; utrace(&u, sizeof u);} + #else /* !HAS_UTRACE */ + #define UTRACE(a,b,c) + #endif /* HAS_UTRACE */ + + /* my last break. */ + static void *malloc_brk; + + /* one location cache for free-list holders */ + static struct pgfree *px; + + /* compile-time options */ + char *malloc_options; + + /* Name of the current public function */ + static char *malloc_func; + + /* Macro for mmap */ + #define MMAP(size) \ + mmap((caddr_t)0, (size), PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, \ + MMAP_FD, 0); + + /* + * Necessary function declarations + */ + static int extend_pgdir(u_long index); + static void *imalloc(size_t size); + static void ifree(void *ptr); + static void *irealloc(void *ptr, size_t size); + + static void + wrterror(char *p) + { + char *q = " error: "; + write(STDERR_FILENO, malloc_func, strlen(malloc_func)); + write(STDERR_FILENO, q, strlen(q)); + write(STDERR_FILENO, p, strlen(p)); + suicide = 1; + abort(); + } + + static void + wrtwarning(char *p) + { + char *q = " warning: "; + if (malloc_abort) + wrterror(p); + write(STDERR_FILENO, malloc_func, strlen(malloc_func)); + write(STDERR_FILENO, q, strlen(q)); + write(STDERR_FILENO, p, strlen(p)); + } + + + /* + * Allocate a number of pages from the OS + */ + static caddr_t + map_pages(int pages) + { + caddr_t result, tail; + + result = (caddr_t)pageround((u_long)sbrk(0)); + tail = result + (pages << malloc_pageshift); + + if (brk(tail)) { + #ifdef EXTRA_SANITY + wrterror("(ES): map_pages fails\n"); + #endif /* EXTRA_SANITY */ + return 0; + } + + last_index = ptr2index(tail) - 1; + malloc_brk = tail; + + if ((last_index+1) >= malloc_ninfo && !extend_pgdir(last_index)) + return 0;; + + return result; + } + + /* + * Extend page directory + */ + static int + extend_pgdir(u_long index) + { + struct pginfo **new, **old; + int i, oldlen; + + /* Make it this many pages */ + i = index * sizeof *page_dir; + i /= malloc_pagesize; + i += 2; + + /* remember the old mapping size */ + oldlen = malloc_ninfo * sizeof *page_dir; + + /* + * NOTE: we allocate new pages and copy the directory rather than tempt + * fate by trying to "grow" the region.. There is nothing to prevent + * us from accidently re-mapping space that's been allocated by our caller + * via dlopen() or other mmap(). + * + * The copy problem is not too bad, as there is 4K of page index per + * 4MB of malloc arena. + * + * We can totally avoid the copy if we open a file descriptor to associate + * the anon mappings with. Then, when we remap the pages at the new + * address, the old pages will be "magically" remapped.. But this means + * keeping open a "secret" file descriptor..... + */ + + /* Get new pages */ + new = (struct pginfo**) MMAP(i * malloc_pagesize); + if (new == (struct pginfo **)-1) + return 0; + + /* Copy the old stuff */ + memcpy(new, page_dir, + malloc_ninfo * sizeof *page_dir); + + /* register the new size */ + malloc_ninfo = i * malloc_pagesize / sizeof *page_dir; + + /* swap the pointers */ + old = page_dir; + page_dir = new; + + /* Now free the old stuff */ + munmap((caddr_t)old, oldlen); + return 1; + } + + /* + * Initialize the world + */ + static void + malloc_init () + { + char *p, b[64]; + int i, j; + + INIT_MMAP(); + + #ifdef EXTRA_SANITY + malloc_junk = 1; + #endif /* EXTRA_SANITY */ + + for (i = 0; i < 3; i++) { + if (i == 0) { + j = readlink("/etc/malloc.conf", b, sizeof b - 1); + if (j <= 0) + continue; + b[j] = '\0'; + p = b; + } else if (i == 1) { + p = getenv("MALLOC_OPTIONS"); + } else { + p = malloc_options; + } + for (; p && *p; p++) { + switch (*p) { + case '>': malloc_cache <<= 1; break; + case '<': malloc_cache >>= 1; break; + case 'a': malloc_abort = 0; break; + case 'A': malloc_abort = 1; break; + case 'h': malloc_hint = 0; break; + case 'H': malloc_hint = 1; break; + case 'r': malloc_realloc = 0; break; + case 'R': malloc_realloc = 1; break; + case 'j': malloc_junk = 0; break; + case 'J': malloc_junk = 1; break; + #ifdef HAS_UTRACE + case 'u': malloc_utrace = 0; break; + case 'U': malloc_utrace = 1; break; + #endif + case 'v': malloc_sysv = 0; break; + case 'V': malloc_sysv = 1; break; + case 'x': malloc_xmalloc = 0; break; + case 'X': malloc_xmalloc = 1; break; + case 'z': malloc_zero = 0; break; + case 'Z': malloc_zero = 1; break; + default: + j = malloc_abort; + malloc_abort = 0; + wrtwarning("unknown char in MALLOC_OPTIONS\n"); + malloc_abort = j; + break; + } + } + } + + UTRACE(0, 0, 0); + + /* + * We want junk in the entire allocation, and zero only in the part + * the user asked for. + */ + if (malloc_zero) + malloc_junk=1; + + /* + * If we run with junk (or implicitly from above: zero), we want to + * force realloc() to get new storage, so we can DTRT with it. + */ + if (malloc_junk) + malloc_realloc=1; + + /* Allocate one page for the page directory */ + page_dir = (struct pginfo **) MMAP(malloc_pagesize); + + if (page_dir == (struct pginfo **) -1) + wrterror("mmap(2) failed, check limits.\n"); + + /* + * We need a maximum of malloc_pageshift buckets, steal these from the + * front of the page_directory; + */ + malloc_origo = ((u_long)pageround((u_long)sbrk(0))) >> malloc_pageshift; + malloc_origo -= malloc_pageshift; + + malloc_ninfo = malloc_pagesize / sizeof *page_dir; + + /* Recalculate the cache size in bytes, and make sure it's nonzero */ + + if (!malloc_cache) + malloc_cache++; + + malloc_cache <<= malloc_pageshift; + + /* + * This is a nice hack from Kaleb Keithly (kaleb@x.org). + * We can sbrk(2) further back when we keep this on a low address. + */ + px = (struct pgfree *) imalloc (sizeof *px); + + /* Been here, done that */ + malloc_started++; + } + + /* + * Allocate a number of complete pages + */ + static void * + malloc_pages(size_t size) + { + void *p, *delay_free = 0; + int i; + struct pgfree *pf; + u_long index; + + size = pageround(size); + + p = 0; + + /* Look for free pages before asking for more */ + for(pf = free_list.next; pf; pf = pf->next) { + + #ifdef EXTRA_SANITY + if (pf->size & malloc_pagemask) + wrterror("(ES): junk length entry on free_list\n"); + if (!pf->size) + wrterror("(ES): zero length entry on free_list\n"); + if (pf->page == pf->end) + wrterror("(ES): zero entry on free_list\n"); + if (pf->page > pf->end) + wrterror("(ES): sick entry on free_list\n"); + if ((void*)pf->page >= (void*)sbrk(0)) + wrterror("(ES): entry on free_list past brk\n"); + if (page_dir[ptr2index(pf->page)] != MALLOC_FREE) + wrterror("(ES): non-free first page on free-list\n"); + if (page_dir[ptr2index(pf->end)-1] != MALLOC_FREE) + wrterror("(ES): non-free last page on free-list\n"); + #endif /* EXTRA_SANITY */ + + if (pf->size < size) + continue; + + if (pf->size == size) { + p = pf->page; + if (pf->next) + pf->next->prev = pf->prev; + pf->prev->next = pf->next; + delay_free = pf; + break; + } + + p = pf->page; + pf->page = (char *)pf->page + size; + pf->size -= size; + break; + } + + #ifdef EXTRA_SANITY + if (p && page_dir[ptr2index(p)] != MALLOC_FREE) + wrterror("(ES): allocated non-free page on free-list\n"); + #endif /* EXTRA_SANITY */ + + size >>= malloc_pageshift; + + /* Map new pages */ + if (!p) + p = map_pages(size); + + if (p) { + + index = ptr2index(p); + page_dir[index] = MALLOC_FIRST; + for (i=1;ibits[0] * + (((malloc_pagesize >> bits)+MALLOC_BITS-1) / MALLOC_BITS); + + /* Don't waste more than two chunks on this */ + if ((1<<(bits)) <= l+l) { + bp = (struct pginfo *)pp; + } else { + bp = (struct pginfo *)imalloc(l); + if (!bp) { + ifree(pp); + return 0; + } + } + + bp->size = (1<shift = bits; + bp->total = bp->free = malloc_pagesize >> bits; + bp->page = pp; + + /* set all valid bits in the bitmap */ + k = bp->total; + i = 0; + + /* Do a bunch at a time */ + for(;k-i >= MALLOC_BITS; i += MALLOC_BITS) + bp->bits[i / MALLOC_BITS] = ~0; + + for(; i < k; i++) + bp->bits[i/MALLOC_BITS] |= 1<<(i%MALLOC_BITS); + + if (bp == bp->page) { + /* Mark the ones we stole for ourselves */ + for(i=0;l > 0;i++) { + bp->bits[i/MALLOC_BITS] &= ~(1<<(i%MALLOC_BITS)); + bp->free--; + bp->total--; + l -= (1 << bits); + } + } + + /* MALLOC_LOCK */ + + page_dir[ptr2index(pp)] = bp; + + bp->next = page_dir[bits]; + page_dir[bits] = bp; + + /* MALLOC_UNLOCK */ + + return 1; + } + + /* + * Allocate a fragment + */ + static void * + malloc_bytes(size_t size) + { + int i,j; + u_int u; + struct pginfo *bp; + int k; + u_int *lp; + + /* Don't bother with anything less than this */ + if (size < malloc_minsize) + size = malloc_minsize; + + /* Find the right bucket */ + j = 1; + i = size-1; + while (i >>= 1) + j++; + + /* If it's empty, make a page more of that size chunks */ + if (!page_dir[j] && !malloc_make_chunks(j)) + return 0; + + bp = page_dir[j]; + + /* Find first word of bitmap which isn't empty */ + for (lp = bp->bits; !*lp; lp++) + ; + + /* Find that bit, and tweak it */ + u = 1; + k = 0; + while (!(*lp & u)) { + u += u; + k++; + } + *lp ^= u; + + /* If there are no more free, remove from free-list */ + if (!--bp->free) { + page_dir[j] = bp->next; + bp->next = 0; + } + + /* Adjust to the real offset of that chunk */ + k += (lp-bp->bits)*MALLOC_BITS; + k <<= bp->shift; + + if (malloc_junk) + memset((u_char*)bp->page + k, SOME_JUNK, bp->size); + + return (u_char *)bp->page + k; + } + + /* + * Allocate a piece of memory + */ + static void * + imalloc(size_t size) + { + void *result; + + if (suicide) + abort(); + + if ((size + malloc_pagesize) < size) /* Check for overflow */ + result = 0; + else if (size <= malloc_maxsize) + result = malloc_bytes(size); + else + result = malloc_pages(size); + + if (malloc_abort && !result) + wrterror("allocation failed.\n"); + + if (malloc_zero && result) + memset(result, 0, size); + + return result; + } + + /* + * Change the size of an allocation. + */ + static void * + irealloc(void *ptr, size_t size) + { + void *p; + u_long osize, index; + struct pginfo **mp; + int i; + + if (suicide) + abort(); + + index = ptr2index(ptr); + + if (index < malloc_pageshift) { + wrtwarning("junk pointer, too low to make sense.\n"); + return 0; + } + + if (index > last_index) { + wrtwarning("junk pointer, too high to make sense.\n"); + return 0; + } + + mp = &page_dir[index]; + + if (*mp == MALLOC_FIRST) { /* Page allocation */ + + /* Check the pointer */ + if ((u_long)ptr & malloc_pagemask) { + wrtwarning("modified (page-) pointer.\n"); + return 0; + } + + /* Find the size in bytes */ + for (osize = malloc_pagesize; *++mp == MALLOC_FOLLOW;) + osize += malloc_pagesize; + + if (!malloc_realloc && /* unless we have to, */ + size <= osize && /* .. or are too small, */ + size > (osize - malloc_pagesize)) { /* .. or can free a page, */ + return ptr; /* don't do anything. */ + } + + } else if (*mp >= MALLOC_MAGIC) { /* Chunk allocation */ + + /* Check the pointer for sane values */ + if (((u_long)ptr & ((*mp)->size-1))) { + wrtwarning("modified (chunk-) pointer.\n"); + return 0; + } + + /* Find the chunk index in the page */ + i = ((u_long)ptr & malloc_pagemask) >> (*mp)->shift; + + /* Verify that it isn't a free chunk already */ + if ((*mp)->bits[i/MALLOC_BITS] & (1<<(i%MALLOC_BITS))) { + wrtwarning("chunk is already free.\n"); + return 0; + } + + osize = (*mp)->size; + + if (!malloc_realloc && /* Unless we have to, */ + size < osize && /* ..or are too small, */ + (size > osize/2 || /* ..or could use a smaller size, */ + osize == malloc_minsize)) { /* ..(if there is one) */ + return ptr; /* ..Don't do anything */ + } + + } else { + wrtwarning("pointer to wrong page.\n"); + return 0; + } + + p = imalloc(size); + + if (p) { + /* copy the lesser of the two sizes, and free the old one */ + if (!size || !osize) + ; + else if (osize < size) + memcpy(p, ptr, osize); + else + memcpy(p, ptr, size); + ifree(ptr); + } + return p; + } + + /* + * Free a sequence of pages + */ + + static __inline__ void + free_pages(void *ptr, int index, struct pginfo *info) + { + int i; + struct pgfree *pf, *pt=0; + u_long l; + void *tail; + + if (info == MALLOC_FREE) { + wrtwarning("page is already free.\n"); + return; + } + + if (info != MALLOC_FIRST) { + wrtwarning("pointer to wrong page.\n"); + return; + } + + if ((u_long)ptr & malloc_pagemask) { + wrtwarning("modified (page-) pointer.\n"); + return; + } + + /* Count how many pages and mark them free at the same time */ + page_dir[index] = MALLOC_FREE; + for (i = 1; page_dir[index+i] == MALLOC_FOLLOW; i++) + page_dir[index + i] = MALLOC_FREE; + + l = i << malloc_pageshift; + + if (malloc_junk) + memset(ptr, SOME_JUNK, l); + + #ifdef MADV_FREE + if (malloc_hint) + madvise(ptr, l, MADV_FREE); + #endif + + tail = (char *)ptr+l; + + /* add to free-list */ + if (!px) + px = imalloc(sizeof *pt); /* This cannot fail... */ + px->page = ptr; + px->end = tail; + px->size = l; + if (!free_list.next) { + + /* Nothing on free list, put this at head */ + px->next = free_list.next; + px->prev = &free_list; + free_list.next = px; + pf = px; + px = 0; + + } else { + + /* Find the right spot, leave pf pointing to the modified entry. */ + tail = (char *)ptr+l; + + for(pf = free_list.next; pf->end < ptr && pf->next; pf = pf->next) + ; /* Race ahead here */ + + if (pf->page > tail) { + /* Insert before entry */ + px->next = pf; + px->prev = pf->prev; + pf->prev = px; + px->prev->next = px; + pf = px; + px = 0; + } else if (pf->end == ptr ) { + /* Append to the previous entry */ + pf->end = (char *)pf->end + l; + pf->size += l; + if (pf->next && pf->end == pf->next->page ) { + /* And collapse the next too. */ + pt = pf->next; + pf->end = pt->end; + pf->size += pt->size; + pf->next = pt->next; + if (pf->next) + pf->next->prev = pf; + } + } else if (pf->page == tail) { + /* Prepend to entry */ + pf->size += l; + pf->page = ptr; + } else if (!pf->next) { + /* Append at tail of chain */ + px->next = 0; + px->prev = pf; + pf->next = px; + pf = px; + px = 0; + } else { + wrterror("freelist is destroyed.\n"); + } + } + + /* Return something to OS ? */ + if (!pf->next && /* If we're the last one, */ + pf->size > malloc_cache && /* ..and the cache is full, */ + pf->end == malloc_brk && /* ..and none behind us, */ + malloc_brk == sbrk(0)) { /* ..and it's OK to do... */ + + /* + * Keep the cache intact. Notice that the '>' above guarantees that + * the pf will always have at least one page afterwards. + */ + pf->end = (char *)pf->page + malloc_cache; + pf->size = malloc_cache; + + brk(pf->end); + malloc_brk = pf->end; + + index = ptr2index(pf->end); + last_index = index - 1; + + for(i=index;i <= last_index;) + page_dir[i++] = MALLOC_NOT_MINE; + + /* XXX: We could realloc/shrink the pagedir here I guess. */ + } + if (pt) + ifree(pt); + } + + /* + * Free a chunk, and possibly the page it's on, if the page becomes empty. + */ + + static __inline__ void + free_bytes(void *ptr, int index, struct pginfo *info) + { + int i; + struct pginfo **mp; + void *vp; + + /* Find the chunk number on the page */ + i = ((u_long)ptr & malloc_pagemask) >> info->shift; + + if (((u_long)ptr & (info->size-1))) { + wrtwarning("modified (chunk-) pointer.\n"); + return; + } + + if (info->bits[i/MALLOC_BITS] & (1<<(i%MALLOC_BITS))) { + wrtwarning("chunk is already free.\n"); + return; + } + + if (malloc_junk) + memset(ptr, SOME_JUNK, info->size); + + info->bits[i/MALLOC_BITS] |= 1<<(i%MALLOC_BITS); + info->free++; + + mp = page_dir + info->shift; + + if (info->free == 1) { + + /* Page became non-full */ + + mp = page_dir + info->shift; + /* Insert in address order */ + while (*mp && (*mp)->next && (*mp)->next->page < info->page) + mp = &(*mp)->next; + info->next = *mp; + *mp = info; + return; + } + + if (info->free != info->total) + return; + + /* Find & remove this page in the queue */ + while (*mp != info) { + mp = &((*mp)->next); + #ifdef EXTRA_SANITY + if (!*mp) + wrterror("(ES): Not on queue\n"); + #endif /* EXTRA_SANITY */ + } + *mp = info->next; + + /* Free the page & the info structure if need be */ + page_dir[ptr2index(info->page)] = MALLOC_FIRST; + vp = info->page; /* Order is important ! */ + if(vp != (void*)info) + ifree(info); + ifree(vp); + } + + static void + ifree(void *ptr) + { + struct pginfo *info; + int index; + + /* This is legal */ + if (!ptr) + return; + + if (!malloc_started) { + wrtwarning("malloc() has never been called.\n"); + return; + } + + /* If we're already sinking, don't make matters any worse. */ + if (suicide) + return; + + index = ptr2index(ptr); + + if (index < malloc_pageshift) { + wrtwarning("junk pointer, too low to make sense.\n"); + return; + } + + if (index > last_index) { + wrtwarning("junk pointer, too high to make sense.\n"); + return; + } + + info = page_dir[index]; + + if (info < MALLOC_MAGIC) + free_pages(ptr, index, info); + else + free_bytes(ptr, index, info); + return; + } + + /* + * These are the public exported interface routines. + */ + + + void * + malloc(size_t size) + { + register void *r; + + malloc_func = " in malloc():"; + THREAD_LOCK(); + if (malloc_active++) { + wrtwarning("recursive call.\n"); + malloc_active--; + return (0); + } + if (!malloc_started) + malloc_init(); + if (malloc_sysv && !size) + r = 0; + else + r = imalloc(size); + UTRACE(0, size, r); + malloc_active--; + THREAD_UNLOCK(); + if (malloc_xmalloc && !r) + wrterror("out of memory.\n"); + return (r); + } + + void + free(void *ptr) + { + malloc_func = " in free():"; + THREAD_LOCK(); + if (malloc_active++) { + wrtwarning("recursive call.\n"); + malloc_active--; + return; + } + ifree(ptr); + UTRACE(ptr, 0, 0); + malloc_active--; + THREAD_UNLOCK(); + return; + } + + void * + realloc(void *ptr, size_t size) + { + register void *r; + + malloc_func = " in realloc():"; + THREAD_LOCK(); + if (malloc_active++) { + wrtwarning("recursive call.\n"); + malloc_active--; + return (0); + } + if (ptr && !malloc_started) { + wrtwarning("malloc() has never been called.\n"); + ptr = 0; + } + if (!malloc_started) + malloc_init(); + if (malloc_sysv && !size) { + ifree(ptr); + r = 0; + } else if (!ptr) { + r = imalloc(size); + } else { + r = irealloc(ptr, size); + } + UTRACE(ptr, size, r); + malloc_active--; + THREAD_UNLOCK(); + if (malloc_xmalloc && !r) + wrterror("out of memory.\n"); + return (r); + } + + void * + calloc(size_t num, size_t size) + { + register void *r; + + size *= num; + r = malloc(size); + if (r) + memset(r, 0, size); + return (r); + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/read.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/read.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/read.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_read(int d, void *buf, size_t nbytes) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + result = read(d, buf, nbytes); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/recv.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/recv.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/recv.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_recv(int s, void *buf, size_t len, int flags) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + result = recv(s, buf, len, flags); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/recvfrom.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/recvfrom.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/recvfrom.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,18 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_recvfrom(int s, void *buf, size_t len, int flags, + struct sockaddr *from, int *fromlen) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(buf); + MAKE_WRITABLE(from); + MAKE_WRITABLE(fromlen); + result = recvfrom(s, buf, len, flags, from, fromlen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/select.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/select.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/select.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,20 ---- + #include "wrap.h" + #include + #include + #include + + int + m3_select(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout) + { + int result; + + ENTER_CRITICAL; + MAKE_WRITABLE(readfds); + MAKE_WRITABLE(writefds); + MAKE_WRITABLE(exceptfds); + MAKE_READABLE(timeout); + result = select(nfds, readfds, writefds, exceptfds, timeout); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/send.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/send.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/send.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_send(int s, const void *msg, size_t len, int flags) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(msg); + result = send(s, msg, len, flags); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/sendto.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/sendto.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/sendto.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,17 ---- + #include "wrap.h" + #include + #include + + ssize_t + m3_sendto(int s, const void *msg, size_t len, int flags, + const struct sockaddr *to, int tolen) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(msg); + MAKE_READABLE(to); + result = sendto(s, msg, len, flags, to, tolen); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/shutdown.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/shutdown.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/shutdown.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + #include + + int + m3_shutdown(int s, int how) + { + int result; + + ENTER_CRITICAL; + result = shutdown(s, how); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/socket.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/socket.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/socket.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,14 ---- + #include "wrap.h" + #include + #include + + int + m3_socket(int domain, int type, int protocol) + { + int result; + + ENTER_CRITICAL; + result = socket(domain, type, protocol); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/socksconf.h diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/socksconf.h:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/socksconf.h Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,6 ---- + /* + * Define 0 or 1 of these, to select the variety of SOCKS support you want. + */ + #undef HPSOCKS + #undef SOCKS4 + #undef SOCKS5 Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/wrap.h diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/wrap.h:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/wrap.h Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,61 ---- + #include "socksconf.h" + + #if defined(HPSOCKS) /* { */ + #define accept Raccept + #define bind Rxbind + #define close Rclose + #define connect Rconnect + #define dup Rdup + #define dup2 Rdup2 + #define gethostbyaddr Rgethostbyaddr + #define gethostbyname Rgethostbyname + #define getpeername Rgetpeername + #define getsockname Rgetsockname + #define listen Rlisten + #define recv Rrecv + #define recvfrom Rrecvfrom + #define send Rsend + #define sendto Rsendto + #define shutdown Rshutdown + #define socket Rsocket + #elif defined(SOCKS4) /* } { */ + #define accept Raccept + #define bind Rbind + #define connect Rconnect + #define getpeername Rgetpeername + #define getsockname Rgetsockname + #define listen Rlisten + #define select Rselect + #elif defined(SOCKS5) /* } { */ + #define accept SOCKSaccept + #define bind SOCKSbind + #define close SOCKSclose + #define connect SOCKSconnect + #define dup SOCKSdup + #define dup2 SOCKSdup2 + #define fclose SOCKSfclose + #define gethostbyname SOCKSgethostbyname + #define getpeername SOCKSgetpeername + #define getsockname SOCKSgetsockname + #define listen SOCKSlisten + #define read SOCKSread + #define recv SOCKSrecv + #define recvfrom SOCKSrecvfrom + #define rresvport SOCKSrresvport + #define select SOCKSselect + #define send SOCKSsend + #define sendto SOCKSsendto + #define shutdown SOCKSshutdown + #define write SOCKSwrite + #endif /* } */ + + extern int RT0u__inCritical; + #define ENTER_CRITICAL RT0u__inCritical++ + #define EXIT_CRITICAL RT0u__inCritical-- + + static char RTHeapDepC__c; + #define MAKE_READABLE(x) \ + if ((int)x) { RTHeapDepC__c = *(char*)(x); } + + #define MAKE_WRITABLE(x) \ + if ((int)x) { *(char*)(x) = RTHeapDepC__c = *(char*)(x); } Index: m3/pm3/libs/m3core/src/runtime/FreeBSD3/write.c diff -c /dev/null m3/pm3/libs/m3core/src/runtime/FreeBSD3/write.c:1.1 *** /dev/null Mon Jun 7 17:09:11 1999 --- m3/pm3/libs/m3core/src/runtime/FreeBSD3/write.c Mon Jun 7 13:14:39 1999 *************** *** 0 **** --- 1,15 ---- + #include "wrap.h" + #include + #include + + size_t + m3_write(int fd, const void *buf, int nbytes) + { + int result; + + ENTER_CRITICAL; + MAKE_READABLE(buf); + result = write(fd, buf, nbytes); + EXIT_CRITICAL; + return result; + } Index: m3/pm3/libs/m3core/src/runtime/LINUXLIBC6/RTHeapDepC.c diff -c m3/pm3/libs/m3core/src/runtime/LINUXLIBC6/RTHeapDepC.c:1.6 m3/pm3/libs/m3core/src/runtime/LINUXLIBC6/RTHeapDepC.c:1.7 *** m3/pm3/libs/m3core/src/runtime/LINUXLIBC6/RTHeapDepC.c:1.6 Fri Jan 29 20:54:59 1999 --- m3/pm3/libs/m3core/src/runtime/LINUXLIBC6/RTHeapDepC.c Mon Jun 7 13:14:44 1999 *************** *** 104,115 **** #include #include #include - #include #include #include #include #include extern int RT0u__inCritical; #define ENTER_CRITICAL RT0u__inCritical++ #define EXIT_CRITICAL RT0u__inCritical-- --- 104,118 ---- #include #include #include #include #include #include #include + #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 + #include + #endif + extern int RT0u__inCritical; #define ENTER_CRITICAL RT0u__inCritical++ #define EXIT_CRITICAL RT0u__inCritical-- *************** *** 122,130 **** #define MAKE_WRITABLE(x) if (x) { *(char*)(x) = RTHeapDepC__c = *(char*)(x); } #define MAKE_WRITEABLE MAKE_WRITABLE ! /* glibc has no socketcall() */ #define socketcall(a,b) syscall(SYS_socketcall,a,b) /* Unless otherwise noted, all the following wrappers have the same structure. */ --- 125,152 ---- #define MAKE_WRITABLE(x) if (x) { *(char*)(x) = RTHeapDepC__c = *(char*)(x); } #define MAKE_WRITEABLE MAKE_WRITABLE ! /* glibc has no socketcall() nor __ipc() */ #define socketcall(a,b) syscall(SYS_socketcall,a,b) + #define __ipc(a,b,c,d,e) syscall(SYS_ipc,a,b,c,d,e) + #define SYS_SOCKET 1 + #define SYS_BIND 2 + #define SYS_CONNECT 3 + #define SYS_LISTEN 4 + #define SYS_ACCEPT 5 + #define SYS_GETSOCKNAME 6 + #define SYS_GETPEERNAME 7 + #define SYS_SOCKETPAIR 8 + #define SYS_SEND 9 + #define SYS_RECV 10 + #define SYS_SENDTO 11 + #define SYS_RECVFROM 12 + #define SYS_SHUTDOWN 13 + #define SYS_SETSOCKOPT 14 + #define SYS_GETSOCKOPT 15 + #define SYS_SENDMSG 16 + #define SYS_RECVMSG 17 + /* Unless otherwise noted, all the following wrappers have the same structure. */ *************** *** 140,146 **** args[0] = sockfd; args[1] = (unsigned long)peer; args[2] = (unsigned long)paddrlen; ! result = socketcall(SOCKOP_accept, args); EXIT_CRITICAL; return result; --- 162,168 ---- args[0] = sockfd; args[1] = (unsigned long)peer; args[2] = (unsigned long)paddrlen; ! result = socketcall(SYS_ACCEPT, args); EXIT_CRITICAL; return result; *************** *** 168,181 **** EXIT_CRITICAL; return result; } ! int adjtime(const struct timeval *delta, struct timeval *olddelta) { int result; ENTER_CRITICAL; MAKE_READABLE(delta); MAKE_WRITABLE(olddelta); ! result = __adjtime(delta, olddelta); EXIT_CRITICAL; return result; } --- 190,205 ---- EXIT_CRITICAL; return result; } + + int __real_adjtime(const struct timeval *delta, struct timeval *olddelta); ! int __wrap_adjtime(const struct timeval *delta, struct timeval *olddelta) { int result; ENTER_CRITICAL; MAKE_READABLE(delta); MAKE_WRITABLE(olddelta); ! result = __real_adjtime(delta, olddelta); EXIT_CRITICAL; return result; } *************** *** 269,275 **** args[0] = sockfd; args[1] = (unsigned long)myaddr; args[2] = addrlen; ! result = socketcall(SOCKOP_bind, args); EXIT_CRITICAL; return result; --- 293,299 ---- args[0] = sockfd; args[1] = (unsigned long)myaddr; args[2] = addrlen; ! result = socketcall(SYS_BIND, args); EXIT_CRITICAL; return result; *************** *** 359,365 **** args[0] = sockfd; args[1] = (unsigned long)saddr; args[2] = addrlen; ! result = socketcall(SOCKOP_connect, args); EXIT_CRITICAL; return result; --- 383,389 ---- args[0] = sockfd; args[1] = (unsigned long)saddr; args[2] = addrlen; ! result = socketcall(SYS_CONNECT, args); EXIT_CRITICAL; return result; *************** *** 482,503 **** ENTER_CRITICAL; MAKE_WRITABLE(dirp); ! result = __getdents(fd, dirp, count); EXIT_CRITICAL; return result; } ! int getdirentries(fd, buf, nbytes, basep) ! int fd; ! char *buf; ! size_t nbytes; ! long *basep; { int result; ENTER_CRITICAL; MAKE_WRITABLE(buf); MAKE_WRITABLE(basep); ! result = __getdirentries(fd, buf, nbytes, basep); EXIT_CRITICAL; return result; } --- 506,525 ---- ENTER_CRITICAL; MAKE_WRITABLE(dirp); ! result = syscall(SYS_getdents, fd, dirp, count); EXIT_CRITICAL; return result; } ! int __real_getdirentries(int fd, char *buf, size_t nbytes, long *basep); ! ! int __wrap_getdirentries(int fd, char *buf, size_t nbytes, long *basep) { int result; ENTER_CRITICAL; MAKE_WRITABLE(buf); MAKE_WRITABLE(basep); ! result = __real_getdirentries(fd, buf, nbytes, basep); EXIT_CRITICAL; return result; } *************** *** 580,586 **** args[0] = sockfd; args[1] = (unsigned long)addr; args[2] = (unsigned long)paddrlen; ! result = socketcall(SOCKOP_getpeername, args); EXIT_CRITICAL; return result; --- 602,608 ---- args[0] = sockfd; args[1] = (unsigned long)addr; args[2] = (unsigned long)paddrlen; ! result = socketcall(SYS_GETPEERNAME, args); EXIT_CRITICAL; return result; *************** *** 622,628 **** args[0] = sockfd; args[1] = (unsigned long)addr; args[2] = (unsigned long)paddrlen; ! result = socketcall(SOCKOP_getsockname, args); EXIT_CRITICAL; return result; --- 644,650 ---- args[0] = sockfd; args[1] = (unsigned long)addr; args[2] = (unsigned long)paddrlen; ! result = socketcall(SYS_GETSOCKNAME, args); EXIT_CRITICAL; return result; *************** *** 642,648 **** args[2]=optname; args[3]=(unsigned long)optval; args[4]=(unsigned long)optlen; ! result = (socketcall (SOCKOP_getsockopt, args)); EXIT_CRITICAL; return result; --- 664,670 ---- args[2]=optname; args[3]=(unsigned long)optval; args[4]=(unsigned long)optlen; ! result = (socketcall (SYS_GETSOCKOPT, args)); EXIT_CRITICAL; return result; *************** *** 793,807 **** return result; } - /* Taken from linux/ip.h, but normally only accessible to kernel */ - /* .. not anymore in glibc 2 */ - #ifndef __GLIBC__ - struct ipc_kludge { - struct msgbuf *msgp; - long msgtyp; - }; - #endif - #define SEMOP 1 #define SEMGET 2 #define SEMCTL 3 --- 815,820 ---- *************** *** 952,959 **** EXIT_CRITICAL; return result; } ! ssize_t readv(int d, const struct iovec *iov, int count) { int result; ENTER_CRITICAL; --- 965,974 ---- EXIT_CRITICAL; return result; } + + ssize_t __real_readv(int d, const struct iovec *iov, int count); ! ssize_t __wrap_readv(int d, const struct iovec *iov, int count) { int result; ENTER_CRITICAL; *************** *** 962,968 **** MAKE_WRITABLE(iov[i].iov_base); } } ! result = __readv(d, iov, count); /***************** result = syscall(SYS_readv, d, iov, count); *****************/ --- 977,983 ---- MAKE_WRITABLE(iov[i].iov_base); } } ! result = __real_readv(d, iov, count); /***************** result = syscall(SYS_readv, d, iov, count); *****************/ *************** *** 982,988 **** args[1] = (unsigned long) buffer; args[2] = len; args[3] = flags; ! result = (socketcall (SOCKOP_recv, args)); EXIT_CRITICAL; return result; --- 997,1003 ---- args[1] = (unsigned long) buffer; args[2] = len; args[3] = flags; ! result = (socketcall (SYS_RECV, args)); EXIT_CRITICAL; return result; *************** *** 1005,1011 **** args[3] = flags; args[4] = (unsigned long) to; args[5] = (unsigned long) tolen; ! result = (socketcall (SOCKOP_recvfrom, args)); EXIT_CRITICAL; return result; --- 1020,1026 ---- args[3] = flags; args[4] = (unsigned long) to; args[5] = (unsigned long) tolen; ! result = (socketcall (SYS_RECVFROM, args)); EXIT_CRITICAL; return result; *************** *** 1038,1044 **** args[0] = sockfd; args[1] = (unsigned long) msg; args[2] = flags; ! result = (socketcall (SOCKOP_recvmsg, args)); EXIT_CRITICAL; return result; --- 1053,1059 ---- args[0] = sockfd; args[1] = (unsigned long) msg; args[2] = flags; ! result = (socketcall (SYS_RECVMSG, args)); EXIT_CRITICAL; return result; *************** *** 1082,1092 **** return result; } int semctl(semid, semnum, cmd, arg) int semid, cmd; int semnum; union semun arg; ! { int result; ENTER_CRITICAL; switch (cmd) { --- 1097,1132 ---- return result; } + #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 + + union semun + { + int val; + struct semid_ds *buf; + unsigned short int *array; + struct seminfo *__buf; + }; + + int semctl(int semid, int semnum, int cmd, ...) + { + va_list ap; + union semun arg; + int result; + + va_start(ap,cmd); + arg = va_arg(ap,union semun); + va_end(ap); + + #else + int semctl(semid, semnum, cmd, arg) int semid, cmd; int semnum; union semun arg; ! { ! int result; ! ! #endif ENTER_CRITICAL; switch (cmd) { *************** *** 1138,1144 **** args[1] = (unsigned long) buffer; args[2] = len; args[3] = flags; ! result = (socketcall (SOCKOP_send, args)); EXIT_CRITICAL; return result; --- 1178,1184 ---- args[1] = (unsigned long) buffer; args[2] = len; args[3] = flags; ! result = (socketcall (SYS_SEND, args)); EXIT_CRITICAL; return result; *************** *** 1168,1174 **** args[0] = sockfd; args[1] = (unsigned long) msg; args[2] = flags; ! result = (socketcall (SOCKOP_sendmsg, args)); EXIT_CRITICAL; return result; --- 1208,1214 ---- args[0] = sockfd; args[1] = (unsigned long) msg; args[2] = flags; ! result = (socketcall (SYS_SENDMSG, args)); EXIT_CRITICAL; return result; *************** *** 1190,1196 **** args[3] = flags; args[4] = (unsigned long) to; args[5] = tolen; ! result = (socketcall (SOCKOP_sendto, args)); EXIT_CRITICAL; return result; --- 1230,1236 ---- args[3] = flags; args[4] = (unsigned long) to; args[5] = tolen; ! result = (socketcall (SYS_SENDTO, args)); EXIT_CRITICAL; return result; *************** *** 1287,1293 **** args[2]=optname; args[3]=(unsigned long)optval; args[4]=optlen; ! result = (socketcall (SOCKOP_setsockopt, args)); EXIT_CRITICAL; return result; --- 1327,1333 ---- args[2]=optname; args[3]=(unsigned long)optval; args[4]=optlen; ! result = (socketcall (SYS_SETSOCKOPT, args)); EXIT_CRITICAL; return result; *************** *** 1386,1392 **** args[1] = type; args[2] = protocol; args[3] = (unsigned long)sockvec; ! result = socketcall(SOCKOP_socketpair, args); EXIT_CRITICAL; return result; --- 1426,1432 ---- args[1] = type; args[2] = protocol; args[3] = (unsigned long)sockvec; ! result = socketcall(SYS_SOCKETPAIR, args); EXIT_CRITICAL; return result; *************** *** 1507,1541 **** return result; } ! int utimes(file, tvp) ! const char *file; ! struct timeval *tvp; { int result; ENTER_CRITICAL; MAKE_READABLE(file); MAKE_READABLE(tvp); ! result = __utimes(file, tvp); EXIT_CRITICAL; return result; } ! pid_t wait(status) ! union wait *status; { return wait3(status, 0, 0); } ! pid_t wait3(status, options, rusage) ! union wait *status; ! int options; ! struct rusage *rusage; { int result; ENTER_CRITICAL; MAKE_WRITABLE(status); MAKE_WRITABLE(rusage); ! result = __wait3(status, options, rusage); EXIT_CRITICAL; return result; } --- 1547,1579 ---- return result; } ! int __real_utimes(const char *file, struct timeval *tvp); ! ! int __wrap_utimes(const char *file, struct timeval *tvp) { int result; ENTER_CRITICAL; MAKE_READABLE(file); MAKE_READABLE(tvp); ! result = __real_utimes(file, tvp); EXIT_CRITICAL; return result; } ! pid_t wait(union wait *status) { return wait3(status, 0, 0); } ! pid_t __real_wait3(union wait *status, int options, struct rusage *rusage); ! ! pid_t __wrap_wait3(union wait *status, int options, struct rusage *rusage) { int result; ENTER_CRITICAL; MAKE_WRITABLE(status); MAKE_WRITABLE(rusage); ! result = __real_wait3(status, options, rusage); EXIT_CRITICAL; return result; } Index: m3/pm3/libs/m3core/src/time/POSIX/m3makefile diff -c m3/pm3/libs/m3core/src/time/POSIX/m3makefile:1.4 m3/pm3/libs/m3core/src/time/POSIX/m3makefile:1.5 *** m3/pm3/libs/m3core/src/time/POSIX/m3makefile:1.4 Tue Apr 28 16:27:12 1998 --- m3/pm3/libs/m3core/src/time/POSIX/m3makefile Mon Jun 7 13:14:52 1999 *************** *** 14,21 **** --- 14,23 ---- "ARM" : "DateBsd", "DS3100" : "DateBsd", "DS3100_OSF" : "DateBsd", + "FBSD_ALPHA" : "DateBsd", "FreeBSD" : "DateBsd", "FreeBSD2" : "DateBsd", + "FreeBSD3" : "DateBsd", "HP300" : "DateBsd", "HPPA" : "DateBsd", "IBMR2" : "DateBsd", Index: m3/pm3/libs/m3core/src/unix/m3makefile diff -c m3/pm3/libs/m3core/src/unix/m3makefile:1.3 m3/pm3/libs/m3core/src/unix/m3makefile:1.4 *** m3/pm3/libs/m3core/src/unix/m3makefile:1.3 Tue Apr 28 16:27:15 1998 --- m3/pm3/libs/m3core/src/unix/m3makefile Mon Jun 7 13:14:57 1999 *************** *** 18,25 **** --- 18,27 ---- "ARM" : [ "ultrix-3-1.generic", "ultrix-3-1.ARM" ], "DS3100" : [ "ultrix-3-1.generic", "ultrix-3-1.DS3100" ], "DS3100_OSF" : [ "osf-1.generic", "osf-1.DS3100" ], + "FBSD_ALPHA" : [ "fbsd-alpha" ], "FreeBSD" : [ "freebsd-1" ], "FreeBSD2" : [ "freebsd-2" ], + "FreeBSD3" : [ "freebsd-3" ], "HP300" : [ "hpux-7-0" ], "HPPA" : [ "hpux-7-0" ], "IBMR2" : [ "aix-3-2" ], Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/COPYRIGHT diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/COPYRIGHT:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/COPYRIGHT Mon Jun 7 13:15:01 1999 *************** *** 0 **** --- 1,93 ---- + + Digital License Agreement + + SRC Modula-3 + + 1. Grant Of License. Digital Equipment Corporation, having a principal + office at 146 Main Street, Maynard, MA 01754 ("DIGITAL") grants to + you ("LICENSEE") the non-exclusive, non-transferable, royalty free + right to use, modify, reproduce and distribute SRC Modula-3 ("SOFTWARE") + subject to the terms set forth herein. Any distribution of SOFTWARE + shall include this Digital License Agreement in human readable form. + + 2. Title to Intellectual Property and Software. Subject to the limited + rights and licenses granted under this License Agreement, all rights, + title and interests including patent, copyright, and trademark rights + in SOFTWARE are and shall remain vested in DIGITAL to the exclusion + of LICENSEE. DIGITAL represents and warrants that DIGITAL has the + legal right to grant such licenses as are expressly granted under + this Agreement. + + 3. Copyright. The SOFTWARE is owned by DIGITAL or its suppliers and is + protected by United States copyright laws and international treaty + provisions. Therefore, you must treat the SOFTWARE like any other + copyrighted material (e.g., a book or musical recording) except + that you may use the SOFTWARE as provided in this Digital License + Agreement. + + 4. Improvements. LICENSEE hereby grants to DIGITAL a non-exclusive, + non-transferable, royalty free right to use, modify, reproduce + and distribute with the right to sublicense at any tier, any + improvements, enhancements, extensions, or modifications that + LICENSEE make to SOFTWARE, provided such are returned to DIGITAL + by LICENSEE. + + 5. DISCLAIMER OF WARRANTY. Because the SOFTWARE is a research work and + not a released product, it is provided "AS IS" WITHOUT WARRANTY OF ANY + KIND AND WITHOUT ANY SUPPORT SERVICES. EXCEPT AS SPECIFICALLY PROVIDED + ABOVE IN SECTION 2, DIGITAL FURTHER DISCLAIMS ALL OTHER EXPRESS OR + IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS FOR A PARTICULAR + PURPOSE. THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF + THE SOFTWARE REMAINS WITH YOU. + + 6. Limitation of Liability. IN NO EVENT SHALL DIGITAL OR ITS SUPPLIERS BE + LIABLE IN AN AMOUNT THAT EXCEEDS THE LICENSE FEE PAID BY LICENSEE FOR + ANY DAMAGES (INCLUDING, WITH LIMITATION, DAMAGES FOR LOSS OF BUSINESS + PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER + PECUNIARY LOSS), REGARDLESS OF THE FORM OF CLAIM OR ACTIONS, ARISING + OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, + EVEN IF DIGITAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY + FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT + APPLY TO YOU. + + 7. Acknowledgement of Allocation of Risk. LICENSEE acknowledges and agrees + that the fees charged by DIGITAL in this Agreement reflect the allocation + of risks provided by the foregoing limitation of liability. LICENSEE + acknowledges and represents that it has read and understands these + allocations of risk limiting the liability of DIGITAL and that it + understands that a modification of the allocation of risks set forth + in this agreement would affect the fees charged by DIGITAL, and that + LICENSEE, in consideration of such fees, agrees to such allocations + of risk. + + 8. LICENSEE INDEMNIFICATION. LICENSEE SHALL INDEMNIFY DIGITAL AGAINST + ALL COSTS AND DAMAGE JUDGEMENTS, INCLUDING ATTORNEY'S FEES AND COSTS + OF DEFENSE, INCURRED BECAUSE OF CLAIMS OF DAMAGE ARISING FROM LICENSEE'S + POSSESSION OR USE OR INABILITY TO USE SOFTWARE. + + 9. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE and documentation are provided + with RESTRICTED RIGHTS. Use duplication, or disclosure by the Government + is subject restrictions as set forth in subparagraph (c)(1)(ii) of The + Rights in Technical Data and Computer Software clause in DFARS + 252.227-7013, or subparagraphs (c)(i) and (2) of the Commercial Computer + Software -- Restricted Rights at 48 CFR 52.227-19, as applicable. + Manufacturer is Digital Equipment Corporation, 130 Lytton Avenue, + Palo Alto, CA 94301-1044. + + 10. Severability. If any provision of the Agreement is held illegal or + unenforceable by any court of competent jurisdiction, such provision + shall be deemed separable from the remaining provisions of this Agreement + and shall not affect or impair the validity or enforceability of the + remaining provisions of this Agreement. + + 11. Governing Law. This Agreement is governed by the laws of the + Commonwealth of Massachusetts. + + 12. Publicity. You my not use the name of DIGITAL in any advertisement, + press release or other publicity with reference to SRC Modula-3 + without prior written consent of DIGITAL. + + 13. Should you have any questions concerning this Agreement, or if you + desire to contact Digital for any reason, please do so via E-mail: + M3-REQUEST@SRC.DEC.COM. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Udir.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Udir.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Udir.i3 Mon Jun 7 13:15:01 1999 *************** *** 0 **** --- 1,78 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Thu Feb 23 13:39:23 PST 1995 by kalsow *) + (* modified on Sat Feb 18 23:43:23 MET 1995 by ow *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Mon Apr 13 10:04:46 PDT 1992 by muller *) + (* modified on Mon Jul 2 13:25:12 PDT 1990 by mjordan *) + + UNSAFE INTERFACE Udir; + + (*** ***) + + IMPORT Ctypes, Utypes; + + CONST + MAXNAMLEN = 255; (* maximum length of component of file path name *) + MAXPATHLEN = 1024; (* maximum length of file path name *) + + (* file types *) + DT_UNKNOWN = 0; + DT_FIFO = 1; + DT_CHR = 2; + DT_DIR = 4; + DT_BLK = 6; + DT_REG = 8; + DT_LNK = 10; + DT_SOCK = 12; + + (* + * The dirent structure defines the format of directory entries returned by + * the getdirentries(2) system call. + * + * A directory entry has a struct dirent at the front of it, containing its + * inode number, the length of the entry, and the length of the name + * contained in the entry. These are followed by the name padded to a 4 + * byte boundary with null bytes. All names are guaranteed null terminated. + * The maximum length of a name in a directory is MAXNAMLEN. + *) + TYPE + dirent = RECORD (* describes directory entry *) + d_fileno: Utypes.u_int32_t; (* inode number of entry *) + d_reclen: Utypes.u_int16_t; (* record length in bytes *) + d_type: Utypes.u_int8_t; (* file types, see above *) + d_namelen: Utypes.u_int8_t; (* name length in bytes *) + d_name: ARRAY [0..MAXNAMLEN] OF Ctypes.char; (* name *) + END; + + direct = dirent; (* backwards compatibility *) + + DIR = RECORD + dd_fd: Ctypes.int; (* file descriptor associated with directory *) + dd_loc: Ctypes.long; (* offset in current buffer *) + dd_size: Ctypes.long; (* amount of data returned by getdirentries *) + dd_buf: Ctypes.char_star; (* data buffer *) + dd_len: Ctypes.int; (* size of data buffer *) + dd_seek: Ctypes.long (* magic cookie returned by getdirentries *); + dd_rewind: Ctypes.long; (* magic cookie for rewinding *) + dd_flags: Ctypes.int; (* flags for readdir *) + END; + + DIR_star = UNTRACED REF DIR; + + direct_star = UNTRACED REF direct; + + <*EXTERNAL*> PROCEDURE opendir (filename: Ctypes.char_star): DIR_star; + <*EXTERNAL*> PROCEDURE readdir (dirp: DIR_star): direct_star; + <*EXTERNAL*> PROCEDURE telldir (dirp: DIR_star): Ctypes.long; + <*EXTERNAL*> PROCEDURE seekdir (dirp: DIR_star; loc: Ctypes.long); + <*EXTERNAL*> PROCEDURE rewinddir (dirp: DIR_star); + <*EXTERNAL*> PROCEDURE closedir(dirp: DIR_star): Ctypes.int; + <*EXTERNAL*> PROCEDURE getdirentries(fd : Ctypes.int; + buf : UNTRACED REF Ctypes.char; + nbytes : Ctypes.int; + basep : UNTRACED REF Ctypes.long): Ctypes.int; + + END Udir. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uerror.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uerror.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uerror.i3 Mon Jun 7 13:15:01 1999 *************** *** 0 **** --- 1,139 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Sat Jan 7 14:21:51 PST 1995 by kalsow *) + (* modified on Thu Nov 22 05:20:45 1990 by muller *) + (* ow 02.10.1994 *) + + INTERFACE Uerror; + + FROM Ctypes IMPORT int, char_star; + + (*** ***) + + CONST + EPERM = 1; (* Not owner *) + ENOENT = 2; (* No such file or directory *) + ESRCH = 3; (* No such process *) + EINTR = 4; (* Interrupted system call *) + EIO = 5; (* I/O error *) + ENXIO = 6; (* No such device or address *) + E2BIG = 7; (* Arg list too long *) + ENOEXEC = 8; (* Exec format error *) + EBADF = 9; (* Bad file number *) + ECHILD = 10; (* No children *) + EDEADLK = 11; (* Resource deadlock avoided *) + ENOMEM = 12; (* Not enough core *) + EACCES = 13; (* Permission denied *) + EFAULT = 14; (* Bad address *) + ENOTBLK = 15; (* Block device required *) + EBUSY = 16; (* Mount device busy *) + EEXIST = 17; (* File exists *) + EXDEV = 18; (* Cross-device link *) + ENODEV = 19; (* No such device *) + ENOTDIR = 20; (* Not a directory*) + EISDIR = 21; (* Is a directory *) + EINVAL = 22; (* Invalid argument *) + ENFILE = 23; (* File table overflow *) + EMFILE = 24; (* Too many open files *) + ENOTTY = 25; (* Not a typewriter *) + ETXTBSY = 26; (* Text file busy *) + EFBIG = 27; (* File too large *) + ENOSPC = 28; (* No space left on device *) + ESPIPE = 29; (* Illegal seek *) + EROFS = 30; (* Read-only file system *) + EMLINK = 31; (* Too many links *) + EPIPE = 32; (* Broken pipe *) + + (* math software *) + EDOM = 33; (* Argument too large *) + ERANGE = 34; (* Result too large *) + + (* non-blocking and interrupt i/o *) + EAGAIN = 35; (* Resource temporarily unavailable *) + EWOULDBLOCK = EAGAIN; (* Operation would block *) + EINPROGRESS = 36; (* Operation now in progress *) + EALREADY = 37; (* Operation already in progress *) + + (* ipc/network software *) + (* argument errors *) + ENOTSOCK = 38; (* Socket operation on non-socket *) + EDESTADDRREQ = 39; (* Destination address required *) + EMSGSIZE = 40; (* Message too long *) + EPROTOTYPE = 41; (* Protocol wrong type for socket *) + ENOPROTOOPT = 42; (* Protocol not available *) + EPROTONOSUPPORT = 43; (* Protocol not supported *) + ESOCKTNOSUPPORT = 44; (* Socket type not supported *) + EOPNOTSUPP = 45; (* Operation not supported on socket *) + EPFNOSUPPORT = 46; (* Protocol family not supported *) + EAFNOSUPPORT = 47; (* Address family not supported by protocol family *) + EADDRINUSE = 48; (* Address already in use *) + EADDRNOTAVAIL = 49; (* Can't assign requested address *) + + (* operational errors *) + ENETDOWN = 50; (* Network is down *) + ENETUNREACH = 51; (* Network is unreachable *) + ENETRESET = 52; (* Network dropped connection on reset *) + ECONNABORTED = 53; (* Software caused connection abort *) + ECONNRESET = 54; (* Connection reset by peer *) + ENOBUFS = 55; (* No buffer space available *) + EISCONN = 56; (* Socket is already connected *) + ENOTCONN = 57; (* Socket is not connected *) + ESHUTDOWN = 58; (* Can't send after socket shutdown *) + ETOOMANYREFS = 59; (* Too many references: can't splice *) + ETIMEDOUT = 60; (* Connection timed out *) + ECONNREFUSED = 61; (* Connection refused *) + + (* *) + ELOOP = 62; (* Too many levels of symbolic links *) + ENAMETOOLONG = 63; (* File name too long *) + + (* should be rearranged *) + EHOSTDOWN = 64; (* Host is down *) + EHOSTUNREACH = 65; (* No route to host *) + ENOTEMPTY = 66; (* Directory not empty *) + + (* quotas & mush *) + EPROCLIM = 67; (* Too many processes *) + EUSERS = 68; (* Too many users *) + EDQUOT = 69; (* Disc quota exceeded *) + + (* NFS error codes *) + ESTALE = 70; + EREMOTE = 71; + EBADRPC = 72; + ERPCMISMATCH = 73; + EPROGUNAVAIL = 74; (* RPC prog. not avail *) + EPROGMISMATCH = 75; (* Program version wrong *) + EPROCUNAVAIL = 76; (* Bad procedure for program *) + + (* POSIX errnos *) + ENOLCK = 77; (* No locks available *) + ENOSYS = 78; (* Function not implemented *) + + EFTYPE = 79; (* Inappropriate file type or format *) + EAUTH = 80; (* Authentication error *) + ENEEDAUTH = 81; (* Need authenticator *) + ELAST = 81; (* Must be equal to the largest errno *) + + <*EXTERNAL*> + VAR + errno: int; + + + (* Extension by mjordan *) + CONST + Max = ELAST; (* should be exported from Uerror *) + + <*EXTERNAL*> VAR + sys_nerr: int; + sys_errlist: ARRAY [0..Max] OF char_star; + + PROCEDURE GetFrom_sys_errlist(n: INTEGER): char_star RAISES {}; + (* returns entry 'n' of the 'sys_errlist' array; a checked runtime error + unless 0 <= n <= sys_nerr. Its safer and more portable to use this + procedure than to access the array directly. + *) + + END Uerror. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uerror.m3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uerror.m3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uerror.m3 Mon Jun 7 13:15:01 1999 *************** *** 0 **** --- 1,20 ---- + (* Copyright (C) 1990, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Mon Mar 09 19:04:37 PST 1992 by muller *) + (* modified on Mon Nov 19 23:46:25 1990 by mjordan *) + + UNSAFE MODULE Uerror; + + IMPORT Ctypes; + + PROCEDURE GetFrom_sys_errlist(n: INTEGER): Ctypes.char_star RAISES {}= + BEGIN + <* ASSERT 0 <= n AND n <= Max *> + RETURN sys_errlist[n] + END GetFrom_sys_errlist; + + BEGIN + END Uerror. + Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uexec.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uexec.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uexec.i3 Mon Jun 7 13:15:01 1999 *************** *** 0 **** --- 1,97 ---- + (* Copyright (C) 1990, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Tue Mar 24 20:01:29 PST 1992 by muller *) + (* modified on Mon Jul 9 16:47:46 PDT 1990 by mjordan *) + + UNSAFE INTERFACE Uexec; + + IMPORT Ctypes, Utypes, Uresource; + + (* Some of the Unix library process control calls. This is not a complete + interface, and should be added to as needed *) + + (* Remember that any of the calls which may return an error code in + 'Uerror.errno' should be serialized by use of 'UnixMutex.errno'. *) + + <*EXTERNAL*> + PROCEDURE execv( + name: Ctypes.char_star; + argv: Ctypes.char_star_star) + : Ctypes.int + RAISES {}; + + <*EXTERNAL*> + PROCEDURE execvp( + name: Ctypes.char_star; + argv: Ctypes.char_star_star) + : Ctypes.int + RAISES {}; + + <*EXTERNAL*> + PROCEDURE exect( + name: Ctypes.char_star; + argv: Ctypes.char_star_star; + envp: Ctypes.char_star_star) + : Ctypes.int + RAISES {}; + + (* options bits for the second argument of wait3. *) + CONST + WNOHANG = 1; (* dont hang in wait *) + WUNTRACED = 2; (* tell about stopped, untraced children *) + + TYPE + w_A = Ctypes.unsigned_int; + + (* terminated process status *) + w_T = RECORD + w_Termsig : BITS 7 FOR [0..16_7F]; (* termination signal *) + w_Coredump: BITS 1 FOR [0..16_01]; (* core dump indicator *) + w_Retcode : BITS 8 FOR [0..16_FF]; (* exit code if w_termsig == 0 *) + w_Filler : BITS 16 FOR [0..16_FFFF]; END; + + (* M3 view of return code *) + w_M3 = RECORD + w_Retcode : BITS 8 FOR [0..16_FF]; (* exit code if w_termsig == 0 *) + w_Termsig : BITS 7 FOR [0..16_7F]; (* termination signal *) + w_Coredump: BITS 1 FOR [0..16_01]; (* core dump indicator *) + w_Filler : BITS 16 FOR [0..16_FFFF]; END; + + (* stopped process status *) + w_S = RECORD + w_Stopval : BITS 8 FOR [0..16_FF]; (* == W_STOPPED if stopped *) + w_Stopsig : BITS 8 FOR [0..16_FF]; (* signal that stopped us *) + w_Filler : BITS 16 FOR [0..16_FFFF]; END; + + (* union wait is a union of the three types above. We will use w_A + in the declarations and do a LOOPHOLE when necessary *) + w_A_star = UNTRACED REF w_A; + + (* Wait queues (needed for Umsg.i3) *) + wait_queue = RECORD + task : Ctypes.void_star; (* : task_struct; see below *) + next : UNTRACED REF wait_queue; + END; + (* task_struct - use Ctypes.void_star because task_struct + should never be touched and is very very hard to emulate in Modula-3 + *) + + wait_queue_star = UNTRACED REF wait_queue; + + (*** wait, wait3, waitpid - wait for process to terminate ***) + + <*EXTERNAL*> + PROCEDURE wait (status: w_A_star): Utypes.pid_t; + + <*EXTERNAL*> + PROCEDURE wait3 (status: w_A_star; options: Ctypes.int; + rusage: Uresource.struct_rusage_star): Utypes.pid_t; + + <*EXTERNAL*> + PROCEDURE waitpid (pid: Utypes.pid_t; status: w_A_star; + options: Ctypes.int): Utypes.pid_t; + + END Uexec. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Ugrp.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Ugrp.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Ugrp.i3 Mon Jun 7 13:15:01 1999 *************** *** 0 **** --- 1,38 ---- + (* Copyright (C) 1994, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Wed Aug 17 14:25:29 PDT 1994 by kalsow *) + (* *) + (* Originally submitted on Fri, 22 Jul 1994 16:42:53 GMT *) + (* by jredford@lehman.com (John Redford) *) + + INTERFACE Ugrp; + + FROM Ctypes IMPORT char_star,char_star_star; + FROM Utypes IMPORT gid_t; + + (*** ***) + + TYPE + struct_group = RECORD + gr_name: char_star; + gr_passwd: char_star; + gr_gid: gid_t; + gr_mem: char_star_star; + END; + + struct_group_star = UNTRACED REF struct_group; + + (*** getgrent, getgrgid, getgrnam, setgrent, endgrent + - get group file entry ***) + + <*EXTERNAL*> PROCEDURE getgrent(): struct_group_star; + <*EXTERNAL*> PROCEDURE getgrgid(gid: gid_t): struct_group_star; + <*EXTERNAL*> PROCEDURE getgrnam(name: char_star): struct_group_star; + <*EXTERNAL*> PROCEDURE setgrent(); + <*EXTERNAL*> PROCEDURE endgrent(); + + END Ugrp. + + Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uin.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uin.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uin.i3 Mon Jun 7 13:15:01 1999 *************** *** 0 **** --- 1,152 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Sat Jul 11 18:04:22 PDT 1992 by muller *) + (* modified on Tue Feb 11 22:04:30 PST 1992 by nichols@parc.xerox.com *) + + + INTERFACE Uin; + + FROM Ctypes IMPORT char; + FROM Utypes IMPORT u_int8_t, u_int16_t, in_addr_t, in_port_t; + IMPORT Word; + + (* Constants and structures defined by the internet system, + Per RFC 790, September 1981. *) + + CONST + IPPROTO_IP = 0; (* dummy for IP *) + IPPROTO_ICMP = 1; (* control message protocol *) + IPPROTO_IGMP = 2; (* group control protocol *) + IPPROTO_GGP = 3; (* gateway^2 (deprecated) *) + IPPROTO_TCP = 6; (* tcp *) + IPPROTO_EGP = 8; (* exterior gateway protocol *) + IPPROTO_PUP = 12; (* pup *) + IPPROTO_UDP = 17; (* user datagram protocol *) + IPPROTO_IDP = 22; (* xns idp *) + IPPROTO_TP = 29; (* tp-4 w/ class negotiation *) + IPPROTO_RSVP = 46; (* resource reservation *) + IPPROTO_EON = 80; (* ISO cnlp *) + IPPROTO_ENCAP = 98; (* encapsulation header *) + + IPPROTO_DIVERT = 254; (* divert pseudo-protocol *) + IPPROTO_RAW = 255; (* raw IP packet *) + IPPROTO_MAX = 256; + + (* Port/socket numbers: network standard functions *) + IPPORT_ECHO = 7; + IPPORT_DISCARD = 9; + IPPORT_SYSTAT = 11; + IPPORT_DAYTIME = 13; + IPPORT_NETSTAT = 15; + IPPORT_FTP = 21; + IPPORT_TELNET = 23; + IPPORT_SMTP = 25; + IPPORT_TIMESERVER = 37; + IPPORT_NAMESERVER = 42; + IPPORT_WHOIS = 43; + IPPORT_MTP = 57; + + (* Port/socket numbers: host specific functions *) + IPPORT_TFTP = 69; + IPPORT_RJE = 77; + IPPORT_FINGER = 79; + IPPORT_TTYLINK = 87; + IPPORT_SUPDUP = 95; + + (* UNIX TCP sockets *) + IPPORT_EXECSERVER = 512; + IPPORT_LOGINSERVER = 513; + IPPORT_CMDSERVER = 514; + IPPORT_EFSSERVER = 520; + + (* UNIX UDP sockets *) + IPPORT_BIFFUDP = 512; + IPPORT_WHOSERVER = 513; + IPPORT_ROUTESERVER = 520; (* 520+1 also used *) + + (* Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root). + Ports > IPPORT_USERRESERVED are reserved for servers, not necessarily + privileged. *) + IPPORT_RESERVED = 1024; + IPPORT_USERRESERVED = 5000; + + (* Link numbers *) + IMPLINK_IP = 155; + IMPLINK_LOWEXPER = 156; + IMPLINK_HIGHEXPER = 158; + + + TYPE + struct_in_addr = RECORD + s_addr: in_addr_t; END; + struct_in_addr_b = RECORD + s_b1, s_b2, s_b3, s_b4: u_int8_t; END; + struct_in_addr_w = RECORD + s_w1, s_w2: u_int16_t; END; + + + (* Definitions of bits in internet address integers. + On subnets, the decomposition of addresses to host and net parts + is done according to subnet mask, not the masks here. *) + PROCEDURE IN_CLASSA(i: INTEGER): BOOLEAN; + CONST + (* Compiler bug/feature forces us to use Word.Shift *) + IN_CLASSA_NET: in_addr_t = Word.Shift(16_ff0000, 8); + IN_CLASSA_NSHIFT = 24; + IN_CLASSA_HOST = 16_00ffffff; + IN_CLASSA_MAX = 128; + + PROCEDURE IN_CLASSB(i: INTEGER): BOOLEAN; + CONST + IN_CLASSB_NET: in_addr_t = Word.Shift(16_ffff00, 8); + IN_CLASSB_NSHIFT = 16; + IN_CLASSB_HOST = 16_0000ffff; + IN_CLASSB_MAX = 65536; + + PROCEDURE IN_CLASSC(i: INTEGER): BOOLEAN; + CONST + IN_CLASSC_NET: in_addr_t = Word.Shift(16_ffffff, 8); + IN_CLASSC_NSHIFT = 8; + IN_CLASSC_HOST = 16_000000ff; + + PROCEDURE IN_CLASSD(i: INTEGER): BOOLEAN; + PROCEDURE IN_MULTICAST(i: INTEGER): BOOLEAN; + + PROCEDURE IN_EXPERIMENTAL(i: INTEGER): BOOLEAN; + PROCEDURE IN_BADCLASS(i: INTEGER): BOOLEAN; + + CONST + INADDR_ANY: in_addr_t = 16_00000000; + INADDR_LOOPBACK: in_addr_t = 16_7F000001; + INADDR_BROADCAST: in_addr_t = Word.Shift(16_ffffff, 8) + 16_ff; + (* must be masked *) + + IN_LOOPBACKNET = 127; (* official! *) + + (* Stuff the loopback address into an Internet address. *) + PROCEDURE IN_SET_LOOPBACK_ADDR(a: struct_sockaddr_in_star); + + (* Socket address, internet style. *) + TYPE + struct_sockaddr_in = RECORD + sin_len: u_int8_t; + sin_family: u_int8_t; + sin_port: in_port_t; + sin_addr: struct_in_addr; + sin_zero: ARRAY [0..7] OF char; + END; + struct_sockaddr_in_star = UNTRACED REF struct_sockaddr_in; + + (* Options for use with [gs]etsockopt at the IP level. *) + CONST + IP_OPTIONS = 1; (* set/get IP per-packet options *) + + (* Procedures for number representation conversion. *) + PROCEDURE ntohl(x: in_addr_t): in_addr_t; + PROCEDURE ntohs(x: in_port_t): in_port_t; + PROCEDURE htonl(x: in_addr_t): in_addr_t; + PROCEDURE htons(x: in_port_t): in_port_t; + + END Uin. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uin.m3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uin.m3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uin.m3 Mon Jun 7 13:15:01 1999 *************** *** 0 **** --- 1,95 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Sat Jan 7 14:33:32 PST 1995 by kalsow *) + (* modified on Tue Mar 24 21:10:33 PST 1992 by muller *) + (* modified on Tue Feb 11 22:04:30 PST 1992 by nichols@parc.xerox.com *) + + (* Little-endian version. *) + + UNSAFE MODULE Uin EXPORTS Uin; + (* Only unsafe because it needs Usocket.AF_INET and Usocket is unsafe. *) + + FROM Utypes IMPORT u_char, in_addr_t, in_port_t; + IMPORT Usocket, Word; + + PROCEDURE IN_CLASSA(i: INTEGER): BOOLEAN = + BEGIN + RETURN Word.And(i, Word.Shift(16_800000, 8)) = 0; + END IN_CLASSA; + + PROCEDURE IN_CLASSB(i: INTEGER): BOOLEAN = + BEGIN + RETURN Word.And(i, Word.Shift(16_c00000, 8)) = Word.Shift(16_800000, 8); + END IN_CLASSB; + + PROCEDURE IN_CLASSC(i: INTEGER): BOOLEAN = + BEGIN + RETURN Word.And(i, Word.Shift(16_e00000, 8)) = Word.Shift(16_c00000, 8); + END IN_CLASSC; + + PROCEDURE IN_CLASSD(i: INTEGER): BOOLEAN = + BEGIN + RETURN Word.And(i, Word.Shift(16_f00000, 8)) = Word.Shift(16_e00000, 8); + END IN_CLASSD; + + PROCEDURE IN_MULTICAST(i: INTEGER): BOOLEAN = + BEGIN + RETURN IN_CLASSD(i); + END IN_MULTICAST; + + PROCEDURE IN_EXPERIMENTAL(i: INTEGER): BOOLEAN = + BEGIN + RETURN Word.And(i, Word.Shift(16_e00000, 8)) = Word.Shift(16_e00000, 8); + END IN_EXPERIMENTAL; + + PROCEDURE IN_BADCLASS(i: INTEGER): BOOLEAN = + BEGIN + RETURN Word.And(i, Word.Shift(16_f00000, 8)) = Word.Shift(16_f00000, 8); + END IN_BADCLASS; + + PROCEDURE IN_SET_LOOPBACK_ADDR(a: struct_sockaddr_in_star) = + BEGIN + a.sin_addr.s_addr := htonl(INADDR_LOOPBACK); + a.sin_family := Usocket.AF_INET; + END IN_SET_LOOPBACK_ADDR; + + TYPE + A = RECORD a, b, c, d: u_char; END; + B = RECORD d, c, b, a: u_char; END; + + C = RECORD a, b: u_char; END; + D = RECORD b, a: u_char; END; + + + PROCEDURE ntohl(x: in_addr_t): in_addr_t = + BEGIN + RETURN LOOPHOLE (B { a := LOOPHOLE (x, A).a, + b := LOOPHOLE (x, A).b, + c := LOOPHOLE (x, A).c, + d := LOOPHOLE (x, A).d}, in_addr_t); + END ntohl; + + PROCEDURE ntohs(x: in_port_t): in_port_t = + BEGIN + RETURN LOOPHOLE (D { a := LOOPHOLE (x, C).a, + b := LOOPHOLE (x, C).b}, in_port_t); + END ntohs; + + PROCEDURE htonl(x: in_addr_t): in_addr_t = + BEGIN + RETURN LOOPHOLE (A { a := LOOPHOLE (x, B).a, + b := LOOPHOLE (x, B).b, + c := LOOPHOLE (x, B).c, + d := LOOPHOLE (x, B).d}, in_addr_t); + END htonl; + + PROCEDURE htons(x: in_port_t): in_port_t = + BEGIN + RETURN LOOPHOLE (C { a := LOOPHOLE (x, D).a, + b := LOOPHOLE (x, D).b}, in_port_t); + END htons; + + BEGIN + END Uin. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uipc.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uipc.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uipc.i3 Mon Jun 7 13:15:01 1999 *************** *** 0 **** --- 1,43 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Sat Mar 17 07:02:31 1990 by muller *) + + INTERFACE Uipc; + + FROM Ctypes IMPORT unsigned_short, long, int; + + (*** ***) + + TYPE + struct_ipc_perm = RECORD + key: int; (* key *) + uid: unsigned_short; (* owner's user id *) + gid: unsigned_short; (* owner's group id *) + cuid: unsigned_short; (* creator's user id *) + cgid: unsigned_short; (* creator's group id *) + mode: unsigned_short; (* access modes *) + seq: unsigned_short; (* slot usage sequence number *) + END; + + + (* Common IPC Definitions. *) + CONST + (* Mode bits. *) + IPC_ALLOC = 8_0100000; (* entry currently allocated *) + IPC_CREAT = 8_0001000; (* create entry if key doesn't exist *) + IPC_EXCL = 8_0002000; (* fail if key exists *) + IPC_NOWAIT = 8_0004000; (* error if request must wait *) + + (* Keys. *) + IPC_PRIVATE : long = 0; (* private key *) + + (* Control Commands. *) + IPC_RMID = 0; (* remove identifier *) + IPC_SET = 1; (* set options *) + IPC_STAT = 2; (* get options *) + + + END Uipc. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Umman.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Umman.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Umman.i3 Mon Jun 7 13:15:01 1999 *************** *** 0 **** --- 1,53 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Fri Apr 30 14:41:23 PDT 1993 by muller *) + (* ow Sat Oct 29 14:10:19 MET 1994 adapted for FreeBSD *) + INTERFACE Umman; + + FROM Ctypes IMPORT int; + FROM Utypes IMPORT caddr_t, size_t, off_t; + + (*** sys/mman.h ***) + + CONST + PROT_NONE = 16_0000; + PROT_READ = 16_0001; + PROT_WRITE = 16_0002; + PROT_EXEC = 16_0004; + + MAP_FILE = 16_0000; + MAP_ANON = 16_1000; + + MAP_PRIVATE = 16_0002; + MAP_SHARED = 16_0001; + MAP_COPY = 16_0004; + + MAP_FIXED = 16_0010; + MAP_RENAME = 16_0020; + MAP_NORESERVE = 16_0040; + MAP_INHERIT = 16_0080; + MAP_NOEXTEND = 16_0100; + MAP_HASSEMAPHORE = 16_0200; + + MADV_NORMAL = 0; + MADV_RANDOM = 1; + MADV_SEQUENTIAL = 2; + MADV_WILLNEED = 3; + MADV_DONTNEED = 4; + + <*EXTERNAL*> + PROCEDURE mmap (addr: caddr_t; len: size_t; prot,flags,fd: int; off: off_t) + : caddr_t; + + <*EXTERNAL*> + PROCEDURE munmap (addr: caddr_t; len: size_t): int; + + <*EXTERNAL*> + PROCEDURE mprotect (addr: caddr_t; len: size_t; prot:int): int; + + <*EXTERNAL*> + PROCEDURE msync (addr: caddr_t; len: size_t): int; + + END Umman. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Umsg.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Umsg.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Umsg.i3 Mon Jun 7 13:15:01 1999 *************** *** 0 **** --- 1,125 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Fri Apr 30 14:41:53 PDT 1993 by muller *) + + UNSAFE INTERFACE Umsg; + + FROM Ctypes IMPORT char, char_star, short, unsigned_short, long, int; + FROM Utypes IMPORT time_t; + FROM Uipc IMPORT struct_ipc_perm; + FROM Uexec IMPORT wait_queue_star; + + (*** ***) + + (* IPC Message Facility. *) + + CONST + + PZERO = 25; (* I got this value from param.h; em *) + PMSG = (PZERO + 2); (* message facility sleep priority *) + + (* Permission Definitions. *) + + MSG_R = 8_0400; (* read permission *) + MSG_W = 8_0200; (* write permission *) + + (* ipc_perm Mode Definitions. *) + + MSG_RWAIT = 8_01000; (* a reader is waiting for a message *) + MSG_WWAIT = 8_02000; (* a writer is waiting to send *) + MSG_LCK = 8_010000; (* message queue locked *) + MSG_WANT = 8_020000; (* lock wanted *) + + + (* + * The following lock routines are required for message queues because + * in the middle of list manipulation, copyin()/copyout() are called. + * An implicit side effect of copyin/copyout are possible page faults on the + * user buffers being accessed. Page faults can cause the process to sleep, + * thereby causing a competing process to startup. -- depp + * + *) + + (** actually, theses macros reference sleep, panic, wakeup, which I + cannot find; therefore their implementations are buggy - em **) + PROCEDURE MSG_LOCK (x: UNTRACED REF struct_msqid_ds); + PROCEDURE MSG_UNLOCK (x: UNTRACED REF struct_msqid_ds); + + + CONST + (* Message Operation Flags. *) + + MSG_NOERROR = 8_010000; (* no error if big message *) + + (* Sizing constants *) + + MSGMAP = 100; + MSGMAX = 8192; + MSGMNB = 16384; + MSGMNI = 50; + MSGSSZ = 8; + MSGTQL = 40; + MSGSEG = 1024; + + (* + ** There is one msg queue id data structure for each q in the system. + *) + + TYPE + struct_msqid_ds = RECORD + msg_perm: struct_ipc_perm; (* operation permission struct *) + msg_first: struct_msg_star; (* ptr to first message on q *) + msg_last: struct_msg_star; (* ptr to last message on q *) + msg_stime: time_t; (* last msgsnd time *) + msg_rtime: time_t; (* last msgrcv time *) + msg_ctime: time_t; (* last change time *) + wwait : wait_queue_star; + rwait : wait_queue_star; (* God knows *) + msg_cbytes: unsigned_short; (* current # bytes on q *) + msg_qnum: unsigned_short; (* # of messages on q *) + msg_qbytes: unsigned_short; (* max # of bytes on q *) + msg_lspid: unsigned_short; (* pid of last msgsnd *) + msg_lrpid: unsigned_short; (* pid of last msgrcv *) + END; + + (* + ** There is one msg structure for each message that may be in the system. + *) + + TYPE + struct_msg = RECORD + msg_next: UNTRACED REF struct_msg; (* ptr to next message on q *) + msg_type: long; (* message type *) + msg_spot: char_star; (* message text address *) + msg_ts: short; (* message text size *) + END; + struct_msg_star = UNTRACED REF struct_msg; + + (* + ** User message buffer template for msgsnd and msgrecv system calls. + *) + + struct_msgbuf = RECORD + mtype: long; (* message type *) + mtext: ARRAY [0..0] OF char; (* message text *) + END; + (* + ** Message information structure. + *) + + struct_msginfo = RECORD + msgpool: int; (* Linux-specific *) + msgmap : int; (* # of entries in msg map *) + msgmax : int; (* max message size *) + msgmnb : int; (* max # bytes on queue *) + msgmni : int; (* # of message queue identifiers *) + msgssz : int; (* msg segment size (should be word size multiple) *) + msgtql : int; (* # of system message headers *) + msgseg : unsigned_short; (* # of msg segments (MUST BE < 32768) *) + END; + + + END Umsg. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Umsg.m3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Umsg.m3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Umsg.m3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,35 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Mon Mar 09 19:04:05 PST 1992 by muller *) + + UNSAFE MODULE Umsg; + + PROCEDURE MSG_LOCK (<*UNUSED*> x: UNTRACED REF struct_msqid_ds) = + BEGIN + (* + WITH mode = x.msg_perm.mode DO + WHILE Word.And (mode, MSG_LCK) # 0 DO + mode := Word.Or (mode, MSG_WANT); + Unix.sleep (x.msg_first, PMSG); END; + mode := Word.Or (mode, MSG_LCK); END; + *) + END MSG_LOCK; + + PROCEDURE MSG_UNLOCK (<*UNUSED*> x: UNTRACED REF struct_msqid_ds) = + BEGIN + (* + WITH mode = x.msg_perm.mode DO + IF Word.And (mode, MSG_LCK) = 0 THEN + Unix.panic (M3toC.TtoS ("MSG_UNLOCK")); END; + IF Word.And (mode, MSG_WANT) # 0 THEN + Ultrix.wakeup (x.msg_first); END; + mode := Word.And (mode, Word.Not (Word.Or (MSG_WANT, MSG_LCK))); END; + *) + END MSG_UNLOCK; + + BEGIN + END Umsg. + Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Unetdb.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Unetdb.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Unetdb.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,159 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Fri Apr 30 14:42:11 PDT 1993 by muller *) + + INTERFACE Unetdb; + + FROM Ctypes IMPORT int, char_star, char_star_star, unsigned_long; + + (*** ***) + + (* + * Structures returned by network + * data base library. All addresses + * are supplied in host order, and + * returned in network order (suitable + * for use in system calls). + *) + + TYPE + struct_hostent = RECORD + h_name: char_star; (* official name of host *) + h_aliases: char_star_star; (* alias list *) + h_addrtype: int; (* host address type *) + h_length: int; (* length of address *) + h_addr_list: char_star_star; (* list of addresses from name server *) + END; + struct_hostent_star = UNTRACED REF struct_hostent; + + (* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + *) + + struct_netent = RECORD + n_name: char_star; (* official name of net *) + n_aliases: char_star_star; (* alias list *) + n_addrtype: int; (* net address type *) + n_net: unsigned_long; (* network # *) + END; + struct_netent_star = UNTRACED REF struct_netent; + + struct_servent = RECORD + s_name: char_star; (* official service name *) + s_aliases: char_star_star; (* alias list *) + s_port: int; (* port # *) + s_proto: char_star; (* protocol to use *) + END; + struct_servent_star = UNTRACED REF struct_servent; + + struct_protoent = RECORD + p_name: char_star; (* official protocol name *) + p_aliases: char_star_star; (* alias list *) + p_proto: int; (* protocol # *) + END; + struct_protoent_star = UNTRACED REF struct_protoent; + + struct_rpcent = RECORD + r_name: char_star; (* name of server for this rpc program *) + r_aliases: char_star_star; (* alias list *) + r_number: int; (* rpc program number *) + END; + + + (* + * Error return codes from gethostbyname() and gethostbyaddr() + *) + + CONST + HOST_NOT_FOUND = 1; (* Authoritive Answer Host not found *) + TRY_AGAIN = 2; (* Non-Authoritive Host not found, or SERVERFAIL *) + NO_RECOVERY = 3; (* Non recoverable errors, FORMERR, REFUSED, NOTIMP *) + NO_ADDRESS = 4; (* Valid host name, no address, look for MX record *) + + (* The services accessible via the V2.4 gethostent interface *) + + SVC_LOCAL = 1; (* /etc/hosts *) + SVC_BIND = 2; (* Internet domain service *) + SVC_YP = 3; (* Yellow Pages service *) + + (* Number of services *) + + NSVCS = 4; (* Number of supported services *) + + PROCEDURE VALID_SVC (a: int): BOOLEAN; + + (*** gethostent(3n), gethostbyaddr(3n), gethostbyname(3n), + sethostent(3n), endhostent(3n) - get network host entry ***) + + <*EXTERNAL "m3_gethostbyname"*> + PROCEDURE gethostbyname (name: char_star): struct_hostent_star; + + <*EXTERNAL "m3_gethostbyaddr"*> + PROCEDURE gethostbyaddr (addr: char_star; len, type: int): struct_hostent_star; + + <*EXTERNAL*> + PROCEDURE sethostent (stayopen: int); + + <*EXTERNAL*> + PROCEDURE endhostent (); + + (*** getnetent(3n), getnetbyaddr(3n), getnetbyname(3n), + setnetent(3n), endnetent(3n) - get network entry ***) + + <*EXTERNAL*> + PROCEDURE getnetent (): struct_netent_star; + + <*EXTERNAL*> + PROCEDURE getnetbyname (name: char_star): struct_netent_star; + + <*EXTERNAL*> + PROCEDURE getnetbyaddr (addr: char_star; type: int): struct_netent_star; + + <*EXTERNAL*> + PROCEDURE setnetent (stayopen: int); + + <*EXTERNAL*> + PROCEDURE endnetent (); + + + (*** getprotoent(3n), getprotobynumber(3n), getprotobyname(3n), + setprotoent(3n), endprotoent(3n) - get protocol entry ***) + + <*EXTERNAL*> + PROCEDURE getprotoent (): struct_protoent_star; + + <*EXTERNAL*> + PROCEDURE getprotobynumber (proto: int): struct_protoent_star; + + <*EXTERNAL*> + PROCEDURE getprotobyname (name: char_star): struct_protoent_star; + + <*EXTERNAL*> + PROCEDURE setprotoent (stayopen: int); + + <*EXTERNAL*> + PROCEDURE endprotoent (); + + + (*** getservent(3n), getservbynumber(3n), getservbyname(3n), + setservent(3n), endservent(3n) - get service entry ***) + + <*EXTERNAL*> + PROCEDURE getservent (): struct_servent_star; + + <*EXTERNAL*> + PROCEDURE getservbyport (port: int; proto: char_star): struct_servent_star; + + <*EXTERNAL*> + PROCEDURE getservbyname (name, proto: char_star): struct_servent_star; + + <*EXTERNAL*> + PROCEDURE setservent (stayopen: int); + + <*EXTERNAL*> + PROCEDURE endservent (); + + END Unetdb. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Unetdb.m3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Unetdb.m3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Unetdb.m3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,18 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Mon Mar 09 19:04:24 PST 1992 by muller *) + + MODULE Unetdb; + + FROM Ctypes IMPORT int; + + PROCEDURE VALID_SVC (a: int): BOOLEAN = + BEGIN + RETURN 0 < a AND a < NSVCS; + END VALID_SVC; + + BEGIN + END Unetdb. + Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Unix.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Unix.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Unix.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,971 ---- + (* Copyright (C) 1994, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Sat Jan 7 14:41:42 PST 1995 by kalsow *) + (* modified on Sun Nov 6 16:39:26 MET 1994 by Olaf Wagner *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Tue Jun 8 16:26:41 PDT 1993 by mcjones *) + (* modified on Mon Jan 11 14:34:49 PST 1993 by muller *) + (* *) + (* ow 01.10.1994 adjusted file mode flags for FreeBSD *) + (* ow Sun Nov 6 16:39:26 MET 1994 *) + (* Most of the system calls have been checked and adjusted *) + (* for FreeBSD now. Still to be done completedly: ioctl *) + + INTERFACE Unix; + + FROM Word IMPORT Or, And, Shift; + + FROM Ctypes IMPORT short, int, long, char_star, + char_star_star; + FROM Utypes IMPORT dev_t, off_t, mode_t, pid_t, (*tcflag_t,*) u_long, + (*cc_t, speed_t,*) uid_t, gid_t, size_t; + FROM Utime IMPORT struct_timeval; + + CONST + MaxPathLen = 1024; + + (*** file flags ***) + CONST + FREAD = 16_0000; (* descriptor read/receive'able *) + FWRITE = 16_0001; (* descriptor write/send'ale *) + FCREAT = 16_0200; (* create if nonexistant *) + FEXCL = 16_0800; (* error if already created *) + FTRUNC = 16_0400; (* truncate to zero length *) + FAPPEND = 16_0008; (* append on each write *) + FNBLOCK = 16_0004; (* POSIX no delay *) + FNDELAY = FNBLOCK; (* no delay *) + FSYNCRON = 16_0080; (* write file syncronously *) + FMARK = 16_1000; (* makr during gc() *) + FDEFER = 16_2000; (* fefer for next gc pass *) + FASYNC = 16_0040; (* signal pgrp when data ready *) + FSHLOCK = 16_0010; (* shared lock present *) + FEXLOCK = 16_0020; (* exclusive lock present *) + + CONST + MSETUID = 8_4000; + MSETGID = 8_2000; + MSTICKY = 8_1000; + MROWNER = 8_0400; + MWOWNER = 8_0200; + MXOWNER = 8_0100; + MRGROUP = 8_0040; + MWGROUP = 8_0020; + MXGROUP = 8_0010; + MROTHER = 8_0004; + MWOTHER = 8_0002; + MXOTHER = 8_0001; + Mrwrr = MROWNER + MWOWNER + MRGROUP + MROTHER; + Mrwrwrw = MROWNER + MWOWNER + MRGROUP + MWGROUP + MROTHER + MWOTHER; + + + + (*** access - determine the accessibility of file ***) + <*EXTERNAL*> PROCEDURE access (path: char_star; mod: int): int; + (* ok *) + + (*** acct - turn accounting on or off ***) + <*EXTERNAL*> PROCEDURE acct (path: char_star): int; + (* ok *) + + (*** brk, sbrk - change data segment space allocation *) + <*EXTERNAL*> PROCEDURE brk (addr: ADDRESS): int; + (* ok *) + <*EXTERNAL*> PROCEDURE sbrk (inc: int): char_star; + (* ok *) + + (*** chdir - change working directory ***) + <*EXTERNAL*> PROCEDURE chdir (path: char_star): int; + (* ok *) + + (*** chmod, fchmod - change mde of file ***) + <*EXTERNAL*> PROCEDURE chmod (path: char_star; mode: mode_t): int; + <*EXTERNAL*> PROCEDURE fchmod (fd, mode: mode_t): int; + (* ok *) + + (*** chown, fchown, lchown - change owner and group of a file ***) + <*EXTERNAL*> PROCEDURE chown (path: char_star; owner: uid_t; group: gid_t): int; + <*EXTERNAL*> PROCEDURE fchown (fd: int; owner: uid_t; group: gid_t): int; + <*EXTERNAL*> PROCEDURE lchown (path: char_star; owner: uid_t; group: gid_t): int; + (* ok *) + + (*** chroot - change root directory ***) + <*EXTERNAL*> PROCEDURE chroot (dirname: char_star): int; + (* ok *) + + (*** close - delete a descriptor ***) + <*EXTERNAL "m3_close"*> PROCEDURE close (d: int): int; + (* ok *) + + (*** creat - create a new file ***) + <*EXTERNAL*> PROCEDURE creat (name: char_star; mode: mode_t): int; + (* ok, but obsolete *) + + (*** dup, dup2 - duplicate an open file descriptor ***) + <*EXTERNAL "m3_dup"*> PROCEDURE dup (oldd: int): int; + <*EXTERNAL "m3_dup2"*> PROCEDURE dup2 (oldd, newd: int): int; + (* ok *) + + (*** execve - execute a file ***) + <*EXTERNAL*> PROCEDURE execve (name: char_star; + argv, envp: char_star_star): int; + (* ok *) + + (*** exit - terminate a process ***) + <*EXTERNAL*> PROCEDURE exit (i: int); + (* ok *) + + (*** _exit - terminate a process without performing C I/O library cleanup ***) + <*EXTERNAL "_exit"*> PROCEDURE underscore_exit (i: int); + (* ok *) + + (*** fcntl - file control ***) + CONST (* request *) + F_DUPFD = 0; (* Duplicate fd *) + F_GETFD = 1; (* Get close-on-exec flag *) + F_SETFD = 2; (* Set close-on-exec flag *) + F_GETFL = 3; (* Get fd status flags *) + F_SETFL = 4; (* Set fd status flags *) + + (* in these three cases, you need to pass LOOPHOLE (ADR (v), int) + for arg, where v is a variable of type struct_flock *) + F_GETOWN = 5; (* Set owner *) + F_SETOWN = 6; (* Get owner *) + + F_GETLK = 7; (* Get file lock *) + F_SETLK = 8; (* Set file lock *) + F_SETLKW = 9; (* Set file lock and wait *) + + CONST (* fd flags *) + FD_CLOEXEC = 1; (* Close file descriptor on exec() *) + + TYPE + struct_flock = RECORD + l_start: off_t := 0; + l_len: off_t := 0; + l_pid: pid_t := 0; + l_type: short; (* see below *) + l_whence: short; + END; + (* ok *) + + CONST (* l_type values *) + F_RDLCK = 1; (* Read lock *) + F_WRLCK = 3; (* Write lock *) + F_UNLCK = 2; (* Remove lock(s) *) + + <*EXTERNAL "ufcntl"*> PROCEDURE fcntl (fd, request, arg: int): int; + (* ok *) + + (*** flock - apply or remove an advisory lock on an open file ***) + CONST + LOCK_SH = 1; (* shared lock *) + LOCK_EX = 2; (* exclusive lock *) + LOCK_NB = 4; (* don't block when locking *) + LOCK_UN = 8; (* unlock *) + + <*EXTERNAL*> PROCEDURE flock (fd, operation: int): int; + (* ok *) + + (*** fork - create a new process ***) + <*EXTERNAL*> PROCEDURE fork (): pid_t; + (* ok *) + + (*** fsync - synchronize a file's in-core state with that on disk ***) + <*EXTERNAL*> PROCEDURE fsync (fd: int): int; + (* ok *) + + (*** getdirentries - gets directory entries in a generic directory format ***) + <*EXTERNAL*> PROCEDURE getdirentries (fd: int; buf: ADDRESS; + nbytes: int; VAR basep: long): int; + (* ok *) + + (*** getdomainname, setdomainname - get or set name of current domain ***) + <*EXTERNAL*> PROCEDURE getdomainname (name: char_star; namelen: int): int; + <*EXTERNAL*> PROCEDURE setdomainname (name: char_star; namelen: int): int; + (* ok *) + + (*** getdtablesize - get descriptor table size ***) + <*EXTERNAL*> PROCEDURE getdtablesize (): int; + (* ok *) + + (*** getgroups - get group access list ***) + <*EXTERNAL*> PROCEDURE getgroups (gidsetsize: int; VAR gidset: int): int; + (* ok *) + + (*** gethostid, sethostid - get/set unique identifier of current host ***) + <*EXTERNAL*> PROCEDURE gethostid (): long; + <*EXTERNAL*> PROCEDURE sethostid (hostid: long): int; + (* ok *) + + + (*** gethostname, sethostname - get/set name of current host ***) + <*EXTERNAL*> PROCEDURE gethostname (name: char_star; namelen: int): int; + <*EXTERNAL*> PROCEDURE sethostname (name: char_star; namelen: int): int; + (* ok *) + + (*** getpagesize - get system page size ***) + <*EXTERNAL*> PROCEDURE getpagesize (): int; + (* ok *) + + (*** getwd - get current working directory pathname ***) + <*EXTERNAL*> PROCEDURE getwd (pathname: char_star): char_star; + <*EXTERNAL*> PROCEDURE getcwd (pathname: char_star; size: size_t): char_star; + (* ok *) + + (*** ioctl - control device ***) + (* this is a temptative declaration of the types of the arguments. + it shoulb probably done in another way, so it is commented. We really need + only the sizes of these records; see below + + TYPE + struct_sgttyb_ULTRIX = RECORD + sg_ispeed: char; (* input speed *) + sg_ospeed: char; (* output speed *) + sg_erase: char; (* erase character *) + sg_kill: char; (* kill character *) + sg_flags: short; (* mode flags *) + END; + (* ok *) + + struct_tchars = RECORD + t_intrc: char; /* Interrupt */ + t_quitc: char; /* Quit */ + t_startc: char; /* Start output */ + t_stopc: char; /* Stop output */ + t_eofc: char; /* End-of-file (EOF) */ + t_brkc: char; /* Input delimiter (like nl) */ + END; + (* ok *) + + struct_ltchars = RECORD + t_suspc: char; /* Stop process signal */ + t_dsuspc: char; /* Delayed stop process signal */ + t_rprntc: char; /* Reprint line */ + t_flushc: char; /* Flush output (toggles) */ + t_werasc: char; /* Word erase */ + t_lnextc: char; /* Literal next character */ + END; + (* ok *) + + struct_winsize = RECORD + ws_row, ws_col: u_short; /* Window charact. size */ + ws_xpixel, ws_ypixel: u_short; /* Window pixel size */ + END; + (* ok *) + + (* + struct_termio = RECORD + c_iflag: u_short; /* input modes */ + c_oflag: u_short; /* output modes */ + c_cflag: u_short; /* control modes */ + c_lflag: u_short; /* line discipline modes */ + c_line: char; /* line discipline */ + c_cc[NCC]: u_char; /* control chars */ + END; + *) + + struct_termios = RECORD + c_iflag: tcflag_t; /* Input Modes */ + c_oflag: tcflag_t; /* Output Modes */ + c_cflag: tcflag_t; /* Control Modes */ + c_lflag: tcflag_t; /* Local Modes */ + c_cc[NCCS]: cc_t; /* Control Characters */ + c_ispeed, + c_ospeed: speed_t; + END; + (* ok *) + + (* This is how far I got. I don't think anybody will ever need it, + so I stop here. ow Sun Nov 6 17:12:47 MET 1994 *) + struct_rtentry = RECORD + u_long rt_hash; /* to speed lookups */ + struct_sockaddr rt_dst; /* key */ + struct_sockaddr rt_gateway; /* value */ + short rt_flags; /* up/down?, host/net */ + short rt_refcnt; /* # held references */ + u_long rt_use; /* raw # packets forwarded */ + struct_ifnet *rt_ifp; /* the answer: interface to use */ + struct_rtentry *rt_next; /* next in list */ + END; + + struct_ifreq_1 = RECORD + char ifr_name[16]; /* if name, e.g. "en0" */ + struct_sockaddr ifru_addr; + END; + struct_ifreq_2 = RECORD + char ifr_name[16]; /* if name, e.g. "en0" */ + u_short ifru_flags; + END; + struct_ifreq_3 = RECORD + char ifr_name[16]; /* if name, e.g. "en0" */ + int ifru_metric; + END; + struct_ifreq_4 = RECORD + char ifr_name[16]; /* if name, e.g. "en0" */ + caddr_t ifru_data; + END; + + struct_ifconf_1 = RECORD + int ifc_len; /* size of associated buffer */ + caddr_t ifcu_buf; + END; + struct_ifconf_2 = RECORD + int ifc_len; /* size of associated buffer */ + struct ifreq *ifcu_req; + END; + + struct_ctrreq_1 = RECORD + char ctr_name[IFNAMSIZ]; /* if name */ + char ctr_type; /* type of interface */ + struct_estat ctrc_ether;/* ethernet counters */ + END; + struct_ctrreq_2 = RECORD + char ctr_name[IFNAMSIZ]; /* if name */ + char ctr_type; /* type of interface */ + struct_dstat ctrc_ddcmp;/* DDCMP pt-to-pt counters */ + END; + + struct_ifdevea = RECORD + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + u_char default_pa[6]; /* default hardware address */ + u_char current_pa[6]; /* current physical address */ + END; + + struct_arpreq = RECORD + struct_sockaddr arp_pa; /* protocol address */ + struct_sockaddr arp_ha; /* hardware address */ + int arp_flags; /* flags */ + END; + + struct_ifstate = RECORD + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + u_short if_family; /* current family ownership */ + u_short if_next_family; /* next family ownership */ + u_short if_mode:3, /* mode of device */ + if_ustate:1, /* user requested state */ + if_nomuxhdr:1, /* if set, omit mux header */ + if_dstate:4, /* current state of device */ + if_xferctl:1, /* xfer control to nxt family */ + if_rdstate:1, /* read current state */ + if_wrstate:1, /* set current state */ + if_reserved:4; + END; + + struct_solicit_1 = RECORD + END; + + struct_response_1 = RECORD + END; + + struct_lat_ucom = RECORD + END; + + struct_lat_ini = RECORD + END; + + #define MAXLTADESTSIZE 16 + #define MAXLTASERVSIZE 16 + #define MAXLTAPORTSIZE 16 + + struct_ltattyi = RECORD + char lta_dest_port[MAXLTADESTSIZE+1]; + char lta_server_name[MAXLTASERVSIZE+1]; + char lta_server_port[MAXLTAPORTSIZE+1]; + END; + + struct_pt = RECORD + END; + + struct_el = RECORD + END; + + struct_mtop = RECORD + short mt_op; /* Operations defined below */ + daddr_t mt_count; /* How many of them */ + END; + + struct_mtget = RECORD + short mt_type; /* Type of device defined below */ + short mt_dsreg; /* ``drive status'' register */ + short mt_erreg; /* ``error'' register */ + short mt_resid; /* Residual count */ + END; + + struct_dkop = RECORD + short dk_op; /* Operations defined below */ + daddr_t dk_count; /* How many of them */ + END; + + struct_dkget = RECORD + short dk_type; /* Type of device defined below */ + short dk_dsreg; /* ``drive status'' register */ + short dk_erreg; /* ``error'' register */ + short dk_resid; /* Residual count */ + END; + + struct_dkacc = RECORD + short dk_opcode; /* Operation code for access */ + long dk_lbn; /* Disk sector number */ + long dk_length; /* Length of transfer */ + unsigned dk_status; /* Status of operation */ + unsigned dk_flags; /* Status flags */ + END; + + struct_devget = RECORD + short category; /* Category */ + short bus; /* Bus */ + char interface[DEV_SIZE]; /* Interface (string) */ + char device[DEV_SIZE]; /* Device (string) */ + short adpt_num; /* Adapter number */ + short nexus_num; /* Nexus or node on adapter no. */ + short bus_num; /* Bus number */ + short ctlr_num; /* Controller number */ + short rctlr_num; /* Remote controller number */ + short slave_num; /* Plug or line number */ + char dev_name[DEV_SIZE]; /* Ultrix device pneumonic */ + short unit_num; /* Ultrix device unit number */ + unsigned soft_count; /* Driver soft error count */ + unsigned hard_count; /* Driver hard error count */ + long stat; /* Generic status mask */ + long category_stat; /* Category specific mask */ + END; + *) + + CONST + IOCPARM_MASK = 16_1fff; + IOC_VOID = Shift (1, 29); (* no parameters *) + IOC_OUT = Shift (1, 30); (* copy out parameters *) + IOC_IN = Shift (1, 31); (* copy in parameters *) + IOC_INOUT = Or (IOC_IN, IOC_OUT); + + + NOARG = IOC_VOID; + R = IOC_OUT; + W = IOC_IN; + RW = IOC_INOUT; + (* if we had the structure declarations, we would use these + INT = Shift (And (BYTESIZE (INTEGER), IOCPARM_MASK), 16); + SG = Shift (And (BYTESIZE (struct_sgttyb_ULTRIX), IOCPARM_MASK), 16); + TCHAR = Shift (And (BYTESIZE (struct_tchars), IOCPARM_MASK), 16); + LC = Shift (And (BYTESIZE (struct_ltchars), IOCPARM_MASK), 16); + WS = Shift (And (BYTESIZE (struct_winsize), IOCPARM_MASK), 16); + TIO = Shift (And (BYTESIZE (struct_termio), IOCPARM_MASK), 16); + IOS = Shift (And (BYTESIZE (struct_termios), IOCPARM_MASK), 16); + RTE = Shift (And (BYTESIZE (struct_rtentry), IOCPARM_MASK), 16); + IFR = Shift (And (BYTESIZE (struct_ifreq), IOCPARM_MASK), 16); + IFC = Shift (And (BYTESIZE (struct_ifconf), IOCPARM_MASK), 16); + CTR = Shift (And (BYTESIZE (struct_ctrreq), IOCPARM_MASK), 16); + IFD = Shift (And (BYTESIZE (struct_ifdevea), IOCPARM_MASK), 16); + ARP = Shift (And (BYTESIZE (struct_arpreq), IOCPARM_MASK), 16); + IFS = Shift (And (BYTESIZE (struct_ifstate), IOCPARM_MASK), 16); + SOL = Shift (And (BYTESIZE (struct_solicit_1), IOCPARM_MASK), 16); + RES = Shift (And (BYTESIZE (struct_response_1), IOCPARM_MASK), 16); + LAU = Shift (And (BYTESIZE (struct_lat_ucom), IOCPARM_MASK), 16); + LAI = Shift (And (BYTESIZE (struct_lat_ini), IOCPARM_MASK), 16); + LTA = Shift (And (BYTESIZE (struct_ltattyi), IOCPARM_MASK), 16); + PT = Shift (And (BYTESIZE (struct_pt), IOCPARM_MASK), 16); + EL = Shift (And (BYTESIZE (struct_el), IOCPARM_MASK), 16); + MTO = Shift (And (BYTESIZE (struct_mtop), IOCPARM_MASK), 16); + MTG = Shift (And (BYTESIZE (struct_mtget), IOCPARM_MASK), 16); + DKO = Shift (And (BYTESIZE (struct_dkop), IOCPARM_MASK), 16); + DKG = Shift (And (BYTESIZE (struct_dkget), IOCPARM_MASK), 16); + DKA = Shift (And (BYTESIZE (struct_dkacc), IOCPARM_MASK), 16); + DEV = Shift (And (BYTESIZE (struct_devget), IOCPARM_MASK), 16); + + but instead we use these *) + + INT = Shift (And (BYTESIZE (INTEGER), IOCPARM_MASK), 16); + SG = Shift (And (0, IOCPARM_MASK), 16); + TCHAR = Shift (And (0, IOCPARM_MASK), 16); + LC = Shift (And (0, IOCPARM_MASK), 16); + WS = Shift (And (0, IOCPARM_MASK), 16); + TIO = Shift (And (0, IOCPARM_MASK), 16); + IOS = Shift (And (0, IOCPARM_MASK), 16); + RTE = Shift (And (0, IOCPARM_MASK), 16); + IFR = Shift (And (0, IOCPARM_MASK), 16); + IFC = Shift (And (0, IOCPARM_MASK), 16); + CTR = Shift (And (0, IOCPARM_MASK), 16); + IFD = Shift (And (0, IOCPARM_MASK), 16); + ARP = Shift (And (0, IOCPARM_MASK), 16); + IFS = Shift (And (0, IOCPARM_MASK), 16); + SOL = Shift (And (0, IOCPARM_MASK), 16); + RES = Shift (And (0, IOCPARM_MASK), 16); + LAU = Shift (And (0, IOCPARM_MASK), 16); + LAI = Shift (And (0, IOCPARM_MASK), 16); + LTA = Shift (And (0, IOCPARM_MASK), 16); + PT = Shift (And (0, IOCPARM_MASK), 16); + EL = Shift (And (0, IOCPARM_MASK), 16); + MTO = Shift (And (0, IOCPARM_MASK), 16); + MTG = Shift (And (0, IOCPARM_MASK), 16); + DKO = Shift (And (0, IOCPARM_MASK), 16); + DKG = Shift (And (0, IOCPARM_MASK), 16); + DKA = Shift (And (0, IOCPARM_MASK), 16); + DEV = Shift (And (0, IOCPARM_MASK), 16); + + CONST (* the tty i/o controls *) + TC = Shift (ORD ('t'), 8); + + TIOCGETD = Or (Or (R, INT), Or (TC, 0)); (* get line discipline *) + TIOCSETD = Or (Or (W, INT), Or (TC, 1)); (* set line discipline *) + OTTYDISC = 16_00; (* Old, v7 std tty driver *) + NETLDISC = 16_01; (* Line discipline for berk net *) + NTTYDISC = 16_02; (* New tty discipline *) + TABLDISC = 16_03; (* Hitachi tablet discipline *) + NTABLDISC = 16_04; (* Gtco tablet discipline *) + HCLDISC = 16_05; (* Half cooked discipline *) + TERMIODISC = 16_06; (* termio line discipline *) + SLPDISC = 16_07; (* BSD Serial Line IP *) + (* Line disc #'s 16-23 are reserved for local extension.*) + TIOCHPCL = Or (NOARG, Or (TC, 2)); (* hangup on last close *) + TIOCMODG = Or (Or (R, INT), Or (TC, 3)); (* get modem control state *) + TIOCMODS = Or (Or (R, INT), Or (TC, 4)); (* set modem control state *) + TIOCM_LE = 16_001; (* line enable *) + TIOCM_DTR = 16_002; (* data terminal ready *) + TIOCM_RTS = 16_004; (* request to send *) + TIOCM_ST = 16_008; (* secondary transmit *) + TIOCM_SR = 16_010; (* secondary receive *) + TIOCM_CTS = 16_020; (* clear to send *) + TIOCM_CAR = 16_040; (* carrier detect *) + TIOCM_CD = TIOCM_CAR; + TIOCM_RNG = 16_080; (* ring *) + TIOCM_RI = TIOCM_RNG; + TIOCM_DSR = 16_100; (* data set ready *) + TIOCGETP = Or (Or (R, SG), Or (TC, 8)); (* get tty params *) + TIOCSETP = Or (Or (W, SG), Or (TC, 9)); (* set tty params *) + TIOCSETN = Or (Or (W, SG), Or (TC, 10)); (* no flush tty *) + TIOCEXCL = Or (NOARG, Or (TC, 13)); (* set exclusive use of tty *) + TIOCNXCL = Or (NOARG, Or (TC, 14)); (* reset exclus. use of tty *) + TIOCFLUSH = Or (Or (W, INT), Or (TC, 16)); (* flush buffers *) + TIOCSETC = Or (Or (W, TC), Or (TC, 17)); (* set special chars *) + TIOCGETC = Or (Or (R, TC), Or (TC, 18)); (* get special chars *) + + + TANDEM = 16_0001; (* send stopc on output q. full *) + CBREAK = 16_0002; (* half-cooked mode *) + + + (* locals, from 127 down *) + + TIOCLBIS = Or (Or (W, INT), Or (TC, 127)); (* bis local mode bits *) + TIOCLBIC = Or (Or (W, INT), Or (TC, 126)); (* bic local mode bits *) + TIOCLSET = Or (Or (W, INT), Or (TC, 125)); (* set local modes *) + TIOCLGET = Or (Or (R, INT), Or (TC, 124)); (* get local modes *) + CRTBS = Shift (1, 16); (* Do backspacing for crt *) + PRTERA = Shift (1, 17); (* \ ... / erase *) + CRTERA = Shift (1, 18); (* " \b " to wipe out char *) + TILDE = Shift (1, 19); (* Hazeltine tilde kludge *) + MDMBUF = Shift (1, 20); (* Start/stop output on c.intr. *) + LITOUT = Shift (1, 21); (* Literal output *) + TOSTOP = Shift (1, 22); (* SIGSTOP on background output *) + FLUSHO = Shift (1, 23); (* Flush output to terminal *) + NOHANG = Shift (1, 24); (* No SIGHUP on carrier drop *) + AUTOFLOW = Shift (1, 25); (* IAUTO hardware start/stop *) + CRTKIL = Shift (1, 26); (* Kill line with " \b " *) + PASS8 = Shift (1, 27); (* Allow 8-bit with canonical *) + CTLECH = Shift (1, 28); (* Echo control chars as ^X *) + PENDIN = Shift (1, 29); (* tp->t_rawq needs reread *) + DECCTQ = Shift (1, 30); (* Only ^Q starts after ^S *) + BNOFLSH = Shift (1, 31); (* No output flush on signal *) + LCRTBS = Shift (CRTBS, -16); + LPRTERA = Shift (PRTERA, -16); + LCRTERA = Shift (CRTERA, -16); + LTILDE = Shift (TILDE, -16); + LMDMBUF = Shift (MDMBUF, -16); + LLITOUT = Shift (LITOUT, -16); + LTOSTOP = Shift (TOSTOP, -16); + LFLUSHO = Shift (FLUSHO, -16); + LNOHANG = Shift (NOHANG, -16); + LAUTOFLOW = Shift (AUTOFLOW, -16); + LCRTKIL = Shift (CRTKIL, -16); + LPASS8 = Shift (PASS8, -16); + LCTLECH = Shift (CTLECH, -16); + LPENDIN = Shift (PENDIN, -16); + LDECCTQ = Shift (DECCTQ, -16); + LBNOFLSH = Shift (BNOFLSH, -16); + TIOCSBRK = Or (NOARG, Or (TC, 123)); (* set break bit *) + TIOCCBRK = Or (NOARG, Or (TC, 122)); (* clear break bit *) + TIOCSDTR = Or (NOARG, Or (TC, 121)); (* set data term. ready *) + TIOCCDTR = Or (NOARG, Or (TC, 120)); (* clear data term. ready *) + TIOCGPGRP = Or (Or (R, INT), Or (TC, 119)); (* get pgrp of tty *) + TIOCSPGRP = Or (Or (W, INT), Or (TC, 118)); (* set pgrp of tty *) + TIOCSLTC = Or (Or (R, LC), Or (TC, 117)); (* set loc. sp. chars *) + TIOCGLTC = Or (Or (R, LC), Or (TC, 116)); (* get loc. sp. chars *) + TIOCOUTQ = Or (Or (R, INT), Or (TC, 115)); (* output queue size *) + TIOCSTI = Or (Or (W, INT), Or (TC, 114)); (* simulate term. input *) + TIOCNOTTY = Or (NOARG, Or (TC, 113)); (* void tty association *) + TIOCPKT = Or (Or (W, INT), Or (TC, 112)); (* Pty: setclr. p. mode *) + TIOCPKT_DATA = 16_00; (* Data packet *) + TIOCPKT_FLUSHREAD = 16_01; (* Flush packet *) + TIOCPKT_FLUSHWRITE = 16_02; (* Flush packet *) + TIOCPKT_STOP = 16_04; (* Stop output *) + TIOCPKT_START = 16_08; (* Start output *) + TIOCPKT_NOSTOP = 16_10; (* No more ^S, ^Q *) + TIOCPKT_DOSTOP = 16_20; (* Now do ^S ^Q *) + TIOCPKT_IOCTL = 16_40; (* Wake up if change term char. *) + + TIOCSTOP = Or (NOARG, Or (TC, 111)); (* Stop output, like ^S *) + TIOCSTART = Or (NOARG, Or (TC, 110)); (* Start out., like ^Q *) + TIOCMSET = Or (Or (W, INT), Or (TC, 109)); (* Set all modem bits *) + TIOCMBIS = Or (Or (W, INT), Or (TC, 108)); (* Bis modem bits *) + TIOCMBIC = Or (Or (W, INT), Or (TC, 107)); (* Bic modem bits *) + TIOCMGET = Or (Or (R, INT), Or (TC, 106)); (* Get all modem bits *) + TIOCREMOTE = Or (Or (W, INT), Or (TC, 105)); (* Remote input editing *) + TIOCGWINSZ = Or (Or (R, WS), Or (TC, 104)); (* Get win. sz. *) + TIOCSWINSZ = Or (Or (W, WS), Or (TC, 103)); (* Set win. sz. *) + TIOCUCNTL = Or (Or (W, INT), Or (TC, 102)); (* Pty: set/clr u.c.mode*) + TIOCSMLB = Or (NOARG, Or (TC, 101)); (* Turn on loopback mode*) + TIOCCMLB = Or (NOARG, Or (TC, 100)); (* Turn off loop. mode *) + TIOCNMODEM = Or (Or (W, INT), Or (TC, 99)); (* Ignore modem status *) + TIOCMODEM = Or (Or (W, INT), Or (TC, 98)); (* Look at modem status *) + TIOCWONLINE = Or (NOARG, Or (TC, 97)); (* Wait on online device*) + TIOCNCAR = Or (NOARG, Or (TC, 96)); (* Ignore soft carrier *) + TIOCCAR = Or (NOARG, Or (TC, 95)); (* Don't ignore s. car. *) + TCSBRK = Or (NOARG, Or (TC, 94)); (* Flush q's w/ cnd. brk*) + TCXONC = Or (NOARG, Or (TC, 93)); (* Start/stop control *) + TCFLSH = Or (NOARG, Or (TC, 92)); (* Cnd. q flushing *) + TCGETA = Or (Or (R, TIO), Or (TC, 91)); (* Get parameters *) + TCSETA = Or (Or (W, TIO), Or (TC, 90)); (* Set parameters *) + TCSETAW = Or (Or (W, TIO), Or (TC, 89)); (* Drain & set *) + TCSETAF = Or (Or (W, TIO), Or (TC, 88)); (* Drain, flush, & set *) + TIOCMASTER = Or (Or (W, INT), Or (TC, 87)); (* master ctrls flags *) + TIOAUTO = Or (NOARG, Or (TC, 86)); (* Autoflow status *) + TIOCSINUSE = FIOSINUSE; (* Test and set mutex *) + TIOCCINUSE = FIOCINUSE; (* Clear mutex *) + + TCGETP = Or (Or (R, IOS), Or (TC, 85)); (* Get parameters *) + TCSANOW = Or (Or (W, IOS), Or (TC, 84)); (* Set parameters *) + TCSADRAIN = Or (Or (W, IOS), Or (TC, 83)); (* Drain & set *) + TCSADFLUSH = Or (Or (W, IOS), Or (TC, 82)); (* Drain, flush, & set *) + + + (* File i/o controls *) + FC = Shift (ORD ('f'), 8); + + FIOCLEX = Or (NOARG, Or (FC, 1)); (* Set exclusive use on fd*) + FIONCLEX = Or (NOARG, Or (FC, 2)); (* Remove exclusive use *) + FIOSINUSE = Or (NOARG, Or (FC, 3)); (* Test & set IINUSE in inode *) + FIOCINUSE = Or (NOARG, Or (FC, 4)); (* Clear mutex *) + FIONREAD = Or (Or (R, INT), Or (FC, 127)); (* Get # bytes to read *) + FIONBIO = Or (Or (W, INT), Or (FC, 126)); (* Set/clear non-bl.i/o *) + FIOASYNC = Or (Or (W, INT), Or (FC, 125)); (* Set/clear async i/o *) + FIOSETOWN = Or (Or (W, INT), Or (FC, 124)); (* Set owner *) + FIOGETOWN = Or (Or (R, INT), Or (FC, 123)); (* Get owner *) + FIONBUF = Or (Or (W, INT), Or (FC, 122)); (* N_buff i/o buf *) + FIONONBUF = Or (NOARG, Or (FC, 121)); (* N_buff i/o on buf *) + FIONBDONE = Or (Or (W, INT), Or (FC, 120)); (* N_buff i/o done buf *) + + (* Socket i/o controls *) + SC = Shift (ORD ('s'), 8); + RC = Shift (ORD ('r'), 8); + IC = Shift (ORD ('i'), 8); + + SIOCSHIWAT = Or (Or (W, INT), Or (SC, 0)); (* Set high watermark *) + SIOCGHIWAT = Or (Or (R, INT), Or (SC, 1)); (* Get high watermark *) + SIOCSLOWAT = Or (Or (W, INT), Or (SC, 2)); (* Set low watermark *) + SIOCGLOWAT = Or (Or (R, INT), Or (SC, 3)); (* Get low watermark *) + SIOCATMARK = Or (Or (R, INT), Or (SC, 7)); (* At oob mark? *) + SIOCSPGRP = Or (Or (W, INT), Or (SC, 8)); (* Set process group *) + SIOCGPGRP = Or (Or (R, INT), Or (SC, 9)); (* Get process group *) + SIOCADDRT = Or (Or (W, RTE), Or (RC, 10)); (* Add route *) + SIOCDELRT = Or (Or (W, RTE), Or (RC, 11)); (* Delete route *) + SIOCSIFADDR = Or (Or (W, IFR), Or (IC, 12)); (* Set ifnet ad.*) + SIOCGIFADDR = Or (Or (RW, IFR), Or (IC, 13)); (* Get ifnet ad.*) + SIOCSIFDSTADDR = Or (Or (W, IFR), Or (IC, 14)); (* Set p-p addr.*) + SIOCGIFDSTADDR = Or (Or (RW, IFR), Or (IC, 15)); (* Get p-p addr.*) + SIOCSIFFLAGS = Or (Or (W, IFR), Or (IC, 16)); (* Set ifnet fl.*) + SIOCGIFFLAGS = Or (Or (RW, IFR), Or (IC, 17)); (* Get ifnet fl.*) + SIOCGIFBRDADDR = Or (Or (RW, IFR), Or (IC, 18)); (* Get broad.ad.*) + SIOCSIFBRDADDR = Or (Or (W, IFR), Or (IC, 19)); (* Set broad.ad.*) + SIOCGIFCONF = Or (Or (RW, IFC), Or (IC, 20)); (* Get ifnet ls.*) + SIOCGIFNETMASK = Or (Or (RW, IFR), Or (IC, 21)); (* Get n.a.mask *) + SIOCSIFNETMASK = Or (Or (W, IFR), Or (IC, 22)); (* Set n.a.mask *) + SIOCSPHYSADDR = Or (Or (RW, IFR), Or (IC, 23)); (* Set phys. ad.*) + SIOCADDMULTI = Or (Or (RW, IFR), Or (IC, 24)); (* Add m.c. ad. *) + SIOCDELMULTI = Or (Or (RW, IFR), Or (IC, 25)); (* Dele. m.c.ad.*) + SIOCRDCTRS = Or (Or (RW, CTR), Or (IC, 26)); (* Read if cntr.*) + SIOCRDZCTRS = Or (Or (RW, CTR), Or (IC, 27)); (* Read/0 if c. *) + SIOCRPHYSADDR = Or (Or (RW, IFD), Or (IC, 28)); (* Read phy. ad.*) + SIOCSARP = Or (Or (W, ARP), Or (IC, 30)); (* Set arp entry *) + SIOCGARP = Or (Or (RW, ARP), Or (IC, 31)); (* Get arp entry *) + SIOCDARP = Or (Or (W, ARP), Or (IC, 32)); (* Del. arp ent. *) + SIOCENABLBACK = Or (Or (W, IFR), Or (IC, 33)); (* Set in.ex.lb. *) + SIOCDISABLBACK = Or (Or (W, IFR), Or (IC, 34)); (* Cl.in.ex.lpb. *) + SIOCSTATE = Or (Or (RW, IFS), Or (IC, 35)); (* Device state *) + LIOCSOL = Or (Or (RW, SOL), Or (IC, 36)); (* send solicit msg *) + LIOCRES = Or (Or (RW, RES), Or (IC, 37)); (* get response msg *) + LIOCCMD = Or (Or (RW, LAU), Or (IC, 38)); (* send command msg *) + LIOCINI = Or (Or (RW, LAI), Or (IC, 39)); (* lat tty init *) + SIOCARPREQ = Or (Or (RW, IFR), Or (IC, 40)); (* arp request pkt *) + SIOCGIFMETRIC = Or (Or (RW, IFR), Or (IC, 41)); (* get IF metric *) + SIOCSIFMETRIC = Or (Or (W, IFR), Or (IC, 42)); (* set IF metric *) + LIOCTTYI = Or (Or (R, LTA), Or (IC, 43)); (* lat tty info *) + + + (* Disk partition table i/o controls *) + PC = Shift (ORD ('p'), 8); + + DIOCGETPT = Or (Or (R, PT), Or (PC, 1)); (* Get disk paritition *) + DIOCSETPT = Or (Or (W, PT), Or (PC, 2)); (* Set disk paritition *) + DIOCDGTPT = Or (Or (R, PT), Or (PC, 3)); (* Get default disk par. *) + + (* Error logging i/o controls *) + EC = Shift (ORD ('e'), 8); + + ELSETPID = Or (Or (RW, EL), Or (EC, 0)); (* Set proc. id. *) + ELGETPID = Or (Or (R, INT), Or (EC, 1)); (* Get proc. id. *) + ELMOVPTR = Or (Or (W, INT), Or (EC, 2)); (* Update elpts. *) + ELREINIT = Or (NOARG, Or (EC, 3)); (* Reinit elbuf *) + ELCLRPID = Or (NOARG, Or (EC, 4)); (* Clr. proc.id. *) + ELWARNOFF = Or (NOARG, Or (EC, 5)); (* disable warn. *) + ELWARNON = Or (NOARG, Or (EC, 6)); (* disable warn. *) + ELGETTIME = Or (Or (R, INT), Or (EC, 7)); (* Get strt time *) + + (* Tape i/o controls *) + MC = Shift (ORD ('m'), 8); + + MTIOCTOP = Or (Or (W, MTO), Or (MC, 1)); (* Do a tape op. *) + MTIOCGET = Or (Or (R, MTG), Or (MC, 2)); (* Get status *) + + (* Disk i/o controls *) + DC = Shift (ORD ('d'), 8); + + DKIOCHDR = Or (NOARG, Or (DC, 1)); (* Header r/w *) + DKIOCDOP = Or (Or (W, DKO), Or (DC, 2)); (* Do a disk op. *) + DKIOCGET = Or (Or (R, DKG), Or (DC, 3)); (* Get status *) + DKIOCACC = Or (Or (RW, DKA), Or (DC, 4)); (* Disk access *) + + (* Generic device information i/o controls *) + VC = Shift (ORD ('v'), 8); + + DEVIOCGET = Or (Or (R, DEV), Or (VC, 1)); (* Get dev.info. *) + + + + CONST + R_OK = 8_4; + W_OK = 8_2; + X_OK = 8_1; + F_OK = 8_0; + + (* Somebody will have to work really hard to get all those ioctl + parameters right. Beware when using them! *) + <*EXTERNAL *> PROCEDURE ioctl (d: int; request: u_long; + argp: ADDRESS): int; + (* ok *) + + (*** link - link to a file ***) + <*EXTERNAL*> PROCEDURE link (name1, name2: char_star): int; + (* ok *) + + (*** lseek, tell - move read/write pointer ***) + CONST (* whence *) + L_SET = 0; + L_INCR = 1; + L_XTND = 2; + + <*EXTERNAL*> + PROCEDURE lseek (d: int; offset: off_t; whence: int): off_t; + (* ok *) + + (*** mkfifo - make a FIFO (named pipe) ***) + <*EXTERNAL*> PROCEDURE mkfifo (path: char_star; mode: mode_t): int; + + (*** mkdir - make a directory file ***) + <*EXTERNAL*> PROCEDURE mkdir (path: char_star; mode: mode_t): int; + (* ok *) + + (*** mknod - make a directory or a special file ***) + CONST (* mode *) + fifo_special = 8_010000; + character_special = 8_020000; + directory = 8_040000; + block_special = 8_060000; + ordinary_file = 8_000000; + ordinary_filea = 8_100000; + regular_file = 8_100000; + symbolic_link = 8_120000; + socket = 8_140000; + set_uid_on_exec = 8_004000; + set_gid_on_exec = 8_002000; + save_text_image_after_exec = 8_001000; + + (* lower bits used for the access permissions *) + + <*EXTERNAL*> PROCEDURE mknod (path: char_star; mode: mode_t; dev: dev_t): int; + (* ok *) + + (*** mount, umount - mount or unmount a file system ***) + CONST (* rwflag *) + writable = 0; + write_protected = 1; + + <*EXTERNAL*> PROCEDURE mount (type: int; + dir: char_star; flags: int; + data: ADDRESS): int; + (* ok *) + + <*EXTERNAL*> PROCEDURE unmount (dir: char_star; flags: int): int; + (* ok *) + + + (*** open - open for reading or writing ***) + CONST (* flags *) + O_RDONLY = 8_0; (* open for reading *) + O_WRONLY = 8_1; (* open for writing *) + O_RDWR = 8_2; (* open for read & write *) + O_CREAT = FCREAT; (* open with file create *) + O_EXCL = FEXCL; (* error on create if file exists *) + O_NOCTTY = 8_000; + O_TRUNC = FTRUNC; (* open with truncation *) + O_APPEND = FAPPEND; (* append on each write *) + O_NONBLOCK = FNBLOCK; (* POSIX non-blocking I/O *) + O_NDELAY = FNDELAY; (* non-blocking open *) + O_FSYNC = FSYNCRON; (* syncronous write *) + + M3_NONBLOCK = O_NONBLOCK; (* -1 => would block, 0 => EOF *) + + <*EXTERNAL "uopen" *> PROCEDURE open (name: char_star; + flags, mode: int): int; + (* ok *) + + (*** pipe - create an interprocess channel ***) + CONST + readEnd = 0; + writeEnd = 1; + <*EXTERNAL*> PROCEDURE pipe (VAR fildes: ARRAY [0..1] OF int): int; + (* ok *) + + (* not implemented + (*** plock - lock process, text, or data in memory ***) + CONST (* op *) + UNLOCK = 0; (* unlock all segments *) + PROCLOCK = 1; (* lock text and data into memory *) + TXTLOCK = 2; (* lock text segment only *) + DATLOCK = 4; (* lock data segment ony *) + <*EXTERNAL*> PROCEDURE plock (op: int): int; + *) + + (*** profil - execution time profile ***) + <*EXTERNAL*> PROCEDURE profil (buff: ADDRESS; + size, offset, scale: int): int; + (* ok *) + + (*** ptrace - process trace ***) + <*EXTERNAL*> PROCEDURE ptrace (request: int; pid: pid_t; + addr: ADDRESS; + data: int): int; + (* ok *) + + (*** readlink - read value of a symbolic link ***) + <*EXTERNAL*> PROCEDURE readlink (path: char_star; buf: ADDRESS; bufsize: int): int; + (* ok *) + + (*** reboot - reboot system or halt processor ***) + CONST (* howto *) + RB_HALT = 16_8; (* dont' reboot, just halt *) + RB_ASKNAME = 16_1; (* ask for file name to reboot from *) + RB_SINGLE = 16_2; (* reboot to single user only *) + RB_AUTOREBOOT = 16_0; (* flag for system auto-booting itself *) + + <*EXTERNAL*> PROCEDURE reboot (howto: int): int; + (* ok *) + + (*** rename - change the name of a file ***) + <*EXTERNAL*> PROCEDURE rename (from, to: char_star): int; + (* ok *) + + (*** rmdir - remove a directory file ***) + <*EXTERNAL*> PROCEDURE rmdir (path: char_star): int; + (* ok *) + + (*** select - synchronous I/O mutiplexing ***) + CONST + MAX_FDSET = 256; + + TYPE + FDSet = SET OF [0 .. MAX_FDSET - 1]; + + <*EXTERNAL "m3_select"*> PROCEDURE select (nfds: int; + readfds, writefds, exceptfds: UNTRACED REF FDSet; + timeout: UNTRACED REF struct_timeval): int; + (* ok *) + + (*** setgroups - set group access list ***) + <*EXTERNAL*> PROCEDURE setgroups (ngroups: int; VAR gidset: int): int; + (* ok *) + + (* not implemented + (*** setquota - enable/disable quotas on a file system ***) + <*EXTERNAL*> PROCEDURE setquota (special, file: char_star): int; + *) + + (*** shutdown - shut down full-duplex connection ***) + <*EXTERNAL*> PROCEDURE shutdown (s, how: int): int; + (* ok *) + + (*** swapon - add a swap device for interleaved paging/swapping ***) + <*EXTERNAL*> PROCEDURE swapon (special: char_star): int; + (* ok *) + + (*** symlink - make symbolic link to a file ***) + <*EXTERNAL*> PROCEDURE symlink (name1, name2: char_star): int; + (* ok *) + + (*** sync - update super-block ***) + <*EXTERNAL*> PROCEDURE sync (); + (* ok *) + + (*** truncate, ftruncate - truncate a file to a specified length ***) + <*EXTERNAL*> + PROCEDURE truncate (path: char_star; length: off_t): int; + <*EXTERNAL*> + PROCEDURE ftruncate (fd, length: off_t): int; + (* ok *) + + (* not implemented + (*** ulimit - get and set user limits ***) + <*EXTERNAL*> PROCEDURE ulimit (cmd: int; newlimit: long): long; + *) + + (*** umask - set file creation mask ***) + <*EXTERNAL*> PROCEDURE umask (numask: mode_t): mode_t; + (* ok *) + + (*** unlink - remove directory entry ***) + <*EXTERNAL*> PROCEDURE unlink (path: char_star): int; + (* ok *) + + (*** utimes - set file times ***) + <*EXTERNAL*> PROCEDURE utimes (file: char_star; + tvp: UNTRACED REF ARRAY [0..1] OF struct_timeval): int; + (* ok *) + + (*** vfork - spawn new process in a virtual memory efficient way ***) + <*EXTERNAL*> PROCEDURE vfork (): int; + (* ok *) + + (* not implemented, obsolete + (*** vhangup - virtually hang up the current control terminal ***) + <*EXTERNAL*> PROCEDURE vhangup (): int; + *) + + (* not implemented + (*** rexec(3x) - return stream to a remote command ***) + <*EXTERNAL*> PROCEDURE rexec (VAR ahost: char_star; + inport: u_short; + user, passwd, cmd: char_star; + fd2p: int_star): int; + *) + + (*** isatty(3) ***) + <*EXTERNAL*> PROCEDURE isatty (filedes: int): int; + (* ok *) + + (*** system(3) ***) + <*EXTERNAL*> PROCEDURE system (string: char_star): int; + (* ok *) + + + END Unix. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uprocess.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uprocess.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uprocess.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,28 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Fri Mar 16 12:35:23 1990 by muller *) + + INTERFACE Uprocess; + + FROM Ctypes IMPORT int; + + + (*** getpgrp(2) - get process group ***) + + <*EXTERNAL*> PROCEDURE getpgrp (pid: int): int; + + + (*** getpid(2), getppid(2) - get process identification ***) + + <*EXTERNAL*> PROCEDURE getpid (): int; + <*EXTERNAL*> PROCEDURE getppid (): int; + + + (*** setpgrp - set process group ***) + + <*EXTERNAL*> PROCEDURE setpgrp (pid, pgrp: int): int; + + + END Uprocess. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Upwd.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Upwd.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Upwd.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,44 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Mon Mar 09 19:02:29 PST 1992 by muller *) + + INTERFACE Upwd; + + FROM Ctypes IMPORT char_star, int; + FROM Utypes IMPORT uid_t; + + (*** ***) + + TYPE + struct_passwd = RECORD + pw_name: char_star; + pw_passwd: char_star; + pw_uid: uid_t; + pw_gid: uid_t; + pw_gecos: char_star; + pw_dir: char_star; + pw_shell: char_star; + END; + + struct_comment = RECORD + c_dept: char_star; + c_name: char_star; + c_acct: char_star; + c_bin: char_star; + END; + + struct_passwd_star = UNTRACED REF struct_passwd; + + (*** getpwent, getpwuid, getpwnam, setpwent, endpwent(2) - get + password file entry ***) + + <*EXTERNAL*> PROCEDURE getpwent (): struct_passwd_star; + <*EXTERNAL*> PROCEDURE getpwuid (uid: int): struct_passwd_star; + <*EXTERNAL*> PROCEDURE getpwnam (name: char_star): struct_passwd_star; + <*EXTERNAL*> PROCEDURE setpwent(): int; + <*EXTERNAL*> PROCEDURE endpwent(): int; + + END Upwd. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uresource.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uresource.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uresource.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,101 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Wed Mar 25 16:45:57 PST 1992 by muller *) + (* ow 03.10.1994 *) + + INTERFACE Uresource; + + FROM Ctypes IMPORT int, long; + IMPORT Utime; + + (*** ***) + + CONST + PRIO_MIN = -20; + PRIO_MAX = 20; + + PRIO_PROCESS = 0; + PRIO_PGRP = 1; + PRIO_USER = 2; + + (* Resource utilization information. *) + + CONST + RUSAGE_SELF = 0; + RUSAGE_CHILDREN = -1; + + TYPE + struct_rusage = RECORD + ru_utime: Utime.struct_timeval; (* user time used *) + ru_stime: Utime.struct_timeval; (* system time used *) + ru_maxrss: long; + ru_ixrss: long; (* integral shared text size *) + (* Unsupported in Linux 1.0: + ru_ismrss: long; (* integral shared memory size*) + ******************************) + ru_idrss: long; (* integral unshared data " *) + ru_isrss: long; (* integral unshared stack " *) + ru_minflt: long; (* page reclaims *) + ru_majflt: long; (* page faults *) + ru_nswap: long; (* swaps *) + ru_inblock: long; (* block input operations *) + ru_oublock: long; (* block output operations *) + ru_msgsnd: long; (* messages sent *) + ru_msgrcv: long; (* messages received *) + ru_nsignals: long; (* signals received *) + ru_nvcsw: long; (* voluntary context switches *) + ru_nivcsw: long; (* involuntary " *) + END; + struct_rusage_star = UNTRACED REF struct_rusage; + + (* Resource limits *) + + CONST + RLIMIT_CPU = 0; (* cpu time in milliseconds *) + RLIMIT_FSIZE = 1; (* maximum file size *) + RLIMIT_DATA = 2; (* data size *) + RLIMIT_STACK = 3; (* stack size *) + RLIMIT_CORE = 4; (* core file size *) + RLIMIT_RSS = 5; (* resident set size *) + RLIMIT_MEMLOCK = 6; (* locked-in-memory address space *) + RLIMIT_NPROC = 7; (* number of processes *) + RLIMIT_OFILE = 8; (* number of open files *) + + + RLIM_NLIMITS = 9; (* number of resource limits *) + + RLIM_INFINITY = 16_7fffffff; + + TYPE + struct_rlimit = RECORD + rlim_cur: int; (* current (soft) limit *) + rlim_max: int; (* maximum value for rlim_cur *) + END; + + + (*** getpriority(2), setpriority(2) - get/set program scheduling priority ***) + + <*EXTERNAL*> PROCEDURE getpriority (which, who: int): int; + <*EXTERNAL*> PROCEDURE setpriority (which, who, prio: int): int; + + + (*** getrlimit(2), setrlimit(2) - control maximum system resource + consumption ***) + + <*EXTERNAL*> PROCEDURE getrlimit (resource: int; VAR rlp: struct_rlimit): int; + <*EXTERNAL*> PROCEDURE setrlimit (resource: int; VAR rlp: struct_rlimit): int; + + + (*** getrusage(2) - get information about resource utilization ***) + + <*EXTERNAL*> PROCEDURE getrusage (who: int; rus: struct_rusage_star): int; + + + (*** nice(3) - set program priority ***) + + <*EXTERNAL*> PROCEDURE nice (incr: int): int; + + END Uresource. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usem.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usem.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usem.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,155 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Fri Apr 30 14:44:50 PDT 1993 by muller *) + (* modified on Wed Dec 23 17:44:54 PST 1992 by jdd *) + + UNSAFE INTERFACE Usem; + + FROM Ctypes IMPORT short, int; + FROM Utypes IMPORT ushort, time_t; + FROM Uexec IMPORT wait_queue_star; + FROM Uipc IMPORT struct_ipc_perm; + + (*** ***) + + (* + ** IPC Semaphore Facility. + *) + + (* + ** Implementation Constants. + *) + + CONST + + PZERO = 25; (* I got this value from param.h; em *) + + PSEMN = (PZERO + 3); (* sleep priority waiting for greater value *) + PSEMZ = (PZERO + 2); (* sleep priority waiting for zero *) + + (* + ** Permission Definitions. + *) + + SEM_A = 8_0200; (* alter permission *) + SEM_R = 8_0400; (* read permission *) + + (* + ** Semaphore Operation Flags. + *) + + SEM_UNDO = 8_010000; (* set up adjust on exit entry *) + + (* + ** Semctl Command Definitions. (from /usr/include/linux/sem.h) + *) + + GETPID = 11; (* get sempid *) + GETVAL = 12; (* get semval *) + GETALL = 13; (* get all semval's *) + GETNCNT = 14; (* get semncnt *) + GETZCNT = 15; (* get semzcnt *) + SETVAL = 16; (* set semval *) + SETALL = 17; (* set all semval's *) + + (* + ** Structure Definitions. + *) + + (* + ** There is one semaphore id data structure for each set of semaphores + ** in the system. + *) + + TYPE + struct_semid_ds = RECORD + sem_perm : struct_ipc_perm; (* operation permission struct *) + sem_otime : time_t; (* last semop time *) + sem_ctime : time_t; (* last change time *) + sem_base : UNTRACED REF struct_sem; (* ptr to first semaphore in set *) + eventn : wait_queue_star; + eventz : wait_queue_star; + undo : UNTRACED REF struct_sem_undo; + sem_nsems : ushort; (* # of semaphores in set *) + END; + + (* + ** There is one semaphore structure for each semaphore in the system. + *) + + struct_sem = RECORD + sempid : short; (* pid of last operation *) + semval : ushort; (* semaphore text map address *) + semncnt : short; (* # awaiting semval > cval *) + semzcnt : ushort; (* # awaiting semval = 0 *) + END; + + (* + ** There is one undo structure per process in the system. + *) + + struct_sem_undo = RECORD + proc_next : UNTRACED REF struct_sem_undo; + id_next : UNTRACED REF struct_sem_undo; + semid : int; + semadj : short; + sem_num : ushort; + END; + + (* + ** semaphore information structure + *) + + struct_seminfo = RECORD + semmap: int; (* # of entries in semaphore map *) + semmni: int; (* # of = semaphore; identifiers *) + semmns: int; (* # of semaphores in system *) + semmnu: int; (* # of undo structures in system *) + semmsl: int; (* max # of semaphores per id *) + semopm: int; (* max # of operations per semop call *) + semume: int; (* max # of undo entries per process *) + semusz: int; (* size in bytes of undo structure *) + semvmx: int; (* semaphore maximum value *) + semaem: int; (* adjust on exit max value *) + END; + + (* + ** User semaphore template for semop system calls. + *) + + struct_sembuf = RECORD + sem_num: ushort; (* semaphore # *) + sem_op: short; (* semaphore operation *) + sem_flg: short; (* operation flags *) + END; + + (* + * Sizing constants + *) + + CONST + + SEMMAP = 10; + SEMMNI = 10; + SEMMNS = 60; + SEMMNU = 30; + SEMMSL = 25; + SEMOPM = 10; + SEMUME = 10; + SEMVMX = 32767; + SEMAEM = 16384; + + + TYPE + union = union_val; + + union_val = int; + union_buf = UNTRACED REF struct_semid_ds; + (* union_array = ARRAY OF ushort *) + + + + END Usem. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Ushm.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Ushm.i3:1.1 *** /dev/null Mon Jun 7 17:09:16 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Ushm.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,201 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Wed Mar 4 11:53:08 PST 1992 by muller *) + + INTERFACE Ushm; + + FROM Ctypes IMPORT char, short, int, char_star; + FROM Utypes IMPORT time_t, key_t, size_t, ushort, swblk_t; + FROM Uipc IMPORT struct_ipc_perm; + + (*** ***) + + (* + ** IPC Shared Memory Facility. + *) + + (* + ** Implementation Constants. + *) + + CONST + (* segment low boundary address multiple *) + (* (SMLBA must be a power of 2) *) + (* SMLBA = ctob(CLSIZE); where does ctob come from ? - em *) + + (* for SYSTEM V compatibility *) + (* SHMLBA = SMLBA; see SMLBA - em *) + + (* + ** Permission Definitions. + *) + + SM_R = 8_0400; (* read permission *) + SM_W = 8_0200; (* write permission *) + + (* for SYSTEM V compatibility *) + SHM_R = SM_R; + SHM_W = SM_W; + + (* + ** ipc_perm Mode Definitions. + *) + + SM_CLEAR = 8_01000; (* clear segment on next attach *) + SM_DEST = 8_02000; (* destroy seg when # attached = 0 *) + + (* for SYSTEM V compatibility *) + SHM_INIT = SM_CLEAR; + SHM_DEST = SM_DEST; + + (* + ** Message Operation Flags. + *) + + SM_RDONLY = 8_010000; (* attach read-only (else read-write) *) + SM_RND = 8_020000; (* round attach address to SHMLBA *) + + (* for SYSTEM V compatibility *) + SHM_RDONLY = SM_RDONLY; + SHM_RND = SM_RND; + + (* + * sizing constant (the balance are in /sys/h/param.h and /sys/conf/param.c. + *) + SMMNI = 100; (* Max number SM segments in system *) + + (* + ** Structure Definitions. + *) + + + (* + ** There is a shared mem id struct for each segment in the system. + *) + + TYPE + struct_smem = RECORD + (* SM_PERM must be the first *) + (* element in the structure. *) + sm_perm: struct_ipc_perm; (* permission struct *) + sm_daddr: UNTRACED REF swblk_t; (* disk addrs of DMTEXT page segs *) + sm_ptdaddr: swblk_t; (* disk address of page table *) + sm_size: size_t ; (* segment size (bytes) *) + + (* sm_caddr: UNTRACED REF struct_proc; (* ptr to linked proc, if loaded *)*) + sm_caddr: ADDRESS; (* where is struct_proc ? - em *) + + (* sm_ptaddr: UNTRACED REF struct_pte; (* ptr to assoc page table *) *) + sm_ptaddr: ADDRESS; (* where is struct_pte ? - em *) + + sm_rssize: size_t; (* SM resource set size (pages) *) + sm_lpid: ushort; (* pid of last smop *) + sm_cpid: ushort; (* pid of creator *) + sm_count: char; (* reference count *) + sm_ccount: char; (* number of loaded references *) + sm_lcount: short; (* number of processes locking SMS *) + sm_flag: short; (* traced, written flags *) + sm_poip: short; (* page out in progress count *) + sm_atime: time_t; (* last smat time *) + sm_dtime: time_t; (* last smdt time *) + sm_ctime: time_t; (* last change time *) + END; + + (* for SYSTEM V compatibility *) + (* key_t = long; already defined in Utypes.i3 - em *) + + struct_shmid_ds = RECORD + (* SM_PERM must be the first *) + (* element in the structure. *) + shm_perm: struct_ipc_perm; (* permission struct *) + sm_daddr: UNTRACED REF swblk_t; (* disk addrs of DMTEXT page segs *) + sm_ptdaddr: swblk_t; (* disk address of page table *) + shm_segsz: size_t ; (* segment size (bytes) *) + + (* sm_caddr: UNTRACED REF struct_proc; (* ptr to linked proc, if loaded *)*) + sm_caddr: ADDRESS; (* where is struct_proc ? - em *) + + (* sm_ptaddr: UNTRACED REF struct_pte; (* ptr to assoc page table *) *) + sm_ptaddr: ADDRESS; (* where is struct_pte ? - em *) + + sm_rssize: size_t; (* SM resource set size (pages) *) + shm_lpidL: ushort; (* pid of last smop *) + shm_cpid: ushort; (* pid of creator *) + shm_nattch: char; (* reference count *) + sm_ccount: char; (* number of loaded references *) + sm_lcount: short; (* number of processes locking SMS *) + sm_flag: short; (* traced, written flags *) + sm_poip: short; (* page out in progress count *) + shm_atime: time_t; (* last smat time *) + shm_dtime: time_t; (* last smdt time *) + shm_ctime: time_t; (* last change time *) + END; + + struct_shmid_ds_star = UNTRACED REF struct_shmid_ds; + + CONST + + (* NOTE: These values must align with X* flag values in text.h *) + SMLOCK = 8_0010; (* Being swapped in or out *) + SMWANT = 8_0020; (* Wanted for swapping *) + SMNOSW = 8_0100; (* Lock segment in memory *) + + (* shared memory specific commands for shmctl syscall *) + SHM_LOCK = 3; (* Lock segment in memory *) + SHM_UNLOCK = 4; (* Unlock segment in memory *) + + (* + * sminfo structure is used by the system for bounds checking. All of + * the elements in this structure are initialized in /sys/conf/param.c. + * + * Three of the elements are configurable via the "config" program + * (smmax, smmin, smbrk). If they are not config'ed, then they all + * have defaults. + *) + + TYPE + struct_sminfo = RECORD + smmax: int; (* max shared memory segment size *) + smmin: int; (* min shared memory segment size *) + smmni: int; (* # of shared memory identifiers *) + smseg: int; (* max attached shared memory segs per proc *) + smbrk: int; (* gap (in clicks) used between data and SM *) + smsmat: int; (* max shmem attach addr (clicks) *) + END; + + (* for SYSTEM V compatibility *) + struct_shminfo = RECORD + shmmax: int; (* max shared memory segment size *) + shmmin: int; (* min shared memory segment size *) + shmmni: int; (* # of shared memory identifiers *) + shmseg: int; (* max attached shared memory segs per proc *) + shmbrk: int; (* gap (in clicks) used between data and SM *) + smsmat: int; (* max shmem attach addr (clicks) *) + END; + + + (*** shmctl(2) - shared memory control operations ***) + + <*EXTERNAL*> + PROCEDURE shmctl (shmid, cmd: int; buf: struct_shmid_ds_star): int; + + + + (*** shmget(2) - get shared memory segment ***) + + <*EXTERNAL*> + PROCEDURE shmget (key: key_t; size, semflg: int): int; + + + (*** shmat(2), shmdt(2) - shared memory operations ***) + + <*EXTERNAL*> + PROCEDURE shmat (shmid: int; shmaddr: char_star; shmflg: int): char_star; + + <*EXTERNAL*> + PROCEDURE shmdt (shmaddr: char_star): int; + + + END Ushm. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usignal.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usignal.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usignal.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,210 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Tue Mar 2 17:18:02 PST 1993 by muller *) + (* ow 03.10.1994 *) + + INTERFACE Usignal; + + FROM Ctypes IMPORT int, unsigned_int, long, unsigned_long; + + (*** ***) + + CONST + SIGHUP = 1; (* hangup *) + SIGINT = 2; (* interrupt *) + SIGQUIT = 3; (* quit *) + SIGILL = 4; (* illegal instruction (not reset when caught) *) + SIGTRAP = 5; (* trace trap (not reset when caught) *) + SIGIOT = 6; (* IOT instruction *) + SIGEMT = 7; (* EMT instruction *) + SIGFPE = 8; (* floating point 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_PAGE_FAULT = 12; (* page fault protection base *) + BUS_SEGNP_FAULT = 26; (* segment not present *) + BUS_STK_FAULT = 27; (* stack fault *) + SIGSEGV = 11; (* segmentation violation *) + SIGSYS = 12; (* bad argument to system call *) + SIGPIPE = 13; (* write on a pipe with no one to read it *) + SIGALRM = 14; (* alarm clock *) + SIGTERM = 15; (* software termination signal from kill *) + SIGURG = 16; (* urgent condition on IO channel *) + SIGSTOP = 17; (* sendable stop signal not from tty *) + SIGTSTP = 18; (* stop signal from tty *) + SIGCONT = 19; (* continue a stopped process *) + SIGCHLD = 20; (* to parent on child stop or exit *) + SIGTTIN = 21; (* to readers pgrp upon background tty read *) + SIGTTOU = 22; (* like TTIN for output if (tp->t_local<OSTOP) *) + SIGIO = 23; (* input/output possible signal *) + SIGXCPU = 24; (* exceeded CPU time limit *) + SIGXFSZ = 25; (* exceeded file size limit *) + SIGVTALRM = 26; (* virtual time alarm *) + SIGPROF = 27; (* profiling time alarm *) + SIGWINCH = 28; (* window size changes *) + SIGINFO = 29; (* information request *) + SIGUSR1 = 30; (* user defined signal 1 *) + SIGUSR2 = 31; (* user defined signal 2 *) + + (* System V definitions *) + SIGCLD = SIGCHLD; + SIGABRT = SIGIOT; + + + (* Signal vector "template" used in sigaction call. *) + TYPE + SignalHandler = PROCEDURE (sig, code: int; + scp: UNTRACED REF struct_sigcontext); + + sigset_t = int; + + struct_sigvec = RECORD + sv_handler: SignalHandler; (* signal handler *) + sv_mask: sigset_t; (* 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; + + CONST + (* Valid flags defined for sv_flags field of sigvec structure. *) + SV_ONSTACK = 16_0001; (* run on special signal stack *) + SV_RESTART = 16_0002; (* restart system calls on sigs *) + SV_RESETHAND = 16_0004; (* reset to SIG_DFL when taking signal *) + SV_NOCLDSTOP = 16_0008; (* do not generate SIGCHLD on child stop *) + SV_NODEFER = 16_0010; (* don't mask the signal we're delivering *) + + (* Defines for sigprocmask() call. POSIX. *) + SIG_BLOCK = 1; (* Add these signals to block mask *) + SIG_UNBLOCK = 2; (* Remove these signals from block mask *) + SIG_SETMASK = 3; (* Set block mask to this mask *) + + TYPE + struct_sigaction = RECORD + sa_handler : SignalHandler; (* signal handler *) + sa_mask : sigset_t; (* signals to block while in handler *) + sa_flags : int; (* signal action flags *) + END; + + struct_sigaction_star = UNTRACED REF struct_sigaction; + + CONST + (* Valid flags defined for sa_flags field of sigaction structure. *) + SA_ONSTACK = 16_0001; (* run on special signal stack *) + SA_RESTART = 16_0002; (* restart system calls on sigs *) + SA_RESETHAND = 16_0004; (* reset to SIG_DFL when taking signal *) + SA_NOCLDSTOP = 16_0008; (* do not generate SIGCHLD on child stop *) + SA_NODEFER = 16_0010; (* don't mask the signal we're delivering *) + + TYPE + struct_sigstack = RECORD + ss_sp: ADDRESS; (* signal stack pointer *) + ss_onstack: int; (* current status *) + END; + + (* + * Information pushed on stack when a signal is delivered. + * This is used by the kernel to restore state following + * 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. + *) + + TYPE + struct_sigcontext = RECORD + sc_onstack: long; (* sigstack state to restore *) + sc_mask: long; (* signal mask to restore *) + sc_pc: long; (* program counter to restore *) + sc_ps: long; + sc_regs: ARRAY [0..31] OF unsigned_long; (* struct reg *) + sc_ownedfp: long; + sc_fpregs: ARRAY [0..31] OF unsigned_long; (* struct fpreg *) + sc_fpcr: unsigned_long; + sc_fp_control: unsigned_long; + sc_reserved: ARRAY [0..1] OF long; + sc_xxx1: ARRAY [0..1] OF long; (* sc_ssize, sc_sbase on DUX *) + sc_traparg_a0: unsigned_long; + sc_traparg_a1: unsigned_long; + sc_traparg_a2: unsigned_long; + sc_xxx2: ARRAY [0..2] OF long; + END; + + CONST R_SP = 30; (* Index of stack pointer in sc_regs. *) + + (* Do not modifiy these variables *) + VAR (*CONST*) + BADSIG, SIG_ERR, SIG_DFL, SIG_IGN, SIG_HOLD: SignalHandler; + + + (* Convert a signal number to a mask suitable for sigblock(). *) + <*INLINE*> PROCEDURE sigmask (n: int): int; + + + (*** kill(2) - send signal to a process ***) + + <*EXTERNAL*> PROCEDURE kill (pid, sig: int): int; + + + (*** killpg(2) - send signal to a process or process group ***) + + <*EXTERNAL*> PROCEDURE killpg (pgrp, sig: int): int; + + + (*** sigblock(2) - block signals ***) + + <*EXTERNAL*> PROCEDURE sigblock (mask: int): int; + + + (*** sigpause(2) - atomically release blocked signals and wait for + interrupt ***) + + <*EXTERNAL*> PROCEDURE sigpause (sigmask: int): int; + + + (*** sigpending(2) - examine pending signals ***) + + <*EXTERNAL*> PROCEDURE sigpending (VAR set: sigset_t): int; + + + (*** sigsetmask(2) - set current signal mask ***) + + <*EXTERNAL*> PROCEDURE sigsetmask (mask: int): unsigned_int; + + + (*** sigstack(2) - set and/or get signal stack context ***) + + <*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 ***) + + (* FIXME - This should probably use the VAR construct like the other + platforms use. *) + <*EXTERNAL*> + PROCEDURE sigaction (sig: int; act, oact: struct_sigaction_star): int; + + (*** sigvec(2) - software signal facilities ***) + + <*EXTERNAL*> + PROCEDURE sigvec (sig: int; VAR vec, ovec: struct_sigvec): int; + + <*EXTERNAL*> + PROCEDURE sigprocmask (how: int; VAR set, oldset: sigset_t) : int; + + END Usignal. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usignal.m3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usignal.m3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usignal.m3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,22 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Mon Oct 12 15:51:28 PDT 1992 by muller *) + + UNSAFE MODULE Usignal; + + IMPORT Word, Ctypes; + + PROCEDURE sigmask (n: Ctypes.int): Ctypes.int = + BEGIN + RETURN Word.Shift (1, n-1); + END sigmask; + + BEGIN + BADSIG := LOOPHOLE (-1, SignalHandler); + SIG_ERR := LOOPHOLE (-1, SignalHandler); + SIG_DFL := LOOPHOLE ( 0, SignalHandler); + SIG_IGN := LOOPHOLE ( 1, SignalHandler); + SIG_HOLD := LOOPHOLE ( 3, SignalHandler); + END Usignal. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usocket.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usocket.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usocket.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,347 ---- + (* Copyright (C) 1989, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Fri Apr 30 14:46:21 PDT 1993 by muller *) + (* modified on Wed Jul 11 9:34:54 PDT 1990 by mjordan *) + + INTERFACE Usocket; + + + IMPORT Ctypes, Utypes, Uuio; + + (*** sys/socket.h ***) + + (* + * Definitions related to sockets: types, address families, options. + *) + + (* + * Types + *) + CONST + SOCK_STREAM = 1; (* stream socket *) + SOCK_DGRAM = 2; (* datagram socket *) + SOCK_RAW = 3; (* raw-protocol interface *) + SOCK_RDM = 4; (* reliably-delivered message *) + SOCK_SEQPACKET = 5; (* sequenced packet stream *) + + (* + * Option flags per-socket. + *) + SO_DEBUG = 16_0001; (* turn on debugging info recording *) + SO_ACCEPTCONN = 16_0002; (* socket has had listen() *) + SO_REUSEADDR = 16_0004; (* allow local address reuse *) + SO_KEEPALIVE = 16_0008; (* keep connections alive *) + SO_DONTROUTE = 16_0010; (* just use interface addresses *) + SO_BROADCAST = 16_0020; (* permit sending of broadcast msgs *) + SO_USELOOPBACK = 16_0040; (* bypass hardware when possible *) + SO_LINGER = 16_0080; (* linger on close if data present *) + SO_OOBINLINE = 16_0100; (* leave received OOB data in line *) + SO_REUSEPORT = 16_0200; (* allow local address & port reuse *) + SO_TIMESTAMP = 16_0400; (* timestamp received dgram traffic *) + + (* + * Additional options, not kept in so_options. + *) + SO_SNDBUF = 16_1001; (* send buffer size *) + SO_RCVBUF = 16_1002; (* receive buffer size *) + SO_SNDLOWAT = 16_1003; (* send low-water mark *) + SO_RCVLOWAT = 16_1004; (* receive low-water mark *) + SO_SNDTIMEO = 16_1005; (* send timeout *) + SO_RCVTIMEO = 16_1006; (* receive timeout *) + SO_ERROR = 16_1007; (* get error status and clear *) + SO_TYPE = 16_1008; (* get socket type *) + SO_PRIVSTATE = 16_1009; (* get/deny privileged state *) + + (* + * Structure used for manipulating linger option. + *) + TYPE + struct_linger = RECORD + l_onoff: Ctypes.int; (* option on/off *) + l_linger: Ctypes.int; (* linger time *) + END; + + + (* + * Level number for (get/set)sockopt() to apply to socket itself. + *) + CONST + SOL_SOCKET = 16_ffff; (* options for socket level *) + + + (* + * Address families. + *) + AF_UNSPEC = 0; (* unspecified *) + AF_LOCAL = 1; (* local to host (pipes, portals) *) + AF_UNIX = AF_LOCAL; (* backward compatibility *) + AF_INET = 2; (* internetwork: UDP, TCP, etc. *) + AF_IMPLINK = 3; (* arpanet imp addresses *) + AF_PUP = 4; (* pup protocols: e.g. BSP *) + AF_CHAOS = 5; (* mit CHAOS protocols *) + AF_NS = 6; (* XEROX NS protocols *) + AF_ISO = 7; (* ISO protocols *) + AF_OSI = AF_ISO; + AF_ECMA = 8; (* European computer manufacturers *) + AF_DATAKIT = 9; (* datakit protocols *) + AF_CCITT = 10; (* CCITT protocols, X.25 etc *) + AF_SNA = 11; (* IBM SNA *) + AF_DECnet = 12; (* DECnet *) + AF_DLI = 13; (* DEC Direct data link interface *) + AF_LAT = 14; (* LAT *) + AF_HYLINK = 15; (* NSC Hyperchannel *) + AF_APPLETALK = 16; (* Apple Talk *) + AF_ROUTE = 17; (* Internal Routing Protocol *) + AF_LINK = 18; (* Link layer interface *) + pseudo_AF_XTP = 19; (* eXpress Transfer Protocol (no AF) *) + AF_COIP = 20; (* connection-oriented IP, aka ST II *) + AF_CNT = 21; (* Computer Network Technology *) + pseudo_AF_RTIP = 22; (* Help Identify RTIP packets *) + AF_IPX = 23; (* Novell Internet Protocol *) + AF_SIP = 24; (* Simple Internet Protocol *) + pseudo_AF_PIP = 25; (* Help Identify PIP packets *) + AF_ISDN = 26; (* Integrated Services Digital Network*) + AF_E164 = AF_ISDN; (* CCITT E.164 recommendation *) + pseudo_AF_KEY = 27; (* Internal key-management function *) + + AF_MAX = 28; + + (* + * Structure used by kernel to store most + * addresses. + *) + TYPE + struct_sockaddr = RECORD + sa_len: Ctypes.unsigned_char; (* total length *) + sa_family: Ctypes.unsigned_char; (* address family *) + sa_data: ARRAY [0..13] OF Ctypes.char; (* address; actually longer *) + END; + + + (* + * Structure used by kernel to pass protocol + * information in raw sockets. + *) + struct_sockproto = RECORD + sp_family: Ctypes.unsigned_short; (* address family *) + sp_protocol: Ctypes.unsigned_short; (* protocol *) + END; + + (* + * Protocol families, same as address families for now. + *) + CONST + PF_UNSPEC = AF_UNSPEC; + PF_LOCAL = AF_LOCAL; + PF_UNIX = PF_LOCAL; (* backward compatibility *) + PF_INET = AF_INET; + PF_IMPLINK = AF_IMPLINK; + PF_PUP = AF_PUP; + PF_CHAOS = AF_CHAOS; + PF_NS = AF_NS; + PF_ISO = AF_ISO; + PF_OSI = AF_ISO; + PF_ECMA = AF_ECMA; + PF_DATAKIT = AF_DATAKIT; + PF_CCITT = AF_CCITT; + PF_SNA = AF_SNA; + PF_DECnet = AF_DECnet; + PF_DLI = AF_DLI; + PF_LAT = AF_LAT; + PF_HYLINK = AF_HYLINK; + PF_APPLETALK = AF_APPLETALK; + PF_ROUTE = AF_ROUTE; + PF_LINK = AF_LINK; + PF_XTP = pseudo_AF_XTP; (* really just proto family, no AF *) + PF_COIP = AF_COIP; + PF_CNT = AF_CNT; + PF_SIP = AF_SIP; + PF_IPX = AF_IPX; (* same format as AF_NS *) + PF_RTIP = pseudo_AF_RTIP; (* same format as AF_INET *) + PF_PIP = pseudo_AF_PIP; + PF_ISDN = AF_ISDN; + PF_KEY = pseudo_AF_KEY; + + PF_MAX = AF_MAX; + + (* + * Maximum queue length specifiable by listen. + *) + SOMAXCONN = 128; + + (* + * Message header for recvmsg and sendmsg calls. + *) + TYPE + struct_msghdr = RECORD + msg_name: Utypes.caddr_t; (* optional address *) + msg_namelen: Ctypes.unsigned_int; (* size of address *) + msg_iov: Uuio.struct_iovec_star; (* scatter/gather array *) + msg_iovlen: Ctypes.unsigned_int; (* # elements in msg_iov *) + msg_control: Utypes.caddr_t; (* ancillary data, see below *) + msg_controllen: Ctypes.unsigned_int; (* ancillary data buffer len *) + msg_flags: Ctypes.int; (* flags on received message *) + END; + + + CONST + MSG_OOB = 16_1; (* process out-of-band data *) + MSG_PEEK = 16_2; (* peek at incoming message *) + MSG_DONTROUTE = 16_4; (* send without using routing tables *) + MSG_EOR = 16_8; (* data completes record *) + MSG_TRUNC = 16_10; (* data discarded before delivery *) + MSG_CTRUNC = 16_20; (* control data lost before delivery *) + MSG_WAITALL = 16_40; (* wait for full request or error *) + MSG_DONTWAIT = 16_80; (* this message should be nonblocking *) + MSG_EOF = 16_100; (* data completes connection *) + MSG_COMPAT = 16_8000; (* used in sendit() *) + + (* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + *) + TYPE + struct_cmsghdr = RECORD + cmsg_len: Ctypes.unsigned_int; (* data byte count, including hdr *) + cmsg_level: Ctypes.int; (* originating protocol *) + cmsg_type: Ctypes.int; (* protocol-specific type *) + (* followed by u_char cmsg_data[]; *) + END; + + (* "Socket"-level control message types: *) + CONST + SCM_RIGHTS = 16_01; (* access rights (array of int) *) + SCM_TIMESTAMP = 16_02; (* timestamp (struct timeval) *) + + (* + * Definitions for UNIX IPC domain. + *) + TYPE + struct_sockaddr_un = RECORD + sun_len: Ctypes.unsigned_char; (* sockaddr len including null *) + sun_family: Ctypes.unsigned_char; (* AF_UNIX *) + sun_path: ARRAY [0..103] OF Ctypes.char; (* path name (gag) *) + END; + + <*EXTERNAL "m3_accept"*> + PROCEDURE accept( + s: Ctypes.int; + addr: UNTRACED REF struct_sockaddr; + addrlen: Ctypes.int_star) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_bind"*> + PROCEDURE bind( + s: Ctypes.int; + name: UNTRACED REF struct_sockaddr; + namelen: Ctypes.int) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_connect"*> + PROCEDURE connect( + s: Ctypes.int; + name: UNTRACED REF struct_sockaddr; + namelen: Ctypes.int) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_getpeername"*> + PROCEDURE getpeername( + s: Ctypes.int; + name: UNTRACED REF struct_sockaddr; + namelen: Ctypes.int_star) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_getsockname"*> + PROCEDURE getsockname( + s: Ctypes.int; + name: UNTRACED REF struct_sockaddr; + namelen: Ctypes.int_star) + : Ctypes.int + RAISES {}; + + <*EXTERNAL*> + PROCEDURE getsockopt( + s, level, optname: Ctypes.int; + optval: Ctypes.void_star; + optlen: Ctypes.int_star) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_listen"*> + PROCEDURE listen(s, backlog: Ctypes.int): Ctypes.int RAISES {}; + + <*EXTERNAL "m3_recv"*> + PROCEDURE recv( + s: Ctypes.int; + buf: Ctypes.void_star; + len: Utypes.size_t; + flags: Ctypes.int) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_recvfrom"*> + PROCEDURE recvfrom( + s: Ctypes.int; + buf: Ctypes.void_star; + len: Utypes.size_t; + flags: Ctypes.int; + from: UNTRACED REF struct_sockaddr; + fromlen: Ctypes.int_star) + : Ctypes.int + RAISES {}; + + (* FIXME - recvmsg *) + + <*EXTERNAL "m3_send"*> + PROCEDURE send( + s: Ctypes.int; + msg: Ctypes.const_void_star; + len: Utypes.size_t; + flags: Ctypes.int) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_sendto"*> + PROCEDURE sendto( + s: Ctypes.int; + msg: Ctypes.const_void_star; + len: Utypes.size_t; + flags: Ctypes.int; + to: UNTRACED REF struct_sockaddr; + tolen: Ctypes.int) + : Ctypes.int + RAISES {}; + + (* FIXME - sendmsg *) + + <*EXTERNAL*> + PROCEDURE setsockopt( + s, level, optname: Ctypes.int; + optval: Ctypes.const_void_star; + optlen: Ctypes.int) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_shutdown"*> + PROCEDURE shutdown(s, how: Ctypes.int): Ctypes.int RAISES {}; + + <*EXTERNAL "m3_socket" *> + PROCEDURE socket(af, type, protocol: Ctypes.int): Ctypes.int RAISES {}; + + <*EXTERNAL*> + PROCEDURE socketpair( + d, type, protocol: Ctypes.int; + sv: UNTRACED REF ARRAY [0..1] OF Ctypes.int) + : Ctypes.int + RAISES {}; + + END Usocket. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Ustat.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Ustat.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Ustat.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,95 ---- + (* Copyright (C) 1989, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Wed Mar 15 16:47:47 PST 1995 by kalsow *) + (* modified on Sat Feb 18 23:43:23 MET 1995 by ow *) + (* modified on Tue Mar 24 20:42:39 PST 1992 by muller *) + + INTERFACE Ustat; + + FROM Ctypes IMPORT int, char_star, long; + FROM Utypes IMPORT u_short, u_long, dev_t, ino_t, off_t; + FROM Utypes IMPORT mode_t, nlink_t, uid_t, gid_t, time_t, int32_t, + u_int32_t, int64_t; + + CONST + S_IFMT : u_short = 8_0170000; + S_IFSOCK: u_short = 8_0140000; + S_IFLNK : u_short = 8_0120000; + S_IFREG : u_short = 8_0100000; + S_IFPIPE: u_short = 8_0000000; (* no such constant in stat.h!*) + S_IFBLK : u_short = 8_0060000; + S_IFDIR : u_short = 8_0040000; + S_IFCHR : u_short = 8_0020000; + S_IFIFO : u_short = 8_0010000; + S_IFPORT = S_IFIFO; + S_ISUID : u_short = 8_0004000; + S_ISGID : u_short = 8_0002000; + S_ISVTX : u_short = 8_0001000; + S_IREAD : u_short = 8_0000400; + S_IWRITE: u_short = 8_0000200; + S_IEXEC : u_short = 8_0000100; + S_GREAD : u_short = 8_0000040; + S_GWRITE: u_short = 8_0000020; + S_GEXEC : u_short = 8_0000010; + S_OREAD : u_short = 8_0000004; + S_OWRITE: u_short = 8_0000002; + S_OEXEC : u_short = 8_0000001; + + TYPE + struct_stat = RECORD + st_dev : dev_t; + st_ino : ino_t; + st_mode : mode_t; + st_nlink : nlink_t; + st_uid : uid_t; + st_gid : gid_t; + st_rdev : dev_t; + st_atime : time_t; + st_atimensec : long; + st_mtime : time_t; + st_mtimensec : long; + st_ctime : time_t; + st_ctimensec : long; + st_size : off_t; + st_blocks : int64_t; + st_blksize : u_int32_t; + st_flags : u_int32_t; + st_gen : u_int32_t; + st_lspare : int32_t; + st_qspare1 : int64_t; + st_qspare2 : int64_t; + END; + + struct_stat_star = UNTRACED REF struct_stat; + + <*EXTERNAL*> PROCEDURE stat (path: char_star; buf: struct_stat_star): int; + + <*EXTERNAL*> PROCEDURE lstat (path: char_star; buf: struct_stat_star): int; + + <*EXTERNAL*> PROCEDURE fstat (fd: int; buf: struct_stat_star): int; + + (* chflags, fchflags *) + CONST + (* Definitions of flags stored in file flags word. *) + (* Super-user and owner changeable flags. *) + UF_SETTABLE = 16_0000ffff; (* mask of owner changeable flags *) + UF_NODUMP = 16_00000001; (* do not dump file *) + UF_IMMUTABLE = 16_00000002; (* file may not be changed *) + UF_APPEND = 16_00000004; (* writes to file may only append *) + UF_OPAQUE = 16_00000008; (* directory is opaque wrt. union *) + + (* Super-user changeable flags. *) + SF_SETTABLE = 16_ffff0000; (* mask of superuser changeable flags *) + SF_ARCHIVED = 16_00010000; (* file is archived *) + SF_IMMUTABLE = 16_00020000; (* file may not be changed *) + SF_APPEND = 16_00040000; (* writes to file may only append *) + + <*EXTERNAL*> + PROCEDURE chflags(path: char_star; flags: u_long): int; + + <*EXTERNAL*> + PROCEDURE fchflags(fd: int; flags: u_long): int; + + END Ustat. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usyslog.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usyslog.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Usyslog.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,66 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Tue Mar 24 22:25:39 PST 1992 by muller *) + (* modified on Mon Dec 16 09:46:14 PST 1991 by harrison *) + + INTERFACE Usyslog; + + (* + * These declarations are taken from + * + * You can't quite do everything from Modula-3 because syslog is like printf. + * + * Use the Syslog package instead--it's built on top of this and works better + * from Modula-3. + *) + + FROM Ctypes IMPORT char_star, int; + + (* defines for priorities *) + CONST + LOG_ALERT = 1; (* alert -- send to all users *) + LOG_SALERT = 2; (* subalert -- send to special users *) + LOG_EMERG = 3; (* emergency conditions *) + LOG_ERROR = 4; (* error *) + LOG_ERR = LOG_ERROR; (* synonym of LOG_ERROR *) + LOG_CRIT = 5; (* critical information *) + LOG_WARNING = 6; (* warning *) + LOG_NOTICE = 7; (* important information *) + LOG_INFO = 8; (* informational message *) + LOG_DEBUG = 9; (* debug level info *) + + (* + * Mode parameters to initlog. + *) + CONST + LOG_NULL = 0; (* don't touch log *) + LOG_SOUT = 1; (* log standard & diag output *) + LOG_DIAG = 2; (* log diagnostic output *) + LOG_INDEP = 3; (* log independently *) + LOG_CLOSE = 4; (* close the log *) + + (* + * Status parameters to initlog. + *) + CONST + LOG_PID = 16_0001; (* log the pid with each message *) + LOG_TIME = 16_0002; (* log the time with each message *) + LOG_COOLIT = 16_0004; (* suppress priority stuff *) + LOG_DGRAM = 16_0010; (* running over a datagram socket *) + + <* EXTERNAL *> + PROCEDURE openlog( + VALUE ident: char_star; + VALUE logstat: int); + + <* EXTERNAL *> + PROCEDURE syslog( + VALUE priority: int; + VALUE message: char_star); + + <* EXTERNAL *> + PROCEDURE closelog(); + + END Usyslog. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Utime.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Utime.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Utime.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,154 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Fri Apr 30 14:46:35 PDT 1993 by muller *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Wed Dec 2 11:29:00 PST 1992 by mcjones *) + (* modified on Mon Apr 23 16:37:40 1990 by jerome *) + (* ow 03.10.1994 *) + + + INTERFACE Utime; + + FROM Ctypes IMPORT char_star, int, long, long_star, + unsigned_short, short; + + (*** ***) + + TYPE + struct_timeval = RECORD + tv_sec: long; (* seconds *) + tv_usec: long; (* and microseconds *) END; + + struct_timezone = RECORD + tz_minuteswest: int; (* minutes west of Greenwich *) + tz_dsttime: int; (* type of dst correction *) END; + + CONST + DST_NONE = 0; (* not on dst *) + + DST_USA = 1; (* USA style dst *) + DST_AUST = 2; (* Australian style dst *) + DST_WET = 3; (* Western European dst *) + DST_MET = 4; (* Middle European dst *) + DST_EET = 5; (* Eastern European dst *) + DST_CAN = 6; (* Canada *) + + + TYPE + struct_itimerval = RECORD + it_interval: struct_timeval; (* timer interval *) + it_value: struct_timeval; (* current value *) END; + + struct_tm = RECORD + tm_sec: int; (* seconds (0 - 59) *) + tm_min: int; (* minutes (0 - 59) *) + tm_hour: int; (* hours (0 - 23) *) + tm_mday: int; (* day of month (1 - 31) *) + tm_mon: int; (* month of year (0 - 11) *) + tm_year: int; (* year - 1900 *) + tm_wday: int; (* day of week (Sunday = 0) *) + tm_yday: int; (* day of year (0 - 365) *) + tm_isdst: int; (* flag: daylight savings time in effect *) + tm_gmtoff:long; (* offset from GMT in seconds *) + tm_zone: char_star; (* abbreviation of timezone name *) + END; + + struct_tm_star = UNTRACED REF struct_tm; + + time_t = int; (* seconds since the Epoch *) + + (*** ***) + + (* + * Structure returned by times() + *) + + TYPE + struct_tms = RECORD + tms_utime: long; (* user time *) + tms_stime: long; (* system time *) + tms_cutime: long; (* user time, children *) + tms_cstime: long; (* system time, children *) + END; + + struct_tms_star = UNTRACED REF struct_tms; + + + (*** ***) + + (* + * Structure returned by ftime system call + *) + + TYPE + struct_timeb = RECORD + time: long; + millitm: unsigned_short; + timezone: short; + dstflag: short; + END; + + struct_timeb_star = UNTRACED REF struct_timeb; + + + + (*** gettimeofday(2), settimeofday(2) - get/set date and time ***) + + <*EXTERNAL*> + PROCEDURE gettimeofday (VAR t: struct_timeval; + VAR z: struct_timezone): int; + + <*EXTERNAL*> + PROCEDURE settimeofday (VAR t: struct_timeval; + VAR z: struct_timezone): int; + + (*** getitimer(2), setitimer(2) - get/set value of interval timer ***) + + CONST (* which *) + ITIMER_REAL = 0; (* real time intervals *) + ITIMER_VIRTUAL = 1; (* virtual time intervals *) + ITIMER_PROF = 2; (* user and system virtual time *) + + <*EXTERNAL*> + PROCEDURE getitimer (which: int; VAR value: struct_itimerval): int; + + <*EXTERNAL*> + PROCEDURE setitimer (which: int; + VAR value, ovalue: struct_itimerval): int; + + (*** stime(2) - set time ***) + (* not in FreeBSD + <*EXTERNAL*> PROCEDURE stime (VAR tp: long): int; + *) + + + (*** clock(3) - report CPU time used (in micro-seconds) ***) + + <*EXTERNAL*> PROCEDURE clock (): long; + + (*** times(3) - get process times (in ticks) ***) + + <*EXTERNAL*> PROCEDURE times (buffer: struct_tms_star): long; + + (*** time(3), ftime(3) - get date and time (in seconds) ***) + + <*EXTERNAL*> PROCEDURE time (tloc: long_star): long; + (* not in FreeBSD + <*EXTERNAL*> PROCEDURE ftime (tp: struct_timeb_star); + *) + + (*** ctime(3), localtime(3), gmtime(3), asctime(3) + - convert date and time (in seconds) to string ***) + + <*EXTERNAL*> PROCEDURE ctime (clock: long_star): char_star; + <*EXTERNAL*> PROCEDURE asctime (tm: struct_tm_star): char_star; + + <*EXTERNAL*> PROCEDURE localtime (clock: long_star): struct_tm_star; + <*EXTERNAL*> PROCEDURE gmtime (clock: long_star): struct_tm_star; + + (*** mktime(3) - convert a struct_tm to a time_t ***) + <*EXTERNAL*> PROCEDURE mktime (tm: struct_tm_star): time_t; + + END Utime. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Utypes.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Utypes.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Utypes.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,116 ---- + (* Copyright (C) 1994, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Sat Jan 7 14:47:05 PST 1995 by kalsow *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Mon Jan 11 14:34:58 PST 1993 by muller *) + (* ow Sun Nov 6 17:12:47 MET 1994 *) + + INTERFACE Utypes; + + FROM Ctypes IMPORT + long, unsigned_long, int, unsigned_int, short, unsigned_short, + char, unsigned_char; + + (*** ***) + + (* + * Basic system types and major/minor device constructing/busting macros. + *) + + (* major part of a device *) + PROCEDURE major (x: int): int; + + (* minor part of a device *) + PROCEDURE minor (x: int): int; + + (* make a device number *) + PROCEDURE makedev (x, y: int): dev_t; + + TYPE + u_char = unsigned_char; + u_short = unsigned_short; + u_int = unsigned_int; + uint = unsigned_int; (* sys V compatibility *) + u_long = unsigned_long; + ushort = unsigned_short; (* sys III compat *) + + int8_t = char; + u_int8_t = u_char; + int16_t = short; + u_int16_t = u_short; + int32_t = int; + u_int32_t = u_int; + int64_t = long; + u_int64_t = u_long; + + (* #ifdef vax *) + struct__physadr = RECORD r: ARRAY [0..0] OF int; END; + physadr = UNTRACED REF struct__physadr; + + struct_label_t = RECORD val: ARRAY [0..13] OF int; END; + label_t = struct_label_t; + (*#endif*) + + quad = int64_t; + quad_t = int64_t; + daddr_t = int32_t; + caddr_t = ADDRESS; + ino_t = u_int32_t; + swblk_t = int32_t; + size_t = unsigned_long; + time_t = int32_t; + dev_t = u_int32_t; + off_t = int64_t; + key_t = long; (* sys V compatibility *) + clock_t = int; (* POSIX compliance *) + mode_t = u_int16_t; (* POSIX compliance *) + nlink_t = u_int16_t; (* POSIX compliance *) + uid_t = u_int32_t; (* POSIX compliance *) + pid_t = int; (* POSIX compliance *) + gid_t = u_int32_t; (* POSIX compliance *) + + tcflag_t = u_long; + cc_t = u_char; + speed_t = long; + + in_addr_t = u_int32_t; + in_port_t = u_int16_t; + + CONST + NBBY = 8; (* number of bits in a byte *) + + (* + * Select uses bit masks of file descriptors in longs. + * These macros manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here + * should be >= NOFILE (param.h). + *) + FD_SETSIZE = 256; + + (* How many things we'll allow select to use. 0 if unlimited *) + MAXSELFD = 256; + + TYPE + fd_mask = long; + + CONST + NFDBITS = BYTESIZE (fd_mask) * NBBY; (* bits per mask (power of 2!)*) + NFDSHIFT = 5; (* Shift based on above *) + + PROCEDURE howmany (x, y: int): int; + + TYPE + struct_fd_set = RECORD + fds_bits: ARRAY [0 .. + (FD_SETSIZE + NFDBITS - 1) DIV NFDBITS -1] OF fd_mask; + END; + fd_set = struct_fd_set; + + PROCEDURE FD_SET (n: int; p: UNTRACED REF fd_set): int; + PROCEDURE FD_CLEAR (n: int; p: UNTRACED REF fd_set): int; + PROCEDURE FD_ISSET (n: int; p: UNTRACED REF fd_set): int; + PROCEDURE FD_ZERO (p: UNTRACED REF fd_set); + + END Utypes. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Utypes.m3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Utypes.m3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Utypes.m3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,61 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Mon Mar 09 19:03:55 PST 1992 by muller *) + + MODULE Utypes; + + IMPORT Word; + + FROM Ctypes IMPORT int; + + PROCEDURE major (x: int): int = + BEGIN + RETURN Word.And (Word.Shift (x, -8), 8_0377); + END major; + + PROCEDURE minor (x: int): int = + BEGIN + RETURN Word.And (x, 8_0377); + END minor; + + PROCEDURE makedev (x, y: int): dev_t = + BEGIN + RETURN Word.Or (Word.Shift (x, 8), y); + END makedev; + + PROCEDURE howmany (x, y: int): int = + BEGIN + RETURN (x + (y - 1)) DIV y; + END howmany; + + PROCEDURE FD_SET (n: int; p: UNTRACED REF fd_set): int = + BEGIN + WITH l = p.fds_bits [n DIV NFDBITS] DO + l := Word.Or (l, Word.Shift (1, n MOD NFDBITS)); + RETURN l; END; + END FD_SET; + + PROCEDURE FD_CLEAR (n: int; p: UNTRACED REF fd_set): int = + BEGIN + WITH l = p.fds_bits [n DIV NFDBITS] DO + l := Word.And (l, Word.Not (Word.Shift (1, n MOD NFDBITS))); + RETURN l; END; + END FD_CLEAR; + + PROCEDURE FD_ISSET (n: int; p: UNTRACED REF fd_set): int = + BEGIN + WITH l = p.fds_bits [n DIV NFDBITS] DO + RETURN Word.And (l, Word.Shift (1, n MOD NFDBITS)); END; + END FD_ISSET; + + PROCEDURE FD_ZERO (p: UNTRACED REF fd_set) = + BEGIN + WITH a = p.fds_bits DO + FOR i := FIRST (a) TO LAST (a) DO + a[i] := 0; END; END; + END FD_ZERO; + + BEGIN + END Utypes. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uugid.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uugid.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uugid.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,34 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Fri Mar 16 12:20:16 1990 by muller *) + + INTERFACE Uugid; + + FROM Ctypes IMPORT int; + + + (*** getuid(2), geteuid(2) - get user identity ***) + + <*EXTERNAL*> PROCEDURE getuid (): int; + <*EXTERNAL*> PROCEDURE geteuid (): int; + + + (*** getgid(2), getguid(2) - get group identity ***) + + <*EXTERNAL*> PROCEDURE getgid (): int; + <*EXTERNAL*> PROCEDURE getegid (): int; + + + (*** setreuid(2) - set real and effective user ID's ***) + + <*EXTERNAL*> PROCEDURE setreuid (ruid, euid: int): int; + + + (*** setregid(2) - set real and effective group ID ***) + + <*EXTERNAL*> PROCEDURE setregid (rgid, egid: int): int; + + + END Uugid. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uuio.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uuio.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uuio.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,67 ---- + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Wed Mar 4 11:53:52 PST 1992 by muller *) + (* ow 30.09.1994 *) + + INTERFACE Uuio; + + FROM Ctypes IMPORT int, char_star, void_star; + + (*** sys/uio.h ***) + + + TYPE + struct_iovec = RECORD + iov_base: void_star; + iov_len: int; + END; + struct_iovec_star = UNTRACED REF struct_iovec; + + (* There's no corresponding structure to struct_uio - be careful *) + struct_uio = RECORD + uio_iov: struct_iovec_star; + uio_iovcnt: int; + uio_offset: int; + uio_resid: int; + uio_segflg: int; + uio_flag: int; + uio_procp: void_star; + END; + + uio_rw = {UIO_READ, UIO_WRITE}; + + (* + * Segment flag values (should be enum). + *) + + CONST + (* There appear to be no corresponing definitions for any of these + constants - use with caution. *) + UIO_USERSPACE = 0; (* from user data space *) + UIO_SYSSPACE = 1; (* from system space *) + UIO_USERISPACE = 2; (* from user I space *) + + CONST + MAX_IOVEC = 1024; (* maximum length of io vectors *) + + + + (*** read, readv(2) - read from a file ***) + + <*EXTERNAL "m3_read"*> + PROCEDURE read (d: int; buf: char_star; nbytes: int): int; + + <*EXTERNAL*> PROCEDURE readv (d: int; iov: struct_iovec_star; + iovcnt: int): int; + + (*** write, writev(2) - write on a file ***) + + <*EXTERNAL "m3_write"*> + PROCEDURE write (d: int; buf: char_star; nbytes: int): int; + + <*EXTERNAL*> PROCEDURE writev (d: int; iov: struct_iovec_star; + ioveclen: int): int; + + END Uuio. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uutmp.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uutmp.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/Uutmp.i3 Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,76 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* File: Uutmp.i3 *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Mon Apr 16 15:59:54 1990 by jerome *) + + INTERFACE Uutmp; + + FROM Ctypes IMPORT char, char_star, long, short; + FROM Utypes IMPORT pid_t, time_t; + + (*** ***) + + (* + * Structure of utmp and wtmp files. + * + *) + + CONST + (* Constants for the ut_type field : *) + UT_UNKNOWN = 0; + + (* Size of user name *) + UT_NAMESIZE = 8; + + (* Other things *) + RUN_LVL = 1; + BOOT_TIME = 2; + NEW_TIME = 3; + OLD_TIME = 4; + + INIT_PROCESS = 5; + LOGIN_PROCESS = 6; + USER_PROCESS = 7; + DEAD_PROCESS = 8; + + TYPE + struct_utmp = RECORD + ut_type : short; (* type of login *) + ut_pid : pid_t; (* pid of login process *) + ut_line : ARRAY [0..11] OF char; (* name of tty - "/dev", null-term *) + ut_id : ARRAY [0..1] OF char; (* abbrev. ttyname, as 01, s1, etc *) + ut_time : time_t; (* login time *) + ut_user : ARRAY [0..UT_NAMESIZE-1] OF char; (* user id *) + ut_host : ARRAY [0..15] OF char; (* host name, if remote *) + ut_addr : long (* IP addr of remote host *) + END; + + CONST + UTMP_FILE = "/etc/utmp"; + WTMP_FILE = "/var/adm/wtmp"; + UTMP_FILEMNAME = UTMP_FILE; + WTMP_FILENAME = WTMP_FILE; + + (* Special strings or formats used in the "ut_line" field when *) + (* accounting for something other than a process. *) + (* No string for the ut_line field can be more than 7 chars + *) + (* a NULL in length. *) + + (* These constants may not be used under Linux - use ut_type and the + constants specified above for this purpose instead *) + + EMPTY = ""; + BOOT_MSG = "~"; + OTIME_MSG = "|"; + NTIME_MSG = "}"; + + + (*** getlogin(3) ***) + + <*EXTERNAL*> PROCEDURE getlogin (): char_star; + + + END Uutmp. Index: m3/pm3/libs/m3core/src/unix/fbsd-alpha/m3makefile diff -c /dev/null m3/pm3/libs/m3core/src/unix/fbsd-alpha/m3makefile:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/fbsd-alpha/m3makefile Mon Jun 7 13:15:02 1999 *************** *** 0 **** --- 1,32 ---- + % Copyright (C) 1992, Digital Equipment Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + % + % Last modified on Sat Jan 7 14:53:09 PST 1995 by kalsow + % modified on Wed Jun 9 17:03:32 PDT 1993 by harrison + % modified on Tue Mar 2 17:17:34 PST 1993 by muller + + Interface ("Udir") + Module ("Uerror") + Interface ("Uexec") + Interface ("Ugrp") + Module ("Uin") + Interface ("Uipc") + Interface ("Umman") + Module ("Umsg") + Module ("Unetdb") + Interface ("Unix") + Interface ("Uprocess") + Interface ("Upwd") + Interface ("Uresource") + Interface ("Usem") + Interface ("Ushm") + Module ("Usignal") + Interface ("Ustat") + Interface ("Usocket") + Interface ("Usyslog") + Interface ("Utime") + Module ("Utypes") + Interface ("Uugid") + Interface ("Uuio") + Interface ("Uutmp") Index: m3/pm3/libs/m3core/src/unix/freebsd-2/Udir.i3 diff -c m3/pm3/libs/m3core/src/unix/freebsd-2/Udir.i3:1.1.1.1 m3/pm3/libs/m3core/src/unix/freebsd-2/Udir.i3:1.2 *** m3/pm3/libs/m3core/src/unix/freebsd-2/Udir.i3:1.1.1.1 Thu Jan 16 16:30:04 1997 --- m3/pm3/libs/m3core/src/unix/freebsd-2/Udir.i3 Mon Jun 7 13:15:07 1999 *************** *** 40,49 **** *) TYPE dirent = RECORD (* describes directory entry *) ! d_fileno: Ctypes.long; (* inode number of entry *) ! d_reclen: Ctypes.unsigned_char; (* record length in bytes *) d_type: Ctypes.unsigned_char; (* file types, see above *) ! d_namelen: Ctypes.unsigned_short; (* name length in bytes *) d_name: ARRAY [0..MAXNAMLEN] OF Ctypes.char; (* name *) END; --- 40,49 ---- *) TYPE dirent = RECORD (* describes directory entry *) ! d_fileno: Ctypes.unsigned_long; (* inode number of entry *) ! d_reclen: Ctypes.unsigned_short; (* record length in bytes *) d_type: Ctypes.unsigned_char; (* file types, see above *) ! d_namelen: Ctypes.unsigned_char; (* name length in bytes *) d_name: ARRAY [0..MAXNAMLEN] OF Ctypes.char; (* name *) END; *************** *** 53,59 **** dd_fd: Ctypes.int; (* file descriptor associated with directory *) dd_loc: Ctypes.long; (* offset in current buffer *) dd_size: Ctypes.long; (* amount of data returned by getdirentries *) ! dd_buf: UNTRACED REF Ctypes.char; (* data buffer *) dd_len: Ctypes.int; (* size of data buffer *) dd_seek: Ctypes.long (* magic cookie returned by getdirentries *); dd_rewind: Ctypes.long; (* magic cookie for rewinding *) --- 53,59 ---- dd_fd: Ctypes.int; (* file descriptor associated with directory *) dd_loc: Ctypes.long; (* offset in current buffer *) dd_size: Ctypes.long; (* amount of data returned by getdirentries *) ! dd_buf: Ctypes.char_star; (* data buffer *) dd_len: Ctypes.int; (* size of data buffer *) dd_seek: Ctypes.long (* magic cookie returned by getdirentries *); dd_rewind: Ctypes.long; (* magic cookie for rewinding *) Index: m3/pm3/libs/m3core/src/unix/freebsd-2/Uerror.i3 diff -c m3/pm3/libs/m3core/src/unix/freebsd-2/Uerror.i3:1.1.1.1 m3/pm3/libs/m3core/src/unix/freebsd-2/Uerror.i3:1.2 *** m3/pm3/libs/m3core/src/unix/freebsd-2/Uerror.i3:1.1.1.1 Thu Jan 16 16:30:04 1997 --- m3/pm3/libs/m3core/src/unix/freebsd-2/Uerror.i3 Mon Jun 7 13:15:07 1999 *************** *** 23,29 **** ENOEXEC = 8; (* Exec format error *) EBADF = 9; (* Bad file number *) ECHILD = 10; (* No children *) ! EAGAIN = 11; (* No more processes *) ENOMEM = 12; (* Not enough core *) EACCES = 13; (* Permission denied *) EFAULT = 14; (* Bad address *) --- 23,29 ---- ENOEXEC = 8; (* Exec format error *) EBADF = 9; (* Bad file number *) ECHILD = 10; (* No children *) ! EDEADLK = 11; (* Resource deadlock avoided *) ENOMEM = 12; (* Not enough core *) EACCES = 13; (* Permission denied *) EFAULT = 14; (* Bad address *) *************** *** 51,57 **** ERANGE = 34; (* Result too large *) (* non-blocking and interrupt i/o *) ! EWOULDBLOCK = 35; (* Operation would block *) EINPROGRESS = 36; (* Operation now in progress *) EALREADY = 37; (* Operation already in progress *) --- 51,58 ---- ERANGE = 34; (* Result too large *) (* non-blocking and interrupt i/o *) ! EAGAIN = 35; (* Resource temporarily unavailable *) ! EWOULDBLOCK = EAGAIN; (* Operation would block *) EINPROGRESS = 36; (* Operation now in progress *) EALREADY = 37; (* Operation already in progress *) *************** *** 108,136 **** EPROCUNAVAIL = 76; (* Bad procedure for program *) (* POSIX errnos *) ! ENOLCK = 77; (* LOCK_MAX exceeded *) ! (* IPC errors *) - (* I don't know about the following codes. ow 02.10.1994 *) - ENOMSG = 78; (* No message of desired type *) - EIDRM = 79; (* Identifier removed *) - - (* Alignment error of some type (i.e., cluster, page, block ...) *) - EALIGN = 80; (* alignment error *) - - (* System V mappings from BRL package *) - EDEADLK = EWOULDBLOCK; (* resource deadlock would occur *) - - <*EXTERNAL*> VAR errno: int; ! (* Extention by mjordan *) CONST ! Max = ENOLCK; (* should be exported from Uerror *) <*EXTERNAL*> VAR sys_nerr: int; --- 109,130 ---- EPROCUNAVAIL = 76; (* Bad procedure for program *) (* POSIX errnos *) ! ENOLCK = 77; (* No locks available *) ! ENOSYS = 78; (* Function not implemented *) ! EFTYPE = 79; (* Inappropriate file type or format *) ! EAUTH = 80; (* Authentication error *) ! ENEEDAUTH = 81; (* Need authenticator *) ! ELAST = 81; (* Must be equal to the largest errno *) <*EXTERNAL*> VAR errno: int; ! (* Extension by mjordan *) CONST ! Max = ELAST; (* should be exported from Uerror *) <*EXTERNAL*> VAR sys_nerr: int; Index: m3/pm3/libs/m3core/src/unix/freebsd-2/Uin.i3 diff -c m3/pm3/libs/m3core/src/unix/freebsd-2/Uin.i3:1.1.1.1 m3/pm3/libs/m3core/src/unix/freebsd-2/Uin.i3:1.2 *** m3/pm3/libs/m3core/src/unix/freebsd-2/Uin.i3:1.1.1.1 Thu Jan 16 16:30:04 1997 --- m3/pm3/libs/m3core/src/unix/freebsd-2/Uin.i3 Mon Jun 7 13:15:07 1999 *************** *** 8,14 **** INTERFACE Uin; ! FROM Ctypes IMPORT short, char; FROM Utypes IMPORT u_char, u_short, u_long; IMPORT Word; --- 8,14 ---- INTERFACE Uin; ! FROM Ctypes IMPORT char; FROM Utypes IMPORT u_char, u_short, u_long; IMPORT Word; *************** *** 25,33 **** IPPROTO_PUP = 12; (* pup *) IPPROTO_UDP = 17; (* user datagram protocol *) IPPROTO_IDP = 22; (* xns idp *) ! IPPROTO_HELLO = 63; (* "hello" routing protocol *) ! IPPROTO_ND = 77; (* UNOFFICIAL net disk proto *) IPPROTO_RAW = 255; (* raw IP packet *) IPPROTO_MAX = 256; --- 25,36 ---- IPPROTO_PUP = 12; (* pup *) IPPROTO_UDP = 17; (* user datagram protocol *) IPPROTO_IDP = 22; (* xns idp *) ! IPPROTO_TP = 29; (* tp-4 w/ class negotiation *) ! IPPROTO_RSVP = 46; (* resource reservation *) ! IPPROTO_EON = 80; (* ISO cnlp *) ! IPPROTO_ENCAP = 98; (* encapsulation header *) + IPPROTO_DIVERT = 254; (* divert pseudo-protocol *) IPPROTO_RAW = 255; (* raw IP packet *) IPPROTO_MAX = 256; *************** *** 128,134 **** (* Socket address, internet style. *) TYPE struct_sockaddr_in = RECORD ! sin_family: short; sin_port: u_short; sin_addr: struct_in_addr; sin_zero: ARRAY [0..7] OF char; --- 131,138 ---- (* Socket address, internet style. *) TYPE struct_sockaddr_in = RECORD ! sin_len: u_char; ! sin_family: u_char; sin_port: u_short; sin_addr: struct_in_addr; sin_zero: ARRAY [0..7] OF char; Index: m3/pm3/libs/m3core/src/unix/freebsd-2/Unetdb.i3 diff -c m3/pm3/libs/m3core/src/unix/freebsd-2/Unetdb.i3:1.1.1.1 m3/pm3/libs/m3core/src/unix/freebsd-2/Unetdb.i3:1.2 *** m3/pm3/libs/m3core/src/unix/freebsd-2/Unetdb.i3:1.1.1.1 Thu Jan 16 16:30:04 1997 --- m3/pm3/libs/m3core/src/unix/freebsd-2/Unetdb.i3 Mon Jun 7 13:15:07 1999 *************** *** 88,97 **** (*** gethostent(3n), gethostbyaddr(3n), gethostbyname(3n), sethostent(3n), endhostent(3n) - get network host entry ***) ! <*EXTERNAL*> PROCEDURE gethostbyname (name: char_star): struct_hostent_star; ! <*EXTERNAL*> PROCEDURE gethostbyaddr (addr: char_star; len, type: int): struct_hostent_star; <*EXTERNAL*> --- 88,97 ---- (*** gethostent(3n), gethostbyaddr(3n), gethostbyname(3n), sethostent(3n), endhostent(3n) - get network host entry ***) ! <*EXTERNAL "m3_gethostbyname"*> PROCEDURE gethostbyname (name: char_star): struct_hostent_star; ! <*EXTERNAL "m3_gethostbyaddr"*> PROCEDURE gethostbyaddr (addr: char_star; len, type: int): struct_hostent_star; <*EXTERNAL*> Index: m3/pm3/libs/m3core/src/unix/freebsd-2/Unix.i3 diff -c m3/pm3/libs/m3core/src/unix/freebsd-2/Unix.i3:1.1.1.1 m3/pm3/libs/m3core/src/unix/freebsd-2/Unix.i3:1.2 *** m3/pm3/libs/m3core/src/unix/freebsd-2/Unix.i3:1.1.1.1 Thu Jan 16 16:30:04 1997 --- m3/pm3/libs/m3core/src/unix/freebsd-2/Unix.i3 Mon Jun 7 13:15:07 1999 *************** *** 84,92 **** <*EXTERNAL*> PROCEDURE fchmod (fd, mode: mode_t): int; (* ok *) ! (*** chown, fchown - change owner and group of a file ***) <*EXTERNAL*> PROCEDURE chown (path: char_star; owner: uid_t; group: gid_t): int; <*EXTERNAL*> PROCEDURE fchown (fd: int; owner: uid_t; group: gid_t): int; (* ok *) (*** chroot - change root directory ***) --- 84,93 ---- <*EXTERNAL*> PROCEDURE fchmod (fd, mode: mode_t): int; (* ok *) ! (*** chown, fchown, lchown - change owner and group of a file ***) <*EXTERNAL*> PROCEDURE chown (path: char_star; owner: uid_t; group: gid_t): int; <*EXTERNAL*> PROCEDURE fchown (fd: int; owner: uid_t; group: gid_t): int; + <*EXTERNAL*> PROCEDURE lchown (path: char_star; owner: uid_t; group: gid_t): int; (* ok *) (*** chroot - change root directory ***) *************** *** 94,100 **** (* ok *) (*** close - delete a descriptor ***) ! <*EXTERNAL*> PROCEDURE close (d: int): int; (* ok *) (*** creat - create a new file ***) --- 95,101 ---- (* ok *) (*** close - delete a descriptor ***) ! <*EXTERNAL "m3_close"*> PROCEDURE close (d: int): int; (* ok *) (*** creat - create a new file ***) *************** *** 102,109 **** (* ok, but obsolete *) (*** dup, dup2 - duplicate an open file descriptor ***) ! <*EXTERNAL*> PROCEDURE dup (oldd: int): int; ! <*EXTERNAL*> PROCEDURE dup2 (oldd, newd: int): int; (* ok *) (*** execve - execute a file ***) --- 103,110 ---- (* ok, but obsolete *) (*** dup, dup2 - duplicate an open file descriptor ***) ! <*EXTERNAL "m3_dup"*> PROCEDURE dup (oldd: int): int; ! <*EXTERNAL "m3_dup2"*> PROCEDURE dup2 (oldd, newd: int): int; (* ok *) (*** execve - execute a file ***) *************** *** 156,165 **** F_WRLCK = 3; (* Write lock *) F_UNLCK = 2; (* Remove lock(s) *) - (* with vm use this <*EXTERNAL "ufcntl"*> PROCEDURE fcntl (fd, request, arg: int): int; - *) - <*EXTERNAL "m3_fcntl"*> PROCEDURE fcntl (fd, request, arg: int): int; (* ok *) (*** flock - apply or remove an advisory lock on an open file ***) --- 157,163 ---- *************** *** 773,778 **** --- 771,779 ---- PROCEDURE lseek (d: int; offset: off_t; whence: int): off_t; (* ok *) + (*** mkfifo - make a FIFO (named pipe) ***) + <*EXTERNAL*> PROCEDURE mkfifo (path: char_star; mode: mode_t): int; + (*** mkdir - make a directory file ***) <*EXTERNAL*> PROCEDURE mkdir (path: char_star; mode: mode_t): int; (* ok *) *************** *** 827,838 **** M3_NONBLOCK = O_NONBLOCK; (* -1 => would block, 0 => EOF *) - (* with vm use this <*EXTERNAL "uopen" *> PROCEDURE open (name: char_star; flags, mode: int): int; - *) - <*EXTERNAL "m3_open" *> PROCEDURE open (name: char_star; - flags, mode: int): int; (* ok *) (*** pipe - create an interprocess channel ***) --- 828,835 ---- *************** *** 892,898 **** TYPE FDSet = SET OF [0 .. MAX_FDSET - 1]; ! <*EXTERNAL*> PROCEDURE select (nfds: int; readfds, writefds, exceptfds: UNTRACED REF FDSet; timeout: UNTRACED REF struct_timeval): int; (* ok *) --- 889,895 ---- TYPE FDSet = SET OF [0 .. MAX_FDSET - 1]; ! <*EXTERNAL "m3_select"*> PROCEDURE select (nfds: int; readfds, writefds, exceptfds: UNTRACED REF FDSet; timeout: UNTRACED REF struct_timeval): int; (* ok *) Index: m3/pm3/libs/m3core/src/unix/freebsd-2/Usignal.i3 diff -c m3/pm3/libs/m3core/src/unix/freebsd-2/Usignal.i3:1.1.1.1 m3/pm3/libs/m3core/src/unix/freebsd-2/Usignal.i3:1.2 *** m3/pm3/libs/m3core/src/unix/freebsd-2/Usignal.i3:1.1.1.1 Thu Jan 16 16:30:04 1997 --- m3/pm3/libs/m3core/src/unix/freebsd-2/Usignal.i3 Mon Jun 7 13:15:07 1999 *************** *** 12,19 **** (*** ***) - (* I don't know about all the indented values below from the - Linux implementation *) CONST SIGHUP = 1; (* hangup *) SIGINT = 2; (* interrupt *) --- 12,17 ---- *************** *** 23,49 **** 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] *) 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 *) 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 *) --- 21,39 ---- SIGIOT = 6; (* IOT instruction *) SIGEMT = 7; (* EMT instruction *) SIGFPE = 8; (* floating point 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_PAGE_FAULT = 12; (* page fault protection base *) ! BUS_SEGNP_FAULT = 26; (* segment not present *) ! BUS_STK_FAULT = 27; (* stack fault *) SIGSEGV = 11; (* segmentation violation *) SIGSYS = 12; (* bad argument to system call *) SIGPIPE = 13; (* write on a pipe with no one to read it *) SIGALRM = 14; (* alarm clock *) *************** *** 61,69 **** 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) *) (* System V definitions *) SIGCLD = SIGCHLD; --- 51,59 ---- SIGVTALRM = 26; (* virtual time alarm *) SIGPROF = 27; (* profiling time alarm *) SIGWINCH = 28; (* window size changes *) ! SIGINFO = 29; (* information request *) ! SIGUSR1 = 30; (* user defined signal 1 *) ! SIGUSR2 = 31; (* user defined signal 2 *) (* System V definitions *) SIGCLD = SIGCHLD; *************** *** 80,86 **** struct_sigvec = RECORD sv_handler: SignalHandler; (* signal handler *) sv_mask: sigset_t; (* signal mask to apply *) ! sv_flags: int; (* see signal options below *) END; CONST --- 70,77 ---- struct_sigvec = RECORD sv_handler: SignalHandler; (* signal handler *) sv_mask: sigset_t; (* signal mask to apply *) ! sv_flags: int; (* see signal options below *) ! END; CONST *************** *** 101,116 **** 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_flags : int; (* signal action flags *) - (* ow - sa_restorer : SignalRestoreHandler; (* restores interrupted state *) - *) END; struct_sigaction_star = UNTRACED REF struct_sigaction; --- 92,101 ---- SIG_SETMASK = 3; (* Set block mask to this mask *) TYPE struct_sigaction = RECORD ! sa_handler : SignalHandler; (* signal handler *) sa_mask : sigset_t; (* signals to block while in handler *) sa_flags : int; (* signal action flags *) END; struct_sigaction_star = UNTRACED REF struct_sigaction; *************** *** 206,214 **** --- 191,205 ---- <*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 ***) + (* FIXME - This should probably use the VAR construct like the other + platforms use. *) <*EXTERNAL*> PROCEDURE sigaction (sig: int; act, oact: struct_sigaction_star): int; Index: m3/pm3/libs/m3core/src/unix/freebsd-2/Usocket.i3 diff -c m3/pm3/libs/m3core/src/unix/freebsd-2/Usocket.i3:1.1.1.1 m3/pm3/libs/m3core/src/unix/freebsd-2/Usocket.i3:1.2 *** m3/pm3/libs/m3core/src/unix/freebsd-2/Usocket.i3:1.1.1.1 Thu Jan 16 16:30:04 1997 --- m3/pm3/libs/m3core/src/unix/freebsd-2/Usocket.i3 Mon Jun 7 13:15:07 1999 *************** *** 30,57 **** (* * Option flags per-socket. *) ! SO_DEBUG = 1; (* turn on debugging info recording *) ! SO_REUSEADDR = 2; (* allow local address reuse *) ! SO_TYPE = 3; (* get socket type *) ! SO_ERROR = 4; (* get error status and clear *) ! SO_DONTROUTE = 5; (* just use interface addresses *) ! SO_BROADCAST = 6; (* permit sending of broadcast msgs *) ! SO_SNDBUF = 7; (* send buffer size *) ! SO_RCVBUF = 8; (* receive buffer size *) ! SO_KEEPALIVE = 9; (* keep connections alive *) ! SO_OOBINLINE = 10; (* leave received OOB data in line *) ! SO_NO_CHECK = 11; ! SO_PRIORITY = 12; ! SO_LINGER = 13; (* linger on close if data present *) (* * Additional options, not kept in so_options. *) ! (* these constants may not be implemented - be careful *) ! SO_SNDLOWAT = 16_1003; (* send low-water mark *) ! SO_RCVLOWAT = 16_1004; (* receive low-water mark *) ! SO_SNDTIMEO = 16_1005; (* send timeout *) ! SO_RCVTIMEO = 16_1006; (* receive timeout *) (* * Structure used for manipulating linger option. --- 30,59 ---- (* * Option flags per-socket. *) ! SO_DEBUG = 16_0001; (* turn on debugging info recording *) ! SO_ACCEPTCONN = 16_0002; (* socket has had listen() *) ! SO_REUSEADDR = 16_0004; (* allow local address reuse *) ! SO_KEEPALIVE = 16_0008; (* keep connections alive *) ! SO_DONTROUTE = 16_0010; (* just use interface addresses *) ! SO_BROADCAST = 16_0020; (* permit sending of broadcast msgs *) ! SO_USELOOPBACK = 16_0040; (* bypass hardware when possible *) ! SO_LINGER = 16_0080; (* linger on close if data present *) ! SO_OOBINLINE = 16_0100; (* leave received OOB data in line *) ! SO_REUSEPORT = 16_0200; (* allow local address & port reuse *) ! SO_TIMESTAMP = 16_0400; (* timestamp received dgram traffic *) (* * Additional options, not kept in so_options. *) ! SO_SNDBUF = 16_1001; (* send buffer size *) ! SO_RCVBUF = 16_1002; (* receive buffer size *) ! SO_SNDLOWAT = 16_1003; (* send low-water mark *) ! SO_RCVLOWAT = 16_1004; (* receive low-water mark *) ! SO_SNDTIMEO = 16_1005; (* send timeout *) ! SO_RCVTIMEO = 16_1006; (* receive timeout *) ! SO_ERROR = 16_1007; (* get error status and clear *) ! SO_TYPE = 16_1008; (* get socket type *) ! SO_PRIVSTATE = 16_1009; (* get/deny privileged state *) (* * Structure used for manipulating linger option. *************** *** 67,114 **** * Level number for (get/set)sockopt() to apply to socket itself. *) CONST ! SOL_SOCKET = 1; (* options for socket level *) (* * Address families. *) ! AF_UNSPEC = 0; (* unspecified *) ! AF_UNIX = 1; (* local to host (pipes, portals) *) ! AF_INET = 2; (* internetwork: UDP, TCP, etc. *) ! AF_AX25 = 3; ! AF_IPX = 4; ! ! AF_MAX = 5; ! ! (***** ! AF_IMPLINK = 3; (* arpanet imp addresses *) ! AF_PUP = 4; (* pup protocols: e.g. BSP *) ! AF_CHAOS = 5; (* mit CHAOS protocols *) ! AF_NS = 6; (* XEROX NS protocols *) ! AF_NBS = 7; (* nbs protocols *) ! AF_ECMA = 8; (* european computer manufacturers *) ! AF_DATAKIT = 9; (* datakit protocols *) ! AF_CCITT = 10; (* CCITT protocols, X.25 etc *) ! AF_SNA = 11; (* IBM SNA *) ! AF_DECnet = 12; (* DECnet *) ! AF_DLI = 13; (* Direct data link interface *) ! AF_LAT = 14; (* LAT *) ! AF_HYLINK = 15; (* NSC Hyperchannel *) ! AF_APPLETALK = 16; (* Apple talk *) ! AF_BSC = 17; (* BISYNC 2780/3780 *) ! AF_DSS = 18; (* Distributed system services *) ! *******) (* * Structure used by kernel to store most * addresses. *) TYPE struct_sockaddr = RECORD ! sa_family: Ctypes.unsigned_short; (* address family *) ! sa_data: ARRAY [0..13] OF Ctypes.char; ! (* up to 14 bytes of direct address *) END; --- 69,123 ---- * Level number for (get/set)sockopt() to apply to socket itself. *) CONST ! SOL_SOCKET = 16_ffff; (* options for socket level *) (* * Address families. *) ! AF_UNSPEC = 0; (* unspecified *) ! AF_LOCAL = 1; (* local to host (pipes, portals) *) ! AF_UNIX = AF_LOCAL; (* backward compatibility *) ! AF_INET = 2; (* internetwork: UDP, TCP, etc. *) ! AF_IMPLINK = 3; (* arpanet imp addresses *) ! AF_PUP = 4; (* pup protocols: e.g. BSP *) ! AF_CHAOS = 5; (* mit CHAOS protocols *) ! AF_NS = 6; (* XEROX NS protocols *) ! AF_ISO = 7; (* ISO protocols *) ! AF_OSI = AF_ISO; ! AF_ECMA = 8; (* European computer manufacturers *) ! AF_DATAKIT = 9; (* datakit protocols *) ! AF_CCITT = 10; (* CCITT protocols, X.25 etc *) ! AF_SNA = 11; (* IBM SNA *) ! AF_DECnet = 12; (* DECnet *) ! AF_DLI = 13; (* DEC Direct data link interface *) ! AF_LAT = 14; (* LAT *) ! AF_HYLINK = 15; (* NSC Hyperchannel *) ! AF_APPLETALK = 16; (* Apple Talk *) ! AF_ROUTE = 17; (* Internal Routing Protocol *) ! AF_LINK = 18; (* Link layer interface *) ! pseudo_AF_XTP = 19; (* eXpress Transfer Protocol (no AF) *) ! AF_COIP = 20; (* connection-oriented IP, aka ST II *) ! AF_CNT = 21; (* Computer Network Technology *) ! pseudo_AF_RTIP = 22; (* Help Identify RTIP packets *) ! AF_IPX = 23; (* Novell Internet Protocol *) ! AF_SIP = 24; (* Simple Internet Protocol *) ! pseudo_AF_PIP = 25; (* Help Identify PIP packets *) ! AF_ISDN = 26; (* Integrated Services Digital Network*) ! AF_E164 = AF_ISDN; (* CCITT E.164 recommendation *) ! pseudo_AF_KEY = 27; (* Internal key-management function *) + AF_MAX = 28; + (* * Structure used by kernel to store most * addresses. *) TYPE struct_sockaddr = RECORD ! sa_len: Ctypes.unsigned_char; (* total length *) ! sa_family: Ctypes.unsigned_char; (* address family *) ! sa_data: ARRAY [0..13] OF Ctypes.char; (* address; actually longer *) END; *************** *** 116,122 **** * Structure used by kernel to pass protocol * information in raw sockets. *) - (* Can't find this one either .. be careful *) struct_sockproto = RECORD sp_family: Ctypes.unsigned_short; (* address family *) sp_protocol: Ctypes.unsigned_short; (* protocol *) --- 125,130 ---- *************** *** 126,200 **** * Protocol families, same as address families for now. *) CONST ! ! PF_UNSPEC = AF_UNSPEC; ! PF_UNIX = AF_UNIX; ! PF_INET = AF_INET; ! PF_AX25 = AF_AX25; ! PF_IPX = AF_IPX; ! ! (* NO supported on Linux: ! PF_IMPLINK = AF_IMPLINK; ! PF_PUP = AF_PUP; ! PF_CHAOS = AF_CHAOS; ! PF_NS = AF_NS; ! PF_NBS = AF_NBS; ! PF_ECMA = AF_ECMA; ! PF_DATAKIT = AF_DATAKIT; ! PF_CCITT = AF_CCITT; ! PF_SNA = AF_SNA; ! PF_DECnet = AF_DECnet; ! PF_DLI = AF_DLI; ! PF_LAT = AF_LAT; ! PF_HYLINK = AF_HYLINK; ! PF_APPLETALK = AF_APPLETALK; ! PF_BSC = AF_BSC; ! PF_DSS = AF_DSS; ! ************) ! PF_MAX = AF_MAX; (* * Maximum queue length specifiable by listen. *) ! (* Not defined under Linux - be careful *) ! SOMAXCONN = 5; (* * Message header for recvmsg and sendmsg calls. *) TYPE - (* Again, I haven't checked this structure *) struct_msghdr = RECORD ! msg_name: Utypes.caddr_t; (* optional address *) ! msg_namelen: Ctypes.int; (* size of address *) ! msg_iov: Uuio.struct_iovec_star; (* scatter/gather array *) ! msg_iovlen: Ctypes.int; (* # elements in msg_iov *) ! msg_accrights: Utypes.caddr_t; (* access rights sent/received *) ! msg_accrightslen: Ctypes.int; END; CONST ! MSG_OOB = 16_1; (* process out-of-band data *) ! MSG_PEEK = 16_2; (* peek at incoming message *) ! (* The following aren't defined in /usr/include/linux/socket.h *) ! (** ! MSG_DONTROUTE = 16_4; (* send without using routing tables *) ! MSG_MAXIOVLEN = 16; ! ***) (* * Definitions for UNIX IPC domain. *) TYPE struct_sockaddr_un = RECORD ! sun_family: Ctypes.unsigned_short; (* AF_UNIX *) ! sun_path: ARRAY [0..107] OF Ctypes.char; (* path name (gag) *) END; ! <*EXTERNAL*> PROCEDURE accept( s: Ctypes.int; addr: UNTRACED REF struct_sockaddr; --- 134,234 ---- * Protocol families, same as address families for now. *) CONST ! PF_UNSPEC = AF_UNSPEC; ! PF_LOCAL = AF_LOCAL; ! PF_UNIX = PF_LOCAL; (* backward compatibility *) ! PF_INET = AF_INET; ! PF_IMPLINK = AF_IMPLINK; ! PF_PUP = AF_PUP; ! PF_CHAOS = AF_CHAOS; ! PF_NS = AF_NS; ! PF_ISO = AF_ISO; ! PF_OSI = AF_ISO; ! PF_ECMA = AF_ECMA; ! PF_DATAKIT = AF_DATAKIT; ! PF_CCITT = AF_CCITT; ! PF_SNA = AF_SNA; ! PF_DECnet = AF_DECnet; ! PF_DLI = AF_DLI; ! PF_LAT = AF_LAT; ! PF_HYLINK = AF_HYLINK; ! PF_APPLETALK = AF_APPLETALK; ! PF_ROUTE = AF_ROUTE; ! PF_LINK = AF_LINK; ! PF_XTP = pseudo_AF_XTP; (* really just proto family, no AF *) ! PF_COIP = AF_COIP; ! PF_CNT = AF_CNT; ! PF_SIP = AF_SIP; ! PF_IPX = AF_IPX; (* same format as AF_NS *) ! PF_RTIP = pseudo_AF_RTIP; (* same format as AF_INET *) ! PF_PIP = pseudo_AF_PIP; ! PF_ISDN = AF_ISDN; ! PF_KEY = pseudo_AF_KEY; ! PF_MAX = AF_MAX; (* * Maximum queue length specifiable by listen. *) ! SOMAXCONN = 128; (* * Message header for recvmsg and sendmsg calls. *) TYPE struct_msghdr = RECORD ! msg_name: Utypes.caddr_t; (* optional address *) ! msg_namelen: Ctypes.unsigned_int; (* size of address *) ! msg_iov: Uuio.struct_iovec_star; (* scatter/gather array *) ! msg_iovlen: Ctypes.unsigned_int; (* # elements in msg_iov *) ! msg_control: Utypes.caddr_t; (* ancillary data, see below *) ! msg_controllen: Ctypes.unsigned_int; (* ancillary data buffer len *) ! msg_flags: Ctypes.int; (* flags on received message *) END; CONST ! MSG_OOB = 16_1; (* process out-of-band data *) ! MSG_PEEK = 16_2; (* peek at incoming message *) ! MSG_DONTROUTE = 16_4; (* send without using routing tables *) ! MSG_EOR = 16_8; (* data completes record *) ! MSG_TRUNC = 16_10; (* data discarded before delivery *) ! MSG_CTRUNC = 16_20; (* control data lost before delivery *) ! MSG_WAITALL = 16_40; (* wait for full request or error *) ! MSG_DONTWAIT = 16_80; (* this message should be nonblocking *) ! MSG_EOF = 16_100; (* data completes connection *) ! MSG_COMPAT = 16_8000; (* used in sendit() *) ! ! (* ! * Header for ancillary data objects in msg_control buffer. ! * Used for additional information with/about a datagram ! * not expressible by flags. The format is a sequence ! * of message elements headed by cmsghdr structures. ! *) ! TYPE ! struct_cmsghdr = RECORD ! cmsg_len: Ctypes.unsigned_int; (* data byte count, including hdr *) ! cmsg_level: Ctypes.int; (* originating protocol *) ! cmsg_type: Ctypes.int; (* protocol-specific type *) ! (* followed by u_char cmsg_data[]; *) ! END; ! (* "Socket"-level control message types: *) ! CONST ! SCM_RIGHTS = 16_01; (* access rights (array of int) *) ! SCM_TIMESTAMP = 16_02; (* timestamp (struct timeval) *) (* * Definitions for UNIX IPC domain. *) TYPE struct_sockaddr_un = RECORD ! sun_len: Ctypes.unsigned_char; (* sockaddr len including null *) ! sun_family: Ctypes.unsigned_char; (* AF_UNIX *) ! sun_path: ARRAY [0..103] OF Ctypes.char; (* path name (gag) *) END; ! <*EXTERNAL "m3_accept"*> PROCEDURE accept( s: Ctypes.int; addr: UNTRACED REF struct_sockaddr; *************** *** 202,208 **** : Ctypes.int RAISES {}; ! <*EXTERNAL*> PROCEDURE bind( s: Ctypes.int; name: UNTRACED REF struct_sockaddr; --- 236,242 ---- : Ctypes.int RAISES {}; ! <*EXTERNAL "m3_bind"*> PROCEDURE bind( s: Ctypes.int; name: UNTRACED REF struct_sockaddr; *************** *** 210,216 **** : Ctypes.int RAISES {}; ! <*EXTERNAL*> PROCEDURE connect( s: Ctypes.int; name: UNTRACED REF struct_sockaddr; --- 244,250 ---- : Ctypes.int RAISES {}; ! <*EXTERNAL "m3_connect"*> PROCEDURE connect( s: Ctypes.int; name: UNTRACED REF struct_sockaddr; *************** *** 218,224 **** : Ctypes.int RAISES {}; ! <*EXTERNAL*> PROCEDURE getpeername( s: Ctypes.int; name: UNTRACED REF struct_sockaddr; --- 252,258 ---- : Ctypes.int RAISES {}; ! <*EXTERNAL "m3_getpeername"*> PROCEDURE getpeername( s: Ctypes.int; name: UNTRACED REF struct_sockaddr; *************** *** 226,232 **** : Ctypes.int RAISES {}; ! <*EXTERNAL*> PROCEDURE getsockname( s: Ctypes.int; name: UNTRACED REF struct_sockaddr; --- 260,266 ---- : Ctypes.int RAISES {}; ! <*EXTERNAL "m3_getsockname"*> PROCEDURE getsockname( s: Ctypes.int; name: UNTRACED REF struct_sockaddr; *************** *** 237,288 **** <*EXTERNAL*> PROCEDURE getsockopt( s, level, optname: Ctypes.int; ! optval: Ctypes.char_star; optlen: Ctypes.int_star) : Ctypes.int RAISES {}; ! <*EXTERNAL*> PROCEDURE listen(s, backlog: Ctypes.int): Ctypes.int RAISES {}; ! <*EXTERNAL*> ! PROCEDURE recv(s: Ctypes.int; buf: Ctypes.char_star; len, flags: Ctypes.int): Ctypes.int RAISES {}; ! <*EXTERNAL*> PROCEDURE recvfrom( s: Ctypes.int; ! buf: Ctypes.char_star; ! len, flags: Ctypes.int; from: UNTRACED REF struct_sockaddr; fromlen: Ctypes.int_star) : Ctypes.int RAISES {}; ! <*EXTERNAL*> ! PROCEDURE send(s: Ctypes.int; msg: Ctypes.char_star; len, flags: Ctypes.int): Ctypes.int RAISES {}; ! <*EXTERNAL*> PROCEDURE sendto( s: Ctypes.int; ! msg: Ctypes.char_star; ! len, flags: Ctypes.int; to: UNTRACED REF struct_sockaddr; tolen: Ctypes.int) : Ctypes.int RAISES {}; <*EXTERNAL*> PROCEDURE setsockopt( s, level, optname: Ctypes.int; ! optval: Ctypes.char_star; optlen: Ctypes.int) : Ctypes.int RAISES {}; ! <*EXTERNAL*> PROCEDURE shutdown(s, how: Ctypes.int): Ctypes.int RAISES {}; ! <*EXTERNAL*> PROCEDURE socket(af, type, protocol: Ctypes.int): Ctypes.int RAISES {}; <*EXTERNAL*> --- 271,340 ---- <*EXTERNAL*> PROCEDURE getsockopt( s, level, optname: Ctypes.int; ! optval: Ctypes.void_star; optlen: Ctypes.int_star) : Ctypes.int RAISES {}; ! <*EXTERNAL "m3_listen"*> PROCEDURE listen(s, backlog: Ctypes.int): Ctypes.int RAISES {}; ! <*EXTERNAL "m3_recv"*> ! PROCEDURE recv( ! s: Ctypes.int; ! buf: Ctypes.void_star; ! len: Utypes.size_t; ! flags: Ctypes.int) ! : Ctypes.int ! RAISES {}; ! <*EXTERNAL "m3_recvfrom"*> PROCEDURE recvfrom( s: Ctypes.int; ! buf: Ctypes.void_star; ! len: Utypes.size_t; ! flags: Ctypes.int; from: UNTRACED REF struct_sockaddr; fromlen: Ctypes.int_star) : Ctypes.int RAISES {}; ! (* FIXME - recvmsg *) ! <*EXTERNAL "m3_send"*> ! PROCEDURE send( ! s: Ctypes.int; ! msg: Ctypes.const_void_star; ! len: Utypes.size_t; ! flags: Ctypes.int) ! : Ctypes.int ! RAISES {}; ! ! <*EXTERNAL "m3_sendto"*> PROCEDURE sendto( s: Ctypes.int; ! msg: Ctypes.const_void_star; ! len: Utypes.size_t; ! flags: Ctypes.int; to: UNTRACED REF struct_sockaddr; tolen: Ctypes.int) : Ctypes.int RAISES {}; + (* FIXME - sendmsg *) + <*EXTERNAL*> PROCEDURE setsockopt( s, level, optname: Ctypes.int; ! optval: Ctypes.const_void_star; optlen: Ctypes.int) : Ctypes.int RAISES {}; ! <*EXTERNAL "m3_shutdown"*> PROCEDURE shutdown(s, how: Ctypes.int): Ctypes.int RAISES {}; ! <*EXTERNAL "m3_socket" *> PROCEDURE socket(af, type, protocol: Ctypes.int): Ctypes.int RAISES {}; <*EXTERNAL*> Index: m3/pm3/libs/m3core/src/unix/freebsd-2/Ustat.i3 diff -c m3/pm3/libs/m3core/src/unix/freebsd-2/Ustat.i3:1.1.1.1 m3/pm3/libs/m3core/src/unix/freebsd-2/Ustat.i3:1.2 *** m3/pm3/libs/m3core/src/unix/freebsd-2/Ustat.i3:1.1.1.1 Thu Jan 16 16:30:04 1997 --- m3/pm3/libs/m3core/src/unix/freebsd-2/Ustat.i3 Mon Jun 7 13:15:07 1999 *************** *** 70,73 **** --- 70,95 ---- <*EXTERNAL*> PROCEDURE fstat (fd: int; buf: struct_stat_star): int; + (* chflags, fchflags *) + CONST + (* Definitions of flags stored in file flags word. *) + (* Super-user and owner changeable flags. *) + UF_SETTABLE = 16_0000ffff; (* mask of owner changeable flags *) + UF_NODUMP = 16_00000001; (* do not dump file *) + UF_IMMUTABLE = 16_00000002; (* file may not be changed *) + UF_APPEND = 16_00000004; (* writes to file may only append *) + UF_OPAQUE = 16_00000008; (* directory is opaque wrt. union *) + + (* Super-user changeable flags. *) + SF_SETTABLE = 16_ffff0000; (* mask of superuser changeable flags *) + SF_ARCHIVED = 16_00010000; (* file is archived *) + SF_IMMUTABLE = 16_00020000; (* file may not be changed *) + SF_APPEND = 16_00040000; (* writes to file may only append *) + + <*EXTERNAL*> + PROCEDURE chflags(path: char_star; flags: u_long): int; + + <*EXTERNAL*> + PROCEDURE fchflags(fd: int; flags: u_long): int; + END Ustat. Index: m3/pm3/libs/m3core/src/unix/freebsd-2/Uuio.i3 diff -c m3/pm3/libs/m3core/src/unix/freebsd-2/Uuio.i3:1.1.1.1 m3/pm3/libs/m3core/src/unix/freebsd-2/Uuio.i3:1.2 *** m3/pm3/libs/m3core/src/unix/freebsd-2/Uuio.i3:1.1.1.1 Thu Jan 16 16:30:04 1997 --- m3/pm3/libs/m3core/src/unix/freebsd-2/Uuio.i3 Mon Jun 7 13:15:08 1999 *************** *** 50,62 **** (*** read, readv(2) - read from a file ***) ! <*EXTERNAL*> PROCEDURE read (d: int; buf: char_star; nbytes: int): int; <*EXTERNAL*> PROCEDURE readv (d: int; iov: struct_iovec_star; iovcnt: int): int; (*** write, writev(2) - write on a file ***) - <*EXTERNAL*> PROCEDURE write (d: int; buf: char_star; nbytes: int): int; <*EXTERNAL*> PROCEDURE writev (d: int; iov: struct_iovec_star; ioveclen: int): int; --- 50,66 ---- (*** read, readv(2) - read from a file ***) ! <*EXTERNAL "m3_read"*> ! PROCEDURE read (d: int; buf: char_star; nbytes: int): int; ! <*EXTERNAL*> PROCEDURE readv (d: int; iov: struct_iovec_star; iovcnt: int): int; (*** write, writev(2) - write on a file ***) + + <*EXTERNAL "m3_write"*> + PROCEDURE write (d: int; buf: char_star; nbytes: int): int; <*EXTERNAL*> PROCEDURE writev (d: int; iov: struct_iovec_star; ioveclen: int): int; Index: m3/pm3/libs/m3core/src/unix/freebsd-2/off_t_wrap.c diff -c m3/pm3/libs/m3core/src/unix/freebsd-2/off_t_wrap.c:1.1.1.1 m3/pm3/libs/m3core/src/unix/freebsd-2/off_t_wrap.c:1.2 *** m3/pm3/libs/m3core/src/unix/freebsd-2/off_t_wrap.c:1.1.1.1 Thu Jan 16 16:30:04 1997 --- m3/pm3/libs/m3core/src/unix/freebsd-2/off_t_wrap.c Mon Jun 7 13:15:08 1999 *************** *** 33,47 **** off_t len = (off_t) length; return ftruncate(fd, length); } - - /* added to avoid problems with the ellipsis... */ - - int m3_fcntl(int fd, int cmd, int arg) - { - return fcntl(fd, cmd, arg); - } - - int m3_open(const char *path, int flags, mode_t mode) - { - return open(path, flags, mode); - } --- 33,35 ---- Index: m3/pm3/libs/m3core/src/unix/freebsd-3/COPYRIGHT diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/COPYRIGHT:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/COPYRIGHT Mon Jun 7 13:15:11 1999 *************** *** 0 **** --- 1,93 ---- + + Digital License Agreement + + SRC Modula-3 + + 1. Grant Of License. Digital Equipment Corporation, having a principal + office at 146 Main Street, Maynard, MA 01754 ("DIGITAL") grants to + you ("LICENSEE") the non-exclusive, non-transferable, royalty free + right to use, modify, reproduce and distribute SRC Modula-3 ("SOFTWARE") + subject to the terms set forth herein. Any distribution of SOFTWARE + shall include this Digital License Agreement in human readable form. + + 2. Title to Intellectual Property and Software. Subject to the limited + rights and licenses granted under this License Agreement, all rights, + title and interests including patent, copyright, and trademark rights + in SOFTWARE are and shall remain vested in DIGITAL to the exclusion + of LICENSEE. DIGITAL represents and warrants that DIGITAL has the + legal right to grant such licenses as are expressly granted under + this Agreement. + + 3. Copyright. The SOFTWARE is owned by DIGITAL or its suppliers and is + protected by United States copyright laws and international treaty + provisions. Therefore, you must treat the SOFTWARE like any other + copyrighted material (e.g., a book or musical recording) except + that you may use the SOFTWARE as provided in this Digital License + Agreement. + + 4. Improvements. LICENSEE hereby grants to DIGITAL a non-exclusive, + non-transferable, royalty free right to use, modify, reproduce + and distribute with the right to sublicense at any tier, any + improvements, enhancements, extensions, or modifications that + LICENSEE make to SOFTWARE, provided such are returned to DIGITAL + by LICENSEE. + + 5. DISCLAIMER OF WARRANTY. Because the SOFTWARE is a research work and + not a released product, it is provided "AS IS" WITHOUT WARRANTY OF ANY + KIND AND WITHOUT ANY SUPPORT SERVICES. EXCEPT AS SPECIFICALLY PROVIDED + ABOVE IN SECTION 2, DIGITAL FURTHER DISCLAIMS ALL OTHER EXPRESS OR + IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS FOR A PARTICULAR + PURPOSE. THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF + THE SOFTWARE REMAINS WITH YOU. + + 6. Limitation of Liability. IN NO EVENT SHALL DIGITAL OR ITS SUPPLIERS BE + LIABLE IN AN AMOUNT THAT EXCEEDS THE LICENSE FEE PAID BY LICENSEE FOR + ANY DAMAGES (INCLUDING, WITH LIMITATION, DAMAGES FOR LOSS OF BUSINESS + PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER + PECUNIARY LOSS), REGARDLESS OF THE FORM OF CLAIM OR ACTIONS, ARISING + OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, + EVEN IF DIGITAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY + FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT + APPLY TO YOU. + + 7. Acknowledgement of Allocation of Risk. LICENSEE acknowledges and agrees + that the fees charged by DIGITAL in this Agreement reflect the allocation + of risks provided by the foregoing limitation of liability. LICENSEE + acknowledges and represents that it has read and understands these + allocations of risk limiting the liability of DIGITAL and that it + understands that a modification of the allocation of risks set forth + in this agreement would affect the fees charged by DIGITAL, and that + LICENSEE, in consideration of such fees, agrees to such allocations + of risk. + + 8. LICENSEE INDEMNIFICATION. LICENSEE SHALL INDEMNIFY DIGITAL AGAINST + ALL COSTS AND DAMAGE JUDGEMENTS, INCLUDING ATTORNEY'S FEES AND COSTS + OF DEFENSE, INCURRED BECAUSE OF CLAIMS OF DAMAGE ARISING FROM LICENSEE'S + POSSESSION OR USE OR INABILITY TO USE SOFTWARE. + + 9. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE and documentation are provided + with RESTRICTED RIGHTS. Use duplication, or disclosure by the Government + is subject restrictions as set forth in subparagraph (c)(1)(ii) of The + Rights in Technical Data and Computer Software clause in DFARS + 252.227-7013, or subparagraphs (c)(i) and (2) of the Commercial Computer + Software -- Restricted Rights at 48 CFR 52.227-19, as applicable. + Manufacturer is Digital Equipment Corporation, 130 Lytton Avenue, + Palo Alto, CA 94301-1044. + + 10. Severability. If any provision of the Agreement is held illegal or + unenforceable by any court of competent jurisdiction, such provision + shall be deemed separable from the remaining provisions of this Agreement + and shall not affect or impair the validity or enforceability of the + remaining provisions of this Agreement. + + 11. Governing Law. This Agreement is governed by the laws of the + Commonwealth of Massachusetts. + + 12. Publicity. You my not use the name of DIGITAL in any advertisement, + press release or other publicity with reference to SRC Modula-3 + without prior written consent of DIGITAL. + + 13. Should you have any questions concerning this Agreement, or if you + desire to contact Digital for any reason, please do so via E-mail: + M3-REQUEST@SRC.DEC.COM. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Udir.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Udir.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Udir.i3 Mon Jun 7 13:15:11 1999 *************** *** 0 **** --- 1,77 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Thu Feb 23 13:39:23 PST 1995 by kalsow *) + (* modified on Sat Feb 18 23:43:23 MET 1995 by ow *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Mon Apr 13 10:04:46 PDT 1992 by muller *) + (* modified on Mon Jul 2 13:25:12 PDT 1990 by mjordan *) + + UNSAFE INTERFACE Udir; + + (*** ***) + + IMPORT Ctypes; + + CONST + MAXNAMLEN = 255; (* maximum length of component of file path name *) + MAXPATHLEN = 1024; (* maximum length of file path name *) + + (* file types *) + DT_UNKNOWN = 0; + DT_FIFO = 1; + DT_CHR = 2; + DT_DIR = 4; + DT_BLK = 6; + DT_REG = 8; + DT_LNK = 10; + DT_SOCK = 12; + + (* + * The dirent structure defines the format of directory entries returned by + * the getdirentries(2) system call. + * + * A directory entry has a struct dirent at the front of it, containing its + * inode number, the length of the entry, and the length of the name + * contained in the entry. These are followed by the name padded to a 4 + * byte boundary with null bytes. All names are guaranteed null terminated. + * The maximum length of a name in a directory is MAXNAMLEN. + *) + TYPE + dirent = RECORD (* describes directory entry *) + d_fileno: Ctypes.unsigned_long; (* inode number of entry *) + d_reclen: Ctypes.unsigned_short; (* record length in bytes *) + d_type: Ctypes.unsigned_char; (* file types, see above *) + d_namelen: Ctypes.unsigned_char; (* name length in bytes *) + d_name: ARRAY [0..MAXNAMLEN] OF Ctypes.char; (* name *) + END; + + direct = dirent; (* backwards compatibility *) + + DIR = RECORD + dd_fd: Ctypes.int; (* file descriptor associated with directory *) + dd_loc: Ctypes.long; (* offset in current buffer *) + dd_size: Ctypes.long; (* amount of data returned by getdirentries *) + dd_buf: Ctypes.char_star; (* data buffer *) + dd_len: Ctypes.int; (* size of data buffer *) + dd_seek: Ctypes.long (* magic cookie returned by getdirentries *); + dd_rewind: Ctypes.long; (* magic cookie for rewinding *) + END; + + DIR_star = UNTRACED REF DIR; + + direct_star = UNTRACED REF direct; + + <*EXTERNAL*> PROCEDURE opendir (filename: Ctypes.char_star): DIR_star; + <*EXTERNAL*> PROCEDURE readdir (dirp: DIR_star): direct_star; + <*EXTERNAL*> PROCEDURE telldir (dirp: DIR_star): Ctypes.long; + <*EXTERNAL*> PROCEDURE seekdir (dirp: DIR_star; loc: Ctypes.long); + <*EXTERNAL*> PROCEDURE rewinddir (dirp: DIR_star); + <*EXTERNAL*> PROCEDURE closedir(dirp: DIR_star): Ctypes.int; + <*EXTERNAL*> PROCEDURE getdirentries(fd : Ctypes.int; + buf : UNTRACED REF Ctypes.char; + nbytes : Ctypes.int; + basep : UNTRACED REF Ctypes.long): Ctypes.int; + + END Udir. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Uerror.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Uerror.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Uerror.i3 Mon Jun 7 13:15:11 1999 *************** *** 0 **** --- 1,139 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Sat Jan 7 14:21:51 PST 1995 by kalsow *) + (* modified on Thu Nov 22 05:20:45 1990 by muller *) + (* ow 02.10.1994 *) + + INTERFACE Uerror; + + FROM Ctypes IMPORT int, char_star; + + (*** ***) + + CONST + EPERM = 1; (* Not owner *) + ENOENT = 2; (* No such file or directory *) + ESRCH = 3; (* No such process *) + EINTR = 4; (* Interrupted system call *) + EIO = 5; (* I/O error *) + ENXIO = 6; (* No such device or address *) + E2BIG = 7; (* Arg list too long *) + ENOEXEC = 8; (* Exec format error *) + EBADF = 9; (* Bad file number *) + ECHILD = 10; (* No children *) + EDEADLK = 11; (* Resource deadlock avoided *) + ENOMEM = 12; (* Not enough core *) + EACCES = 13; (* Permission denied *) + EFAULT = 14; (* Bad address *) + ENOTBLK = 15; (* Block device required *) + EBUSY = 16; (* Mount device busy *) + EEXIST = 17; (* File exists *) + EXDEV = 18; (* Cross-device link *) + ENODEV = 19; (* No such device *) + ENOTDIR = 20; (* Not a directory*) + EISDIR = 21; (* Is a directory *) + EINVAL = 22; (* Invalid argument *) + ENFILE = 23; (* File table overflow *) + EMFILE = 24; (* Too many open files *) + ENOTTY = 25; (* Not a typewriter *) + ETXTBSY = 26; (* Text file busy *) + EFBIG = 27; (* File too large *) + ENOSPC = 28; (* No space left on device *) + ESPIPE = 29; (* Illegal seek *) + EROFS = 30; (* Read-only file system *) + EMLINK = 31; (* Too many links *) + EPIPE = 32; (* Broken pipe *) + + (* math software *) + EDOM = 33; (* Argument too large *) + ERANGE = 34; (* Result too large *) + + (* non-blocking and interrupt i/o *) + EAGAIN = 35; (* Resource temporarily unavailable *) + EWOULDBLOCK = EAGAIN; (* Operation would block *) + EINPROGRESS = 36; (* Operation now in progress *) + EALREADY = 37; (* Operation already in progress *) + + (* ipc/network software *) + (* argument errors *) + ENOTSOCK = 38; (* Socket operation on non-socket *) + EDESTADDRREQ = 39; (* Destination address required *) + EMSGSIZE = 40; (* Message too long *) + EPROTOTYPE = 41; (* Protocol wrong type for socket *) + ENOPROTOOPT = 42; (* Protocol not available *) + EPROTONOSUPPORT = 43; (* Protocol not supported *) + ESOCKTNOSUPPORT = 44; (* Socket type not supported *) + EOPNOTSUPP = 45; (* Operation not supported on socket *) + EPFNOSUPPORT = 46; (* Protocol family not supported *) + EAFNOSUPPORT = 47; (* Address family not supported by protocol family *) + EADDRINUSE = 48; (* Address already in use *) + EADDRNOTAVAIL = 49; (* Can't assign requested address *) + + (* operational errors *) + ENETDOWN = 50; (* Network is down *) + ENETUNREACH = 51; (* Network is unreachable *) + ENETRESET = 52; (* Network dropped connection on reset *) + ECONNABORTED = 53; (* Software caused connection abort *) + ECONNRESET = 54; (* Connection reset by peer *) + ENOBUFS = 55; (* No buffer space available *) + EISCONN = 56; (* Socket is already connected *) + ENOTCONN = 57; (* Socket is not connected *) + ESHUTDOWN = 58; (* Can't send after socket shutdown *) + ETOOMANYREFS = 59; (* Too many references: can't splice *) + ETIMEDOUT = 60; (* Connection timed out *) + ECONNREFUSED = 61; (* Connection refused *) + + (* *) + ELOOP = 62; (* Too many levels of symbolic links *) + ENAMETOOLONG = 63; (* File name too long *) + + (* should be rearranged *) + EHOSTDOWN = 64; (* Host is down *) + EHOSTUNREACH = 65; (* No route to host *) + ENOTEMPTY = 66; (* Directory not empty *) + + (* quotas & mush *) + EPROCLIM = 67; (* Too many processes *) + EUSERS = 68; (* Too many users *) + EDQUOT = 69; (* Disc quota exceeded *) + + (* NFS error codes *) + ESTALE = 70; + EREMOTE = 71; + EBADRPC = 72; + ERPCMISMATCH = 73; + EPROGUNAVAIL = 74; (* RPC prog. not avail *) + EPROGMISMATCH = 75; (* Program version wrong *) + EPROCUNAVAIL = 76; (* Bad procedure for program *) + + (* POSIX errnos *) + ENOLCK = 77; (* No locks available *) + ENOSYS = 78; (* Function not implemented *) + + EFTYPE = 79; (* Inappropriate file type or format *) + EAUTH = 80; (* Authentication error *) + ENEEDAUTH = 81; (* Need authenticator *) + ELAST = 81; (* Must be equal to the largest errno *) + + <*EXTERNAL*> + VAR + errno: int; + + + (* Extension by mjordan *) + CONST + Max = ELAST; (* should be exported from Uerror *) + + <*EXTERNAL*> VAR + sys_nerr: int; + sys_errlist: ARRAY [0..Max] OF char_star; + + PROCEDURE GetFrom_sys_errlist(n: INTEGER): char_star RAISES {}; + (* returns entry 'n' of the 'sys_errlist' array; a checked runtime error + unless 0 <= n <= sys_nerr. Its safer and more portable to use this + procedure than to access the array directly. + *) + + END Uerror. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Uerror.m3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Uerror.m3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Uerror.m3 Mon Jun 7 13:15:11 1999 *************** *** 0 **** --- 1,20 ---- + (* Copyright (C) 1990, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Mon Mar 09 19:04:37 PST 1992 by muller *) + (* modified on Mon Nov 19 23:46:25 1990 by mjordan *) + + UNSAFE MODULE Uerror; + + IMPORT Ctypes; + + PROCEDURE GetFrom_sys_errlist(n: INTEGER): Ctypes.char_star RAISES {}= + BEGIN + <* ASSERT 0 <= n AND n <= Max *> + RETURN sys_errlist[n] + END GetFrom_sys_errlist; + + BEGIN + END Uerror. + Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Uexec.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Uexec.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Uexec.i3 Mon Jun 7 13:15:11 1999 *************** *** 0 **** --- 1,97 ---- + (* Copyright (C) 1990, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Tue Mar 24 20:01:29 PST 1992 by muller *) + (* modified on Mon Jul 9 16:47:46 PDT 1990 by mjordan *) + + UNSAFE INTERFACE Uexec; + + IMPORT Ctypes, Utypes, Uresource; + + (* Some of the Unix library process control calls. This is not a complete + interface, and should be added to as needed *) + + (* Remember that any of the calls which may return an error code in + 'Uerror.errno' should be serialized by use of 'UnixMutex.errno'. *) + + <*EXTERNAL*> + PROCEDURE execv( + name: Ctypes.char_star; + argv: Ctypes.char_star_star) + : Ctypes.int + RAISES {}; + + <*EXTERNAL*> + PROCEDURE execvp( + name: Ctypes.char_star; + argv: Ctypes.char_star_star) + : Ctypes.int + RAISES {}; + + <*EXTERNAL*> + PROCEDURE exect( + name: Ctypes.char_star; + argv: Ctypes.char_star_star; + envp: Ctypes.char_star_star) + : Ctypes.int + RAISES {}; + + (* options bits for the second argument of wait3. *) + CONST + WNOHANG = 1; (* dont hang in wait *) + WUNTRACED = 2; (* tell about stopped, untraced children *) + + TYPE + w_A = Ctypes.unsigned_int; + + (* terminated process status *) + w_T = RECORD + w_Termsig : BITS 7 FOR [0..16_7F]; (* termination signal *) + w_Coredump: BITS 1 FOR [0..16_01]; (* core dump indicator *) + w_Retcode : BITS 8 FOR [0..16_FF]; (* exit code if w_termsig == 0 *) + w_Filler : BITS 16 FOR [0..16_FFFF]; END; + + (* M3 view of return code *) + w_M3 = RECORD + w_Retcode : BITS 8 FOR [0..16_FF]; (* exit code if w_termsig == 0 *) + w_Termsig : BITS 7 FOR [0..16_7F]; (* termination signal *) + w_Coredump: BITS 1 FOR [0..16_01]; (* core dump indicator *) + w_Filler : BITS 16 FOR [0..16_FFFF]; END; + + (* stopped process status *) + w_S = RECORD + w_Stopval : BITS 8 FOR [0..16_FF]; (* == W_STOPPED if stopped *) + w_Stopsig : BITS 8 FOR [0..16_FF]; (* signal that stopped us *) + w_Filler : BITS 16 FOR [0..16_FFFF]; END; + + (* union wait is a union of the three types above. We will use w_A + in the declarations and do a LOOPHOLE when necessary *) + w_A_star = UNTRACED REF w_A; + + (* Wait queues (needed for Umsg.i3) *) + wait_queue = RECORD + task : Ctypes.void_star; (* : task_struct; see below *) + next : UNTRACED REF wait_queue; + END; + (* task_struct - use Ctypes.void_star because task_struct + should never be touched and is very very hard to emulate in Modula-3 + *) + + wait_queue_star = UNTRACED REF wait_queue; + + (*** wait, wait3, waitpid - wait for process to terminate ***) + + <*EXTERNAL*> + PROCEDURE wait (status: w_A_star): Utypes.pid_t; + + <*EXTERNAL*> + PROCEDURE wait3 (status: w_A_star; options: Ctypes.int; + rusage: Uresource.struct_rusage_star): Utypes.pid_t; + + <*EXTERNAL*> + PROCEDURE waitpid (pid: Utypes.pid_t; status: w_A_star; + options: Ctypes.int): Utypes.pid_t; + + END Uexec. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Ugrp.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Ugrp.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Ugrp.i3 Mon Jun 7 13:15:11 1999 *************** *** 0 **** --- 1,38 ---- + (* Copyright (C) 1994, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Wed Aug 17 14:25:29 PDT 1994 by kalsow *) + (* *) + (* Originally submitted on Fri, 22 Jul 1994 16:42:53 GMT *) + (* by jredford@lehman.com (John Redford) *) + + INTERFACE Ugrp; + + FROM Ctypes IMPORT char_star,char_star_star; + FROM Utypes IMPORT gid_t; + + (*** ***) + + TYPE + struct_group = RECORD + gr_name: char_star; + gr_passwd: char_star; + gr_gid: gid_t; + gr_mem: char_star_star; + END; + + struct_group_star = UNTRACED REF struct_group; + + (*** getgrent, getgrgid, getgrnam, setgrent, endgrent + - get group file entry ***) + + <*EXTERNAL*> PROCEDURE getgrent(): struct_group_star; + <*EXTERNAL*> PROCEDURE getgrgid(gid: gid_t): struct_group_star; + <*EXTERNAL*> PROCEDURE getgrnam(name: char_star): struct_group_star; + <*EXTERNAL*> PROCEDURE setgrent(); + <*EXTERNAL*> PROCEDURE endgrent(); + + END Ugrp. + + Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Uin.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Uin.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Uin.i3 Mon Jun 7 13:15:11 1999 *************** *** 0 **** --- 1,152 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Sat Jul 11 18:04:22 PDT 1992 by muller *) + (* modified on Tue Feb 11 22:04:30 PST 1992 by nichols@parc.xerox.com *) + + + INTERFACE Uin; + + FROM Ctypes IMPORT char; + FROM Utypes IMPORT u_char, u_short, u_long; + IMPORT Word; + + (* Constants and structures defined by the internet system, + Per RFC 790, September 1981. *) + + CONST + IPPROTO_IP = 0; (* dummy for IP *) + IPPROTO_ICMP = 1; (* control message protocol *) + IPPROTO_IGMP = 2; (* group control protocol *) + IPPROTO_GGP = 3; (* gateway^2 (deprecated) *) + IPPROTO_TCP = 6; (* tcp *) + IPPROTO_EGP = 8; (* exterior gateway protocol *) + IPPROTO_PUP = 12; (* pup *) + IPPROTO_UDP = 17; (* user datagram protocol *) + IPPROTO_IDP = 22; (* xns idp *) + IPPROTO_TP = 29; (* tp-4 w/ class negotiation *) + IPPROTO_RSVP = 46; (* resource reservation *) + IPPROTO_EON = 80; (* ISO cnlp *) + IPPROTO_ENCAP = 98; (* encapsulation header *) + + IPPROTO_DIVERT = 254; (* divert pseudo-protocol *) + IPPROTO_RAW = 255; (* raw IP packet *) + IPPROTO_MAX = 256; + + (* Port/socket numbers: network standard functions *) + IPPORT_ECHO = 7; + IPPORT_DISCARD = 9; + IPPORT_SYSTAT = 11; + IPPORT_DAYTIME = 13; + IPPORT_NETSTAT = 15; + IPPORT_FTP = 21; + IPPORT_TELNET = 23; + IPPORT_SMTP = 25; + IPPORT_TIMESERVER = 37; + IPPORT_NAMESERVER = 42; + IPPORT_WHOIS = 43; + IPPORT_MTP = 57; + + (* Port/socket numbers: host specific functions *) + IPPORT_TFTP = 69; + IPPORT_RJE = 77; + IPPORT_FINGER = 79; + IPPORT_TTYLINK = 87; + IPPORT_SUPDUP = 95; + + (* UNIX TCP sockets *) + IPPORT_EXECSERVER = 512; + IPPORT_LOGINSERVER = 513; + IPPORT_CMDSERVER = 514; + IPPORT_EFSSERVER = 520; + + (* UNIX UDP sockets *) + IPPORT_BIFFUDP = 512; + IPPORT_WHOSERVER = 513; + IPPORT_ROUTESERVER = 520; (* 520+1 also used *) + + (* Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root). + Ports > IPPORT_USERRESERVED are reserved for servers, not necessarily + privileged. *) + IPPORT_RESERVED = 1024; + IPPORT_USERRESERVED = 5000; + + (* Link numbers *) + IMPLINK_IP = 155; + IMPLINK_LOWEXPER = 156; + IMPLINK_HIGHEXPER = 158; + + + TYPE + struct_in_addr = RECORD + s_addr: u_long; END; + struct_in_addr_b = RECORD + s_b1, s_b2, s_b3, s_b4: u_char; END; + struct_in_addr_w = RECORD + s_w1, s_w2: u_short; END; + + + (* Definitions of bits in internet address integers. + On subnets, the decomposition of addresses to host and net parts + is done according to subnet mask, not the masks here. *) + PROCEDURE IN_CLASSA(i: INTEGER): BOOLEAN; + CONST + (* Compiler bug/feature forces us to use Word.Shift *) + IN_CLASSA_NET: u_long = Word.Shift(16_ff0000, 8); + IN_CLASSA_NSHIFT = 24; + IN_CLASSA_HOST = 16_00ffffff; + IN_CLASSA_MAX = 128; + + PROCEDURE IN_CLASSB(i: INTEGER): BOOLEAN; + CONST + IN_CLASSB_NET = Word.Shift(16_ffff00, 8); + IN_CLASSB_NSHIFT = 16; + IN_CLASSB_HOST = 16_0000ffff; + IN_CLASSB_MAX = 65536; + + PROCEDURE IN_CLASSC(i: INTEGER): BOOLEAN; + CONST + IN_CLASSC_NET = Word.Shift(16_ffffff, 8); + IN_CLASSC_NSHIFT = 8; + IN_CLASSC_HOST = 16_000000ff; + + PROCEDURE IN_CLASSD(i: INTEGER): BOOLEAN; + PROCEDURE IN_MULTICAST(i: INTEGER): BOOLEAN; + + PROCEDURE IN_EXPERIMENTAL(i: INTEGER): BOOLEAN; + PROCEDURE IN_BADCLASS(i: INTEGER): BOOLEAN; + + CONST + INADDR_ANY = 16_00000000; + INADDR_LOOPBACK = 16_7F000001; + INADDR_BROADCAST = Word.Shift(16_ffffff, 8) + 16_ff; + (* must be masked *) + + IN_LOOPBACKNET = 127; (* official! *) + + (* Stuff the loopback address into an Internet address. *) + PROCEDURE IN_SET_LOOPBACK_ADDR(a: struct_sockaddr_in_star); + + (* Socket address, internet style. *) + TYPE + struct_sockaddr_in = RECORD + sin_len: u_char; + sin_family: u_char; + sin_port: u_short; + sin_addr: struct_in_addr; + sin_zero: ARRAY [0..7] OF char; + END; + struct_sockaddr_in_star = UNTRACED REF struct_sockaddr_in; + + (* Options for use with [gs]etsockopt at the IP level. *) + CONST + IP_OPTIONS = 1; (* set/get IP per-packet options *) + + (* Procedures for number representation conversion. *) + PROCEDURE ntohl(x: u_long): u_long; + PROCEDURE ntohs(x: u_short): u_short; + PROCEDURE htonl(x: u_long): u_long; + PROCEDURE htons(x: u_short): u_short; + + END Uin. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Uin.m3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Uin.m3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Uin.m3 Mon Jun 7 13:15:11 1999 *************** *** 0 **** --- 1,95 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Sat Jan 7 14:33:32 PST 1995 by kalsow *) + (* modified on Tue Mar 24 21:10:33 PST 1992 by muller *) + (* modified on Tue Feb 11 22:04:30 PST 1992 by nichols@parc.xerox.com *) + + (* Little-endian version. *) + + UNSAFE MODULE Uin EXPORTS Uin; + (* Only unsafe because it needs Usocket.AF_INET and Usocket is unsafe. *) + + FROM Utypes IMPORT u_long, u_short, u_char; + IMPORT Usocket, Word; + + PROCEDURE IN_CLASSA(i: INTEGER): BOOLEAN = + BEGIN + RETURN Word.And(i, Word.Shift(16_800000, 8)) = 0; + END IN_CLASSA; + + PROCEDURE IN_CLASSB(i: INTEGER): BOOLEAN = + BEGIN + RETURN Word.And(i, Word.Shift(16_c00000, 8)) = Word.Shift(16_800000, 8); + END IN_CLASSB; + + PROCEDURE IN_CLASSC(i: INTEGER): BOOLEAN = + BEGIN + RETURN Word.And(i, Word.Shift(16_e00000, 8)) = Word.Shift(16_c00000, 8); + END IN_CLASSC; + + PROCEDURE IN_CLASSD(i: INTEGER): BOOLEAN = + BEGIN + RETURN Word.And(i, Word.Shift(16_f00000, 8)) = Word.Shift(16_e00000, 8); + END IN_CLASSD; + + PROCEDURE IN_MULTICAST(i: INTEGER): BOOLEAN = + BEGIN + RETURN IN_CLASSD(i); + END IN_MULTICAST; + + PROCEDURE IN_EXPERIMENTAL(i: INTEGER): BOOLEAN = + BEGIN + RETURN Word.And(i, Word.Shift(16_e00000, 8)) = Word.Shift(16_e00000, 8); + END IN_EXPERIMENTAL; + + PROCEDURE IN_BADCLASS(i: INTEGER): BOOLEAN = + BEGIN + RETURN Word.And(i, Word.Shift(16_f00000, 8)) = Word.Shift(16_f00000, 8); + END IN_BADCLASS; + + PROCEDURE IN_SET_LOOPBACK_ADDR(a: struct_sockaddr_in_star) = + BEGIN + a.sin_addr.s_addr := htonl(INADDR_LOOPBACK); + a.sin_family := Usocket.AF_INET; + END IN_SET_LOOPBACK_ADDR; + + TYPE + A = RECORD a, b, c, d: u_char; END; + B = RECORD d, c, b, a: u_char; END; + + C = RECORD a, b: u_char; END; + D = RECORD b, a: u_char; END; + + + PROCEDURE ntohl(x: u_long): u_long = + BEGIN + RETURN LOOPHOLE (B { a := LOOPHOLE (x, A).a, + b := LOOPHOLE (x, A).b, + c := LOOPHOLE (x, A).c, + d := LOOPHOLE (x, A).d}, u_long); + END ntohl; + + PROCEDURE ntohs(x: u_short): u_short = + BEGIN + RETURN LOOPHOLE (D { a := LOOPHOLE (x, C).a, + b := LOOPHOLE (x, C).b}, u_short); + END ntohs; + + PROCEDURE htonl(x: u_long): u_long = + BEGIN + RETURN LOOPHOLE (A { a := LOOPHOLE (x, B).a, + b := LOOPHOLE (x, B).b, + c := LOOPHOLE (x, B).c, + d := LOOPHOLE (x, B).d}, u_long); + END htonl; + + PROCEDURE htons(x: u_short): u_short = + BEGIN + RETURN LOOPHOLE (C { a := LOOPHOLE (x, D).a, + b := LOOPHOLE (x, D).b}, u_short); + END htons; + + BEGIN + END Uin. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Uipc.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Uipc.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Uipc.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,43 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Sat Mar 17 07:02:31 1990 by muller *) + + INTERFACE Uipc; + + FROM Ctypes IMPORT unsigned_short, long, int; + + (*** ***) + + TYPE + struct_ipc_perm = RECORD + key: int; (* key *) + uid: unsigned_short; (* owner's user id *) + gid: unsigned_short; (* owner's group id *) + cuid: unsigned_short; (* creator's user id *) + cgid: unsigned_short; (* creator's group id *) + mode: unsigned_short; (* access modes *) + seq: unsigned_short; (* slot usage sequence number *) + END; + + + (* Common IPC Definitions. *) + CONST + (* Mode bits. *) + IPC_ALLOC = 8_0100000; (* entry currently allocated *) + IPC_CREAT = 8_0001000; (* create entry if key doesn't exist *) + IPC_EXCL = 8_0002000; (* fail if key exists *) + IPC_NOWAIT = 8_0004000; (* error if request must wait *) + + (* Keys. *) + IPC_PRIVATE : long = 0; (* private key *) + + (* Control Commands. *) + IPC_RMID = 0; (* remove identifier *) + IPC_SET = 1; (* set options *) + IPC_STAT = 2; (* get options *) + + + END Uipc. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Umman.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Umman.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Umman.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,53 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Fri Apr 30 14:41:23 PDT 1993 by muller *) + (* ow Sat Oct 29 14:10:19 MET 1994 adapted for FreeBSD *) + INTERFACE Umman; + + FROM Ctypes IMPORT int; + FROM Utypes IMPORT caddr_t, size_t, off_t; + + (*** sys/mman.h ***) + + CONST + PROT_NONE = 16_0000; + PROT_READ = 16_0001; + PROT_WRITE = 16_0002; + PROT_EXEC = 16_0004; + + MAP_FILE = 16_0000; + MAP_ANON = 16_1000; + + MAP_PRIVATE = 16_0002; + MAP_SHARED = 16_0001; + MAP_COPY = 16_0004; + + MAP_FIXED = 16_0010; + MAP_RENAME = 16_0020; + MAP_NORESERVE = 16_0040; + MAP_INHERIT = 16_0080; + MAP_NOEXTEND = 16_0100; + MAP_HASSEMAPHORE = 16_0200; + + MADV_NORMAL = 0; + MADV_RANDOM = 1; + MADV_SEQUENTIAL = 2; + MADV_WILLNEED = 3; + MADV_DONTNEED = 4; + + <*EXTERNAL "m3_mmap" *> + PROCEDURE mmap (addr: caddr_t; len: size_t; prot,flags,fd: int; off: off_t) + : caddr_t; + + <*EXTERNAL*> + PROCEDURE munmap (addr: caddr_t; len: size_t): int; + + <*EXTERNAL*> + PROCEDURE mprotect (addr: caddr_t; len: size_t; prot:int): int; + + <*EXTERNAL*> + PROCEDURE msync (addr: caddr_t; len: size_t): int; + + END Umman. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Umsg.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Umsg.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Umsg.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,125 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Fri Apr 30 14:41:53 PDT 1993 by muller *) + + UNSAFE INTERFACE Umsg; + + FROM Ctypes IMPORT char, char_star, short, unsigned_short, long, int; + FROM Utypes IMPORT time_t; + FROM Uipc IMPORT struct_ipc_perm; + FROM Uexec IMPORT wait_queue_star; + + (*** ***) + + (* IPC Message Facility. *) + + CONST + + PZERO = 25; (* I got this value from param.h; em *) + PMSG = (PZERO + 2); (* message facility sleep priority *) + + (* Permission Definitions. *) + + MSG_R = 8_0400; (* read permission *) + MSG_W = 8_0200; (* write permission *) + + (* ipc_perm Mode Definitions. *) + + MSG_RWAIT = 8_01000; (* a reader is waiting for a message *) + MSG_WWAIT = 8_02000; (* a writer is waiting to send *) + MSG_LCK = 8_010000; (* message queue locked *) + MSG_WANT = 8_020000; (* lock wanted *) + + + (* + * The following lock routines are required for message queues because + * in the middle of list manipulation, copyin()/copyout() are called. + * An implicit side effect of copyin/copyout are possible page faults on the + * user buffers being accessed. Page faults can cause the process to sleep, + * thereby causing a competing process to startup. -- depp + * + *) + + (** actually, theses macros reference sleep, panic, wakeup, which I + cannot find; therefore their implementations are buggy - em **) + PROCEDURE MSG_LOCK (x: UNTRACED REF struct_msqid_ds); + PROCEDURE MSG_UNLOCK (x: UNTRACED REF struct_msqid_ds); + + + CONST + (* Message Operation Flags. *) + + MSG_NOERROR = 8_010000; (* no error if big message *) + + (* Sizing constants *) + + MSGMAP = 100; + MSGMAX = 8192; + MSGMNB = 16384; + MSGMNI = 50; + MSGSSZ = 8; + MSGTQL = 40; + MSGSEG = 1024; + + (* + ** There is one msg queue id data structure for each q in the system. + *) + + TYPE + struct_msqid_ds = RECORD + msg_perm: struct_ipc_perm; (* operation permission struct *) + msg_first: struct_msg_star; (* ptr to first message on q *) + msg_last: struct_msg_star; (* ptr to last message on q *) + msg_stime: time_t; (* last msgsnd time *) + msg_rtime: time_t; (* last msgrcv time *) + msg_ctime: time_t; (* last change time *) + wwait : wait_queue_star; + rwait : wait_queue_star; (* God knows *) + msg_cbytes: unsigned_short; (* current # bytes on q *) + msg_qnum: unsigned_short; (* # of messages on q *) + msg_qbytes: unsigned_short; (* max # of bytes on q *) + msg_lspid: unsigned_short; (* pid of last msgsnd *) + msg_lrpid: unsigned_short; (* pid of last msgrcv *) + END; + + (* + ** There is one msg structure for each message that may be in the system. + *) + + TYPE + struct_msg = RECORD + msg_next: UNTRACED REF struct_msg; (* ptr to next message on q *) + msg_type: long; (* message type *) + msg_spot: char_star; (* message text address *) + msg_ts: short; (* message text size *) + END; + struct_msg_star = UNTRACED REF struct_msg; + + (* + ** User message buffer template for msgsnd and msgrecv system calls. + *) + + struct_msgbuf = RECORD + mtype: long; (* message type *) + mtext: ARRAY [0..0] OF char; (* message text *) + END; + (* + ** Message information structure. + *) + + struct_msginfo = RECORD + msgpool: int; (* Linux-specific *) + msgmap : int; (* # of entries in msg map *) + msgmax : int; (* max message size *) + msgmnb : int; (* max # bytes on queue *) + msgmni : int; (* # of message queue identifiers *) + msgssz : int; (* msg segment size (should be word size multiple) *) + msgtql : int; (* # of system message headers *) + msgseg : unsigned_short; (* # of msg segments (MUST BE < 32768) *) + END; + + + END Umsg. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Umsg.m3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Umsg.m3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Umsg.m3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,35 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Mon Mar 09 19:04:05 PST 1992 by muller *) + + UNSAFE MODULE Umsg; + + PROCEDURE MSG_LOCK (<*UNUSED*> x: UNTRACED REF struct_msqid_ds) = + BEGIN + (* + WITH mode = x.msg_perm.mode DO + WHILE Word.And (mode, MSG_LCK) # 0 DO + mode := Word.Or (mode, MSG_WANT); + Unix.sleep (x.msg_first, PMSG); END; + mode := Word.Or (mode, MSG_LCK); END; + *) + END MSG_LOCK; + + PROCEDURE MSG_UNLOCK (<*UNUSED*> x: UNTRACED REF struct_msqid_ds) = + BEGIN + (* + WITH mode = x.msg_perm.mode DO + IF Word.And (mode, MSG_LCK) = 0 THEN + Unix.panic (M3toC.TtoS ("MSG_UNLOCK")); END; + IF Word.And (mode, MSG_WANT) # 0 THEN + Ultrix.wakeup (x.msg_first); END; + mode := Word.And (mode, Word.Not (Word.Or (MSG_WANT, MSG_LCK))); END; + *) + END MSG_UNLOCK; + + BEGIN + END Umsg. + Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Unetdb.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Unetdb.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Unetdb.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,159 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Fri Apr 30 14:42:11 PDT 1993 by muller *) + + INTERFACE Unetdb; + + FROM Ctypes IMPORT int, char_star, char_star_star, unsigned_long; + + (*** ***) + + (* + * Structures returned by network + * data base library. All addresses + * are supplied in host order, and + * returned in network order (suitable + * for use in system calls). + *) + + TYPE + struct_hostent = RECORD + h_name: char_star; (* official name of host *) + h_aliases: char_star_star; (* alias list *) + h_addrtype: int; (* host address type *) + h_length: int; (* length of address *) + h_addr_list: char_star_star; (* list of addresses from name server *) + END; + struct_hostent_star = UNTRACED REF struct_hostent; + + (* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + *) + + struct_netent = RECORD + n_name: char_star; (* official name of net *) + n_aliases: char_star_star; (* alias list *) + n_addrtype: int; (* net address type *) + n_net: unsigned_long; (* network # *) + END; + struct_netent_star = UNTRACED REF struct_netent; + + struct_servent = RECORD + s_name: char_star; (* official service name *) + s_aliases: char_star_star; (* alias list *) + s_port: int; (* port # *) + s_proto: char_star; (* protocol to use *) + END; + struct_servent_star = UNTRACED REF struct_servent; + + struct_protoent = RECORD + p_name: char_star; (* official protocol name *) + p_aliases: char_star_star; (* alias list *) + p_proto: int; (* protocol # *) + END; + struct_protoent_star = UNTRACED REF struct_protoent; + + struct_rpcent = RECORD + r_name: char_star; (* name of server for this rpc program *) + r_aliases: char_star_star; (* alias list *) + r_number: int; (* rpc program number *) + END; + + + (* + * Error return codes from gethostbyname() and gethostbyaddr() + *) + + CONST + HOST_NOT_FOUND = 1; (* Authoritive Answer Host not found *) + TRY_AGAIN = 2; (* Non-Authoritive Host not found, or SERVERFAIL *) + NO_RECOVERY = 3; (* Non recoverable errors, FORMERR, REFUSED, NOTIMP *) + NO_ADDRESS = 4; (* Valid host name, no address, look for MX record *) + + (* The services accessible via the V2.4 gethostent interface *) + + SVC_LOCAL = 1; (* /etc/hosts *) + SVC_BIND = 2; (* Internet domain service *) + SVC_YP = 3; (* Yellow Pages service *) + + (* Number of services *) + + NSVCS = 4; (* Number of supported services *) + + PROCEDURE VALID_SVC (a: int): BOOLEAN; + + (*** gethostent(3n), gethostbyaddr(3n), gethostbyname(3n), + sethostent(3n), endhostent(3n) - get network host entry ***) + + <*EXTERNAL "m3_gethostbyname"*> + PROCEDURE gethostbyname (name: char_star): struct_hostent_star; + + <*EXTERNAL "m3_gethostbyaddr"*> + PROCEDURE gethostbyaddr (addr: char_star; len, type: int): struct_hostent_star; + + <*EXTERNAL*> + PROCEDURE sethostent (stayopen: int); + + <*EXTERNAL*> + PROCEDURE endhostent (); + + (*** getnetent(3n), getnetbyaddr(3n), getnetbyname(3n), + setnetent(3n), endnetent(3n) - get network entry ***) + + <*EXTERNAL*> + PROCEDURE getnetent (): struct_netent_star; + + <*EXTERNAL*> + PROCEDURE getnetbyname (name: char_star): struct_netent_star; + + <*EXTERNAL*> + PROCEDURE getnetbyaddr (addr: char_star; type: int): struct_netent_star; + + <*EXTERNAL*> + PROCEDURE setnetent (stayopen: int); + + <*EXTERNAL*> + PROCEDURE endnetent (); + + + (*** getprotoent(3n), getprotobynumber(3n), getprotobyname(3n), + setprotoent(3n), endprotoent(3n) - get protocol entry ***) + + <*EXTERNAL*> + PROCEDURE getprotoent (): struct_protoent_star; + + <*EXTERNAL*> + PROCEDURE getprotobynumber (proto: int): struct_protoent_star; + + <*EXTERNAL*> + PROCEDURE getprotobyname (name: char_star): struct_protoent_star; + + <*EXTERNAL*> + PROCEDURE setprotoent (stayopen: int); + + <*EXTERNAL*> + PROCEDURE endprotoent (); + + + (*** getservent(3n), getservbynumber(3n), getservbyname(3n), + setservent(3n), endservent(3n) - get service entry ***) + + <*EXTERNAL*> + PROCEDURE getservent (): struct_servent_star; + + <*EXTERNAL*> + PROCEDURE getservbyport (port: int; proto: char_star): struct_servent_star; + + <*EXTERNAL*> + PROCEDURE getservbyname (name, proto: char_star): struct_servent_star; + + <*EXTERNAL*> + PROCEDURE setservent (stayopen: int); + + <*EXTERNAL*> + PROCEDURE endservent (); + + END Unetdb. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Unetdb.m3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Unetdb.m3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Unetdb.m3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,18 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Mon Mar 09 19:04:24 PST 1992 by muller *) + + MODULE Unetdb; + + FROM Ctypes IMPORT int; + + PROCEDURE VALID_SVC (a: int): BOOLEAN = + BEGIN + RETURN 0 < a AND a < NSVCS; + END VALID_SVC; + + BEGIN + END Unetdb. + Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Unix.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Unix.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Unix.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,973 ---- + (* Copyright (C) 1994, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Sat Jan 7 14:41:42 PST 1995 by kalsow *) + (* modified on Sun Nov 6 16:39:26 MET 1994 by Olaf Wagner *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Tue Jun 8 16:26:41 PDT 1993 by mcjones *) + (* modified on Mon Jan 11 14:34:49 PST 1993 by muller *) + (* *) + (* ow 01.10.1994 adjusted file mode flags for FreeBSD *) + (* ow Sun Nov 6 16:39:26 MET 1994 *) + (* Most of the system calls have been checked and adjusted *) + (* for FreeBSD now. Still to be done completedly: ioctl *) + + INTERFACE Unix; + + FROM Word IMPORT Or, And, Shift; + + FROM Ctypes IMPORT short, int, long, char_star, + char_star_star; + FROM Utypes IMPORT dev_t, off_t, mode_t, pid_t, (*tcflag_t,*) u_long, + (*cc_t, speed_t,*) uid_t, gid_t, size_t; + FROM Utime IMPORT struct_timeval; + + CONST + MaxPathLen = 1024; + + (*** file flags ***) + CONST + FREAD = 16_0000; (* descriptor read/receive'able *) + FWRITE = 16_0001; (* descriptor write/send'ale *) + FCREAT = 16_0200; (* create if nonexistant *) + FEXCL = 16_0800; (* error if already created *) + FTRUNC = 16_0400; (* truncate to zero length *) + FAPPEND = 16_0008; (* append on each write *) + FNBLOCK = 16_0004; (* POSIX no delay *) + FNDELAY = FNBLOCK; (* no delay *) + FSYNCRON = 16_0080; (* write file syncronously *) + FMARK = 16_1000; (* makr during gc() *) + FDEFER = 16_2000; (* fefer for next gc pass *) + FASYNC = 16_0040; (* signal pgrp when data ready *) + FSHLOCK = 16_0010; (* shared lock present *) + FEXLOCK = 16_0020; (* exclusive lock present *) + + CONST + MSETUID = 8_4000; + MSETGID = 8_2000; + MSTICKY = 8_1000; + MROWNER = 8_0400; + MWOWNER = 8_0200; + MXOWNER = 8_0100; + MRGROUP = 8_0040; + MWGROUP = 8_0020; + MXGROUP = 8_0010; + MROTHER = 8_0004; + MWOTHER = 8_0002; + MXOTHER = 8_0001; + Mrwrr = MROWNER + MWOWNER + MRGROUP + MROTHER; + Mrwrwrw = MROWNER + MWOWNER + MRGROUP + MWGROUP + MROTHER + MWOTHER; + + + + (*** access - determine the accessibility of file ***) + <*EXTERNAL*> PROCEDURE access (path: char_star; mod: int): int; + (* ok *) + + (*** acct - turn accounting on or off ***) + <*EXTERNAL*> PROCEDURE acct (path: char_star): int; + (* ok *) + + (*** brk, sbrk - change data segment space allocation *) + <*EXTERNAL*> PROCEDURE brk (addr: ADDRESS): int; + (* ok *) + <*EXTERNAL*> PROCEDURE sbrk (inc: int): char_star; + (* ok *) + + (*** chdir - change working directory ***) + <*EXTERNAL*> PROCEDURE chdir (path: char_star): int; + (* ok *) + + (*** chmod, fchmod - change mde of file ***) + <*EXTERNAL*> PROCEDURE chmod (path: char_star; mode: mode_t): int; + <*EXTERNAL*> PROCEDURE fchmod (fd, mode: mode_t): int; + (* ok *) + + (*** chown, fchown, lchown - change owner and group of a file ***) + <*EXTERNAL*> PROCEDURE chown (path: char_star; owner: uid_t; group: gid_t): int; + <*EXTERNAL*> PROCEDURE fchown (fd: int; owner: uid_t; group: gid_t): int; + <*EXTERNAL*> PROCEDURE lchown (path: char_star; owner: uid_t; group: gid_t): int; + (* ok *) + + (*** chroot - change root directory ***) + <*EXTERNAL*> PROCEDURE chroot (dirname: char_star): int; + (* ok *) + + (*** close - delete a descriptor ***) + <*EXTERNAL "m3_close"*> PROCEDURE close (d: int): int; + (* ok *) + + (*** creat - create a new file ***) + <*EXTERNAL*> PROCEDURE creat (name: char_star; mode: mode_t): int; + (* ok, but obsolete *) + + (*** dup, dup2 - duplicate an open file descriptor ***) + <*EXTERNAL "m3_dup"*> PROCEDURE dup (oldd: int): int; + <*EXTERNAL "m3_dup2"*> PROCEDURE dup2 (oldd, newd: int): int; + (* ok *) + + (*** execve - execute a file ***) + <*EXTERNAL*> PROCEDURE execve (name: char_star; + argv, envp: char_star_star): int; + (* ok *) + + (*** exit - terminate a process ***) + <*EXTERNAL*> PROCEDURE exit (i: int); + (* ok *) + + (*** _exit - terminate a process without performing C I/O library cleanup ***) + <*EXTERNAL "_exit"*> PROCEDURE underscore_exit (i: int); + (* ok *) + + (*** fcntl - file control ***) + CONST (* request *) + F_DUPFD = 0; (* Duplicate fd *) + F_GETFD = 1; (* Get close-on-exec flag *) + F_SETFD = 2; (* Set close-on-exec flag *) + F_GETFL = 3; (* Get fd status flags *) + F_SETFL = 4; (* Set fd status flags *) + + (* in these three cases, you need to pass LOOPHOLE (ADR (v), int) + for arg, where v is a variable of type struct_flock *) + F_GETOWN = 5; (* Set owner *) + F_SETOWN = 6; (* Get owner *) + + F_GETLK = 7; (* Get file lock *) + F_SETLK = 8; (* Set file lock *) + F_SETLKW = 9; (* Set file lock and wait *) + + CONST (* fd flags *) + FD_CLOEXEC = 1; (* Close file descriptor on exec() *) + + TYPE + struct_flock = RECORD + l_start: off_t := 0; + l_pad1: long := 0; (* assume zero sign extension of l_start *) + l_len: off_t := 0; + l_pad2: long := 0; (* assume zero sign extension of l_len *) + l_pid: pid_t := 0; + l_type: short; (* see below *) + l_whence: short; + END; + (* ok *) + + CONST (* l_type values *) + F_RDLCK = 1; (* Read lock *) + F_WRLCK = 3; (* Write lock *) + F_UNLCK = 2; (* Remove lock(s) *) + + <*EXTERNAL "ufcntl"*> PROCEDURE fcntl (fd, request, arg: int): int; + (* ok *) + + (*** flock - apply or remove an advisory lock on an open file ***) + CONST + LOCK_SH = 1; (* shared lock *) + LOCK_EX = 2; (* exclusive lock *) + LOCK_NB = 4; (* don't block when locking *) + LOCK_UN = 8; (* unlock *) + + <*EXTERNAL*> PROCEDURE flock (fd, operation: int): int; + (* ok *) + + (*** fork - create a new process ***) + <*EXTERNAL*> PROCEDURE fork (): pid_t; + (* ok *) + + (*** fsync - synchronize a file's in-core state with that on disk ***) + <*EXTERNAL*> PROCEDURE fsync (fd: int): int; + (* ok *) + + (*** getdirentries - gets directory entries in a generic directory format ***) + <*EXTERNAL*> PROCEDURE getdirentries (fd: int; buf: ADDRESS; + nbytes: int; VAR basep: long): int; + (* ok *) + + (*** getdomainname, setdomainname - get or set name of current domain ***) + <*EXTERNAL*> PROCEDURE getdomainname (name: char_star; namelen: int): int; + <*EXTERNAL*> PROCEDURE setdomainname (name: char_star; namelen: int): int; + (* ok *) + + (*** getdtablesize - get descriptor table size ***) + <*EXTERNAL*> PROCEDURE getdtablesize (): int; + (* ok *) + + (*** getgroups - get group access list ***) + <*EXTERNAL*> PROCEDURE getgroups (gidsetsize: int; VAR gidset: int): int; + (* ok *) + + (*** gethostid, sethostid - get/set unique identifier of current host ***) + <*EXTERNAL*> PROCEDURE gethostid (): long; + <*EXTERNAL*> PROCEDURE sethostid (hostid: long): int; + (* ok *) + + + (*** gethostname, sethostname - get/set name of current host ***) + <*EXTERNAL*> PROCEDURE gethostname (name: char_star; namelen: int): int; + <*EXTERNAL*> PROCEDURE sethostname (name: char_star; namelen: int): int; + (* ok *) + + (*** getpagesize - get system page size ***) + <*EXTERNAL*> PROCEDURE getpagesize (): int; + (* ok *) + + (*** getwd - get current working directory pathname ***) + <*EXTERNAL*> PROCEDURE getwd (pathname: char_star): char_star; + <*EXTERNAL*> PROCEDURE getcwd (pathname: char_star; size: size_t): char_star; + (* ok *) + + (*** ioctl - control device ***) + (* this is a temptative declaration of the types of the arguments. + it shoulb probably done in another way, so it is commented. We really need + only the sizes of these records; see below + + TYPE + struct_sgttyb_ULTRIX = RECORD + sg_ispeed: char; (* input speed *) + sg_ospeed: char; (* output speed *) + sg_erase: char; (* erase character *) + sg_kill: char; (* kill character *) + sg_flags: short; (* mode flags *) + END; + (* ok *) + + struct_tchars = RECORD + t_intrc: char; /* Interrupt */ + t_quitc: char; /* Quit */ + t_startc: char; /* Start output */ + t_stopc: char; /* Stop output */ + t_eofc: char; /* End-of-file (EOF) */ + t_brkc: char; /* Input delimiter (like nl) */ + END; + (* ok *) + + struct_ltchars = RECORD + t_suspc: char; /* Stop process signal */ + t_dsuspc: char; /* Delayed stop process signal */ + t_rprntc: char; /* Reprint line */ + t_flushc: char; /* Flush output (toggles) */ + t_werasc: char; /* Word erase */ + t_lnextc: char; /* Literal next character */ + END; + (* ok *) + + struct_winsize = RECORD + ws_row, ws_col: u_short; /* Window charact. size */ + ws_xpixel, ws_ypixel: u_short; /* Window pixel size */ + END; + (* ok *) + + (* + struct_termio = RECORD + c_iflag: u_short; /* input modes */ + c_oflag: u_short; /* output modes */ + c_cflag: u_short; /* control modes */ + c_lflag: u_short; /* line discipline modes */ + c_line: char; /* line discipline */ + c_cc[NCC]: u_char; /* control chars */ + END; + *) + + struct_termios = RECORD + c_iflag: tcflag_t; /* Input Modes */ + c_oflag: tcflag_t; /* Output Modes */ + c_cflag: tcflag_t; /* Control Modes */ + c_lflag: tcflag_t; /* Local Modes */ + c_cc[NCCS]: cc_t; /* Control Characters */ + c_ispeed, + c_ospeed: speed_t; + END; + (* ok *) + + (* This is how far I got. I don't think anybody will ever need it, + so I stop here. ow Sun Nov 6 17:12:47 MET 1994 *) + struct_rtentry = RECORD + u_long rt_hash; /* to speed lookups */ + struct_sockaddr rt_dst; /* key */ + struct_sockaddr rt_gateway; /* value */ + short rt_flags; /* up/down?, host/net */ + short rt_refcnt; /* # held references */ + u_long rt_use; /* raw # packets forwarded */ + struct_ifnet *rt_ifp; /* the answer: interface to use */ + struct_rtentry *rt_next; /* next in list */ + END; + + struct_ifreq_1 = RECORD + char ifr_name[16]; /* if name, e.g. "en0" */ + struct_sockaddr ifru_addr; + END; + struct_ifreq_2 = RECORD + char ifr_name[16]; /* if name, e.g. "en0" */ + u_short ifru_flags; + END; + struct_ifreq_3 = RECORD + char ifr_name[16]; /* if name, e.g. "en0" */ + int ifru_metric; + END; + struct_ifreq_4 = RECORD + char ifr_name[16]; /* if name, e.g. "en0" */ + caddr_t ifru_data; + END; + + struct_ifconf_1 = RECORD + int ifc_len; /* size of associated buffer */ + caddr_t ifcu_buf; + END; + struct_ifconf_2 = RECORD + int ifc_len; /* size of associated buffer */ + struct ifreq *ifcu_req; + END; + + struct_ctrreq_1 = RECORD + char ctr_name[IFNAMSIZ]; /* if name */ + char ctr_type; /* type of interface */ + struct_estat ctrc_ether;/* ethernet counters */ + END; + struct_ctrreq_2 = RECORD + char ctr_name[IFNAMSIZ]; /* if name */ + char ctr_type; /* type of interface */ + struct_dstat ctrc_ddcmp;/* DDCMP pt-to-pt counters */ + END; + + struct_ifdevea = RECORD + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + u_char default_pa[6]; /* default hardware address */ + u_char current_pa[6]; /* current physical address */ + END; + + struct_arpreq = RECORD + struct_sockaddr arp_pa; /* protocol address */ + struct_sockaddr arp_ha; /* hardware address */ + int arp_flags; /* flags */ + END; + + struct_ifstate = RECORD + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + u_short if_family; /* current family ownership */ + u_short if_next_family; /* next family ownership */ + u_short if_mode:3, /* mode of device */ + if_ustate:1, /* user requested state */ + if_nomuxhdr:1, /* if set, omit mux header */ + if_dstate:4, /* current state of device */ + if_xferctl:1, /* xfer control to nxt family */ + if_rdstate:1, /* read current state */ + if_wrstate:1, /* set current state */ + if_reserved:4; + END; + + struct_solicit_1 = RECORD + END; + + struct_response_1 = RECORD + END; + + struct_lat_ucom = RECORD + END; + + struct_lat_ini = RECORD + END; + + #define MAXLTADESTSIZE 16 + #define MAXLTASERVSIZE 16 + #define MAXLTAPORTSIZE 16 + + struct_ltattyi = RECORD + char lta_dest_port[MAXLTADESTSIZE+1]; + char lta_server_name[MAXLTASERVSIZE+1]; + char lta_server_port[MAXLTAPORTSIZE+1]; + END; + + struct_pt = RECORD + END; + + struct_el = RECORD + END; + + struct_mtop = RECORD + short mt_op; /* Operations defined below */ + daddr_t mt_count; /* How many of them */ + END; + + struct_mtget = RECORD + short mt_type; /* Type of device defined below */ + short mt_dsreg; /* ``drive status'' register */ + short mt_erreg; /* ``error'' register */ + short mt_resid; /* Residual count */ + END; + + struct_dkop = RECORD + short dk_op; /* Operations defined below */ + daddr_t dk_count; /* How many of them */ + END; + + struct_dkget = RECORD + short dk_type; /* Type of device defined below */ + short dk_dsreg; /* ``drive status'' register */ + short dk_erreg; /* ``error'' register */ + short dk_resid; /* Residual count */ + END; + + struct_dkacc = RECORD + short dk_opcode; /* Operation code for access */ + long dk_lbn; /* Disk sector number */ + long dk_length; /* Length of transfer */ + unsigned dk_status; /* Status of operation */ + unsigned dk_flags; /* Status flags */ + END; + + struct_devget = RECORD + short category; /* Category */ + short bus; /* Bus */ + char interface[DEV_SIZE]; /* Interface (string) */ + char device[DEV_SIZE]; /* Device (string) */ + short adpt_num; /* Adapter number */ + short nexus_num; /* Nexus or node on adapter no. */ + short bus_num; /* Bus number */ + short ctlr_num; /* Controller number */ + short rctlr_num; /* Remote controller number */ + short slave_num; /* Plug or line number */ + char dev_name[DEV_SIZE]; /* Ultrix device pneumonic */ + short unit_num; /* Ultrix device unit number */ + unsigned soft_count; /* Driver soft error count */ + unsigned hard_count; /* Driver hard error count */ + long stat; /* Generic status mask */ + long category_stat; /* Category specific mask */ + END; + *) + + CONST + IOCPARM_MASK = 16_1fff; + IOC_VOID = Shift (1, 29); (* no parameters *) + IOC_OUT = Shift (1, 30); (* copy out parameters *) + IOC_IN = Shift (1, 31); (* copy in parameters *) + IOC_INOUT = Or (IOC_IN, IOC_OUT); + + + NOARG = IOC_VOID; + R = IOC_OUT; + W = IOC_IN; + RW = IOC_INOUT; + (* if we had the structure declarations, we would use these + INT = Shift (And (BYTESIZE (INTEGER), IOCPARM_MASK), 16); + SG = Shift (And (BYTESIZE (struct_sgttyb_ULTRIX), IOCPARM_MASK), 16); + TCHAR = Shift (And (BYTESIZE (struct_tchars), IOCPARM_MASK), 16); + LC = Shift (And (BYTESIZE (struct_ltchars), IOCPARM_MASK), 16); + WS = Shift (And (BYTESIZE (struct_winsize), IOCPARM_MASK), 16); + TIO = Shift (And (BYTESIZE (struct_termio), IOCPARM_MASK), 16); + IOS = Shift (And (BYTESIZE (struct_termios), IOCPARM_MASK), 16); + RTE = Shift (And (BYTESIZE (struct_rtentry), IOCPARM_MASK), 16); + IFR = Shift (And (BYTESIZE (struct_ifreq), IOCPARM_MASK), 16); + IFC = Shift (And (BYTESIZE (struct_ifconf), IOCPARM_MASK), 16); + CTR = Shift (And (BYTESIZE (struct_ctrreq), IOCPARM_MASK), 16); + IFD = Shift (And (BYTESIZE (struct_ifdevea), IOCPARM_MASK), 16); + ARP = Shift (And (BYTESIZE (struct_arpreq), IOCPARM_MASK), 16); + IFS = Shift (And (BYTESIZE (struct_ifstate), IOCPARM_MASK), 16); + SOL = Shift (And (BYTESIZE (struct_solicit_1), IOCPARM_MASK), 16); + RES = Shift (And (BYTESIZE (struct_response_1), IOCPARM_MASK), 16); + LAU = Shift (And (BYTESIZE (struct_lat_ucom), IOCPARM_MASK), 16); + LAI = Shift (And (BYTESIZE (struct_lat_ini), IOCPARM_MASK), 16); + LTA = Shift (And (BYTESIZE (struct_ltattyi), IOCPARM_MASK), 16); + PT = Shift (And (BYTESIZE (struct_pt), IOCPARM_MASK), 16); + EL = Shift (And (BYTESIZE (struct_el), IOCPARM_MASK), 16); + MTO = Shift (And (BYTESIZE (struct_mtop), IOCPARM_MASK), 16); + MTG = Shift (And (BYTESIZE (struct_mtget), IOCPARM_MASK), 16); + DKO = Shift (And (BYTESIZE (struct_dkop), IOCPARM_MASK), 16); + DKG = Shift (And (BYTESIZE (struct_dkget), IOCPARM_MASK), 16); + DKA = Shift (And (BYTESIZE (struct_dkacc), IOCPARM_MASK), 16); + DEV = Shift (And (BYTESIZE (struct_devget), IOCPARM_MASK), 16); + + but instead we use these *) + + INT = Shift (And (BYTESIZE (INTEGER), IOCPARM_MASK), 16); + SG = Shift (And (0, IOCPARM_MASK), 16); + TCHAR = Shift (And (0, IOCPARM_MASK), 16); + LC = Shift (And (0, IOCPARM_MASK), 16); + WS = Shift (And (0, IOCPARM_MASK), 16); + TIO = Shift (And (0, IOCPARM_MASK), 16); + IOS = Shift (And (0, IOCPARM_MASK), 16); + RTE = Shift (And (0, IOCPARM_MASK), 16); + IFR = Shift (And (0, IOCPARM_MASK), 16); + IFC = Shift (And (0, IOCPARM_MASK), 16); + CTR = Shift (And (0, IOCPARM_MASK), 16); + IFD = Shift (And (0, IOCPARM_MASK), 16); + ARP = Shift (And (0, IOCPARM_MASK), 16); + IFS = Shift (And (0, IOCPARM_MASK), 16); + SOL = Shift (And (0, IOCPARM_MASK), 16); + RES = Shift (And (0, IOCPARM_MASK), 16); + LAU = Shift (And (0, IOCPARM_MASK), 16); + LAI = Shift (And (0, IOCPARM_MASK), 16); + LTA = Shift (And (0, IOCPARM_MASK), 16); + PT = Shift (And (0, IOCPARM_MASK), 16); + EL = Shift (And (0, IOCPARM_MASK), 16); + MTO = Shift (And (0, IOCPARM_MASK), 16); + MTG = Shift (And (0, IOCPARM_MASK), 16); + DKO = Shift (And (0, IOCPARM_MASK), 16); + DKG = Shift (And (0, IOCPARM_MASK), 16); + DKA = Shift (And (0, IOCPARM_MASK), 16); + DEV = Shift (And (0, IOCPARM_MASK), 16); + + CONST (* the tty i/o controls *) + TC = Shift (ORD ('t'), 8); + + TIOCGETD = Or (Or (R, INT), Or (TC, 0)); (* get line discipline *) + TIOCSETD = Or (Or (W, INT), Or (TC, 1)); (* set line discipline *) + OTTYDISC = 16_00; (* Old, v7 std tty driver *) + NETLDISC = 16_01; (* Line discipline for berk net *) + NTTYDISC = 16_02; (* New tty discipline *) + TABLDISC = 16_03; (* Hitachi tablet discipline *) + NTABLDISC = 16_04; (* Gtco tablet discipline *) + HCLDISC = 16_05; (* Half cooked discipline *) + TERMIODISC = 16_06; (* termio line discipline *) + SLPDISC = 16_07; (* BSD Serial Line IP *) + (* Line disc #'s 16-23 are reserved for local extension.*) + TIOCHPCL = Or (NOARG, Or (TC, 2)); (* hangup on last close *) + TIOCMODG = Or (Or (R, INT), Or (TC, 3)); (* get modem control state *) + TIOCMODS = Or (Or (R, INT), Or (TC, 4)); (* set modem control state *) + TIOCM_LE = 16_001; (* line enable *) + TIOCM_DTR = 16_002; (* data terminal ready *) + TIOCM_RTS = 16_004; (* request to send *) + TIOCM_ST = 16_008; (* secondary transmit *) + TIOCM_SR = 16_010; (* secondary receive *) + TIOCM_CTS = 16_020; (* clear to send *) + TIOCM_CAR = 16_040; (* carrier detect *) + TIOCM_CD = TIOCM_CAR; + TIOCM_RNG = 16_080; (* ring *) + TIOCM_RI = TIOCM_RNG; + TIOCM_DSR = 16_100; (* data set ready *) + TIOCGETP = Or (Or (R, SG), Or (TC, 8)); (* get tty params *) + TIOCSETP = Or (Or (W, SG), Or (TC, 9)); (* set tty params *) + TIOCSETN = Or (Or (W, SG), Or (TC, 10)); (* no flush tty *) + TIOCEXCL = Or (NOARG, Or (TC, 13)); (* set exclusive use of tty *) + TIOCNXCL = Or (NOARG, Or (TC, 14)); (* reset exclus. use of tty *) + TIOCFLUSH = Or (Or (W, INT), Or (TC, 16)); (* flush buffers *) + TIOCSETC = Or (Or (W, TC), Or (TC, 17)); (* set special chars *) + TIOCGETC = Or (Or (R, TC), Or (TC, 18)); (* get special chars *) + + + TANDEM = 16_0001; (* send stopc on output q. full *) + CBREAK = 16_0002; (* half-cooked mode *) + + + (* locals, from 127 down *) + + TIOCLBIS = Or (Or (W, INT), Or (TC, 127)); (* bis local mode bits *) + TIOCLBIC = Or (Or (W, INT), Or (TC, 126)); (* bic local mode bits *) + TIOCLSET = Or (Or (W, INT), Or (TC, 125)); (* set local modes *) + TIOCLGET = Or (Or (R, INT), Or (TC, 124)); (* get local modes *) + CRTBS = Shift (1, 16); (* Do backspacing for crt *) + PRTERA = Shift (1, 17); (* \ ... / erase *) + CRTERA = Shift (1, 18); (* " \b " to wipe out char *) + TILDE = Shift (1, 19); (* Hazeltine tilde kludge *) + MDMBUF = Shift (1, 20); (* Start/stop output on c.intr. *) + LITOUT = Shift (1, 21); (* Literal output *) + TOSTOP = Shift (1, 22); (* SIGSTOP on background output *) + FLUSHO = Shift (1, 23); (* Flush output to terminal *) + NOHANG = Shift (1, 24); (* No SIGHUP on carrier drop *) + AUTOFLOW = Shift (1, 25); (* IAUTO hardware start/stop *) + CRTKIL = Shift (1, 26); (* Kill line with " \b " *) + PASS8 = Shift (1, 27); (* Allow 8-bit with canonical *) + CTLECH = Shift (1, 28); (* Echo control chars as ^X *) + PENDIN = Shift (1, 29); (* tp->t_rawq needs reread *) + DECCTQ = Shift (1, 30); (* Only ^Q starts after ^S *) + BNOFLSH = Shift (1, 31); (* No output flush on signal *) + LCRTBS = Shift (CRTBS, -16); + LPRTERA = Shift (PRTERA, -16); + LCRTERA = Shift (CRTERA, -16); + LTILDE = Shift (TILDE, -16); + LMDMBUF = Shift (MDMBUF, -16); + LLITOUT = Shift (LITOUT, -16); + LTOSTOP = Shift (TOSTOP, -16); + LFLUSHO = Shift (FLUSHO, -16); + LNOHANG = Shift (NOHANG, -16); + LAUTOFLOW = Shift (AUTOFLOW, -16); + LCRTKIL = Shift (CRTKIL, -16); + LPASS8 = Shift (PASS8, -16); + LCTLECH = Shift (CTLECH, -16); + LPENDIN = Shift (PENDIN, -16); + LDECCTQ = Shift (DECCTQ, -16); + LBNOFLSH = Shift (BNOFLSH, -16); + TIOCSBRK = Or (NOARG, Or (TC, 123)); (* set break bit *) + TIOCCBRK = Or (NOARG, Or (TC, 122)); (* clear break bit *) + TIOCSDTR = Or (NOARG, Or (TC, 121)); (* set data term. ready *) + TIOCCDTR = Or (NOARG, Or (TC, 120)); (* clear data term. ready *) + TIOCGPGRP = Or (Or (R, INT), Or (TC, 119)); (* get pgrp of tty *) + TIOCSPGRP = Or (Or (W, INT), Or (TC, 118)); (* set pgrp of tty *) + TIOCSLTC = Or (Or (R, LC), Or (TC, 117)); (* set loc. sp. chars *) + TIOCGLTC = Or (Or (R, LC), Or (TC, 116)); (* get loc. sp. chars *) + TIOCOUTQ = Or (Or (R, INT), Or (TC, 115)); (* output queue size *) + TIOCSTI = Or (Or (W, INT), Or (TC, 114)); (* simulate term. input *) + TIOCNOTTY = Or (NOARG, Or (TC, 113)); (* void tty association *) + TIOCPKT = Or (Or (W, INT), Or (TC, 112)); (* Pty: setclr. p. mode *) + TIOCPKT_DATA = 16_00; (* Data packet *) + TIOCPKT_FLUSHREAD = 16_01; (* Flush packet *) + TIOCPKT_FLUSHWRITE = 16_02; (* Flush packet *) + TIOCPKT_STOP = 16_04; (* Stop output *) + TIOCPKT_START = 16_08; (* Start output *) + TIOCPKT_NOSTOP = 16_10; (* No more ^S, ^Q *) + TIOCPKT_DOSTOP = 16_20; (* Now do ^S ^Q *) + TIOCPKT_IOCTL = 16_40; (* Wake up if change term char. *) + + TIOCSTOP = Or (NOARG, Or (TC, 111)); (* Stop output, like ^S *) + TIOCSTART = Or (NOARG, Or (TC, 110)); (* Start out., like ^Q *) + TIOCMSET = Or (Or (W, INT), Or (TC, 109)); (* Set all modem bits *) + TIOCMBIS = Or (Or (W, INT), Or (TC, 108)); (* Bis modem bits *) + TIOCMBIC = Or (Or (W, INT), Or (TC, 107)); (* Bic modem bits *) + TIOCMGET = Or (Or (R, INT), Or (TC, 106)); (* Get all modem bits *) + TIOCREMOTE = Or (Or (W, INT), Or (TC, 105)); (* Remote input editing *) + TIOCGWINSZ = Or (Or (R, WS), Or (TC, 104)); (* Get win. sz. *) + TIOCSWINSZ = Or (Or (W, WS), Or (TC, 103)); (* Set win. sz. *) + TIOCUCNTL = Or (Or (W, INT), Or (TC, 102)); (* Pty: set/clr u.c.mode*) + TIOCSMLB = Or (NOARG, Or (TC, 101)); (* Turn on loopback mode*) + TIOCCMLB = Or (NOARG, Or (TC, 100)); (* Turn off loop. mode *) + TIOCNMODEM = Or (Or (W, INT), Or (TC, 99)); (* Ignore modem status *) + TIOCMODEM = Or (Or (W, INT), Or (TC, 98)); (* Look at modem status *) + TIOCWONLINE = Or (NOARG, Or (TC, 97)); (* Wait on online device*) + TIOCNCAR = Or (NOARG, Or (TC, 96)); (* Ignore soft carrier *) + TIOCCAR = Or (NOARG, Or (TC, 95)); (* Don't ignore s. car. *) + TCSBRK = Or (NOARG, Or (TC, 94)); (* Flush q's w/ cnd. brk*) + TCXONC = Or (NOARG, Or (TC, 93)); (* Start/stop control *) + TCFLSH = Or (NOARG, Or (TC, 92)); (* Cnd. q flushing *) + TCGETA = Or (Or (R, TIO), Or (TC, 91)); (* Get parameters *) + TCSETA = Or (Or (W, TIO), Or (TC, 90)); (* Set parameters *) + TCSETAW = Or (Or (W, TIO), Or (TC, 89)); (* Drain & set *) + TCSETAF = Or (Or (W, TIO), Or (TC, 88)); (* Drain, flush, & set *) + TIOCMASTER = Or (Or (W, INT), Or (TC, 87)); (* master ctrls flags *) + TIOAUTO = Or (NOARG, Or (TC, 86)); (* Autoflow status *) + TIOCSINUSE = FIOSINUSE; (* Test and set mutex *) + TIOCCINUSE = FIOCINUSE; (* Clear mutex *) + + TCGETP = Or (Or (R, IOS), Or (TC, 85)); (* Get parameters *) + TCSANOW = Or (Or (W, IOS), Or (TC, 84)); (* Set parameters *) + TCSADRAIN = Or (Or (W, IOS), Or (TC, 83)); (* Drain & set *) + TCSADFLUSH = Or (Or (W, IOS), Or (TC, 82)); (* Drain, flush, & set *) + + + (* File i/o controls *) + FC = Shift (ORD ('f'), 8); + + FIOCLEX = Or (NOARG, Or (FC, 1)); (* Set exclusive use on fd*) + FIONCLEX = Or (NOARG, Or (FC, 2)); (* Remove exclusive use *) + FIOSINUSE = Or (NOARG, Or (FC, 3)); (* Test & set IINUSE in inode *) + FIOCINUSE = Or (NOARG, Or (FC, 4)); (* Clear mutex *) + FIONREAD = Or (Or (R, INT), Or (FC, 127)); (* Get # bytes to read *) + FIONBIO = Or (Or (W, INT), Or (FC, 126)); (* Set/clear non-bl.i/o *) + FIOASYNC = Or (Or (W, INT), Or (FC, 125)); (* Set/clear async i/o *) + FIOSETOWN = Or (Or (W, INT), Or (FC, 124)); (* Set owner *) + FIOGETOWN = Or (Or (R, INT), Or (FC, 123)); (* Get owner *) + FIONBUF = Or (Or (W, INT), Or (FC, 122)); (* N_buff i/o buf *) + FIONONBUF = Or (NOARG, Or (FC, 121)); (* N_buff i/o on buf *) + FIONBDONE = Or (Or (W, INT), Or (FC, 120)); (* N_buff i/o done buf *) + + (* Socket i/o controls *) + SC = Shift (ORD ('s'), 8); + RC = Shift (ORD ('r'), 8); + IC = Shift (ORD ('i'), 8); + + SIOCSHIWAT = Or (Or (W, INT), Or (SC, 0)); (* Set high watermark *) + SIOCGHIWAT = Or (Or (R, INT), Or (SC, 1)); (* Get high watermark *) + SIOCSLOWAT = Or (Or (W, INT), Or (SC, 2)); (* Set low watermark *) + SIOCGLOWAT = Or (Or (R, INT), Or (SC, 3)); (* Get low watermark *) + SIOCATMARK = Or (Or (R, INT), Or (SC, 7)); (* At oob mark? *) + SIOCSPGRP = Or (Or (W, INT), Or (SC, 8)); (* Set process group *) + SIOCGPGRP = Or (Or (R, INT), Or (SC, 9)); (* Get process group *) + SIOCADDRT = Or (Or (W, RTE), Or (RC, 10)); (* Add route *) + SIOCDELRT = Or (Or (W, RTE), Or (RC, 11)); (* Delete route *) + SIOCSIFADDR = Or (Or (W, IFR), Or (IC, 12)); (* Set ifnet ad.*) + SIOCGIFADDR = Or (Or (RW, IFR), Or (IC, 13)); (* Get ifnet ad.*) + SIOCSIFDSTADDR = Or (Or (W, IFR), Or (IC, 14)); (* Set p-p addr.*) + SIOCGIFDSTADDR = Or (Or (RW, IFR), Or (IC, 15)); (* Get p-p addr.*) + SIOCSIFFLAGS = Or (Or (W, IFR), Or (IC, 16)); (* Set ifnet fl.*) + SIOCGIFFLAGS = Or (Or (RW, IFR), Or (IC, 17)); (* Get ifnet fl.*) + SIOCGIFBRDADDR = Or (Or (RW, IFR), Or (IC, 18)); (* Get broad.ad.*) + SIOCSIFBRDADDR = Or (Or (W, IFR), Or (IC, 19)); (* Set broad.ad.*) + SIOCGIFCONF = Or (Or (RW, IFC), Or (IC, 20)); (* Get ifnet ls.*) + SIOCGIFNETMASK = Or (Or (RW, IFR), Or (IC, 21)); (* Get n.a.mask *) + SIOCSIFNETMASK = Or (Or (W, IFR), Or (IC, 22)); (* Set n.a.mask *) + SIOCSPHYSADDR = Or (Or (RW, IFR), Or (IC, 23)); (* Set phys. ad.*) + SIOCADDMULTI = Or (Or (RW, IFR), Or (IC, 24)); (* Add m.c. ad. *) + SIOCDELMULTI = Or (Or (RW, IFR), Or (IC, 25)); (* Dele. m.c.ad.*) + SIOCRDCTRS = Or (Or (RW, CTR), Or (IC, 26)); (* Read if cntr.*) + SIOCRDZCTRS = Or (Or (RW, CTR), Or (IC, 27)); (* Read/0 if c. *) + SIOCRPHYSADDR = Or (Or (RW, IFD), Or (IC, 28)); (* Read phy. ad.*) + SIOCSARP = Or (Or (W, ARP), Or (IC, 30)); (* Set arp entry *) + SIOCGARP = Or (Or (RW, ARP), Or (IC, 31)); (* Get arp entry *) + SIOCDARP = Or (Or (W, ARP), Or (IC, 32)); (* Del. arp ent. *) + SIOCENABLBACK = Or (Or (W, IFR), Or (IC, 33)); (* Set in.ex.lb. *) + SIOCDISABLBACK = Or (Or (W, IFR), Or (IC, 34)); (* Cl.in.ex.lpb. *) + SIOCSTATE = Or (Or (RW, IFS), Or (IC, 35)); (* Device state *) + LIOCSOL = Or (Or (RW, SOL), Or (IC, 36)); (* send solicit msg *) + LIOCRES = Or (Or (RW, RES), Or (IC, 37)); (* get response msg *) + LIOCCMD = Or (Or (RW, LAU), Or (IC, 38)); (* send command msg *) + LIOCINI = Or (Or (RW, LAI), Or (IC, 39)); (* lat tty init *) + SIOCARPREQ = Or (Or (RW, IFR), Or (IC, 40)); (* arp request pkt *) + SIOCGIFMETRIC = Or (Or (RW, IFR), Or (IC, 41)); (* get IF metric *) + SIOCSIFMETRIC = Or (Or (W, IFR), Or (IC, 42)); (* set IF metric *) + LIOCTTYI = Or (Or (R, LTA), Or (IC, 43)); (* lat tty info *) + + + (* Disk partition table i/o controls *) + PC = Shift (ORD ('p'), 8); + + DIOCGETPT = Or (Or (R, PT), Or (PC, 1)); (* Get disk paritition *) + DIOCSETPT = Or (Or (W, PT), Or (PC, 2)); (* Set disk paritition *) + DIOCDGTPT = Or (Or (R, PT), Or (PC, 3)); (* Get default disk par. *) + + (* Error logging i/o controls *) + EC = Shift (ORD ('e'), 8); + + ELSETPID = Or (Or (RW, EL), Or (EC, 0)); (* Set proc. id. *) + ELGETPID = Or (Or (R, INT), Or (EC, 1)); (* Get proc. id. *) + ELMOVPTR = Or (Or (W, INT), Or (EC, 2)); (* Update elpts. *) + ELREINIT = Or (NOARG, Or (EC, 3)); (* Reinit elbuf *) + ELCLRPID = Or (NOARG, Or (EC, 4)); (* Clr. proc.id. *) + ELWARNOFF = Or (NOARG, Or (EC, 5)); (* disable warn. *) + ELWARNON = Or (NOARG, Or (EC, 6)); (* disable warn. *) + ELGETTIME = Or (Or (R, INT), Or (EC, 7)); (* Get strt time *) + + (* Tape i/o controls *) + MC = Shift (ORD ('m'), 8); + + MTIOCTOP = Or (Or (W, MTO), Or (MC, 1)); (* Do a tape op. *) + MTIOCGET = Or (Or (R, MTG), Or (MC, 2)); (* Get status *) + + (* Disk i/o controls *) + DC = Shift (ORD ('d'), 8); + + DKIOCHDR = Or (NOARG, Or (DC, 1)); (* Header r/w *) + DKIOCDOP = Or (Or (W, DKO), Or (DC, 2)); (* Do a disk op. *) + DKIOCGET = Or (Or (R, DKG), Or (DC, 3)); (* Get status *) + DKIOCACC = Or (Or (RW, DKA), Or (DC, 4)); (* Disk access *) + + (* Generic device information i/o controls *) + VC = Shift (ORD ('v'), 8); + + DEVIOCGET = Or (Or (R, DEV), Or (VC, 1)); (* Get dev.info. *) + + + + CONST + R_OK = 8_4; + W_OK = 8_2; + X_OK = 8_1; + F_OK = 8_0; + + (* Somebody will have to work really hard to get all those ioctl + parameters right. Beware when using them! *) + <*EXTERNAL *> PROCEDURE ioctl (d: int; request: u_long; + argp: ADDRESS): int; + (* ok *) + + (*** link - link to a file ***) + <*EXTERNAL*> PROCEDURE link (name1, name2: char_star): int; + (* ok *) + + (*** lseek, tell - move read/write pointer ***) + CONST (* whence *) + L_SET = 0; + L_INCR = 1; + L_XTND = 2; + + <*EXTERNAL "m3_lseek"*> + PROCEDURE lseek (d: int; offset: off_t; whence: int): off_t; + (* ok *) + + (*** mkfifo - make a FIFO (named pipe) ***) + <*EXTERNAL*> PROCEDURE mkfifo (path: char_star; mode: mode_t): int; + + (*** mkdir - make a directory file ***) + <*EXTERNAL*> PROCEDURE mkdir (path: char_star; mode: mode_t): int; + (* ok *) + + (*** mknod - make a directory or a special file ***) + CONST (* mode *) + fifo_special = 8_010000; + character_special = 8_020000; + directory = 8_040000; + block_special = 8_060000; + ordinary_file = 8_000000; + ordinary_filea = 8_100000; + regular_file = 8_100000; + symbolic_link = 8_120000; + socket = 8_140000; + set_uid_on_exec = 8_004000; + set_gid_on_exec = 8_002000; + save_text_image_after_exec = 8_001000; + + (* lower bits used for the access permissions *) + + <*EXTERNAL*> PROCEDURE mknod (path: char_star; mode: mode_t; dev: dev_t): int; + (* ok *) + + (*** mount, umount - mount or unmount a file system ***) + CONST (* rwflag *) + writable = 0; + write_protected = 1; + + <*EXTERNAL*> PROCEDURE mount (type: int; + dir: char_star; flags: int; + data: ADDRESS): int; + (* ok *) + + <*EXTERNAL*> PROCEDURE unmount (dir: char_star; flags: int): int; + (* ok *) + + + (*** open - open for reading or writing ***) + CONST (* flags *) + O_RDONLY = 8_0; (* open for reading *) + O_WRONLY = 8_1; (* open for writing *) + O_RDWR = 8_2; (* open for read & write *) + O_CREAT = FCREAT; (* open with file create *) + O_EXCL = FEXCL; (* error on create if file exists *) + O_NOCTTY = 8_000; + O_TRUNC = FTRUNC; (* open with truncation *) + O_APPEND = FAPPEND; (* append on each write *) + O_NONBLOCK = FNBLOCK; (* POSIX non-blocking I/O *) + O_NDELAY = FNDELAY; (* non-blocking open *) + O_FSYNC = FSYNCRON; (* syncronous write *) + + M3_NONBLOCK = O_NONBLOCK; (* -1 => would block, 0 => EOF *) + + <*EXTERNAL "uopen" *> PROCEDURE open (name: char_star; + flags, mode: int): int; + (* ok *) + + (*** pipe - create an interprocess channel ***) + CONST + readEnd = 0; + writeEnd = 1; + <*EXTERNAL*> PROCEDURE pipe (VAR fildes: ARRAY [0..1] OF int): int; + (* ok *) + + (* not implemented + (*** plock - lock process, text, or data in memory ***) + CONST (* op *) + UNLOCK = 0; (* unlock all segments *) + PROCLOCK = 1; (* lock text and data into memory *) + TXTLOCK = 2; (* lock text segment only *) + DATLOCK = 4; (* lock data segment ony *) + <*EXTERNAL*> PROCEDURE plock (op: int): int; + *) + + (*** profil - execution time profile ***) + <*EXTERNAL*> PROCEDURE profil (buff: ADDRESS; + size, offset, scale: int): int; + (* ok *) + + (*** ptrace - process trace ***) + <*EXTERNAL*> PROCEDURE ptrace (request: int; pid: pid_t; + addr: ADDRESS; + data: int): int; + (* ok *) + + (*** readlink - read value of a symbolic link ***) + <*EXTERNAL*> PROCEDURE readlink (path: char_star; buf: ADDRESS; bufsize: int): int; + (* ok *) + + (*** reboot - reboot system or halt processor ***) + CONST (* howto *) + RB_HALT = 16_8; (* dont' reboot, just halt *) + RB_ASKNAME = 16_1; (* ask for file name to reboot from *) + RB_SINGLE = 16_2; (* reboot to single user only *) + RB_AUTOREBOOT = 16_0; (* flag for system auto-booting itself *) + + <*EXTERNAL*> PROCEDURE reboot (howto: int): int; + (* ok *) + + (*** rename - change the name of a file ***) + <*EXTERNAL*> PROCEDURE rename (from, to: char_star): int; + (* ok *) + + (*** rmdir - remove a directory file ***) + <*EXTERNAL*> PROCEDURE rmdir (path: char_star): int; + (* ok *) + + (*** select - synchronous I/O mutiplexing ***) + CONST + MAX_FDSET = 256; + + TYPE + FDSet = SET OF [0 .. MAX_FDSET - 1]; + + <*EXTERNAL "m3_select"*> PROCEDURE select (nfds: int; + readfds, writefds, exceptfds: UNTRACED REF FDSet; + timeout: UNTRACED REF struct_timeval): int; + (* ok *) + + (*** setgroups - set group access list ***) + <*EXTERNAL*> PROCEDURE setgroups (ngroups: int; VAR gidset: int): int; + (* ok *) + + (* not implemented + (*** setquota - enable/disable quotas on a file system ***) + <*EXTERNAL*> PROCEDURE setquota (special, file: char_star): int; + *) + + (*** shutdown - shut down full-duplex connection ***) + <*EXTERNAL*> PROCEDURE shutdown (s, how: int): int; + (* ok *) + + (*** swapon - add a swap device for interleaved paging/swapping ***) + <*EXTERNAL*> PROCEDURE swapon (special: char_star): int; + (* ok *) + + (*** symlink - make symbolic link to a file ***) + <*EXTERNAL*> PROCEDURE symlink (name1, name2: char_star): int; + (* ok *) + + (*** sync - update super-block ***) + <*EXTERNAL*> PROCEDURE sync (); + (* ok *) + + (*** truncate, ftruncate - truncate a file to a specified length ***) + <*EXTERNAL "m3_truncate" *> + PROCEDURE truncate (path: char_star; length: off_t): int; + <*EXTERNAL "m3_ftruncate" *> + PROCEDURE ftruncate (fd, length: off_t): int; + (* ok *) + + (* not implemented + (*** ulimit - get and set user limits ***) + <*EXTERNAL*> PROCEDURE ulimit (cmd: int; newlimit: long): long; + *) + + (*** umask - set file creation mask ***) + <*EXTERNAL*> PROCEDURE umask (numask: mode_t): mode_t; + (* ok *) + + (*** unlink - remove directory entry ***) + <*EXTERNAL*> PROCEDURE unlink (path: char_star): int; + (* ok *) + + (*** utimes - set file times ***) + <*EXTERNAL*> PROCEDURE utimes (file: char_star; + tvp: UNTRACED REF ARRAY [0..1] OF struct_timeval): int; + (* ok *) + + (*** vfork - spawn new process in a virtual memory efficient way ***) + <*EXTERNAL*> PROCEDURE vfork (): int; + (* ok *) + + (* not implemented, obsolete + (*** vhangup - virtually hang up the current control terminal ***) + <*EXTERNAL*> PROCEDURE vhangup (): int; + *) + + (* not implemented + (*** rexec(3x) - return stream to a remote command ***) + <*EXTERNAL*> PROCEDURE rexec (VAR ahost: char_star; + inport: u_short; + user, passwd, cmd: char_star; + fd2p: int_star): int; + *) + + (*** isatty(3) ***) + <*EXTERNAL*> PROCEDURE isatty (filedes: int): int; + (* ok *) + + (*** system(3) ***) + <*EXTERNAL*> PROCEDURE system (string: char_star): int; + (* ok *) + + + END Unix. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Uprocess.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Uprocess.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Uprocess.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,28 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Fri Mar 16 12:35:23 1990 by muller *) + + INTERFACE Uprocess; + + FROM Ctypes IMPORT int; + + + (*** getpgrp(2) - get process group ***) + + <*EXTERNAL*> PROCEDURE getpgrp (pid: int): int; + + + (*** getpid(2), getppid(2) - get process identification ***) + + <*EXTERNAL*> PROCEDURE getpid (): int; + <*EXTERNAL*> PROCEDURE getppid (): int; + + + (*** setpgrp - set process group ***) + + <*EXTERNAL*> PROCEDURE setpgrp (pid, pgrp: int): int; + + + END Uprocess. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Upwd.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Upwd.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Upwd.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,44 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Mon Mar 09 19:02:29 PST 1992 by muller *) + + INTERFACE Upwd; + + FROM Ctypes IMPORT char_star, int; + FROM Utypes IMPORT uid_t; + + (*** ***) + + TYPE + struct_passwd = RECORD + pw_name: char_star; + pw_passwd: char_star; + pw_uid: uid_t; + pw_gid: uid_t; + pw_gecos: char_star; + pw_dir: char_star; + pw_shell: char_star; + END; + + struct_comment = RECORD + c_dept: char_star; + c_name: char_star; + c_acct: char_star; + c_bin: char_star; + END; + + struct_passwd_star = UNTRACED REF struct_passwd; + + (*** getpwent, getpwuid, getpwnam, setpwent, endpwent(2) - get + password file entry ***) + + <*EXTERNAL*> PROCEDURE getpwent (): struct_passwd_star; + <*EXTERNAL*> PROCEDURE getpwuid (uid: int): struct_passwd_star; + <*EXTERNAL*> PROCEDURE getpwnam (name: char_star): struct_passwd_star; + <*EXTERNAL*> PROCEDURE setpwent(): int; + <*EXTERNAL*> PROCEDURE endpwent(): int; + + END Upwd. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Uresource.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Uresource.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Uresource.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,101 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Wed Mar 25 16:45:57 PST 1992 by muller *) + (* ow 03.10.1994 *) + + INTERFACE Uresource; + + FROM Ctypes IMPORT int, long; + IMPORT Utime; + + (*** ***) + + CONST + PRIO_MIN = -20; + PRIO_MAX = 20; + + PRIO_PROCESS = 0; + PRIO_PGRP = 1; + PRIO_USER = 2; + + (* Resource utilization information. *) + + CONST + RUSAGE_SELF = 0; + RUSAGE_CHILDREN = -1; + + TYPE + struct_rusage = RECORD + ru_utime: Utime.struct_timeval; (* user time used *) + ru_stime: Utime.struct_timeval; (* system time used *) + ru_maxrss: long; + ru_ixrss: long; (* integral shared text size *) + (* Unsupported in Linux 1.0: + ru_ismrss: long; (* integral shared memory size*) + ******************************) + ru_idrss: long; (* integral unshared data " *) + ru_isrss: long; (* integral unshared stack " *) + ru_minflt: long; (* page reclaims *) + ru_majflt: long; (* page faults *) + ru_nswap: long; (* swaps *) + ru_inblock: long; (* block input operations *) + ru_oublock: long; (* block output operations *) + ru_msgsnd: long; (* messages sent *) + ru_msgrcv: long; (* messages received *) + ru_nsignals: long; (* signals received *) + ru_nvcsw: long; (* voluntary context switches *) + ru_nivcsw: long; (* involuntary " *) + END; + struct_rusage_star = UNTRACED REF struct_rusage; + + (* Resource limits *) + + CONST + RLIMIT_CPU = 0; (* cpu time in milliseconds *) + RLIMIT_FSIZE = 1; (* maximum file size *) + RLIMIT_DATA = 2; (* data size *) + RLIMIT_STACK = 3; (* stack size *) + RLIMIT_CORE = 4; (* core file size *) + RLIMIT_RSS = 5; (* resident set size *) + RLIMIT_MEMLOCK = 6; (* locked-in-memory address space *) + RLIMIT_NPROC = 7; (* number of processes *) + RLIMIT_OFILE = 8; (* number of open files *) + + + RLIM_NLIMITS = 9; (* number of resource limits *) + + RLIM_INFINITY = 16_7fffffff; + + TYPE + struct_rlimit = RECORD + rlim_cur: int; (* current (soft) limit *) + rlim_max: int; (* maximum value for rlim_cur *) + END; + + + (*** getpriority(2), setpriority(2) - get/set program scheduling priority ***) + + <*EXTERNAL*> PROCEDURE getpriority (which, who: int): int; + <*EXTERNAL*> PROCEDURE setpriority (which, who, prio: int): int; + + + (*** getrlimit(2), setrlimit(2) - control maximum system resource + consumption ***) + + <*EXTERNAL*> PROCEDURE getrlimit (resource: int; VAR rlp: struct_rlimit): int; + <*EXTERNAL*> PROCEDURE setrlimit (resource: int; VAR rlp: struct_rlimit): int; + + + (*** getrusage(2) - get information about resource utilization ***) + + <*EXTERNAL*> PROCEDURE getrusage (who: int; rus: struct_rusage_star): int; + + + (*** nice(3) - set program priority ***) + + <*EXTERNAL*> PROCEDURE nice (incr: int): int; + + END Uresource. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Usem.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Usem.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Usem.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,155 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Fri Apr 30 14:44:50 PDT 1993 by muller *) + (* modified on Wed Dec 23 17:44:54 PST 1992 by jdd *) + + UNSAFE INTERFACE Usem; + + FROM Ctypes IMPORT short, int; + FROM Utypes IMPORT ushort, time_t; + FROM Uexec IMPORT wait_queue_star; + FROM Uipc IMPORT struct_ipc_perm; + + (*** ***) + + (* + ** IPC Semaphore Facility. + *) + + (* + ** Implementation Constants. + *) + + CONST + + PZERO = 25; (* I got this value from param.h; em *) + + PSEMN = (PZERO + 3); (* sleep priority waiting for greater value *) + PSEMZ = (PZERO + 2); (* sleep priority waiting for zero *) + + (* + ** Permission Definitions. + *) + + SEM_A = 8_0200; (* alter permission *) + SEM_R = 8_0400; (* read permission *) + + (* + ** Semaphore Operation Flags. + *) + + SEM_UNDO = 8_010000; (* set up adjust on exit entry *) + + (* + ** Semctl Command Definitions. (from /usr/include/linux/sem.h) + *) + + GETPID = 11; (* get sempid *) + GETVAL = 12; (* get semval *) + GETALL = 13; (* get all semval's *) + GETNCNT = 14; (* get semncnt *) + GETZCNT = 15; (* get semzcnt *) + SETVAL = 16; (* set semval *) + SETALL = 17; (* set all semval's *) + + (* + ** Structure Definitions. + *) + + (* + ** There is one semaphore id data structure for each set of semaphores + ** in the system. + *) + + TYPE + struct_semid_ds = RECORD + sem_perm : struct_ipc_perm; (* operation permission struct *) + sem_otime : time_t; (* last semop time *) + sem_ctime : time_t; (* last change time *) + sem_base : UNTRACED REF struct_sem; (* ptr to first semaphore in set *) + eventn : wait_queue_star; + eventz : wait_queue_star; + undo : UNTRACED REF struct_sem_undo; + sem_nsems : ushort; (* # of semaphores in set *) + END; + + (* + ** There is one semaphore structure for each semaphore in the system. + *) + + struct_sem = RECORD + sempid : short; (* pid of last operation *) + semval : ushort; (* semaphore text map address *) + semncnt : short; (* # awaiting semval > cval *) + semzcnt : ushort; (* # awaiting semval = 0 *) + END; + + (* + ** There is one undo structure per process in the system. + *) + + struct_sem_undo = RECORD + proc_next : UNTRACED REF struct_sem_undo; + id_next : UNTRACED REF struct_sem_undo; + semid : int; + semadj : short; + sem_num : ushort; + END; + + (* + ** semaphore information structure + *) + + struct_seminfo = RECORD + semmap: int; (* # of entries in semaphore map *) + semmni: int; (* # of = semaphore; identifiers *) + semmns: int; (* # of semaphores in system *) + semmnu: int; (* # of undo structures in system *) + semmsl: int; (* max # of semaphores per id *) + semopm: int; (* max # of operations per semop call *) + semume: int; (* max # of undo entries per process *) + semusz: int; (* size in bytes of undo structure *) + semvmx: int; (* semaphore maximum value *) + semaem: int; (* adjust on exit max value *) + END; + + (* + ** User semaphore template for semop system calls. + *) + + struct_sembuf = RECORD + sem_num: ushort; (* semaphore # *) + sem_op: short; (* semaphore operation *) + sem_flg: short; (* operation flags *) + END; + + (* + * Sizing constants + *) + + CONST + + SEMMAP = 10; + SEMMNI = 10; + SEMMNS = 60; + SEMMNU = 30; + SEMMSL = 25; + SEMOPM = 10; + SEMUME = 10; + SEMVMX = 32767; + SEMAEM = 16384; + + + TYPE + union = union_val; + + union_val = int; + union_buf = UNTRACED REF struct_semid_ds; + (* union_array = ARRAY OF ushort *) + + + + END Usem. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Ushm.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Ushm.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Ushm.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,201 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Wed Mar 4 11:53:08 PST 1992 by muller *) + + INTERFACE Ushm; + + FROM Ctypes IMPORT char, short, int, char_star; + FROM Utypes IMPORT time_t, key_t, size_t, ushort, swblk_t; + FROM Uipc IMPORT struct_ipc_perm; + + (*** ***) + + (* + ** IPC Shared Memory Facility. + *) + + (* + ** Implementation Constants. + *) + + CONST + (* segment low boundary address multiple *) + (* (SMLBA must be a power of 2) *) + (* SMLBA = ctob(CLSIZE); where does ctob come from ? - em *) + + (* for SYSTEM V compatibility *) + (* SHMLBA = SMLBA; see SMLBA - em *) + + (* + ** Permission Definitions. + *) + + SM_R = 8_0400; (* read permission *) + SM_W = 8_0200; (* write permission *) + + (* for SYSTEM V compatibility *) + SHM_R = SM_R; + SHM_W = SM_W; + + (* + ** ipc_perm Mode Definitions. + *) + + SM_CLEAR = 8_01000; (* clear segment on next attach *) + SM_DEST = 8_02000; (* destroy seg when # attached = 0 *) + + (* for SYSTEM V compatibility *) + SHM_INIT = SM_CLEAR; + SHM_DEST = SM_DEST; + + (* + ** Message Operation Flags. + *) + + SM_RDONLY = 8_010000; (* attach read-only (else read-write) *) + SM_RND = 8_020000; (* round attach address to SHMLBA *) + + (* for SYSTEM V compatibility *) + SHM_RDONLY = SM_RDONLY; + SHM_RND = SM_RND; + + (* + * sizing constant (the balance are in /sys/h/param.h and /sys/conf/param.c. + *) + SMMNI = 100; (* Max number SM segments in system *) + + (* + ** Structure Definitions. + *) + + + (* + ** There is a shared mem id struct for each segment in the system. + *) + + TYPE + struct_smem = RECORD + (* SM_PERM must be the first *) + (* element in the structure. *) + sm_perm: struct_ipc_perm; (* permission struct *) + sm_daddr: UNTRACED REF swblk_t; (* disk addrs of DMTEXT page segs *) + sm_ptdaddr: swblk_t; (* disk address of page table *) + sm_size: size_t ; (* segment size (bytes) *) + + (* sm_caddr: UNTRACED REF struct_proc; (* ptr to linked proc, if loaded *)*) + sm_caddr: ADDRESS; (* where is struct_proc ? - em *) + + (* sm_ptaddr: UNTRACED REF struct_pte; (* ptr to assoc page table *) *) + sm_ptaddr: ADDRESS; (* where is struct_pte ? - em *) + + sm_rssize: size_t; (* SM resource set size (pages) *) + sm_lpid: ushort; (* pid of last smop *) + sm_cpid: ushort; (* pid of creator *) + sm_count: char; (* reference count *) + sm_ccount: char; (* number of loaded references *) + sm_lcount: short; (* number of processes locking SMS *) + sm_flag: short; (* traced, written flags *) + sm_poip: short; (* page out in progress count *) + sm_atime: time_t; (* last smat time *) + sm_dtime: time_t; (* last smdt time *) + sm_ctime: time_t; (* last change time *) + END; + + (* for SYSTEM V compatibility *) + (* key_t = long; already defined in Utypes.i3 - em *) + + struct_shmid_ds = RECORD + (* SM_PERM must be the first *) + (* element in the structure. *) + shm_perm: struct_ipc_perm; (* permission struct *) + sm_daddr: UNTRACED REF swblk_t; (* disk addrs of DMTEXT page segs *) + sm_ptdaddr: swblk_t; (* disk address of page table *) + shm_segsz: size_t ; (* segment size (bytes) *) + + (* sm_caddr: UNTRACED REF struct_proc; (* ptr to linked proc, if loaded *)*) + sm_caddr: ADDRESS; (* where is struct_proc ? - em *) + + (* sm_ptaddr: UNTRACED REF struct_pte; (* ptr to assoc page table *) *) + sm_ptaddr: ADDRESS; (* where is struct_pte ? - em *) + + sm_rssize: size_t; (* SM resource set size (pages) *) + shm_lpidL: ushort; (* pid of last smop *) + shm_cpid: ushort; (* pid of creator *) + shm_nattch: char; (* reference count *) + sm_ccount: char; (* number of loaded references *) + sm_lcount: short; (* number of processes locking SMS *) + sm_flag: short; (* traced, written flags *) + sm_poip: short; (* page out in progress count *) + shm_atime: time_t; (* last smat time *) + shm_dtime: time_t; (* last smdt time *) + shm_ctime: time_t; (* last change time *) + END; + + struct_shmid_ds_star = UNTRACED REF struct_shmid_ds; + + CONST + + (* NOTE: These values must align with X* flag values in text.h *) + SMLOCK = 8_0010; (* Being swapped in or out *) + SMWANT = 8_0020; (* Wanted for swapping *) + SMNOSW = 8_0100; (* Lock segment in memory *) + + (* shared memory specific commands for shmctl syscall *) + SHM_LOCK = 3; (* Lock segment in memory *) + SHM_UNLOCK = 4; (* Unlock segment in memory *) + + (* + * sminfo structure is used by the system for bounds checking. All of + * the elements in this structure are initialized in /sys/conf/param.c. + * + * Three of the elements are configurable via the "config" program + * (smmax, smmin, smbrk). If they are not config'ed, then they all + * have defaults. + *) + + TYPE + struct_sminfo = RECORD + smmax: int; (* max shared memory segment size *) + smmin: int; (* min shared memory segment size *) + smmni: int; (* # of shared memory identifiers *) + smseg: int; (* max attached shared memory segs per proc *) + smbrk: int; (* gap (in clicks) used between data and SM *) + smsmat: int; (* max shmem attach addr (clicks) *) + END; + + (* for SYSTEM V compatibility *) + struct_shminfo = RECORD + shmmax: int; (* max shared memory segment size *) + shmmin: int; (* min shared memory segment size *) + shmmni: int; (* # of shared memory identifiers *) + shmseg: int; (* max attached shared memory segs per proc *) + shmbrk: int; (* gap (in clicks) used between data and SM *) + smsmat: int; (* max shmem attach addr (clicks) *) + END; + + + (*** shmctl(2) - shared memory control operations ***) + + <*EXTERNAL*> + PROCEDURE shmctl (shmid, cmd: int; buf: struct_shmid_ds_star): int; + + + + (*** shmget(2) - get shared memory segment ***) + + <*EXTERNAL*> + PROCEDURE shmget (key: key_t; size, semflg: int): int; + + + (*** shmat(2), shmdt(2) - shared memory operations ***) + + <*EXTERNAL*> + PROCEDURE shmat (shmid: int; shmaddr: char_star; shmflg: int): char_star; + + <*EXTERNAL*> + PROCEDURE shmdt (shmaddr: char_star): int; + + + END Ushm. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Usignal.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Usignal.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Usignal.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,214 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Tue Mar 2 17:18:02 PST 1993 by muller *) + (* ow 03.10.1994 *) + + INTERFACE Usignal; + + FROM Ctypes IMPORT int, unsigned_int; + + (*** ***) + + CONST + SIGHUP = 1; (* hangup *) + SIGINT = 2; (* interrupt *) + SIGQUIT = 3; (* quit *) + SIGILL = 4; (* illegal instruction (not reset when caught) *) + SIGTRAP = 5; (* trace trap (not reset when caught) *) + SIGIOT = 6; (* IOT instruction *) + SIGEMT = 7; (* EMT instruction *) + SIGFPE = 8; (* floating point 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_PAGE_FAULT = 12; (* page fault protection base *) + BUS_SEGNP_FAULT = 26; (* segment not present *) + BUS_STK_FAULT = 27; (* stack fault *) + SIGSEGV = 11; (* segmentation violation *) + SIGSYS = 12; (* bad argument to system call *) + SIGPIPE = 13; (* write on a pipe with no one to read it *) + SIGALRM = 14; (* alarm clock *) + SIGTERM = 15; (* software termination signal from kill *) + SIGURG = 16; (* urgent condition on IO channel *) + SIGSTOP = 17; (* sendable stop signal not from tty *) + SIGTSTP = 18; (* stop signal from tty *) + SIGCONT = 19; (* continue a stopped process *) + SIGCHLD = 20; (* to parent on child stop or exit *) + SIGTTIN = 21; (* to readers pgrp upon background tty read *) + SIGTTOU = 22; (* like TTIN for output if (tp->t_local<OSTOP) *) + SIGIO = 23; (* input/output possible signal *) + SIGXCPU = 24; (* exceeded CPU time limit *) + SIGXFSZ = 25; (* exceeded file size limit *) + SIGVTALRM = 26; (* virtual time alarm *) + SIGPROF = 27; (* profiling time alarm *) + SIGWINCH = 28; (* window size changes *) + SIGINFO = 29; (* information request *) + SIGUSR1 = 30; (* user defined signal 1 *) + SIGUSR2 = 31; (* user defined signal 2 *) + + (* System V definitions *) + SIGCLD = SIGCHLD; + SIGABRT = SIGIOT; + + + (* Signal vector "template" used in sigaction call. *) + TYPE + SignalHandler = PROCEDURE (sig, code: int; + scp: UNTRACED REF struct_sigcontext); + + sigset_t = int; + + struct_sigvec = RECORD + sv_handler: SignalHandler; (* signal handler *) + sv_mask: sigset_t; (* 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; + + CONST + (* Valid flags defined for sv_flags field of sigvec structure. *) + SV_ONSTACK = 16_0001; (* run on special signal stack *) + SV_RESTART = 16_0002; (* restart system calls on sigs *) + SV_RESETHAND = 16_0004; (* reset to SIG_DFL when taking signal *) + SV_NOCLDSTOP = 16_0008; (* do not generate SIGCHLD on child stop *) + SV_NODEFER = 16_0010; (* don't mask the signal we're delivering *) + + (* Defines for sigprocmask() call. POSIX. *) + SIG_BLOCK = 1; (* Add these signals to block mask *) + SIG_UNBLOCK = 2; (* Remove these signals from block mask *) + SIG_SETMASK = 3; (* Set block mask to this mask *) + + TYPE + struct_sigaction = RECORD + sa_handler : SignalHandler; (* signal handler *) + sa_mask : sigset_t; (* signals to block while in handler *) + sa_flags : int; (* signal action flags *) + END; + + struct_sigaction_star = UNTRACED REF struct_sigaction; + + CONST + (* Valid flags defined for sa_flags field of sigaction structure. *) + SA_ONSTACK = 16_0001; (* run on special signal stack *) + SA_RESTART = 16_0002; (* restart system calls on sigs *) + SA_RESETHAND = 16_0004; (* reset to SIG_DFL when taking signal *) + SA_NOCLDSTOP = 16_0008; (* do not generate SIGCHLD on child stop *) + SA_NODEFER = 16_0010; (* don't mask the signal we're delivering *) + + TYPE + struct_sigstack = RECORD + ss_sp: ADDRESS; (* signal stack pointer *) + ss_onstack: int; (* current status *) + END; + + (* + * Information pushed on stack when a signal is delivered. + * This is used by the kernel to restore state following + * 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_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_es: int; + sc_ds: int; + sc_cs: int; + sc_ss: int; + sc_edi: int; + sc_esi: int; + sc_ebx: int; + sc_edx: int; + sc_ecx: int; + sc_eax: int; + END; + + (* Do not modifiy these variables *) + VAR (*CONST*) + BADSIG, SIG_ERR, SIG_DFL, SIG_IGN, SIG_HOLD: SignalHandler; + + + (* Convert a signal number to a mask suitable for sigblock(). *) + <*INLINE*> PROCEDURE sigmask (n: int): int; + + + (*** kill(2) - send signal to a process ***) + + <*EXTERNAL*> PROCEDURE kill (pid, sig: int): int; + + + (*** killpg(2) - send signal to a process or process group ***) + + <*EXTERNAL*> PROCEDURE killpg (pgrp, sig: int): int; + + + (*** sigblock(2) - block signals ***) + + <*EXTERNAL*> PROCEDURE sigblock (mask: int): int; + + + (*** sigpause(2) - atomically release blocked signals and wait for + interrupt ***) + + <*EXTERNAL*> PROCEDURE sigpause (sigmask: int): int; + + + (*** sigpending(2) - examine pending signals ***) + + <*EXTERNAL*> PROCEDURE sigpending (VAR set: sigset_t): int; + + + (*** sigsetmask(2) - set current signal mask ***) + + <*EXTERNAL*> PROCEDURE sigsetmask (mask: int): unsigned_int; + + + (*** sigstack(2) - set and/or get signal stack context ***) + + <*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 ***) + + (* FIXME - This should probably use the VAR construct like the other + platforms use. *) + <*EXTERNAL*> + PROCEDURE sigaction (sig: int; act, oact: struct_sigaction_star): int; + + (*** sigvec(2) - software signal facilities ***) + + <*EXTERNAL*> + PROCEDURE sigvec (sig: int; VAR vec, ovec: struct_sigvec): int; + + <*EXTERNAL*> + PROCEDURE sigprocmask (how: int; VAR set, oldset: sigset_t) : int; + + END Usignal. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Usignal.m3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Usignal.m3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Usignal.m3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,22 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Mon Oct 12 15:51:28 PDT 1992 by muller *) + + UNSAFE MODULE Usignal; + + IMPORT Word, Ctypes; + + PROCEDURE sigmask (n: Ctypes.int): Ctypes.int = + BEGIN + RETURN Word.Shift (1, n-1); + END sigmask; + + BEGIN + BADSIG := LOOPHOLE (-1, SignalHandler); + SIG_ERR := LOOPHOLE (-1, SignalHandler); + SIG_DFL := LOOPHOLE ( 0, SignalHandler); + SIG_IGN := LOOPHOLE ( 1, SignalHandler); + SIG_HOLD := LOOPHOLE ( 3, SignalHandler); + END Usignal. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Usocket.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Usocket.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Usocket.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,347 ---- + (* Copyright (C) 1989, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Fri Apr 30 14:46:21 PDT 1993 by muller *) + (* modified on Wed Jul 11 9:34:54 PDT 1990 by mjordan *) + + INTERFACE Usocket; + + + IMPORT Ctypes, Utypes, Uuio; + + (*** sys/socket.h ***) + + (* + * Definitions related to sockets: types, address families, options. + *) + + (* + * Types + *) + CONST + SOCK_STREAM = 1; (* stream socket *) + SOCK_DGRAM = 2; (* datagram socket *) + SOCK_RAW = 3; (* raw-protocol interface *) + SOCK_RDM = 4; (* reliably-delivered message *) + SOCK_SEQPACKET = 5; (* sequenced packet stream *) + + (* + * Option flags per-socket. + *) + SO_DEBUG = 16_0001; (* turn on debugging info recording *) + SO_ACCEPTCONN = 16_0002; (* socket has had listen() *) + SO_REUSEADDR = 16_0004; (* allow local address reuse *) + SO_KEEPALIVE = 16_0008; (* keep connections alive *) + SO_DONTROUTE = 16_0010; (* just use interface addresses *) + SO_BROADCAST = 16_0020; (* permit sending of broadcast msgs *) + SO_USELOOPBACK = 16_0040; (* bypass hardware when possible *) + SO_LINGER = 16_0080; (* linger on close if data present *) + SO_OOBINLINE = 16_0100; (* leave received OOB data in line *) + SO_REUSEPORT = 16_0200; (* allow local address & port reuse *) + SO_TIMESTAMP = 16_0400; (* timestamp received dgram traffic *) + + (* + * Additional options, not kept in so_options. + *) + SO_SNDBUF = 16_1001; (* send buffer size *) + SO_RCVBUF = 16_1002; (* receive buffer size *) + SO_SNDLOWAT = 16_1003; (* send low-water mark *) + SO_RCVLOWAT = 16_1004; (* receive low-water mark *) + SO_SNDTIMEO = 16_1005; (* send timeout *) + SO_RCVTIMEO = 16_1006; (* receive timeout *) + SO_ERROR = 16_1007; (* get error status and clear *) + SO_TYPE = 16_1008; (* get socket type *) + SO_PRIVSTATE = 16_1009; (* get/deny privileged state *) + + (* + * Structure used for manipulating linger option. + *) + TYPE + struct_linger = RECORD + l_onoff: Ctypes.int; (* option on/off *) + l_linger: Ctypes.int; (* linger time *) + END; + + + (* + * Level number for (get/set)sockopt() to apply to socket itself. + *) + CONST + SOL_SOCKET = 16_ffff; (* options for socket level *) + + + (* + * Address families. + *) + AF_UNSPEC = 0; (* unspecified *) + AF_LOCAL = 1; (* local to host (pipes, portals) *) + AF_UNIX = AF_LOCAL; (* backward compatibility *) + AF_INET = 2; (* internetwork: UDP, TCP, etc. *) + AF_IMPLINK = 3; (* arpanet imp addresses *) + AF_PUP = 4; (* pup protocols: e.g. BSP *) + AF_CHAOS = 5; (* mit CHAOS protocols *) + AF_NS = 6; (* XEROX NS protocols *) + AF_ISO = 7; (* ISO protocols *) + AF_OSI = AF_ISO; + AF_ECMA = 8; (* European computer manufacturers *) + AF_DATAKIT = 9; (* datakit protocols *) + AF_CCITT = 10; (* CCITT protocols, X.25 etc *) + AF_SNA = 11; (* IBM SNA *) + AF_DECnet = 12; (* DECnet *) + AF_DLI = 13; (* DEC Direct data link interface *) + AF_LAT = 14; (* LAT *) + AF_HYLINK = 15; (* NSC Hyperchannel *) + AF_APPLETALK = 16; (* Apple Talk *) + AF_ROUTE = 17; (* Internal Routing Protocol *) + AF_LINK = 18; (* Link layer interface *) + pseudo_AF_XTP = 19; (* eXpress Transfer Protocol (no AF) *) + AF_COIP = 20; (* connection-oriented IP, aka ST II *) + AF_CNT = 21; (* Computer Network Technology *) + pseudo_AF_RTIP = 22; (* Help Identify RTIP packets *) + AF_IPX = 23; (* Novell Internet Protocol *) + AF_SIP = 24; (* Simple Internet Protocol *) + pseudo_AF_PIP = 25; (* Help Identify PIP packets *) + AF_ISDN = 26; (* Integrated Services Digital Network*) + AF_E164 = AF_ISDN; (* CCITT E.164 recommendation *) + pseudo_AF_KEY = 27; (* Internal key-management function *) + + AF_MAX = 28; + + (* + * Structure used by kernel to store most + * addresses. + *) + TYPE + struct_sockaddr = RECORD + sa_len: Ctypes.unsigned_char; (* total length *) + sa_family: Ctypes.unsigned_char; (* address family *) + sa_data: ARRAY [0..13] OF Ctypes.char; (* address; actually longer *) + END; + + + (* + * Structure used by kernel to pass protocol + * information in raw sockets. + *) + struct_sockproto = RECORD + sp_family: Ctypes.unsigned_short; (* address family *) + sp_protocol: Ctypes.unsigned_short; (* protocol *) + END; + + (* + * Protocol families, same as address families for now. + *) + CONST + PF_UNSPEC = AF_UNSPEC; + PF_LOCAL = AF_LOCAL; + PF_UNIX = PF_LOCAL; (* backward compatibility *) + PF_INET = AF_INET; + PF_IMPLINK = AF_IMPLINK; + PF_PUP = AF_PUP; + PF_CHAOS = AF_CHAOS; + PF_NS = AF_NS; + PF_ISO = AF_ISO; + PF_OSI = AF_ISO; + PF_ECMA = AF_ECMA; + PF_DATAKIT = AF_DATAKIT; + PF_CCITT = AF_CCITT; + PF_SNA = AF_SNA; + PF_DECnet = AF_DECnet; + PF_DLI = AF_DLI; + PF_LAT = AF_LAT; + PF_HYLINK = AF_HYLINK; + PF_APPLETALK = AF_APPLETALK; + PF_ROUTE = AF_ROUTE; + PF_LINK = AF_LINK; + PF_XTP = pseudo_AF_XTP; (* really just proto family, no AF *) + PF_COIP = AF_COIP; + PF_CNT = AF_CNT; + PF_SIP = AF_SIP; + PF_IPX = AF_IPX; (* same format as AF_NS *) + PF_RTIP = pseudo_AF_RTIP; (* same format as AF_INET *) + PF_PIP = pseudo_AF_PIP; + PF_ISDN = AF_ISDN; + PF_KEY = pseudo_AF_KEY; + + PF_MAX = AF_MAX; + + (* + * Maximum queue length specifiable by listen. + *) + SOMAXCONN = 128; + + (* + * Message header for recvmsg and sendmsg calls. + *) + TYPE + struct_msghdr = RECORD + msg_name: Utypes.caddr_t; (* optional address *) + msg_namelen: Ctypes.unsigned_int; (* size of address *) + msg_iov: Uuio.struct_iovec_star; (* scatter/gather array *) + msg_iovlen: Ctypes.unsigned_int; (* # elements in msg_iov *) + msg_control: Utypes.caddr_t; (* ancillary data, see below *) + msg_controllen: Ctypes.unsigned_int; (* ancillary data buffer len *) + msg_flags: Ctypes.int; (* flags on received message *) + END; + + + CONST + MSG_OOB = 16_1; (* process out-of-band data *) + MSG_PEEK = 16_2; (* peek at incoming message *) + MSG_DONTROUTE = 16_4; (* send without using routing tables *) + MSG_EOR = 16_8; (* data completes record *) + MSG_TRUNC = 16_10; (* data discarded before delivery *) + MSG_CTRUNC = 16_20; (* control data lost before delivery *) + MSG_WAITALL = 16_40; (* wait for full request or error *) + MSG_DONTWAIT = 16_80; (* this message should be nonblocking *) + MSG_EOF = 16_100; (* data completes connection *) + MSG_COMPAT = 16_8000; (* used in sendit() *) + + (* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + *) + TYPE + struct_cmsghdr = RECORD + cmsg_len: Ctypes.unsigned_int; (* data byte count, including hdr *) + cmsg_level: Ctypes.int; (* originating protocol *) + cmsg_type: Ctypes.int; (* protocol-specific type *) + (* followed by u_char cmsg_data[]; *) + END; + + (* "Socket"-level control message types: *) + CONST + SCM_RIGHTS = 16_01; (* access rights (array of int) *) + SCM_TIMESTAMP = 16_02; (* timestamp (struct timeval) *) + + (* + * Definitions for UNIX IPC domain. + *) + TYPE + struct_sockaddr_un = RECORD + sun_len: Ctypes.unsigned_char; (* sockaddr len including null *) + sun_family: Ctypes.unsigned_char; (* AF_UNIX *) + sun_path: ARRAY [0..103] OF Ctypes.char; (* path name (gag) *) + END; + + <*EXTERNAL "m3_accept"*> + PROCEDURE accept( + s: Ctypes.int; + addr: UNTRACED REF struct_sockaddr; + addrlen: Ctypes.int_star) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_bind"*> + PROCEDURE bind( + s: Ctypes.int; + name: UNTRACED REF struct_sockaddr; + namelen: Ctypes.int) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_connect"*> + PROCEDURE connect( + s: Ctypes.int; + name: UNTRACED REF struct_sockaddr; + namelen: Ctypes.int) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_getpeername"*> + PROCEDURE getpeername( + s: Ctypes.int; + name: UNTRACED REF struct_sockaddr; + namelen: Ctypes.int_star) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_getsockname"*> + PROCEDURE getsockname( + s: Ctypes.int; + name: UNTRACED REF struct_sockaddr; + namelen: Ctypes.int_star) + : Ctypes.int + RAISES {}; + + <*EXTERNAL*> + PROCEDURE getsockopt( + s, level, optname: Ctypes.int; + optval: Ctypes.void_star; + optlen: Ctypes.int_star) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_listen"*> + PROCEDURE listen(s, backlog: Ctypes.int): Ctypes.int RAISES {}; + + <*EXTERNAL "m3_recv"*> + PROCEDURE recv( + s: Ctypes.int; + buf: Ctypes.void_star; + len: Utypes.size_t; + flags: Ctypes.int) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_recvfrom"*> + PROCEDURE recvfrom( + s: Ctypes.int; + buf: Ctypes.void_star; + len: Utypes.size_t; + flags: Ctypes.int; + from: UNTRACED REF struct_sockaddr; + fromlen: Ctypes.int_star) + : Ctypes.int + RAISES {}; + + (* FIXME - recvmsg *) + + <*EXTERNAL "m3_send"*> + PROCEDURE send( + s: Ctypes.int; + msg: Ctypes.const_void_star; + len: Utypes.size_t; + flags: Ctypes.int) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_sendto"*> + PROCEDURE sendto( + s: Ctypes.int; + msg: Ctypes.const_void_star; + len: Utypes.size_t; + flags: Ctypes.int; + to: UNTRACED REF struct_sockaddr; + tolen: Ctypes.int) + : Ctypes.int + RAISES {}; + + (* FIXME - sendmsg *) + + <*EXTERNAL*> + PROCEDURE setsockopt( + s, level, optname: Ctypes.int; + optval: Ctypes.const_void_star; + optlen: Ctypes.int) + : Ctypes.int + RAISES {}; + + <*EXTERNAL "m3_shutdown"*> + PROCEDURE shutdown(s, how: Ctypes.int): Ctypes.int RAISES {}; + + <*EXTERNAL "m3_socket" *> + PROCEDURE socket(af, type, protocol: Ctypes.int): Ctypes.int RAISES {}; + + <*EXTERNAL*> + PROCEDURE socketpair( + d, type, protocol: Ctypes.int; + sv: UNTRACED REF ARRAY [0..1] OF Ctypes.int) + : Ctypes.int + RAISES {}; + + END Usocket. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Ustat.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Ustat.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Ustat.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,95 ---- + (* Copyright (C) 1989, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Wed Mar 15 16:47:47 PST 1995 by kalsow *) + (* modified on Sat Feb 18 23:43:23 MET 1995 by ow *) + (* modified on Tue Mar 24 20:42:39 PST 1992 by muller *) + + INTERFACE Ustat; + + FROM Ctypes IMPORT int, char_star, long; + FROM Utypes IMPORT u_short, u_long, dev_t, ino_t, off_t; + FROM Utypes IMPORT mode_t, nlink_t, uid_t, gid_t, time_t, quad_t; + + CONST + S_IFMT : u_short = 8_0170000; + S_IFSOCK: u_short = 8_0140000; + S_IFLNK : u_short = 8_0120000; + S_IFREG : u_short = 8_0100000; + S_IFPIPE: u_short = 8_0000000; (* no such constant in stat.h!*) + S_IFBLK : u_short = 8_0060000; + S_IFDIR : u_short = 8_0040000; + S_IFCHR : u_short = 8_0020000; + S_IFIFO : u_short = 8_0010000; + S_IFPORT = S_IFIFO; + S_ISUID : u_short = 8_0004000; + S_ISGID : u_short = 8_0002000; + S_ISVTX : u_short = 8_0001000; + S_IREAD : u_short = 8_0000400; + S_IWRITE: u_short = 8_0000200; + S_IEXEC : u_short = 8_0000100; + S_GREAD : u_short = 8_0000040; + S_GWRITE: u_short = 8_0000020; + S_GEXEC : u_short = 8_0000010; + S_OREAD : u_short = 8_0000004; + S_OWRITE: u_short = 8_0000002; + S_OEXEC : u_short = 8_0000001; + + TYPE + struct_stat = RECORD + st_dev : dev_t; + st_ino : ino_t; + st_mode : mode_t; + st_nlink : nlink_t; + st_uid : uid_t; + st_gid : gid_t; + st_rdev : dev_t; + st_atime : time_t; + st_spare1 : u_long; + st_mtime : time_t; + st_spare2 : u_long; + st_ctime : time_t; + st_spare3 : u_long; + st_size : off_t; + st_pad1 : long; + st_blocks : quad_t; + st_blksize: u_long; + st_flags : u_long; + st_gen : u_long; + st_lspare : long; + st_qspare1: quad_t; + st_qspare2: quad_t; + END; + + struct_stat_star = UNTRACED REF struct_stat; + + <*EXTERNAL*> PROCEDURE stat (path: char_star; buf: struct_stat_star): int; + + <*EXTERNAL*> PROCEDURE lstat (path: char_star; buf: struct_stat_star): int; + + <*EXTERNAL*> PROCEDURE fstat (fd: int; buf: struct_stat_star): int; + + (* chflags, fchflags *) + CONST + (* Definitions of flags stored in file flags word. *) + (* Super-user and owner changeable flags. *) + UF_SETTABLE = 16_0000ffff; (* mask of owner changeable flags *) + UF_NODUMP = 16_00000001; (* do not dump file *) + UF_IMMUTABLE = 16_00000002; (* file may not be changed *) + UF_APPEND = 16_00000004; (* writes to file may only append *) + UF_OPAQUE = 16_00000008; (* directory is opaque wrt. union *) + + (* Super-user changeable flags. *) + SF_SETTABLE = 16_ffff0000; (* mask of superuser changeable flags *) + SF_ARCHIVED = 16_00010000; (* file is archived *) + SF_IMMUTABLE = 16_00020000; (* file may not be changed *) + SF_APPEND = 16_00040000; (* writes to file may only append *) + + <*EXTERNAL*> + PROCEDURE chflags(path: char_star; flags: u_long): int; + + <*EXTERNAL*> + PROCEDURE fchflags(fd: int; flags: u_long): int; + + END Ustat. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Usyslog.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Usyslog.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Usyslog.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,66 ---- + (* Copyright (C) 1992, Digital Equipment Corporation *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Tue Mar 24 22:25:39 PST 1992 by muller *) + (* modified on Mon Dec 16 09:46:14 PST 1991 by harrison *) + + INTERFACE Usyslog; + + (* + * These declarations are taken from + * + * You can't quite do everything from Modula-3 because syslog is like printf. + * + * Use the Syslog package instead--it's built on top of this and works better + * from Modula-3. + *) + + FROM Ctypes IMPORT char_star, int; + + (* defines for priorities *) + CONST + LOG_ALERT = 1; (* alert -- send to all users *) + LOG_SALERT = 2; (* subalert -- send to special users *) + LOG_EMERG = 3; (* emergency conditions *) + LOG_ERROR = 4; (* error *) + LOG_ERR = LOG_ERROR; (* synonym of LOG_ERROR *) + LOG_CRIT = 5; (* critical information *) + LOG_WARNING = 6; (* warning *) + LOG_NOTICE = 7; (* important information *) + LOG_INFO = 8; (* informational message *) + LOG_DEBUG = 9; (* debug level info *) + + (* + * Mode parameters to initlog. + *) + CONST + LOG_NULL = 0; (* don't touch log *) + LOG_SOUT = 1; (* log standard & diag output *) + LOG_DIAG = 2; (* log diagnostic output *) + LOG_INDEP = 3; (* log independently *) + LOG_CLOSE = 4; (* close the log *) + + (* + * Status parameters to initlog. + *) + CONST + LOG_PID = 16_0001; (* log the pid with each message *) + LOG_TIME = 16_0002; (* log the time with each message *) + LOG_COOLIT = 16_0004; (* suppress priority stuff *) + LOG_DGRAM = 16_0010; (* running over a datagram socket *) + + <* EXTERNAL *> + PROCEDURE openlog( + VALUE ident: char_star; + VALUE logstat: int); + + <* EXTERNAL *> + PROCEDURE syslog( + VALUE priority: int; + VALUE message: char_star); + + <* EXTERNAL *> + PROCEDURE closelog(); + + END Usyslog. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Utime.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Utime.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Utime.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,154 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Fri Apr 30 14:46:35 PDT 1993 by muller *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Wed Dec 2 11:29:00 PST 1992 by mcjones *) + (* modified on Mon Apr 23 16:37:40 1990 by jerome *) + (* ow 03.10.1994 *) + + + INTERFACE Utime; + + FROM Ctypes IMPORT char_star, int, long, long_star, + unsigned_short, short; + + (*** ***) + + TYPE + struct_timeval = RECORD + tv_sec: long; (* seconds *) + tv_usec: long; (* and microseconds *) END; + + struct_timezone = RECORD + tz_minuteswest: int; (* minutes west of Greenwich *) + tz_dsttime: int; (* type of dst correction *) END; + + CONST + DST_NONE = 0; (* not on dst *) + + DST_USA = 1; (* USA style dst *) + DST_AUST = 2; (* Australian style dst *) + DST_WET = 3; (* Western European dst *) + DST_MET = 4; (* Middle European dst *) + DST_EET = 5; (* Eastern European dst *) + DST_CAN = 6; (* Canada *) + + + TYPE + struct_itimerval = RECORD + it_interval: struct_timeval; (* timer interval *) + it_value: struct_timeval; (* current value *) END; + + struct_tm = RECORD + tm_sec: int; (* seconds (0 - 59) *) + tm_min: int; (* minutes (0 - 59) *) + tm_hour: int; (* hours (0 - 23) *) + tm_mday: int; (* day of month (1 - 31) *) + tm_mon: int; (* month of year (0 - 11) *) + tm_year: int; (* year - 1900 *) + tm_wday: int; (* day of week (Sunday = 0) *) + tm_yday: int; (* day of year (0 - 365) *) + tm_isdst: int; (* flag: daylight savings time in effect *) + tm_gmtoff:long; (* offset from GMT in seconds *) + tm_zone: char_star; (* abbreviation of timezone name *) + END; + + struct_tm_star = UNTRACED REF struct_tm; + + time_t = int; (* seconds since the Epoch *) + + (*** ***) + + (* + * Structure returned by times() + *) + + TYPE + struct_tms = RECORD + tms_utime: long; (* user time *) + tms_stime: long; (* system time *) + tms_cutime: long; (* user time, children *) + tms_cstime: long; (* system time, children *) + END; + + struct_tms_star = UNTRACED REF struct_tms; + + + (*** ***) + + (* + * Structure returned by ftime system call + *) + + TYPE + struct_timeb = RECORD + time: long; + millitm: unsigned_short; + timezone: short; + dstflag: short; + END; + + struct_timeb_star = UNTRACED REF struct_timeb; + + + + (*** gettimeofday(2), settimeofday(2) - get/set date and time ***) + + <*EXTERNAL*> + PROCEDURE gettimeofday (VAR t: struct_timeval; + VAR z: struct_timezone): int; + + <*EXTERNAL*> + PROCEDURE settimeofday (VAR t: struct_timeval; + VAR z: struct_timezone): int; + + (*** getitimer(2), setitimer(2) - get/set value of interval timer ***) + + CONST (* which *) + ITIMER_REAL = 0; (* real time intervals *) + ITIMER_VIRTUAL = 1; (* virtual time intervals *) + ITIMER_PROF = 2; (* user and system virtual time *) + + <*EXTERNAL*> + PROCEDURE getitimer (which: int; VAR value: struct_itimerval): int; + + <*EXTERNAL*> + PROCEDURE setitimer (which: int; + VAR value, ovalue: struct_itimerval): int; + + (*** stime(2) - set time ***) + (* not in FreeBSD + <*EXTERNAL*> PROCEDURE stime (VAR tp: long): int; + *) + + + (*** clock(3) - report CPU time used (in micro-seconds) ***) + + <*EXTERNAL*> PROCEDURE clock (): long; + + (*** times(3) - get process times (in ticks) ***) + + <*EXTERNAL*> PROCEDURE times (buffer: struct_tms_star): long; + + (*** time(3), ftime(3) - get date and time (in seconds) ***) + + <*EXTERNAL*> PROCEDURE time (tloc: long_star): long; + (* not in FreeBSD + <*EXTERNAL*> PROCEDURE ftime (tp: struct_timeb_star); + *) + + (*** ctime(3), localtime(3), gmtime(3), asctime(3) + - convert date and time (in seconds) to string ***) + + <*EXTERNAL*> PROCEDURE ctime (clock: long_star): char_star; + <*EXTERNAL*> PROCEDURE asctime (tm: struct_tm_star): char_star; + + <*EXTERNAL*> PROCEDURE localtime (clock: long_star): struct_tm_star; + <*EXTERNAL*> PROCEDURE gmtime (clock: long_star): struct_tm_star; + + (*** mktime(3) - convert a struct_tm to a time_t ***) + <*EXTERNAL*> PROCEDURE mktime (tm: struct_tm_star): time_t; + + END Utime. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Utypes.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Utypes.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Utypes.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,108 ---- + (* Copyright (C) 1994, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* Last modified on Sat Jan 7 14:47:05 PST 1995 by kalsow *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Mon Jan 11 14:34:58 PST 1993 by muller *) + (* ow Sun Nov 6 17:12:47 MET 1994 *) + + INTERFACE Utypes; + + FROM Ctypes IMPORT + long, unsigned_long, int, unsigned_int, short, unsigned_short, + unsigned_char; + + (*** ***) + + (* + * Basic system types and major/minor device constructing/busting macros. + *) + + (* major part of a device *) + PROCEDURE major (x: int): int; + + (* minor part of a device *) + PROCEDURE minor (x: int): int; + + (* make a device number *) + PROCEDURE makedev (x, y: int): dev_t; + + TYPE + u_char = unsigned_char; + u_short = unsigned_short; + u_int = unsigned_int; + uint = unsigned_int; (* sys V compatibility *) + u_long = unsigned_long; + ushort = unsigned_short; (* sys III compat *) + + (* #ifdef vax *) + struct__physadr = RECORD r: ARRAY [0..0] OF int; END; + physadr = UNTRACED REF struct__physadr; + + struct_label_t = RECORD val: ARRAY [0..13] OF int; END; + label_t = struct_label_t; + (*#endif*) + + struct__quad = RECORD val: ARRAY [0..1] OF long; END; + quad = struct__quad; + quad_t = struct__quad; + daddr_t = long; + caddr_t = ADDRESS; + ino_t = u_long; + gno_t = u_long; + cnt_t = short; (*?*) (* sys V compatibility *) + swblk_t = long; + size_t = u_int; + time_t = long; + dev_t = u_long; + off_t = long; (*!!! SHOULD BE quad_t !!!*) + paddr_t = long; (* sys V compatibility *) + key_t = long; (* sys V compatibility *) + clock_t = u_long; (* POSIX compliance *) + mode_t = u_short; (* POSIX compliance *) + nlink_t = u_short; (* POSIX compliance *) + uid_t = u_long; (* POSIX compliance *) + pid_t = long; (* POSIX compliance *) + gid_t = u_long; (* POSIX compliance *) + + tcflag_t = u_long; + cc_t = u_char; + speed_t = long; + + CONST + NBBY = 8; (* number of bits in a byte *) + + (* + * Select uses bit masks of file descriptors in longs. + * These macros manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here + * should be >= NOFILE (param.h). + *) + FD_SETSIZE = 256; + + (* How many things we'll allow select to use. 0 if unlimited *) + MAXSELFD = 256; + + TYPE + fd_mask = long; + + CONST + NFDBITS = BYTESIZE (fd_mask) * NBBY; (* bits per mask (power of 2!)*) + NFDSHIFT = 5; (* Shift based on above *) + + PROCEDURE howmany (x, y: int): int; + + TYPE + struct_fd_set = RECORD + fds_bits: ARRAY [0 .. + (FD_SETSIZE + NFDBITS - 1) DIV NFDBITS -1] OF fd_mask; + END; + fd_set = struct_fd_set; + + PROCEDURE FD_SET (n: int; p: UNTRACED REF fd_set): int; + PROCEDURE FD_CLEAR (n: int; p: UNTRACED REF fd_set): int; + PROCEDURE FD_ISSET (n: int; p: UNTRACED REF fd_set): int; + PROCEDURE FD_ZERO (p: UNTRACED REF fd_set); + + END Utypes. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Utypes.m3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Utypes.m3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Utypes.m3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,61 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Mon Mar 09 19:03:55 PST 1992 by muller *) + + MODULE Utypes; + + IMPORT Word; + + FROM Ctypes IMPORT int; + + PROCEDURE major (x: int): int = + BEGIN + RETURN Word.And (Word.Shift (x, -8), 8_0377); + END major; + + PROCEDURE minor (x: int): int = + BEGIN + RETURN Word.And (x, 8_0377); + END minor; + + PROCEDURE makedev (x, y: int): dev_t = + BEGIN + RETURN Word.Or (Word.Shift (x, 8), y); + END makedev; + + PROCEDURE howmany (x, y: int): int = + BEGIN + RETURN (x + (y - 1)) DIV y; + END howmany; + + PROCEDURE FD_SET (n: int; p: UNTRACED REF fd_set): int = + BEGIN + WITH l = p.fds_bits [n DIV NFDBITS] DO + l := Word.Or (l, Word.Shift (1, n MOD NFDBITS)); + RETURN l; END; + END FD_SET; + + PROCEDURE FD_CLEAR (n: int; p: UNTRACED REF fd_set): int = + BEGIN + WITH l = p.fds_bits [n DIV NFDBITS] DO + l := Word.And (l, Word.Not (Word.Shift (1, n MOD NFDBITS))); + RETURN l; END; + END FD_CLEAR; + + PROCEDURE FD_ISSET (n: int; p: UNTRACED REF fd_set): int = + BEGIN + WITH l = p.fds_bits [n DIV NFDBITS] DO + RETURN Word.And (l, Word.Shift (1, n MOD NFDBITS)); END; + END FD_ISSET; + + PROCEDURE FD_ZERO (p: UNTRACED REF fd_set) = + BEGIN + WITH a = p.fds_bits DO + FOR i := FIRST (a) TO LAST (a) DO + a[i] := 0; END; END; + END FD_ZERO; + + BEGIN + END Utypes. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Uugid.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Uugid.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Uugid.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,34 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + + (* Last modified on Fri Mar 16 12:20:16 1990 by muller *) + + INTERFACE Uugid; + + FROM Ctypes IMPORT int; + + + (*** getuid(2), geteuid(2) - get user identity ***) + + <*EXTERNAL*> PROCEDURE getuid (): int; + <*EXTERNAL*> PROCEDURE geteuid (): int; + + + (*** getgid(2), getguid(2) - get group identity ***) + + <*EXTERNAL*> PROCEDURE getgid (): int; + <*EXTERNAL*> PROCEDURE getegid (): int; + + + (*** setreuid(2) - set real and effective user ID's ***) + + <*EXTERNAL*> PROCEDURE setreuid (ruid, euid: int): int; + + + (*** setregid(2) - set real and effective group ID ***) + + <*EXTERNAL*> PROCEDURE setregid (rgid, egid: int): int; + + + END Uugid. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Uuio.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Uuio.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Uuio.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,67 ---- + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Wed Mar 4 11:53:52 PST 1992 by muller *) + (* ow 30.09.1994 *) + + INTERFACE Uuio; + + FROM Ctypes IMPORT int, char_star, void_star; + + (*** sys/uio.h ***) + + + TYPE + struct_iovec = RECORD + iov_base: void_star; + iov_len: int; + END; + struct_iovec_star = UNTRACED REF struct_iovec; + + (* There's no corresponding structure to struct_uio - be careful *) + struct_uio = RECORD + uio_iov: struct_iovec_star; + uio_iovcnt: int; + uio_offset: int; + uio_resid: int; + uio_segflg: int; + uio_flag: int; + uio_procp: void_star; + END; + + uio_rw = {UIO_READ, UIO_WRITE}; + + (* + * Segment flag values (should be enum). + *) + + CONST + (* There appear to be no corresponing definitions for any of these + constants - use with caution. *) + UIO_USERSPACE = 0; (* from user data space *) + UIO_SYSSPACE = 1; (* from system space *) + UIO_USERISPACE = 2; (* from user I space *) + + CONST + MAX_IOVEC = 1024; (* maximum length of io vectors *) + + + + (*** read, readv(2) - read from a file ***) + + <*EXTERNAL "m3_read"*> + PROCEDURE read (d: int; buf: char_star; nbytes: int): int; + + <*EXTERNAL*> PROCEDURE readv (d: int; iov: struct_iovec_star; + iovcnt: int): int; + + (*** write, writev(2) - write on a file ***) + + <*EXTERNAL "m3_write"*> + PROCEDURE write (d: int; buf: char_star; nbytes: int): int; + + <*EXTERNAL*> PROCEDURE writev (d: int; iov: struct_iovec_star; + ioveclen: int): int; + + END Uuio. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/Uutmp.i3 diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/Uutmp.i3:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/Uutmp.i3 Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,76 ---- + (* Copyright (C) 1990, Digital Equipment Corporation. *) + (* All rights reserved. *) + (* See the file COPYRIGHT for a full description. *) + (* *) + (* File: Uutmp.i3 *) + (* modified on Sat Apr 16 by rrw1000@hermes.cam.ac.uk *) + (* modified on Mon Apr 16 15:59:54 1990 by jerome *) + + INTERFACE Uutmp; + + FROM Ctypes IMPORT char, char_star, long, short; + FROM Utypes IMPORT pid_t, time_t; + + (*** ***) + + (* + * Structure of utmp and wtmp files. + * + *) + + CONST + (* Constants for the ut_type field : *) + UT_UNKNOWN = 0; + + (* Size of user name *) + UT_NAMESIZE = 8; + + (* Other things *) + RUN_LVL = 1; + BOOT_TIME = 2; + NEW_TIME = 3; + OLD_TIME = 4; + + INIT_PROCESS = 5; + LOGIN_PROCESS = 6; + USER_PROCESS = 7; + DEAD_PROCESS = 8; + + TYPE + struct_utmp = RECORD + ut_type : short; (* type of login *) + ut_pid : pid_t; (* pid of login process *) + ut_line : ARRAY [0..11] OF char; (* name of tty - "/dev", null-term *) + ut_id : ARRAY [0..1] OF char; (* abbrev. ttyname, as 01, s1, etc *) + ut_time : time_t; (* login time *) + ut_user : ARRAY [0..UT_NAMESIZE-1] OF char; (* user id *) + ut_host : ARRAY [0..15] OF char; (* host name, if remote *) + ut_addr : long (* IP addr of remote host *) + END; + + CONST + UTMP_FILE = "/etc/utmp"; + WTMP_FILE = "/var/adm/wtmp"; + UTMP_FILEMNAME = UTMP_FILE; + WTMP_FILENAME = WTMP_FILE; + + (* Special strings or formats used in the "ut_line" field when *) + (* accounting for something other than a process. *) + (* No string for the ut_line field can be more than 7 chars + *) + (* a NULL in length. *) + + (* These constants may not be used under Linux - use ut_type and the + constants specified above for this purpose instead *) + + EMPTY = ""; + BOOT_MSG = "~"; + OTIME_MSG = "|"; + NTIME_MSG = "}"; + + + (*** getlogin(3) ***) + + <*EXTERNAL*> PROCEDURE getlogin (): char_star; + + + END Uutmp. Index: m3/pm3/libs/m3core/src/unix/freebsd-3/m3makefile diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/m3makefile:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/m3makefile Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,35 ---- + % Copyright (C) 1992, Digital Equipment Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + % + % Last modified on Sat Jan 7 14:53:09 PST 1995 by kalsow + % modified on Wed Jun 9 17:03:32 PDT 1993 by harrison + % modified on Tue Mar 2 17:17:34 PST 1993 by muller + + Interface ("Udir") + Module ("Uerror") + Interface ("Uexec") + Interface ("Ugrp") + Module ("Uin") + Interface ("Uipc") + Interface ("Umman") + Module ("Umsg") + Module ("Unetdb") + Interface ("Unix") + Interface ("Uprocess") + Interface ("Upwd") + Interface ("Uresource") + Interface ("Usem") + Interface ("Ushm") + Module ("Usignal") + Interface ("Ustat") + Interface ("Usocket") + Interface ("Usyslog") + Interface ("Utime") + Module ("Utypes") + Interface ("Uugid") + Interface ("Uuio") + Interface ("Uutmp") + + c_source ("off_t_wrap") + Index: m3/pm3/libs/m3core/src/unix/freebsd-3/off_t_wrap.c diff -c /dev/null m3/pm3/libs/m3core/src/unix/freebsd-3/off_t_wrap.c:1.1 *** /dev/null Mon Jun 7 17:09:17 1999 --- m3/pm3/libs/m3core/src/unix/freebsd-3/off_t_wrap.c Mon Jun 7 13:15:12 1999 *************** *** 0 **** --- 1,35 ---- + /* Copyright (C) 1994, Digital Equipment Corporation */ + /* All rights reserved. */ + /* See the file COPYRIGHT for a full description. */ + /* */ + /* Last modified on Thu Jan 12 09:28:20 PST 1995 by kalsow */ + /* Contributed by Olaf Wagner, Jan 1995 */ + + #include + #include + #include + #include + + caddr_t m3_mmap(caddr_t addr, size_t len, int prot, int flags, int fd, long offset) + { + off_t off = (off_t) offset; + return mmap(addr, len, prot, flags, fd, off); + } + + long m3_lseek(int fildes, long offset, int whence) + { + off_t off = (off_t) offset; + return (long) lseek(fildes, off, whence); + } + + int m3_truncate(const char *path, long length) + { + off_t len = (off_t) length; + return truncate(path, len); + } + + int m3_ftruncate(int fd, long length) + { + off_t len = (off_t) length; + return ftruncate(fd, length); + } Index: m3/pm3/libs/m3core/src/unix/osf-1.ALPHA_OSF/Umman.i3 diff -c m3/pm3/libs/m3core/src/unix/osf-1.ALPHA_OSF/Umman.i3:1.1.1.1 m3/pm3/libs/m3core/src/unix/osf-1.ALPHA_OSF/Umman.i3:1.2 *** m3/pm3/libs/m3core/src/unix/osf-1.ALPHA_OSF/Umman.i3:1.1.1.1 Thu Jan 16 16:30:09 1997 --- m3/pm3/libs/m3core/src/unix/osf-1.ALPHA_OSF/Umman.i3 Wed Apr 28 12:02:14 1999 *************** *** 52,58 **** MSEM_IF_WAITERS = 3; MS_ASYNC = 1; ! MS_SYNC = 3; MS_INVALIDATE = 4; --- 52,58 ---- MSEM_IF_WAITERS = 3; MS_ASYNC = 1; ! MS_SYNC = 2; MS_INVALIDATE = 4; Index: m3/pm3/libs/m3core/src/unix/osf-1.generic/Uresource.i3 diff -c m3/pm3/libs/m3core/src/unix/osf-1.generic/Uresource.i3:1.1.1.1 m3/pm3/libs/m3core/src/unix/osf-1.generic/Uresource.i3:1.3 *** m3/pm3/libs/m3core/src/unix/osf-1.generic/Uresource.i3:1.1.1.1 Thu Jan 16 16:30:09 1997 --- m3/pm3/libs/m3core/src/unix/osf-1.generic/Uresource.i3 Fri Apr 30 01:20:14 1999 *************** *** 50,63 **** (* Resource limits *) CONST ! RLIMIT_CPU = 0; (* cpu time in milliseconds *) ! RLIMIT_FSIZE = 1; (* maximum file size *) ! RLIMIT_DATA = 2; (* data size *) ! RLIMIT_STACK = 3; (* stack size *) ! RLIMIT_CORE = 4; (* core file size *) ! RLIMIT_RSS = 5; (* resident set size *) ! RLIM_NLIMITS = 6; (* number of resource limits *) RLIM_INFINITY = 16_7fffffff; --- 50,66 ---- (* Resource limits *) CONST ! RLIMIT_CPU = 0; (* cpu time in milliseconds *) ! RLIMIT_FSIZE = 1; (* maximum file size *) ! RLIMIT_DATA = 2; (* data size *) ! RLIMIT_STACK = 3; (* stack size *) ! RLIMIT_CORE = 4; (* core file size *) ! RLIMIT_RSS = 5; (* resident set size *) ! RLIMIT_NOFILE = 6; (* open files *) ! RLIMIT_AS = 7; (* address space *) ! RLIMIT_VMEM = RLIMIT_AS; (* V.4 alias for AS *) ! RLIM_NLIMITS = 8; (* number of resource limits *) RLIM_INFINITY = 16_7fffffff; Index: m3/pm3/m3config/src/ALPHA_OSF diff -c m3/pm3/m3config/src/ALPHA_OSF:1.6 m3/pm3/m3config/src/ALPHA_OSF:1.8 *** m3/pm3/m3config/src/ALPHA_OSF:1.6 Wed Mar 11 17:35:49 1998 --- m3/pm3/m3config/src/ALPHA_OSF Tue May 4 17:55:07 1999 *************** *** 8,48 **** %INSTALL_ROOT = "/usr/local" ! readonly PLATFORM_SUPPORTS_MOTIF = "TRUE" - %PLATFORM_SUPPORTS_SHARED_LIB = "TRUE" % does not seem to work with many libs - setDefault("","") CC = [ "/bin/cc", "-ieee_with_no_inexact", "-c" ] LINK = [ "/bin/cc", "-ieee_with_no_inexact" ] MAKELIB = [ "/bin/ar", "crusl" ] MAKESHLIB = ["/usr/bin/ld", "-shared", "-expect_unresolved", "end" ,"-o"] ! ASM = ["/bin/as","-o"] % Assembler ! FIXOBJ = [ LIB_USE & "/mips-tfile" ] OPT_FLAG = "-O" ! BOPT_FLAG = "-O" DEBUG_FLAG = "-g3" STATIC_FLAG = "-non_shared" LINK_suffix = ["-ldnet_stub", "-lm"] % Tail of the link command % Do we need "-call_shared" or is it the default proc m3_make_shared_lib (lib, objects, imported_libs) is local lib_a = format ("lib%s.a", lib) local lib_so = format ("lib%s.so", lib) local cmd = [MAKESHLIB_CMD, lib_so, "-all", lib_a, "-none", objects, "-ldnet_stub", "-lm", "-lc"] - if VERBOSE write(cmd, CR) end return exec (cmd) end ! proc m3_assemble (source, object, optimize, debug, shared) is local cmd = [ ASM_CMD, object, source ] local ret = 0 ! if Options{"optimization"}[0] cmd += [ "-O" ] end if Options{"debuginfo"}[0] cmd += [ "-g3" ] end if VERBOSE write(cmd, CR) end --- 8,53 ---- %INSTALL_ROOT = "/usr/local" ! PLATFORM_SUPPORTS_MOTIF = "T" ! PLATFORM_SUPPORTS_SHARED_LIB = "" % does not seem to work with many libs ! %PLATFORM_SUPPORTS_LATEX = "T" setDefault("","") CC = [ "/bin/cc", "-ieee_with_no_inexact", "-c" ] LINK = [ "/bin/cc", "-ieee_with_no_inexact" ] MAKELIB = [ "/bin/ar", "crusl" ] MAKESHLIB = ["/usr/bin/ld", "-shared", "-expect_unresolved", "end" ,"-o"] ! ASM = [ LIB_USE & "/as", "-o"] % Assembler ! FIXOBJ = [ LIB_USE & "/fixobj" ] OPT_FLAG = "-O" ! BOPT_FLAG = "-O2" DEBUG_FLAG = "-g3" STATIC_FLAG = "-non_shared" LINK_suffix = ["-ldnet_stub", "-lm"] % Tail of the link command % Do we need "-call_shared" or is it the default + RPATH_FLAG = "-rpath" + RPATH_prefix = "" proc m3_make_shared_lib (lib, objects, imported_libs) is local lib_a = format ("lib%s.a", lib) local lib_so = format ("lib%s.so", lib) local cmd = [MAKESHLIB_CMD, lib_so, "-all", lib_a, "-none", objects, "-ldnet_stub", "-lm", "-lc"] if VERBOSE write(cmd, CR) end return exec (cmd) end ! proc m3_assemble (source, object) is local cmd = [ ASM_CMD, object, source ] local ret = 0 ! if Options{"optimization"}[0] ! cmd += [ "-O1" ] ! else ! cmd += [ "-O0" ] ! end if Options{"debuginfo"}[0] cmd += [ "-g3" ] end if VERBOSE write(cmd, CR) end *************** *** 50,55 **** --- 55,66 ---- if not equal(ret, 0) return ret end cmd = [ FIXOBJ, "-o", object, source ] + if VERBOSE write(cmd, CR) end return exec(cmd) end + proc install_file (src, dest, mode) is + Note_install (src, dest) + local ret = exec (["installbsd", "-c", "-m", mode, src, dest]) + if not equal(ret, 0) error("install failed with error code: ", ret) end + end Index: m3/pm3/m3config/src/COMMON diff -c m3/pm3/m3config/src/COMMON:1.17 m3/pm3/m3config/src/COMMON:1.18 *** m3/pm3/m3config/src/COMMON:1.17 Fri Jan 29 20:57:08 1999 --- m3/pm3/m3config/src/COMMON Mon Jun 7 13:15:22 1999 *************** *** 22,27 **** --- 22,28 ---- PLATFORM_SUPPORTS_INTERNAL_BACKEND = "" PLATFORM_SUPPORTS_SHARED_LIB = "" PLATFORM_SUPPORTS_LATEX = "" + BOOTSTRAP_TO_IL = "" % Use intermediate language for bootstrapping X11_WITH_SHARED_MEM = "TRUE" % X11 server with shared memory extension INSTALL_IMPLS = "TRUE" % install .m3 source files to ease browsing/debug % MAN_SECTION = "l" % install man pages in section "l", not in 1..8 *************** *** 51,56 **** --- 52,58 ---- DYNAMIC_FLAG = "" % executable with shared libs RPATH_FLAG = "-Wl,-rpath" % run time path for shared library RPATH_prefix = "-Wl," % Prefix for each library path argument + RPATH_LIB_USE_ONLY = "" % Generate only a single rpath pointing to LIB_USE GNU_CC = "gcc" % C compiler for m3cc and m3gdb GNU_CFLAGS = "-O2" % options for GNU_CC *************** *** 86,95 **** % proc pm3_version() is ! if not defined("VERSION") ! include("VERSION") ! end ! return VERSION end % --- 88,94 ---- % proc pm3_version() is ! return M3_VERSION end % *************** *** 255,268 **** LINK_CMD += STATIC_FLAG else if not empty(DYNAMIC_FLAG) LINK_CMD += DYNAMIC_FLAG end ! if defined("TARGET_LIB_USE") and RPATH_FLAG ! if RPATH_prefix ! LINK_CMD += [RPATH_FLAG, RPATH_prefix & TARGET_LIB_USE] ! else ! LINK_CMD += RPATH_FLAG & TARGET_LIB_USE ! end end - LINK_libpath = RPATH_FLAG end end end --- 254,277 ---- LINK_CMD += STATIC_FLAG else if not empty(DYNAMIC_FLAG) LINK_CMD += DYNAMIC_FLAG end ! if RPATH_FLAG ! if defined("TARGET_LIB_USE") ! if RPATH_prefix ! LINK_CMD += [RPATH_FLAG, RPATH_prefix & TARGET_LIB_USE] ! else ! LINK_CMD += RPATH_FLAG & TARGET_LIB_USE ! end ! end ! if RPATH_LIB_USE_ONLY ! if RPATH_prefix ! LINK_CMD += [RPATH_FLAG, RPATH_prefix & LIB_USE] ! else ! LINK_CMD += RPATH_FLAG & LIB_USE ! end ! else ! LINK_libpath = "T" ! end end end end end *************** *** 564,571 **** "AP3000" : [ "POSIX", "32BITS", "apollo68-bsd", "" ], "ARM" : [ "POSIX", "32BITS", "arm--riscos", "" ], "DS3100" : [ "POSIX", "32BITS", "decstation", "T" ], "FreeBSD" : [ "POSIX", "32BITS", "i486-unknown-bsd", "" ], ! "FreeBSD2" : [ "POSIX", "32BITS", "i486-unknown-bsd", "T" ], "HP300" : [ "POSIX", "32BITS", "m68k-hp-hpux", "" ], "HPPA" : [ "POSIX", "32BITS", "hppa1.1-hp-hpux", "T" ], "IBMR2" : [ "POSIX", "32BITS", "rs6000-ibm-aix3.2", "" ], --- 573,582 ---- "AP3000" : [ "POSIX", "32BITS", "apollo68-bsd", "" ], "ARM" : [ "POSIX", "32BITS", "arm--riscos", "" ], "DS3100" : [ "POSIX", "32BITS", "decstation", "T" ], + "FBSD_ALPHA": [ "POSIX", "64BITS", "alpha-unknown-freebsd", "T" ], "FreeBSD" : [ "POSIX", "32BITS", "i486-unknown-bsd", "" ], ! "FreeBSD2" : [ "POSIX", "32BITS", "i486-unknown-freebsd", "T" ], ! "FreeBSD3" : [ "POSIX", "32BITS", "i486-unknown-freebsdelf", "T" ], "HP300" : [ "POSIX", "32BITS", "m68k-hp-hpux", "" ], "HPPA" : [ "POSIX", "32BITS", "hppa1.1-hp-hpux", "T" ], "IBMR2" : [ "POSIX", "32BITS", "rs6000-ibm-aix3.2", "" ], *************** *** 644,646 **** --- 655,660 ---- "unfold_nested_procs" : [ "", "T", m3frontOption] } + % Redefined in released versions + M3_VERSION="PM3 experimental" + M3_VERSION_DATE="Now" Index: m3/pm3/m3config/src/FBSD_ALPHA diff -c /dev/null m3/pm3/m3config/src/FBSD_ALPHA:1.2 *** /dev/null Mon Jun 7 17:09:22 1999 --- m3/pm3/m3config/src/FBSD_ALPHA Mon Jun 7 17:02:58 1999 *************** *** 0 **** --- 1,59 ---- + % + % FreeBSD/Alpha 3.x configuration. + % + + readonly TARGET = "FBSD_ALPHA" + + include("COMMON") + + INSTALL_ROOT = "/usr/local/pm3" + X11ROOT = "/usr/X11R6/lib" + + PLATFORM_SUPPORTS_MOTIF = "" + PLATFORM_SUPPORTS_SHARED_LIB = "T" + INSTALL_IMPLS = "" + SKIP_M3GDB = "T" + + ASM = ["as", "-o"] + BOPT_FLAG = [] + CC = ["cc","-mieee","-c"] + GNU_CC = "cc" + GNU_CFLAGS = [] + LINK = ["cc"] + MAKELIB = [ "ar", "cru" ] + MAKESHLIB = ["cc","-shared"] + OPT_FLAG = [] + RANLIB = ["ranlib"] + RPATH_FLAG = "-R" + RPATH_prefix = "" + RPATH_LIB_USE_ONLY = "T" + + % FreeBSD requires a version number on each shared library. Don't try + % to derive these from the PM3 version number. That approach does not + % work out well in practice. + SHLIB_VERSION = "7" + + proc m3_make_shared_lib (lib, objects, imported_libs) is + local lib_so = format ("lib%s.so", lib) + local lib_sox = format ("%s.%s", lib_so, SHLIB_VERSION) + local cmd = [MAKESHLIB_CMD, "-o", lib_so, "-Wl,-soname," & lib_sox, objects] + + if VERBOSE write(cmd, CR) end + return exec(cmd) + end + + proc m3_note_shlib(lib) is + if Options{"shared_lib"}[0] and PLATFORM_SUPPORTS_SHARED_LIB + local lib_so = format ("lib%s.so", lib) + local lib_sox = format ("%s.%s", lib_so, SHLIB_VERSION) + + if defined ("_all") + install_derived(lib_so) + install_alias_link(lib_so, + LIB_TO_PKG_USE & SL & PACKAGE & SL & BUILD_DIR, lib_sox, LIB_INSTALL) + end + deriveds (lib_so, [""]) + end + end + + setDefault("","") Index: m3/pm3/m3config/src/FreeBSD2 diff -c m3/pm3/m3config/src/FreeBSD2:1.5 m3/pm3/m3config/src/FreeBSD2:1.7 *** m3/pm3/m3config/src/FreeBSD2:1.5 Sat Jan 17 11:51:44 1998 --- m3/pm3/m3config/src/FreeBSD2 Mon Jun 7 13:47:52 1999 *************** *** 1,20 **** % ! % FreeBSD 2.0 configuration (with shared library support in comments) % readonly TARGET = "FreeBSD2" include("COMMON") ! %INSTALL_ROOT = "/usr/local" ! X11ROOT = "/usr/X386/lib" ! PLATFORM_SUPPORTS_MOTIF = "TRUE" PLATFORM_SUPPORTS_SHARED_LIB = "T" ! MAKELIB = [ "/usr/bin/ar", "cru" ] ! MAKESHLIB = [ "/usr/bin/ld", "-Bshareable", "-assert", "pure-text" ] ! ! DYNAMIC_FLAG = [ "-Xlinker", "-Bdynamic" ] setDefault("","") --- 1,58 ---- % ! % FreeBSD 2.x (a.out) configuration. % readonly TARGET = "FreeBSD2" include("COMMON") ! INSTALL_ROOT = "/usr/local/pm3" ! X11ROOT = "/usr/X11R6/lib" ! PLATFORM_SUPPORTS_MOTIF = "" PLATFORM_SUPPORTS_SHARED_LIB = "T" + INSTALL_IMPLS = "" + SKIP_M3GDB = "T" ! ASM = ["as", "-k", "-o"] ! BOPT_FLAG = "-O" ! BPIC_FLAG = ["-O0", "-fPIC"] ! CC = ["cc","-c"] ! GNU_CC = "cc" ! GNU_CFLAGS = [] ! LINK = ["cc"] ! MAKELIB = [ "ar", "cru" ] ! MAKESHLIB = ["cc","-shared"] ! OPT_FLAG = "-O" ! RANLIB = ["ranlib"] ! RPATH_FLAG = "-R" ! RPATH_prefix = "" ! RPATH_LIB_USE_ONLY = "T" ! ! % FreeBSD/a.out requires a major and minor version number on each shared ! % library. Don't try to derive these from the PM3 version number. That ! % approach does not work out well in practice. ! SHLIB_VERSION = "7.0" ! ! proc m3_make_shared_lib (lib, objects, imported_libs) is ! local lib_sox = format ("lib%s.so.%s", lib, SHLIB_VERSION) ! local cmd = [MAKESHLIB_CMD, "-o", lib_sox, objects] ! ! if VERBOSE write(cmd, CR) end ! return exec(cmd) ! end ! ! proc m3_note_shlib(lib) is ! if Options{"shared_lib"}[0] and PLATFORM_SUPPORTS_SHARED_LIB ! local lib_sox = format ("lib%s.so.%s", lib, SHLIB_VERSION) ! ! if defined ("_all") ! install_derived(lib_sox) ! install_link(lib_sox, ! LIB_TO_PKG_USE & SL & PACKAGE & SL & BUILD_DIR, LIB_INSTALL) ! end ! deriveds (lib_sox, [""]) ! end ! end setDefault("","") Index: m3/pm3/m3config/src/FreeBSD3 diff -c /dev/null m3/pm3/m3config/src/FreeBSD3:1.2 *** /dev/null Mon Jun 7 17:09:22 1999 --- m3/pm3/m3config/src/FreeBSD3 Mon Jun 7 13:47:52 1999 *************** *** 0 **** --- 1,59 ---- + % + % FreeBSD 3.x (ELF) configuration. + % + + readonly TARGET = "FreeBSD3" + + include("COMMON") + + INSTALL_ROOT = "/usr/local/pm3" + X11ROOT = "/usr/X11R6/lib" + + PLATFORM_SUPPORTS_MOTIF = "" + PLATFORM_SUPPORTS_SHARED_LIB = "T" + INSTALL_IMPLS = "" + SKIP_M3GDB = "T" + + ASM = ["as", "-o"] + BOPT_FLAG = "-O" + CC = ["cc","-c"] + GNU_CC = "cc" + GNU_CFLAGS = [] + LINK = ["cc"] + MAKELIB = [ "ar", "cru" ] + MAKESHLIB = ["cc","-shared"] + OPT_FLAG = "-O" + RANLIB = ["ranlib"] + RPATH_FLAG = "-R" + RPATH_prefix = "" + RPATH_LIB_USE_ONLY = "T" + + % FreeBSD requires a version number on each shared library. Don't try + % to derive these from the PM3 version number. That approach does not + % work out well in practice. + SHLIB_VERSION = "7" + + proc m3_make_shared_lib (lib, objects, imported_libs) is + local lib_so = format ("lib%s.so", lib) + local lib_sox = format ("%s.%s", lib_so, SHLIB_VERSION) + local cmd = [MAKESHLIB_CMD, "-o", lib_so, "-Wl,-soname," & lib_sox, objects] + + if VERBOSE write(cmd, CR) end + return exec(cmd) + end + + proc m3_note_shlib(lib) is + if Options{"shared_lib"}[0] and PLATFORM_SUPPORTS_SHARED_LIB + local lib_so = format ("lib%s.so", lib) + local lib_sox = format ("%s.%s", lib_so, SHLIB_VERSION) + + if defined ("_all") + install_derived(lib_so) + install_alias_link(lib_so, + LIB_TO_PKG_USE & SL & PACKAGE & SL & BUILD_DIR, lib_sox, LIB_INSTALL) + end + deriveds (lib_so, [""]) + end + end + + setDefault("","") Index: m3/pm3/m3config/src/GCWRAP diff -c /dev/null m3/pm3/m3config/src/GCWRAP:1.1 *** /dev/null Mon Jun 7 17:09:22 1999 --- m3/pm3/m3config/src/GCWRAP Mon Jun 7 13:15:22 1999 *************** *** 0 **** --- 1,2 ---- + + GCWRAPFLAGS = "-Wl,--wrap,adjtime,--wrap,getdirentries,--wrap,readv,--wrap,utimes,--wrap,wait3" \ No newline at end of file Index: m3/pm3/m3config/src/LINUXLIBC6 diff -c m3/pm3/m3config/src/LINUXLIBC6:1.4 m3/pm3/m3config/src/LINUXLIBC6:1.5 *** m3/pm3/m3config/src/LINUXLIBC6:1.4 Fri Jan 29 20:57:08 1999 --- m3/pm3/m3config/src/LINUXLIBC6 Mon Jun 7 13:15:23 1999 *************** *** 2,13 **** --- 2,15 ---- readonly TARGET = "LINUXLIBC6" include("COMMON") + include("GCWRAP") PLATFORM_SUPPORTS_INTERNAL_BACKEND = "T" PLATFORM_SUPPORTS_SHARED_LIB = "T" X11ROOT = "/usr/X11R6/lib" OPENGLROOT = "/usr/lib" + LINK_suffix += GCWRAPFLAGS %INSTALL_ROOT = "/usr/local" setDefault("","") Index: m3/pm3/m3config/src/NT386GNU diff -c m3/pm3/m3config/src/NT386GNU:1.7 m3/pm3/m3config/src/NT386GNU:1.9 *** m3/pm3/m3config/src/NT386GNU:1.7 Tue Nov 3 12:37:52 1998 --- m3/pm3/m3config/src/NT386GNU Mon Jun 7 17:02:59 1999 *************** *** 6,16 **** --- 6,35 ---- PLATFORM_SUPPORTS_OPENGL = "TRUE" PLATFORM_SUPPORTS_LATEX = "" + % A first attempt at shared library support is included in this file. + % It is not functional due to lack of NT platform/cygwin32 knowkledge + % but may be quite easy to get in shape for someone familiar with these. + % + %PLATFORM_SUPPORTS_SHARED_LIB = "T" + %PIC_FLAG = "" + %BPIC_FLAG = "" + %option("static_lib","") + CYGNUS_LIB_DIR = "/usr/local/lib/i386-cygwin32" INSTALL_ROOT = "\\usr\\pm3" + LINK_suffix = [ "-luser32", "-lgdi32", "-ladvapi32", "-lnetapi32", "-lm" ] + proc setNTLinkSuffix() is + if OPTION_GUI + LINK_suffix += [ "-mwindows", "-lcomctl32", "-lcomdlg32", "-lkernel32", + "-e_mainCRTStartup" ] + end + end + + add_m3_hook(setNTLinkSuffix) + setDefault("","") readonly proc import_OpenGL() is *************** *** 27,29 **** --- 46,111 ---- local ret = exec (["install", "-c", "-m", mode, w2p(src), w2p(dest)]) if not equal(ret, 0) error("install failed with error code: ", ret) end end + + proc m3_make_shared_lib (lib, objects, imported_libs) is + local llib = "lib" & lib + + > llib & ".c" in + write("#include ",CR,CR, + "int WINAPI",CR, + llib & "_init(HANDLE h, DWORD reason, void *foo)",CR, + "{",CR, + " return 1;",CR, + "}",CR) + end + + local cmd = ["gcc", "-c", llib & ".c"] + + if VERBOSE write(cmd,CR) end + local ret = exec(cmd) + if not equal(ret,0) return ret end + + cmd = ["gcc","-s","-Wl,--base-file," & llib & ".base", + "-o", llib & ".dll", objects, llib & ".o", + "-Wl,-e,_" & llib & "_init@12"] + + if VERBOSE write(cmd,CR) end + ret = exec(cmd) + if not equal(ret,0) return ret end + + cmd = ["dlltool", "--base-file", llib & ".base", "--def", llib & ".def", + "--output-exp", llib & ".exp", "--dllname", llib & ".dll"] + + if VERBOSE write(cmd,CR) end + ret = exec(cmd) + if not equal(ret,0) return ret end + + cmd = ["gcc", "-s", "-Wl,--base-file," & llib & ".base," & llib & ".exp", + "-o", llib & ".dll", objects, llib & ".o", + "-Wl,-e,_" & llib & "_init@12"] + + if VERBOSE write(cmd,CR) end + ret = exec(cmd) + if not equal(ret,0) return ret end + + cmd = ["dlltool", "--base-file", llib & ".base", "--def", llib & ".def", + "--output-exp", llib & ".exp", "--dllname", llib & ".dll"] + + if VERBOSE write(cmd,CR) end + ret = exec(cmd) + if not equal(ret,0) return ret end + + cmd = ["gcc", "-Wl," & llib & ".exp", "-o", llib & ".dll", objects, + llib & ".o", "-Wl,-e,_" & llib & "_init@12"] + + if VERBOSE write(cmd,CR) end + ret = exec(cmd) + if not equal(ret,0) return ret end + + cmd = ["dlltool", "--def", llib & ".def", "--dllname", llib & ".dll", + "--output-lib", llib & ".a"] + + if VERBOSE write(cmd, CR) end + return exec(cmd) + end + Index: m3/pm3/m3config/src/VERSION diff -c m3/pm3/m3config/src/VERSION:1.1 m3/pm3/m3config/src/VERSION:removed *** m3/pm3/m3config/src/VERSION:1.1 Thu Mar 26 12:46:56 1998 --- m3/pm3/m3config/src/VERSION Mon Jun 7 17:09:22 1999 *************** *** 1,2 **** - VERSION="" - VERSION_DATE="" --- 0 ---- Index: m3/pm3/m3config/src/m3makefile diff -c m3/pm3/m3config/src/m3makefile:1.6 m3/pm3/m3config/src/m3makefile:1.7 *** m3/pm3/m3config/src/m3makefile:1.6 Thu Mar 26 12:46:56 1998 --- m3/pm3/m3config/src/m3makefile Mon Jun 7 13:15:23 1999 *************** *** 28,33 **** --- 28,35 ---- "INTERFACE M3Config;", "", "CONST (* misc. configuration *)", + " M3_VERSION = \"" & escape(M3_VERSION) & "\";", + " M3_VERSION_DATE = \"" & escape(M3_VERSION_DATE) & "\";", " TARGET = \"" & escape(TARGET) & "\";", " OS_TYPE = \"" & escape(OS_TYPE) & "\";", " WORD_SIZE = \"" & escape(WORD_SIZE) & "\";", *************** *** 72,78 **** derived_interface ("M3Config", VISIBLE) SrcExport("COMMON") - SrcExport("VERSION") SrcExport(TARGET) Library("m3config") --- 74,79 ---- Index: m3/pm3/network/mail/llscan/src/err.c diff -c m3/pm3/network/mail/llscan/src/err.c:1.3 m3/pm3/network/mail/llscan/src/err.c:1.5 *** m3/pm3/network/mail/llscan/src/err.c:1.3 Fri Jan 29 20:57:40 1999 --- m3/pm3/network/mail/llscan/src/err.c Fri Apr 30 15:55:36 1999 *************** *** 11,20 **** /* The err package implements a simple error routine. */ /***************************************************************/ - extern const char *const sys_errlist[]; - #include #include #include "SRCstdlib.h" #include "err.h" --- 11,19 ---- /* The err package implements a simple error routine. */ /***************************************************************/ #include #include + #include #include "SRCstdlib.h" #include "err.h" Index: m3/pm3/network/mail/llscan/src/llscan.c diff -c m3/pm3/network/mail/llscan/src/llscan.c:1.3 m3/pm3/network/mail/llscan/src/llscan.c:1.4 *** m3/pm3/network/mail/llscan/src/llscan.c:1.3 Fri Jan 29 20:57:40 1999 --- m3/pm3/network/mail/llscan/src/llscan.c Fri Apr 30 15:56:41 1999 *************** *** 39,46 **** #include #include - extern const char *const sys_errlist[]; - extern int errno; extern int sys_nerr; --- 39,44 ---- Index: m3/pm3/network/udp/src/UDP.bib diff -c /dev/null m3/pm3/network/udp/src/UDP.bib:1.1 *** /dev/null Mon Jun 7 17:09:25 1999 --- m3/pm3/network/udp/src/UDP.bib Wed Mar 24 14:41:52 1999 *************** *** 0 **** --- 1,9 ---- + @Misc{RFC-768, + author = "J. Postel", + title = "{Internet RFC 768: User Datagram Protocol}", + year = "1980", + month = aug, + note = "Available on the world-wide web at + ``http://www.freesoft.org/CIE/RFC/768/''." + } + Index: m3/pm3/network/udp/src/UDP.tex diff -c /dev/null m3/pm3/network/udp/src/UDP.tex:1.1 *** /dev/null Mon Jun 7 17:09:25 1999 --- m3/pm3/network/udp/src/UDP.tex Wed Mar 24 14:41:52 1999 *************** *** 0 **** --- 1,25 ---- + % Created on Sun Nov 23 07:32:15 PST 1997 by heydon + % Last modified on Fri Dec 11 15:49:38 PST 1998 by heydon + % Copyright (C) 1997 Digital Equipment Corporation + + \documentclass{article} + \usepackage{times} + + \textwidth 5.5in + \oddsidemargin 0.5in % Left margin on odd-numbered pages. + \evensidemargin 0.5in % Left margin on even-numbered pages. + + \begin{document} + \bibliographystyle{plain} + + \title{A UDP Interface} + \author{Allan Heydon} + \date{DRAFT --- \today\ --- DRAFT} + \maketitle + + \section{UDP.i3} + \input{UDP.i.tex} + + \bibliography{UDP} + + \end{document} Index: m3/pm3/network/udp/src/m3makefile diff -c /dev/null m3/pm3/network/udp/src/m3makefile:1.1 *** /dev/null Mon Jun 7 17:09:25 1999 --- m3/pm3/network/udp/src/m3makefile Wed Mar 24 14:41:52 1999 *************** *** 0 **** --- 1,24 ---- + % Copyright (C) 1998, Compaq Computer Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + + % Last modified on Fri Dec 11 15:39:03 PST 1998 by heydon + + if not defined("AT_SRC") + AT_SRC = "" + end + if AT_SRC + include ("tex.quake") + end + + import ("libm3") + import ("tcp") + include_dir ("Common") + include_dir (OS_TYPE) + Library ("UDP") + + % generate documentation ----------------------------------------------------- + + if AT_SRC + Document ("UDP") + end Index: m3/pm3/network/udp/src/tex.quake diff -c /dev/null m3/pm3/network/udp/src/tex.quake:1.1 *** /dev/null Mon Jun 7 17:09:25 1999 --- m3/pm3/network/udp/src/tex.quake Wed Mar 24 14:41:52 1999 *************** *** 0 **** --- 1,104 ---- + % Created on Sun Nov 23 07:05:44 PST 1997 by heydon + % Last modified on Fri Dec 11 16:04:09 PST 1998 by heydon + % Copyright (C) 1997, Digital Equipment Corporation + + % This is a quake(1) file that defines procedure for tranlating + % Modula-3 interfaces into PostScript by way of m3totex(1), + % latex(1), and dvips(1). This code was adapted from code written + % by Bill Kalsow and Paul McJones, and found in the file + % /proj/m3/pkg/pubint-ip/src/m3makefile. + + % These procedures are used by first invoking the following procedures + % to declare the document's sources: + % + % Source Name Derived Name + % local_tex(nm) nm.tex None + % local_frag(nm) nm.frag nm.f.tex + % local_i3(nm) nm.i3 nm.i.tex + % local_ig(nm) nm.ig nm.ig.tex + % remote_i3(nm, pkg, dir) pkg/dir/nm.i3 nm.i.tex + % remote_ig(nm, pkg, dir) pkg/dir/nm.ig nm.ig.tex + % + % Note: A ".frag" file is a LaTeX source file enclosed by a single + % Modula-3 (*...*) comment. + % + % Then, to produce the document, invoke the following procedure: + % + % Document(nm) - produce the files named "nm.ps" and "nm.txt" + % + % The "Document" procedure assumes the existence of a source file + % named "nm.tex". This should be the top-level LaTeX source file + % that declares the document style and then \input's all of the + % relevant sources as produced by the above procedures. + + readonly M3TOTEX = "m3totex" %--- or "/proj/system/bin/m3totex" + readonly LATEX = "latex" %--- or "/contrib/system/bin/latex" + readonly BIBTEX = "bibtex" %--- or "/contrib/system/bin/bibtex" + readonly DVIPS = "dvips" %--- or "/contrib/system/bin/dvips" + readonly DETEX = "detex" %--- or "/proj/system/bin/detex" + + tex_pieces = [] % all the generated TeX pieces + + readonly proc local_tex (nm) is + local src = path_of (nm) + if stale (nm, src) link_file (src, nm) end + deriveds (nm, no_extension) + tex_pieces += nm + end + + readonly proc gen_tex (source, dest) is + if stale (dest, source) + exec (M3TOTEX, source, dest) + end + deriveds (dest, no_extension) + tex_pieces += dest + end + + readonly proc local_frag (nm) is + gen_tex (path_of (nm & ".frag"), nm & ".f.tex") + end + + readonly proc local_i3 (nm) is + gen_tex (path_of (nm & ".i3"), nm & ".i.tex") + end + + readonly proc local_ig (nm) is + gen_tex (path_of (nm & ".ig"), nm & ".ig.tex") + end + + readonly proc remote_i3 (nm, pkg, dir) is + gen_tex (format ("%s%s%s.i3", Location (pkg, dir), SL, nm), nm & ".i.tex") + end + + readonly proc remote_ig (nm, pkg, dir) is + gen_tex (format ("%s%s%s.ig", Location (pkg, dir), SL, nm), nm & ".ig.tex") + end + + readonly proc Document (nm) is + local TEXFILE = nm & ".tex" + local BIBFILE = nm & ".bib" + local DVIFILE = nm & ".dvi" + local AUXFILE = nm & ".aux" + local PSFILE = nm & ".ps" + local any_stale = "" + + % add the root document to the list of TeX sources + local_tex (TEXFILE) + local_tex (BIBFILE) + + % check for new sources + foreach f in tex_pieces + if not any_stale and stale (DVIFILE, f) any_stale = "TRUE" end + end + + if any_stale + exec (LATEX, TEXFILE) % run the document through latex + exec (BIBTEX, nm) % get the references + exec (LATEX, TEXFILE) % again to correct references + exec (LATEX, TEXFILE) % yet again to correct references + exec (DVIPS, "-o", PSFILE, DVIFILE) % generate PostScript + % exec (DETEX, nm, "> "& nm & ".txt")% generate ".txt" version + end + + deriveds (nm, [".aux", ".bbl", ".blg", ".dvi",".log", ".ps", ".txt"]) + end Index: m3/pm3/network/udp/src/Common/UDP.i3 diff -c /dev/null m3/pm3/network/udp/src/Common/UDP.i3:1.1 *** /dev/null Mon Jun 7 17:09:26 1999 --- m3/pm3/network/udp/src/Common/UDP.i3 Wed Mar 24 14:41:54 1999 *************** *** 0 **** --- 1,106 ---- + (* Copyright 1998, Compaq Computer Corporation *) + (* *) + (* Last modified on Fri Dec 11 16:00:07 PST 1998 by heydon *) + + (* The User Datagram Protocol (UDP) is a connectionless protocol for + sending data packets (or {\em datagrams}) over the internet. UDP runs + on top of the Internet Protocol (IP). It provides a simple datagram + service that guarantees the integrity of delivered packets. However, + unlike the Transmission Control Protocol (TCP), which also runs on + IP, UDP does not guarantee reliable delivery of packets: packets may + be dropped or duplicated, and any corrupted packets are simply + discarded. Nor does UDP provide any sequencing guarantees. + + Like TCP, each UDP endpoint is identified by the IP address of a host + together with a port number (see the IP interface for a description + of IP endpoints). Hence, datagrams may be addressed to different + processes (listening on different ports) that are running on the same + host. + + The complete UDP protocol is documented in Internet RFC 768 + \cite{RFC-768}. + *) + + INTERFACE UDP; + + IMPORT IP, Thread; + + TYPE + Datagram = RECORD + other: IP.Endpoint; + len: CARDINAL; + bytes: REF ARRAY OF CHAR; + END; + + (* A "UDP.Datagram" represents a packet of data. If "d" is a "Datagram", + then "d.other" is the IP endpoint to which the packet will be sent, or + from which it was received, "d.len" is the length of the packet, and + "d.bytes" contains the packet contents. A valid packet has "d.bytes # NIL" + and "d.len <= NUMBER(d.bytes^)", in which case the bytes of the packet + are in "d.bytes[0..(d.len-1)]". *) + + EXCEPTION Timeout; + + (* The "Timeout" exception may be raised to indicate a timeout on a blocking + UDP operation. The UDP implementation may also raise the "IP.Error" + exception; arguments to this exception will be one of the predefined + values "IP.NoResources" or "IP.PortBusy", or a message indicating that + an unexpected error occured. *) + + TYPE + T <: Public; + Public = OBJECT METHODS + init(myPort: IP.Port; myAddr := IP.NullAddress): T + RAISES {IP.Error}; + send(READONLY d: Datagram): INTEGER + RAISES {IP.Error}; + sendText(READONLY other: IP.Endpoint; t: TEXT): INTEGER + RAISES {IP.Error}; + receive(VAR (*INOUT*) d: Datagram; timeout: LONGREAL := -1.0d0) + RAISES {Timeout, IP.Error, Thread.Alerted}; + close() + RAISES {IP.Error}; + END; + + END UDP. + + (* A "UDP.T" is a handle on a socket for receiving datagrams on a particular + port. + + The expression "NEW(UDP.T).init(myPort)" evaluates to a new UDP handle for + listening on port "myPort". If the program is being run on a machine with + multiple IP addresses, an "IP.Address" argument can also be passed in + the optional "myAddr" parameter to indicate which network interface will + be used by this handle to send and receive datagrams. + + If a UDP handle is closed using the "close" method, the "init" method can + be called again to initialize the handle on a different port/address. All + methods of a "UDP.T" other than "init" require that the UDP handle has been + initialized; "init" requires that the handle is new or closed. + + The descriptions of the remaining methods assume that "udp" denotes an + initialized "UDP.T". + + The call "udp.send(d)" sends the datagram "d", returning the number of + bytes that were successfully sent. + + The call "udp.sendText(other, t)" sends the contents of the text "t" + to the endpoint "other", returning the number of characters of "t" that + were successfully sent. + + The call "udp.receive(d)" blocks until a datagram is sent to "udp"'s + port/address. On entry, "d.bytes" should point to an array of characters + large enough to contain incoming datagrams. On exit, "d.other" is set to + the endpoint from which the datagram was sent, "d.len" is set to the length + of the received datagram, and the contents of the datagram are written into + "d.bytes[0..(d.len)-1]". If the packet that was received is larger than the + initial value of "d.len", the packet is truncated to "d.len" bytes. + + If a non-negative value is supplied for "timeout", the method will raise + "Timeout" if "timeout" seconds elapse without a packet being received. + Negative values of "timeout" indicate an indefinite wait. If the calling + thread is alerted before a packet is received, "Thread.Alerted" is thrown. + + The call "udp.close" closes "udp". Invoking any methods other than "init" + on a closed handle results in a checked run-time error. + *) Index: m3/pm3/network/udp/src/Common/m3makefile diff -c /dev/null m3/pm3/network/udp/src/Common/m3makefile:1.1 *** /dev/null Mon Jun 7 17:09:26 1999 --- m3/pm3/network/udp/src/Common/m3makefile Wed Mar 24 14:41:54 1999 *************** *** 0 **** --- 1,11 ---- + % Copyright (C) 1998, Compaq Computer Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + + % Last modified on Fri Dec 11 15:41:23 PST 1998 by heydon + + Interface ("UDP") + + if AT_SRC + local_i3 ("UDP") + end Index: m3/pm3/network/udp/src/POSIX/UDPPosix.m3 diff -c /dev/null m3/pm3/network/udp/src/POSIX/UDPPosix.m3:1.1 *** /dev/null Mon Jun 7 17:09:26 1999 --- m3/pm3/network/udp/src/POSIX/UDPPosix.m3 Wed Mar 24 14:41:56 1999 *************** *** 0 **** --- 1,146 ---- + (* Copyright 1998, Compaq Computer Corporation *) + (* *) + (* Last modified on Fri Dec 11 15:17:51 PST 1998 by heydon *) + + UNSAFE MODULE UDPPosix EXPORTS UDP; + + IMPORT Atom, AtomList, Ctypes, IP; + IMPORT OSErrorPosix, SchedulerPosix, TextF, Thread; + IMPORT Uerror, Uin, Unix, Usocket, Utypes; + + REVEAL + T = Public BRANDED "UDPPosix.T" OBJECT + open: BOOLEAN := FALSE; (* TRUE iff the UDP connection is open *) + myEnd := IP.NullEndPoint; (* this socket's port *) + fileno: INTEGER := -1; (* this socket's file descriptor *) + OVERRIDES + init := Init; + send := Send; + sendText := SendText; + receive := Receive; + close := Close; + END; + + (* An open UDP socket "udp" has "udp.open", "udp.myEnd" set to this + socket's endpoint, and "udp.fileno" set to the socket's corresponding + file descriptor. *) + + CONST SinZero = ARRAY [0 .. 7] OF Ctypes.char{VAL(0, Ctypes.char), ..}; + + PROCEDURE Raise(a: Atom.T) RAISES {IP.Error} = + BEGIN + RAISE IP.Error(AtomList.List2(a, OSErrorPosix.ErrnoAtom(Uerror.errno))); + END Raise; + + PROCEDURE RaiseUnexpected(syscall: TEXT) RAISES {IP.Error} = + BEGIN + Raise(Atom.FromText("Unexpected error calling " & syscall)); + END RaiseUnexpected; + + PROCEDURE Init(self: T; myPort: IP.Port; myAddr: IP.Address): T + RAISES {IP.Error} = + BEGIN + <* ASSERT NOT self.open *> + self.myEnd.port := myPort; + self.myEnd.addr := myAddr; + + (* create socket via socket(2) system call *) + self.fileno := Usocket.socket(Usocket.AF_INET, Usocket.SOCK_DGRAM, 0); + IF self.fileno = -1 THEN + IF Uerror.errno = Uerror.EMFILE OR Uerror.errno = Uerror.ENFILE + THEN Raise(IP.NoResources) + ELSE RaiseUnexpected("socket(2)") + END + END; + + (* bind socket via bind(2) system call *) + VAR sockaddr: Uin.struct_sockaddr_in; status: INTEGER; BEGIN + sockaddr.sin_family := Usocket.AF_INET; + sockaddr.sin_port := Uin.htons(myPort); + sockaddr.sin_addr.s_addr := LOOPHOLE(myAddr, Utypes.u_int); + sockaddr.sin_zero := SinZero; + status := Usocket.bind(self.fileno, + (*INOUT*) ADR(sockaddr), BYTESIZE(Uin.struct_sockaddr_in)); + IF status # 0 THEN + IF Uerror.errno = Uerror.EADDRINUSE + THEN Raise(IP.PortBusy) + ELSE RaiseUnexpected("bind(2)") + END + END + END; + self.open := TRUE; + RETURN self + END Init; + + PROCEDURE Send(self: T; READONLY d: Datagram): INTEGER RAISES {IP.Error} = + VAR numSent: INTEGER; sockaddr: Uin.struct_sockaddr_in; BEGIN + <* ASSERT self.open AND d.len <= NUMBER(d.bytes^) *> + sockaddr.sin_family := Usocket.AF_INET; + sockaddr.sin_port := Uin.htons(d.other.port); + sockaddr.sin_addr.s_addr := LOOPHOLE(d.other.addr, Utypes.u_int); + sockaddr.sin_zero := SinZero; + numSent := Usocket.sendto(self.fileno, + LOOPHOLE(ADR(d.bytes[0]), Ctypes.char_star), d.len, (*flags=*) 0, + ADR(sockaddr), BYTESIZE(Uin.struct_sockaddr_in)); + IF numSent < 0 THEN RaiseUnexpected("sendto(2)") END; + RETURN numSent + END Send; + + PROCEDURE SendText(self: T; READONLY other: IP.Endpoint; t: TEXT): INTEGER + RAISES {IP.Error} = + VAR numSent: INTEGER; sockaddr: Uin.struct_sockaddr_in; BEGIN + <* ASSERT self.open *> + sockaddr.sin_family := Usocket.AF_INET; + sockaddr.sin_port := Uin.htons(other.port); + sockaddr.sin_addr.s_addr := LOOPHOLE(other.addr, Utypes.u_int); + sockaddr.sin_zero := SinZero; + numSent := Usocket.sendto(self.fileno, + LOOPHOLE(ADR(t[0]), Ctypes.char_star), NUMBER(t^) - 1, (*flags=*) 0, + ADR(sockaddr), BYTESIZE(Uin.struct_sockaddr_in)); + IF numSent < 0 THEN RaiseUnexpected("sendto(2)") END; + RETURN numSent + END SendText; + + PROCEDURE Receive(self: T; VAR (*INOUT*) d: Datagram; timeout: LONGREAL) + RAISES {Timeout, IP.Error, Thread.Alerted} = + VAR + waitRes: SchedulerPosix.WaitResult; + numRead: INTEGER; + sockaddr: Uin.struct_sockaddr_in; + saSize: Ctypes.int; + BEGIN + <* ASSERT self.open *> + waitRes := SchedulerPosix.IOAlertWait(self.fileno, TRUE, timeout); + CASE waitRes OF + | SchedulerPosix.WaitResult.Ready => (* SKIP *) + | SchedulerPosix.WaitResult.Error => <* ASSERT FALSE *> + | SchedulerPosix.WaitResult.FDError => <* ASSERT FALSE *> + | SchedulerPosix.WaitResult.Timeout => RAISE Timeout; + END; + sockaddr.sin_zero := SinZero; + saSize := BYTESIZE(Uin.struct_sockaddr_in); + numRead := Usocket.recvfrom(self.fileno, + LOOPHOLE(ADR(d.bytes[0]), Ctypes.char_star), NUMBER(d.bytes^), + (*flags=*) 0, ADR(sockaddr), ADR(saSize)); + IF numRead < 0 + THEN RaiseUnexpected("recvfrom(2)") + ELSE d.len := numRead + END; + <* ASSERT saSize = BYTESIZE(Uin.struct_sockaddr_in) *> + d.other.port := Uin.ntohs(sockaddr.sin_port); + d.other.addr := LOOPHOLE(sockaddr.sin_addr.s_addr, IP.Address); + END Receive; + + PROCEDURE Close(self: T) RAISES {IP.Error} = + BEGIN + <* ASSERT self.open *> + VAR status := Unix.close(self.fileno); BEGIN + IF status # 0 THEN RaiseUnexpected("close(2)") END + END; + self.open := FALSE; + self.myEnd := IP.NullEndPoint; + self.fileno := -1 + END Close; + + BEGIN + END UDPPosix. Index: m3/pm3/network/udp/src/POSIX/m3makefile diff -c /dev/null m3/pm3/network/udp/src/POSIX/m3makefile:1.1 *** /dev/null Mon Jun 7 17:09:26 1999 --- m3/pm3/network/udp/src/POSIX/m3makefile Wed Mar 24 14:41:56 1999 *************** *** 0 **** --- 1,7 ---- + % Copyright (C) 1998, Compaq Computer Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + + % Last modified on Fri Dec 11 15:41:20 PST 1998 by heydon + + implementation ("UDPPosix") Index: m3/pm3/network/udp/test/src/TestUDP.m3 diff -c /dev/null m3/pm3/network/udp/test/src/TestUDP.m3:1.1 *** /dev/null Mon Jun 7 17:09:26 1999 --- m3/pm3/network/udp/test/src/TestUDP.m3 Wed Mar 24 14:41:58 1999 *************** *** 0 **** --- 1,192 ---- + (* Copyright 1998, Compaq Computer Corporation *) + (* *) + (* Last modified on Fri Dec 11 15:15:29 PST 1998 by heydon *) + + (* Syntax: + + | TestUDP -server + | TestUDP -client [serverhost] + + The first command runs the program as a server, and the second command + runs it as a client. The server program should be run first. The client + program may then be run, specifying the name of the server machine in + the "serverhost" argument. If "serverhost" is omitted, the local host + is used. + *) + + MODULE TestUDP EXPORTS Main; + + IMPORT Atom, AtomList, Fmt, IP, Params, Process, Text, Time, UDP, Word, Wr; + FROM Stdio IMPORT stdout, stderr; + + IMPORT Thread; + <* FATAL Thread.Alerted, Wr.Failure *> + + CONST + ServerPort = 2000; + ClientPort = ServerPort + 1; + ReceiveTimeout = 10.0d0; + BuffSz = 4; + Ack = "ACK"; + AckLen = 3; + + PROCEDURE PrintIPError(arg: AtomList.T) = + BEGIN + Wr.PutText(stderr, "IP Error"); + VAR i := 0; BEGIN + WHILE arg # NIL DO + IF i = 0 + THEN Wr.PutText(stderr, ": ") + ELSE Wr.PutText(stderr, ", ") + END; + Wr.PutText(stderr, Atom.ToText(arg.head)); + arg := arg.tail; + INC(i) + END + END + END PrintIPError; + + PROCEDURE HostPort(READONLY end: IP.Endpoint): TEXT RAISES {IP.Error} = + BEGIN + RETURN IP.GetCanonicalByAddr(end.addr) & ":" & Fmt.Int(end.port) + END HostPort; + + PROCEDURE PickleInt(i: INTEGER; VAR (*INOUT*) bytes: ARRAY OF CHAR) = + BEGIN + FOR j := 0 TO 3 DO + bytes[j] := VAL(Word.And(i, 16_ff), CHAR); + i := Word.RightShift(i, 8) + END + END PickleInt; + + PROCEDURE UnpickleInt(READONLY bytes: ARRAY OF CHAR): INTEGER = + VAR res := 0; BEGIN + FOR i := 3 TO 0 BY -1 DO + res := Word.LeftShift(res, 8); + res := Word.Or(res, ORD(bytes[i])) + END; + RETURN res + END UnpickleInt; + + PROCEDURE Server() RAISES {IP.Error} = + VAR conn: UDP.T; d: UDP.Datagram; sent: INTEGER; BEGIN + d.bytes := NEW(REF ARRAY OF CHAR, BuffSz); + Wr.PutText(stdout, "Starting server...\n"); + Wr.Flush(stdout); + conn := NEW(UDP.T).init(ServerPort); + Wr.PutText(stdout, "Server listening on port "&Fmt.Int(ServerPort)&".\n"); + Wr.Flush(stdout); + TRY + LOOP + VAR packetReceived := FALSE; BEGIN + REPEAT + TRY + conn.receive((*INOUT*) d, timeout := ReceiveTimeout); + packetReceived := TRUE; + EXCEPT + UDP.Timeout => + Wr.PutText(stdout, "No packet received after " & + Fmt.LongReal(ReceiveTimeout) & " seconds; retrying...\n"); + Wr.Flush(stdout); + END + UNTIL packetReceived + END; + VAR i := UnpickleInt(d.bytes^); BEGIN + Wr.PutText(stdout, "Received packet " & Fmt.Int(i) + & " from " & HostPort(d.other) & "; sending ACK...\n"); + Wr.Flush(stdout); + END; + sent := conn.sendText(d.other, Ack); + <* ASSERT sent = AckLen *> + END + FINALLY + conn.close() + END + END Server; + + PROCEDURE Client(server: IP.Address) RAISES {IP.Error} = + VAR conn: UDP.T; d: UDP.Datagram; cnt := 0; BEGIN + d.bytes := NEW(REF ARRAY OF CHAR, BuffSz); + Wr.PutText(stdout, "Starting client...\n"); + Wr.Flush(stdout); + conn := NEW(UDP.T).init(ClientPort); + TRY + LOOP + VAR start: LONGREAL; sent: INTEGER; BEGIN + (* record start time *) + start := Time.Now(); + + (* send packet *) + d.other.addr := server; + d.other.port := ServerPort; + d.len := 4; + PickleInt(cnt, d.bytes^); + sent := conn.send(d); + <* ASSERT sent = 4 *> + + (* wait for ack *) + TRY + conn.receive((*INOUT*) d, timeout := ReceiveTimeout); + VAR t := Text.FromChars(SUBARRAY(d.bytes^, 0, d.len)); BEGIN + <* ASSERT Text.Equal(t, Ack) *> + END; + + (* print message *) + Wr.PutText(stdout, "UDP round trip time = " & + Fmt.LongReal((Time.Now() - start)*1000.0d0, prec:=1) & " ms\n"); + Wr.Flush(stdout); + EXCEPT + UDP.Timeout => + Wr.PutText(stdout, "No packet received after " & + Fmt.LongReal(ReceiveTimeout) & " seconds...\n"); + Wr.Flush(stdout); + END; + + (* wait before trying again *) + Thread.Pause(1.0d0); + INC(cnt); + END + END + FINALLY + conn.close() + END + END Client; + + PROCEDURE SyntaxError(msg: TEXT) = + BEGIN + Wr.PutText(stderr, "Fatal error: " & msg & "\n"); + Wr.PutText(stderr, "Syntax: TestUDP (-server | -client [serverhost])\n"); + Process.Exit(1) + END SyntaxError; + + BEGIN + IF Params.Count < 2 THEN + SyntaxError("too few parameters") + ELSIF Params.Count > 3 THEN + SyntaxError("too many parameters") + END; + TRY + VAR switch := Params.Get(1); BEGIN + IF Text.Equal(switch, "-server") THEN + Server() + ELSIF Text.Equal(switch, "-client") THEN + VAR addr: IP.Address; BEGIN + IF Params.Count = 3 THEN + IF NOT IP.GetHostByName(Params.Get(2), (*OUT*) addr) THEN + Wr.PutText(stderr, "Fatal error: host name " & Params.Get(2) + & " not found!"); + Process.Exit(1) + END + ELSE + addr := IP.GetHostAddr() + END; + Client(addr); + END + ELSE + SyntaxError("exptected -server or -client") + END + END + EXCEPT + | IP.Error (e) => PrintIPError(e); + END + END TestUDP. Index: m3/pm3/network/udp/test/src/m3makefile diff -c /dev/null m3/pm3/network/udp/test/src/m3makefile:1.1 *** /dev/null Mon Jun 7 17:09:26 1999 --- m3/pm3/network/udp/test/src/m3makefile Wed Mar 24 14:41:58 1999 *************** *** 0 **** --- 1,12 ---- + % Copyright (C) 1998, Compaq Computer Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + + % Last modified on Sun Dec 6 18:29:29 PST 1998 by heydon + + import ("libm3") + import ("tcp") + import ("udp") + + implementation ("TestUDP") + program ("TestUDP") Index: m3/pm3/network/udp/test/src/m3overrides diff -c /dev/null m3/pm3/network/udp/test/src/m3overrides:1.1 *** /dev/null Mon Jun 7 17:09:26 1999 --- m3/pm3/network/udp/test/src/m3overrides Wed Mar 24 14:41:58 1999 *************** *** 0 **** --- 1,7 ---- + % Copyright (C) 1998, Compaq Computer Corporation + % All rights reserved. + % See the file COPYRIGHT for a full description. + + % Last modified on Sun Dec 6 18:32:34 PST 1998 by heydon + + override ("udp", "/udir/heydon/m3") Index: m3/pm3/src/m3makefile diff -c m3/pm3/src/m3makefile:1.26 m3/pm3/src/m3makefile:1.27 *** m3/pm3/src/m3makefile:1.26 Wed Nov 4 08:45:28 1998 --- m3/pm3/src/m3makefile Mon Jun 7 13:47:05 1999 *************** *** 201,208 **** capabilities{OS_TYPE} = "" if not defined("SKIP_LLSCAN") capabilities{"LLSCAN"} = "" end % m3gdb is sensitive. On some versions of NT it did not work ! capabilities{"M3GDB"} = "" if PLATFORM_SUPPORTS_MOTIF capabilities{"MOTIF"} = "" end if PLATFORM_SUPPORTS_DECPEX capabilities{"DECPEX"} = "" end if PLATFORM_SUPPORTS_OPENGL capabilities{"OPENGL"} = "" end --- 201,210 ---- capabilities{OS_TYPE} = "" if not defined("SKIP_LLSCAN") capabilities{"LLSCAN"} = "" end + % m3gdb is sensitive. On some versions of NT it did not work ! if not defined("SKIP_M3GDB") capabilities{"M3GDB"} = "" end ! if PLATFORM_SUPPORTS_MOTIF capabilities{"MOTIF"} = "" end if PLATFORM_SUPPORTS_DECPEX capabilities{"DECPEX"} = "" end if PLATFORM_SUPPORTS_OPENGL capabilities{"OPENGL"} = "" end