[Gd-chatter] r10713 - in trunk/fundev/sources: app/runtime-generator common-dylan dfmc/harp-cg dfmc/native-harp-cg dfmc/pentium-harp-cg harp/linux-rtg harp/native-harp harp/pentium-harp harp/pentium-linux-rtg io lib/unix-portability lib/variable-search network network/unix-sockets registry/generic registry/x86-freebsd registry/x86-linux registry/x86-win32 system system/file-system

hannes at gwydiondylan.org hannes at gwydiondylan.org
Fri May 5 00:57:16 CEST 2006


Author: hannes
Date: Fri May  5 00:57:08 2006
New Revision: 10713

Added:
   trunk/fundev/sources/app/runtime-generator/pentium-freebsd-library.dylan
      - copied, changed from r10708, trunk/fundev/sources/app/runtime-generator/pentium-linux-library.dylan
   trunk/fundev/sources/app/runtime-generator/pentium-freebsd-runtime-generator.lid
      - copied, changed from r10708, trunk/fundev/sources/app/runtime-generator/pentium-linux-runtime-generator.lid
   trunk/fundev/sources/app/runtime-generator/pentium-freebsd-runtime.dylan
      - copied, changed from r10708, trunk/fundev/sources/app/runtime-generator/pentium-linux-runtime.dylan
   trunk/fundev/sources/harp/pentium-linux-rtg/initialize-rtg-freebsd.dylan
      - copied, changed from r10708, trunk/fundev/sources/harp/pentium-linux-rtg/initialize-rtg.dylan
   trunk/fundev/sources/harp/pentium-linux-rtg/pentium-freebsd-glue-rtg.lid
      - copied, changed from r10708, trunk/fundev/sources/harp/pentium-linux-rtg/pentium-linux-glue-rtg.lid
   trunk/fundev/sources/lib/unix-portability/
   trunk/fundev/sources/lib/unix-portability/freebsd-portability.dylan   (contents, props changed)
   trunk/fundev/sources/lib/unix-portability/freebsd-portability.lid   (contents, props changed)
   trunk/fundev/sources/lib/unix-portability/freebsd.c   (contents, props changed)
   trunk/fundev/sources/lib/unix-portability/library.dylan   (contents, props changed)
   trunk/fundev/sources/lib/unix-portability/linux-portability.dylan   (contents, props changed)
   trunk/fundev/sources/lib/unix-portability/linux-portability.lid   (contents, props changed)
   trunk/fundev/sources/lib/unix-portability/win32-portability.dylan   (contents, props changed)
   trunk/fundev/sources/lib/unix-portability/win32-portability.lid   (contents, props changed)
   trunk/fundev/sources/lib/variable-search/freebsd-variable-search.lid
      - copied, changed from r10708, trunk/fundev/sources/lib/variable-search/unix-variable-search.lid
   trunk/fundev/sources/registry/generic/pentium-freebsd-runtime-generator   (contents, props changed)
      - copied, changed from r10708, trunk/fundev/sources/registry/generic/pentium-linux-runtime-generator
   trunk/fundev/sources/registry/x86-freebsd/pentium-linux-glue-rtg   (contents, props changed)
      - copied, changed from r10708, trunk/fundev/sources/registry/generic/pentium-linux-glue-rtg
   trunk/fundev/sources/registry/x86-freebsd/unix-portability   (contents, props changed)
   trunk/fundev/sources/registry/x86-linux/unix-portability   (contents, props changed)
   trunk/fundev/sources/registry/x86-win32/unix-portability   (contents, props changed)
Modified:
   trunk/fundev/sources/common-dylan/library.dylan
   trunk/fundev/sources/common-dylan/unix-common-extensions.dylan
   trunk/fundev/sources/dfmc/harp-cg/harp-back-end.dylan
   trunk/fundev/sources/dfmc/native-harp-cg/back-end.dylan
   trunk/fundev/sources/dfmc/native-harp-cg/library.dylan
   trunk/fundev/sources/dfmc/native-harp-cg/linker.dylan
   trunk/fundev/sources/dfmc/native-harp-cg/primitives.dylan
   trunk/fundev/sources/dfmc/pentium-harp-cg/pentium-harp-cg-library.dylan
   trunk/fundev/sources/harp/linux-rtg/c-primitives.dylan
   trunk/fundev/sources/harp/linux-rtg/debug-primitives.dylan
   trunk/fundev/sources/harp/linux-rtg/ffi-barrier.dylan
   trunk/fundev/sources/harp/linux-rtg/mangling.dylan
   trunk/fundev/sources/harp/linux-rtg/nlx-primitives.dylan
   trunk/fundev/sources/harp/linux-rtg/os-primitives.dylan
   trunk/fundev/sources/harp/linux-rtg/registration.dylan
   trunk/fundev/sources/harp/linux-rtg/stack-overflow.dylan
   trunk/fundev/sources/harp/native-harp/module.dylan
   trunk/fundev/sources/harp/native-harp/native-back-end.dylan
   trunk/fundev/sources/harp/pentium-harp/back-end.dylan
   trunk/fundev/sources/harp/pentium-harp/general.dylan
   trunk/fundev/sources/harp/pentium-harp/jumps.dylan
   trunk/fundev/sources/harp/pentium-harp/module.dylan
   trunk/fundev/sources/harp/pentium-harp/moves.dylan
   trunk/fundev/sources/harp/pentium-harp/overflow.dylan
   trunk/fundev/sources/harp/pentium-linux-rtg/module.dylan
   trunk/fundev/sources/io/library.dylan
   trunk/fundev/sources/io/unix-standard-io.dylan
   trunk/fundev/sources/network/unix-network-library.dylan
   trunk/fundev/sources/network/unix-sockets/errno.dylan
   trunk/fundev/sources/registry/x86-freebsd/variable-search
   trunk/fundev/sources/system/file-system/unix-ffi.dylan
   trunk/fundev/sources/system/file-system/unix-interface.dylan
   trunk/fundev/sources/system/library.dylan
Log:
Bug: 7297
*add freebsd back-end classes
 (<native-unix-back-end>, <native-freebsd-back-end>,
  <pentium-unix-back-end>, <pentium-freebsd-back-end>)
*use <native-unix-back-end> and <pentium-unix-back-end> where possible
*add unix-portability library,
  exporting $errno-location, $proc-path, unix-lseek, unix-errno


Copied: trunk/fundev/sources/app/runtime-generator/pentium-freebsd-library.dylan (from r10708, trunk/fundev/sources/app/runtime-generator/pentium-linux-library.dylan)
==============================================================================
--- trunk/fundev/sources/app/runtime-generator/pentium-linux-library.dylan	(original)
+++ trunk/fundev/sources/app/runtime-generator/pentium-freebsd-library.dylan	Fri May  5 00:57:08 2006
@@ -5,12 +5,12 @@
 Dual-license: GNU Lesser General Public License
 Warranty:     Distributed WITHOUT WARRANTY OF ANY KIND
 
-define library pentium-linux-runtime-generator
+define library pentium-freebsd-runtime-generator
   use functional-dylan;
   use pentium-linux-core-rtg;
 end library;
 
-define module pentium-linux-runtime-generator
+define module pentium-freebsd-runtime-generator
   use functional-dylan;
   use pentium-linux-rtg;
 end module;

Copied: trunk/fundev/sources/app/runtime-generator/pentium-freebsd-runtime-generator.lid (from r10708, trunk/fundev/sources/app/runtime-generator/pentium-linux-runtime-generator.lid)
==============================================================================
--- trunk/fundev/sources/app/runtime-generator/pentium-linux-runtime-generator.lid	(original)
+++ trunk/fundev/sources/app/runtime-generator/pentium-freebsd-runtime-generator.lid	Fri May  5 00:57:08 2006
@@ -1,7 +1,7 @@
-Library: pentium-linux-runtime-generator
+Library: pentium-freebsd-runtime-generator
 Synopsis: Pentium runtime generator
-Files:  pentium-linux-library
-        pentium-linux-runtime
+Files:  pentium-freebsd-library
+        pentium-freebsd-runtime
 Copyright:    Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
               All rights reserved.
 License:      Functional Objects Library Public License Version 1.0

Copied: trunk/fundev/sources/app/runtime-generator/pentium-freebsd-runtime.dylan (from r10708, trunk/fundev/sources/app/runtime-generator/pentium-linux-runtime.dylan)
==============================================================================
--- trunk/fundev/sources/app/runtime-generator/pentium-linux-runtime.dylan	(original)
+++ trunk/fundev/sources/app/runtime-generator/pentium-freebsd-runtime.dylan	Fri May  5 00:57:08 2006
@@ -1,4 +1,4 @@
-Module: pentium-linux-runtime-generator
+Module: pentium-freebsd-runtime-generator
 Copyright:    Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
               All rights reserved.
 License:      Functional Objects Library Public License Version 1.0
@@ -7,6 +7,6 @@
 
 
 create-dylan-runtime
-  (back-end-class: <pentium-linux-back-end>,
+  (back-end-class: <pentium-freebsd-back-end>,
    type: #"linux-outputter");
 

Modified: trunk/fundev/sources/common-dylan/library.dylan
==============================================================================
--- trunk/fundev/sources/common-dylan/library.dylan	(original)
+++ trunk/fundev/sources/common-dylan/library.dylan	Fri May  5 00:57:08 2006
@@ -14,6 +14,7 @@
 	      finalization,
 	      threads, 
 	      threads-extensions };
+  use unix-portability;
   export 
     common-dylan,
     common-extensions,
@@ -307,4 +308,5 @@
   use simple-random;
   use simple-profiling;
   use simple-io;
+  use unix-portability;
 end module common-dylan-internals;

Modified: trunk/fundev/sources/common-dylan/unix-common-extensions.dylan
==============================================================================
--- trunk/fundev/sources/common-dylan/unix-common-extensions.dylan	(original)
+++ trunk/fundev/sources/common-dylan/unix-common-extensions.dylan	Fri May  5 00:57:08 2006
@@ -108,7 +108,7 @@
     end;
     //
     let exe-path
-      = concatenate("/proc/", integer-to-string(pid), "/exe");
+      = concatenate("/proc/", integer-to-string(pid), "/", $proc-path);
     let buffer = make(<byte-string>, size: 8192, fill: '\0');
     let count
       = raw-as-integer(%call-c-function ("readlink")

Modified: trunk/fundev/sources/dfmc/harp-cg/harp-back-end.dylan
==============================================================================
--- trunk/fundev/sources/dfmc/harp-cg/harp-back-end.dylan	(original)
+++ trunk/fundev/sources/dfmc/harp-cg/harp-back-end.dylan	Fri May  5 00:57:08 2006
@@ -18,6 +18,7 @@
     assembler-output? := select ($os-name)
 			   #"win32"  => #f;
 			   #"linux" => #"linux-outputter";
+			   #"freebsd" => #"linux-outputter";
 			   otherwise => #f;
 			 end;
   end;

Modified: trunk/fundev/sources/dfmc/native-harp-cg/back-end.dylan
==============================================================================
--- trunk/fundev/sources/dfmc/native-harp-cg/back-end.dylan	(original)
+++ trunk/fundev/sources/dfmc/native-harp-cg/back-end.dylan	Fri May  5 00:57:08 2006
@@ -14,7 +14,7 @@
 // On Linux, C Compiler doesn't prepend C names with underscores
 
 define sideways method c-name
-    (back-end :: <native-linux-back-end>, name :: <string>) => (name :: <string>)
+    (back-end :: <native-unix-back-end>, name :: <string>) => (name :: <string>)
  name
 end method c-name;
 
@@ -25,7 +25,7 @@
 end method shared-library-entry-point-name;
 
 define sideways method shared-library-entry-point-name
-    (back-end :: <native-linux-back-end>, name :: <string>) => (name :: <string>)
+    (back-end :: <native-unix-back-end>, name :: <string>) => (name :: <string>)
   c-name(back-end, concatenate(name, "SO"));
 end method shared-library-entry-point-name;
 
@@ -36,7 +36,7 @@
 end method shared-library-runtime-entry-point-name;
 
 define sideways method shared-library-runtime-entry-point-name
-    (back-end :: <native-linux-back-end>) => (name :: <string>)
+    (back-end :: <native-unix-back-end>) => (name :: <string>)
   c-name(back-end, "DylanSOEntry");
 end method shared-library-runtime-entry-point-name;
 
@@ -51,14 +51,14 @@
 // Imports aren't renamed on Linux
 
 define sideways method emit-imported-name
-    (back-end :: <native-linux-back-end>, stream, o) => (name :: <string>)
+    (back-end :: <native-unix-back-end>, stream, o) => (name :: <string>)
   emit-name(back-end, stream, o);
 end method;
 
 // Imports don't require an extra indirection on Linux
 
 define sideways method make-imported-constant-reference
-    (back-end :: <native-linux-back-end>, o,
+    (back-end :: <native-unix-back-end>, o,
      #key indirect?) => (name :: <constant-reference>)
   if (indirect?)
     ins--indirect-constant-ref(back-end, o, import?: #t);
@@ -70,7 +70,7 @@
 // No compiler issues with import generation on Linux
 
 define sideways method emit-import-adjustment?
-    (back-end :: <native-linux-back-end>) => (adjust? :: <boolean>)
+    (back-end :: <native-unix-back-end>) => (adjust? :: <boolean>)
   #f
 end method emit-import-adjustment?;
 
@@ -79,7 +79,7 @@
 // Linker can create appropriate dynamic relocation records for them
 
 define sideways method emit-data-footer
-    (back-end :: <native-linux-back-end>, stream, name,
+    (back-end :: <native-unix-back-end>, stream, name,
      #key model-object = unsupplied()) => ()
   output-data-footer
   (back-end, stream, name,
@@ -88,11 +88,11 @@
 
 
 define sideways method emit-imports
-    (back-end :: <native-linux-back-end>, cr, ld :: <library-description>) => ()
+    (back-end :: <native-unix-back-end>, cr, ld :: <library-description>) => ()
 end method;
 
 define sideways method emit-library-imported-data
-    (back-end :: <native-linux-back-end>, stream, description :: <library-description>,
+    (back-end :: <native-unix-back-end>, stream, description :: <library-description>,
      #key compilation-layer)
  => ()
 end method;

Modified: trunk/fundev/sources/dfmc/native-harp-cg/library.dylan
==============================================================================
--- trunk/fundev/sources/dfmc/native-harp-cg/library.dylan	(original)
+++ trunk/fundev/sources/dfmc/native-harp-cg/library.dylan	Fri May  5 00:57:08 2006
@@ -30,7 +30,9 @@
 
  use native-harp,
     export: { <harp-native-back-end>,
-	      <native-linux-back-end> };
+              <native-unix-back-end>,
+	      <native-linux-back-end>,
+              <native-freebsd-back-end> };
  use dfmc-harp-cg, export: {*trace-harp?*};
  use dfmc-harp-cg-linker;
  use native-rtg, import: { output-data, output-glue, output-functions };

Modified: trunk/fundev/sources/dfmc/native-harp-cg/linker.dylan
==============================================================================
--- trunk/fundev/sources/dfmc/native-harp-cg/linker.dylan	(original)
+++ trunk/fundev/sources/dfmc/native-harp-cg/linker.dylan	Fri May  5 00:57:08 2006
@@ -46,7 +46,7 @@
 
 
 define sideways method emit-glue-data
-    (back-end :: <native-linux-back-end>, stream, ld) => ()
+    (back-end :: <native-unix-back-end>, stream, ld) => ()
   let dylan-library? = *compiling-dylan?*;
   output-data(back-end, stream, client?: (~ dylan-library?));
   output-glue(back-end, stream);
@@ -56,7 +56,7 @@
 
 
 define sideways method emit-library-initializer
-    (back-end :: <native-linux-back-end>, stream, ld,
+    (back-end :: <native-unix-back-end>, stream, ld,
      emit-call-used :: <method>,
      emit-call-crs :: <method>,
      emit-branch-on-init :: <method>,
@@ -109,7 +109,7 @@
 
 
 define sideways method emit-executable-entry-points
-    (back-end :: <native-linux-back-end>, stream, ld,
+    (back-end :: <native-unix-back-end>, stream, ld,
      #key harp-output?, debug-info?) => ()
 
   let constant-ref = curry(ins--constant-ref, back-end);
@@ -154,7 +154,7 @@
 end method;
 
 define sideways method emit-shared-library-entry-points
-    (back-end :: <native-linux-back-end>, stream, ld,
+    (back-end :: <native-unix-back-end>, stream, ld,
      #key harp-output?, debug-info?) => ()
 
   let output-one-fn =
@@ -169,6 +169,6 @@
 
 end method;
 
-define sideways method main-unit?(back-end :: <native-linux-back-end>) => (main? :: <boolean>)
+define sideways method main-unit?(back-end :: <native-unix-back-end>) => (main? :: <boolean>)
   #t
 end method;

Modified: trunk/fundev/sources/dfmc/native-harp-cg/primitives.dylan
==============================================================================
--- trunk/fundev/sources/dfmc/native-harp-cg/primitives.dylan	(original)
+++ trunk/fundev/sources/dfmc/native-harp-cg/primitives.dylan	Fri May  5 00:57:08 2006
@@ -264,32 +264,32 @@
 define c-runtime-reference primitive-release-recursive-lock;
 
 
-define sideways method op--wait-for-simple-lock(back-end :: <native-linux-back-end>, result, lock, #key zmilsecs) => ()
+define sideways method op--wait-for-simple-lock(back-end :: <native-unix-back-end>, result, lock, #key zmilsecs) => ()
   call-c-primitive(back-end, result, $primitive-wait-for-simple-lock, lock);
 end method op--wait-for-simple-lock;
 
 
-define sideways method op--wait-for-simple-lock-timed(back-end :: <native-linux-back-end>, result, lock, zmilsecs) => ()
+define sideways method op--wait-for-simple-lock-timed(back-end :: <native-unix-back-end>, result, lock, zmilsecs) => ()
   call-c-primitive(back-end, result, $primitive-wait-for-simple-lock-timed, lock, zmilsecs);
 end method op--wait-for-simple-lock-timed;
 
 
-define sideways method op--release-simple-lock(back-end :: <native-linux-back-end>, result, lock) => ()
+define sideways method op--release-simple-lock(back-end :: <native-unix-back-end>, result, lock) => ()
   call-c-primitive(back-end, result, $primitive-release-simple-lock, lock);
 end method op--release-simple-lock;
 
 
-define sideways method op--wait-for-recursive-lock(back-end :: <native-linux-back-end>, result, lock, #key zmilsecs) => ()
+define sideways method op--wait-for-recursive-lock(back-end :: <native-unix-back-end>, result, lock, #key zmilsecs) => ()
   call-c-primitive(back-end, result, $primitive-wait-for-recursive-lock, lock);
 end method op--wait-for-recursive-lock;
 
 
-define sideways method op--wait-for-recursive-lock-timed(back-end :: <native-linux-back-end>, result, lock, zmilsecs) => ()
+define sideways method op--wait-for-recursive-lock-timed(back-end :: <native-unix-back-end>, result, lock, zmilsecs) => ()
   call-c-primitive(back-end, result, $primitive-wait-for-recursive-lock-timed, lock, zmilsecs);
 end method op--wait-for-recursive-lock-timed;
 
 
-define sideways method op--release-recursive-lock(back-end :: <native-linux-back-end>, result, lock) => ()
+define sideways method op--release-recursive-lock(back-end :: <native-unix-back-end>, result, lock) => ()
   call-c-primitive(back-end, result, $primitive-release-recursive-lock, lock);
 end method op--release-recursive-lock;
 

Modified: trunk/fundev/sources/dfmc/pentium-harp-cg/pentium-harp-cg-library.dylan
==============================================================================
--- trunk/fundev/sources/dfmc/pentium-harp-cg/pentium-harp-cg-library.dylan	(original)
+++ trunk/fundev/sources/dfmc/pentium-harp-cg/pentium-harp-cg-library.dylan	Fri May  5 00:57:08 2006
@@ -31,7 +31,9 @@
 
  use pentium-harp,
     export: { <pentium-back-end>,
-	      <pentium-linux-back-end> };
+              <pentium-unix-back-end>,
+	      <pentium-linux-back-end>,
+              <pentium-freebsd-back-end> };
  use dfmc-harp-cg, export: {*trace-harp?*};
  use dfmc-native-harp-cg,
     export: { current-native-back-end, current-native-back-end-setter };

Modified: trunk/fundev/sources/harp/linux-rtg/c-primitives.dylan
==============================================================================
--- trunk/fundev/sources/harp/linux-rtg/c-primitives.dylan	(original)
+++ trunk/fundev/sources/harp/linux-rtg/c-primitives.dylan	Fri May  5 00:57:08 2006
@@ -8,13 +8,13 @@
 Warranty:     Distributed WITHOUT WARRANTY OF ANY KIND
 
 
-define linux-runtime-primitive spy-exit-application
+define unix-runtime-primitive spy-exit-application
   // On exit: entire process is terminated
   op--call-c(be, ExitProcess-ref, 0);
   ins--rts(be);
-end linux-runtime-primitive;
+end unix-runtime-primitive;
 
-define linux-runtime-primitive spy-fixup-imported-dylan-data
+define unix-runtime-primitive spy-fixup-imported-dylan-data
   // On entry:
   //   fixup-start, fixup-end
   // On exit:
@@ -22,9 +22,9 @@
 
   ins--rts(be);
 
-end linux-runtime-primitive;
+end unix-runtime-primitive;
 
-define linux-runtime-primitive spy-fixup-unimported-dylan-data
+define unix-runtime-primitive spy-fixup-unimported-dylan-data
   // On entry:
   //   fixup-start, fixup-end
   // On exit:
@@ -32,4 +32,4 @@
 
   ins--rts(be);
 
-end linux-runtime-primitive;
+end unix-runtime-primitive;

Modified: trunk/fundev/sources/harp/linux-rtg/debug-primitives.dylan
==============================================================================
--- trunk/fundev/sources/harp/linux-rtg/debug-primitives.dylan	(original)
+++ trunk/fundev/sources/harp/linux-rtg/debug-primitives.dylan	Fri May  5 00:57:08 2006
@@ -9,5 +9,5 @@
 
 
 define sideways method op--output-debug-string
-    (be :: <native-linux-back-end>, string :: <register>) => ()
+    (be :: <native-unix-back-end>, string :: <register>) => ()
 end method;

Modified: trunk/fundev/sources/harp/linux-rtg/ffi-barrier.dylan
==============================================================================
--- trunk/fundev/sources/harp/linux-rtg/ffi-barrier.dylan	(original)
+++ trunk/fundev/sources/harp/linux-rtg/ffi-barrier.dylan	Fri May  5 00:57:08 2006
@@ -19,7 +19,7 @@
 
 
 define sideways method op--create-TEB-tlv-index 
-    (be :: <native-linux-back-end>) => ()
+    (be :: <native-unix-back-end>) => ()
   with-harp (be)
     tag done;
     c-result c-result;
@@ -29,7 +29,7 @@
 end method;
 
 define sideways method op--get-teb-tlv
-    (be :: <native-linux-back-end>, dest :: <register>) => ()
+    (be :: <native-unix-back-end>, dest :: <register>) => ()
   with-harp (be)
     c-result c-result;
     op--call-c(be, tlv-get-value, TEB-tlv-index);
@@ -38,34 +38,34 @@
 end method;
 
 define sideways method op--set-teb-tlv
-    (be :: <native-linux-back-end>, val) => ()
+    (be :: <native-unix-back-end>, val) => ()
   with-harp (be)
     op--call-c(be, tlv-set-value, TEB-tlv-index, val);
   end with-harp;
 end method;
 
 define sideways method op--free-teb-tlv
-    (be :: <native-linux-back-end>) => ()
+    (be :: <native-unix-back-end>) => ()
   with-harp (be)
     op--call-c(be, tlv-destroy-key, TEB-tlv-index);
   end with-harp;
 end method;
 
 
-define sideways method op--get-module-handle(be :: <native-linux-back-end>) => ()
+define sideways method op--get-module-handle(be :: <native-unix-back-end>) => ()
 end method;
 
 
 
-define no-export linux-API-runtime-primitive dylan-thread-trampoline
+define no-export unix-API-runtime-primitive dylan-thread-trampoline
   ("dylan_thread_trampoline")
   op--dylan-thread-trampoline(be, #f);
-end linux-API-runtime-primitive;
+end unix-API-runtime-primitive;
 
 
 
 
-define shared init no-public linux-API-runtime-primitive dylan-shared-object-entry
+define shared init no-public unix-API-runtime-primitive dylan-shared-object-entry
   ("DylanSOEntry")
   c-result c-result;
   
@@ -94,14 +94,14 @@
   ins--move(be, c-result, 0);
   ins--rts-and-drop(be, 0);
 
-end linux-API-runtime-primitive;
+end unix-API-runtime-primitive;
 
-define open generic op--initialize-thread-instructions (be :: <native-linux-back-end>) => ();
+define open generic op--initialize-thread-instructions (be :: <native-unix-back-end>) => ();
 
-define sideways method op--initialize-thread-instructions (be :: <native-linux-back-end>) => ()
+define sideways method op--initialize-thread-instructions (be :: <native-unix-back-end>) => ()
 end method;
 
-define shared init no-public linux-API-runtime-primitive dylan-shared-object-exit
+define shared init no-public unix-API-runtime-primitive dylan-shared-object-exit
   ("DylanSOExit")
   c-result c-result;
   
@@ -117,10 +117,10 @@
   ins--move(be, c-result, 0);
   ins--rts-and-drop(be, 0);
 
-end linux-API-runtime-primitive;
+end unix-API-runtime-primitive;
 
 
-define sideways method op--init-dylan-data (be :: <native-linux-back-end>) => ()
+define sideways method op--init-dylan-data (be :: <native-unix-back-end>) => ()
   with-harp (be)
     let data-start  = ins--constant-ref(be, $data-start-symbol);
     let data-end    = ins--constant-ref(be, $data-end-symbol);

Modified: trunk/fundev/sources/harp/linux-rtg/mangling.dylan
==============================================================================
--- trunk/fundev/sources/harp/linux-rtg/mangling.dylan	(original)
+++ trunk/fundev/sources/harp/linux-rtg/mangling.dylan	Fri May  5 00:57:08 2006
@@ -14,7 +14,7 @@
 
 
 define sideways method c-mangle 
-    (be :: <native-linux-back-end>, name :: <byte-string>)
+    (be :: <native-unix-back-end>, name :: <byte-string>)
      => (mangled :: <byte-string>)
   name
 end method;

Modified: trunk/fundev/sources/harp/linux-rtg/nlx-primitives.dylan
==============================================================================
--- trunk/fundev/sources/harp/linux-rtg/nlx-primitives.dylan	(original)
+++ trunk/fundev/sources/harp/linux-rtg/nlx-primitives.dylan	Fri May  5 00:57:08 2006
@@ -12,5 +12,5 @@
 /// OP--POP-ANY-SEH-HANDLERS
 
 define sideways method op--pop-any-SEH-handlers
-    (be :: <native-linux-back-end>, new-stack-ptr :: <register>)
+    (be :: <native-unix-back-end>, new-stack-ptr :: <register>)
 end method;

Modified: trunk/fundev/sources/harp/linux-rtg/os-primitives.dylan
==============================================================================
--- trunk/fundev/sources/harp/linux-rtg/os-primitives.dylan	(original)
+++ trunk/fundev/sources/harp/linux-rtg/os-primitives.dylan	Fri May  5 00:57:08 2006
@@ -13,14 +13,14 @@
 define c-fun runtime-external c-primitive-stop-timer-ref = "c_primitive_stop_timer";
 
 
-define linux-runtime-primitive start-timer
+define unix-runtime-primitive start-timer
 
   op--call-c(be, c-primitive-start-timer-ref);
   ins--rts-and-drop(be, 0);
 
-end linux-runtime-primitive;
+end unix-runtime-primitive;
 
-define linux-runtime-primitive stop-timer
+define unix-runtime-primitive stop-timer
   // On entry:
   //    
   // On exit:
@@ -29,12 +29,12 @@
   op--call-c(be, c-primitive-stop-timer-ref);
   ins--rts-and-drop(be, 0);
 
-end linux-runtime-primitive;
+end unix-runtime-primitive;
 
 
 define c-fun runtime-external ExitProcess-ref    = "exit";
 
-define used-by-client linux-runtime-primitive exit-application
+define used-by-client unix-runtime-primitive exit-application
   // On entry: raw-int-status
   //    
   // On exit: entire process is terminated
@@ -42,12 +42,12 @@
 
   op--call-c(be, ExitProcess-ref, status);
   ins--rts-and-drop(be, 0);
-end linux-runtime-primitive;
+end unix-runtime-primitive;
 
 
 define c-fun runtime-external system-ref   = "system";
 
-define linux-runtime-primitive run-application
+define unix-runtime-primitive run-application
   // On entry: c-string-command-line
   //    
   // On exit: raw-integer-status
@@ -55,5 +55,5 @@
 
   op--call-c(be, system-ref, command);
   ins--rts-and-drop(be, 0);
-end linux-runtime-primitive;
+end unix-runtime-primitive;
 

Modified: trunk/fundev/sources/harp/linux-rtg/registration.dylan
==============================================================================
--- trunk/fundev/sources/harp/linux-rtg/registration.dylan	(original)
+++ trunk/fundev/sources/harp/linux-rtg/registration.dylan	Fri May  5 00:57:08 2006
@@ -8,13 +8,13 @@
 Warranty:     Distributed WITHOUT WARRANTY OF ANY KIND
 
 
-define macro linux-runtime-primitive-definer
-  { define ?adjectives:* linux-runtime-primitive ?:name 
+define macro unix-runtime-primitive-definer
+  { define ?adjectives:* unix-runtime-primitive ?:name 
       ?body:*
     end }
     => {
          define sideways method "genop--" ## ?name
-           (?=be :: <native-linux-back-end>) => ()
+           (?=be :: <native-unix-back-end>) => ()
            with-harp (?=be)
              ?body
            end with-harp;
@@ -23,8 +23,8 @@
 end macro;
 
 
-define macro linux-API-runtime-primitive-definer
-  { define ?adjectives:* linux-API-runtime-primitive ?:name 
+define macro unix-API-runtime-primitive-definer
+  { define ?adjectives:* unix-API-runtime-primitive ?:name 
         (?linux-name:expression)
       ?body:*
     end }

Modified: trunk/fundev/sources/harp/linux-rtg/stack-overflow.dylan
==============================================================================
--- trunk/fundev/sources/harp/linux-rtg/stack-overflow.dylan	(original)
+++ trunk/fundev/sources/harp/linux-rtg/stack-overflow.dylan	Fri May  5 00:57:08 2006
@@ -9,7 +9,7 @@
 
 
 
-define linux-runtime-primitive dylan-stack-overflow-handler
+define unix-runtime-primitive dylan-stack-overflow-handler
   // On entry:
   //   base-address  - the address of the page to re-protect for guarding
   //   page-size     - size of page to re-protect
@@ -37,7 +37,7 @@
   op--unwind-protect(be, protected-op, cleanup-op);
   // Control should never get here - but code the tail anyway
   ins--rts(be);
-end linux-runtime-primitive;
+end unix-runtime-primitive;
 
 
 

Modified: trunk/fundev/sources/harp/native-harp/module.dylan
==============================================================================
--- trunk/fundev/sources/harp/native-harp/module.dylan	(original)
+++ trunk/fundev/sources/harp/native-harp/module.dylan	Fri May  5 00:57:08 2006
@@ -24,7 +24,9 @@
     <harp-native-back-end>,
     <harp-risc-back-end>,
     <harp-cisc-back-end>,
-    <native-linux-back-end>;
+    <native-unix-back-end>,
+    <native-linux-back-end>,
+    <native-freebsd-back-end>;
 end module;
 
 

Modified: trunk/fundev/sources/harp/native-harp/native-back-end.dylan
==============================================================================
--- trunk/fundev/sources/harp/native-harp/native-back-end.dylan	(original)
+++ trunk/fundev/sources/harp/native-harp/native-back-end.dylan	Fri May  5 00:57:08 2006
@@ -38,7 +38,13 @@
   #t
 end;
 
+define abstract open class <native-unix-back-end> (<harp-native-back-end>)
+end;
+
 // All Linux back-ends should multiply inherit this class.
 
-define abstract open class <native-linux-back-end> (<harp-native-back-end>)
+define abstract open class <native-linux-back-end> (<native-unix-back-end>)
 end;
+
+define abstract open class <native-freebsd-back-end> (<native-unix-back-end>)
+end;
\ No newline at end of file

Modified: trunk/fundev/sources/harp/pentium-harp/back-end.dylan
==============================================================================
--- trunk/fundev/sources/harp/pentium-harp/back-end.dylan	(original)
+++ trunk/fundev/sources/harp/pentium-harp/back-end.dylan	Fri May  5 00:57:08 2006
@@ -26,7 +26,17 @@
 
 register-back-end(<pentium-windows-back-end>, #"harp", #"x86", #"win32");
 
-Define class <pentium-linux-back-end> (<pentium-back-end>, <native-linux-back-end>)
+define class <pentium-unix-back-end> (<pentium-back-end>)
+end;
+
+define class <pentium-linux-back-end>
+ (<pentium-unix-back-end>, <native-linux-back-end>)
 end;
 
 register-back-end(<pentium-linux-back-end>, #"harp", #"x86", #"linux");
+
+define class <pentium-freebsd-back-end>
+ (<pentium-unix-back-end>, <native-freebsd-back-end>)
+end;
+
+register-back-end(<pentium-freebsd-back-end>, #"harp", #"x86", #"freebsd");

Modified: trunk/fundev/sources/harp/pentium-harp/general.dylan
==============================================================================
--- trunk/fundev/sources/harp/pentium-harp/general.dylan	(original)
+++ trunk/fundev/sources/harp/pentium-harp/general.dylan	Fri May  5 00:57:08 2006
@@ -423,7 +423,7 @@
     
 
 define method output-implicit-externals
-    (backend :: <pentium-linux-back-end>, outputter :: <harp-outputter>)
+    (backend :: <pentium-unix-back-end>, outputter :: <harp-outputter>)
   output-external(backend, outputter, remove-optionals-runtime);
   output-external(backend, outputter, dylan-integer-overflow-handler);
 end method;

Modified: trunk/fundev/sources/harp/pentium-harp/jumps.dylan
==============================================================================
--- trunk/fundev/sources/harp/pentium-harp/jumps.dylan	(original)
+++ trunk/fundev/sources/harp/pentium-harp/jumps.dylan	Fri May  5 00:57:08 2006
@@ -17,7 +17,7 @@
   #t;
 end;
 
-define method emit-jumps-symbolically?(be :: <pentium-linux-back-end>) => (b :: <boolean>)
+define method emit-jumps-symbolically?(be :: <pentium-unix-back-end>) => (b :: <boolean>)
   #f;
 end;
 

Modified: trunk/fundev/sources/harp/pentium-harp/module.dylan
==============================================================================
--- trunk/fundev/sources/harp/pentium-harp/module.dylan	(original)
+++ trunk/fundev/sources/harp/pentium-harp/module.dylan	Fri May  5 00:57:08 2006
@@ -33,7 +33,9 @@
 
     <pentium-back-end>,
     <pentium-windows-back-end>,
+    <pentium-unix-back-end>,
     <pentium-linux-back-end>,
+    <pentium-freebsd-back-end>,
     ins--st-index, ins--stb-index, ins--sth-index,
     ins--st-index-scaled, ins--sth-index-scaled, 
     ins--fst-index, ins--dst-index,

Modified: trunk/fundev/sources/harp/pentium-harp/moves.dylan
==============================================================================
--- trunk/fundev/sources/harp/pentium-harp/moves.dylan	(original)
+++ trunk/fundev/sources/harp/pentium-harp/moves.dylan	Fri May  5 00:57:08 2006
@@ -437,12 +437,10 @@
 
 
 /// Linux TEB support:
-///  Some versions of LinuxThreads store the pthread descriptor in the gs segment register.
-///  Use an unused fixed offset in pthread descriptor to store the TEB
-///  while running Dylan code.
+/// We use Linux' TLV support here.
 
 define method op--tlb-base-register 
-    (be :: <pentium-linux-back-end>, dest :: <real-register>) => ()
+    (be :: <pentium-unix-back-end>, dest :: <real-register>) => ()
   op--load-thread-local(be, dest, /* dummy */ 0);
 end method;
 
@@ -465,6 +463,29 @@
   end harp-out;
 end method;
 
+define method op--store-thread-local
+    (be :: <pentium-freebsd-back-end>, data, offset :: <integer>) => ()
+  harp-out(be)
+    push(be, reg--tmp2);
+  end harp-out;
+  emit(be, gs.segment-prefix);
+  harp-out(be)
+    ld(be, reg--tmp2, 0, 0);
+    st(be, data, $teb, reg--tmp2);
+    pop(be, reg--tmp2);
+  end harp-out;
+end method;
+
+define method op--load-thread-local
+    (be :: <pentium-freebsd-back-end>, dest :: <real-register>, offset :: <integer>) => ()
+  emit(be, gs.segment-prefix);
+  harp-out(be)
+    ld(be, dest, 0, 0);
+    ld(be, dest, $teb, dest);
+  end harp-out;
+end method;
+
+
 /// Now the templates
 
 // Temporary: the TLB is currently stored in the Windows TIB at offset #x14

Modified: trunk/fundev/sources/harp/pentium-harp/overflow.dylan
==============================================================================
--- trunk/fundev/sources/harp/pentium-harp/overflow.dylan	(original)
+++ trunk/fundev/sources/harp/pentium-harp/overflow.dylan	Fri May  5 00:57:08 2006
@@ -233,21 +233,21 @@
 
 // Linux doesn't use INT 4, but instead directly branches to the
 // overflow handler
-define method trap-if-not-equal (be :: <pentium-linux-back-end>) => ()
+define method trap-if-not-equal (be :: <pentium-unix-back-end>) => ()
 // jump over the trap instruction if there's no overflow
   emit(be, beq-x);  // branch if no overflow
   emit(be, 5); // 5 byte instruction
   trap-always(be);
 end method;
 
-define method trap-on-overflow (be :: <pentium-linux-back-end>) => ()
+define method trap-on-overflow (be :: <pentium-unix-back-end>) => ()
 // jump over the trap instruction if there's no overflow
   emit(be, bno-x);  // branch if no overflow
   emit(be, 5); // 5 byte instruction
   trap-always(be);
 end method;
 
-define method trap-always (be :: <pentium-linux-back-end>) => ()
+define method trap-always (be :: <pentium-unix-back-end>) => ()
   emit(be, call); // CALL
   emit-constant-ref-relative
     (be, dylan-integer-overflow-handler);

Copied: trunk/fundev/sources/harp/pentium-linux-rtg/initialize-rtg-freebsd.dylan (from r10708, trunk/fundev/sources/harp/pentium-linux-rtg/initialize-rtg.dylan)
==============================================================================
--- trunk/fundev/sources/harp/pentium-linux-rtg/initialize-rtg.dylan	(original)
+++ trunk/fundev/sources/harp/pentium-linux-rtg/initialize-rtg-freebsd.dylan	Fri May  5 00:57:08 2006
@@ -12,4 +12,4 @@
 // This will be necessary in order to permit generation of a client 
 // runtime without generating a base first.
 
-dummy-generate-runtime(make(<pentium-linux-back-end>));
+dummy-generate-runtime(make(<pentium-freebsd-back-end>));

Modified: trunk/fundev/sources/harp/pentium-linux-rtg/module.dylan
==============================================================================
--- trunk/fundev/sources/harp/pentium-linux-rtg/module.dylan	(original)
+++ trunk/fundev/sources/harp/pentium-linux-rtg/module.dylan	Fri May  5 00:57:08 2006
@@ -11,7 +11,9 @@
 
 define module pentium-linux-rtg
   use functional-dylan;
-  use pentium-harp, export: { <pentium-linux-back-end> };
+  use pentium-harp, export: { <pentium-unix-back-end>,
+                              <pentium-linux-back-end>,
+                              <pentium-freebsd-back-end> };
   use native-rtg, export: { create-dylan-runtime };
   use linux-rtg;
   use pentium-rtg;

Copied: trunk/fundev/sources/harp/pentium-linux-rtg/pentium-freebsd-glue-rtg.lid (from r10708, trunk/fundev/sources/harp/pentium-linux-rtg/pentium-linux-glue-rtg.lid)
==============================================================================
--- trunk/fundev/sources/harp/pentium-linux-rtg/pentium-linux-glue-rtg.lid	(original)
+++ trunk/fundev/sources/harp/pentium-linux-rtg/pentium-freebsd-glue-rtg.lid	Fri May  5 00:57:08 2006
@@ -1,7 +1,7 @@
 library: pentium-linux-glue-rtg
 files:	 glue-library
 	 module
-	 initialize-rtg
+	 initialize-rtg-freebsd
 	 ffi-barrier
 Copyright:    Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
               All rights reserved.

Modified: trunk/fundev/sources/io/library.dylan
==============================================================================
--- trunk/fundev/sources/io/library.dylan	(original)
+++ trunk/fundev/sources/io/library.dylan	Fri May  5 00:57:08 2006
@@ -9,6 +9,7 @@
 
 define library io
   use functional-dylan;
+  use unix-portability;
   export
     streams,
     streams-internals,
@@ -295,6 +296,7 @@
 define module io-internals
   use functional-dylan,
     exclude: { format-to-string };
+  use unix-portability;
   use dylan-direct-c-ffi;
   use streams-internals;
   use format-internals;

Modified: trunk/fundev/sources/io/unix-standard-io.dylan
==============================================================================
--- trunk/fundev/sources/io/unix-standard-io.dylan	(original)
+++ trunk/fundev/sources/io/unix-standard-io.dylan	Fri May  5 00:57:08 2006
@@ -75,10 +75,7 @@
 end function get-unix-error;
 
 define function unix-errno-value () => (errno :: <integer>)
-  raw-as-integer
-    (primitive-c-signed-int-at
-      (%call-c-function ("__errno_location") () => (errnop :: <raw-pointer>) () end,
-       integer-as-raw(0), integer-as-raw(0)))
+  unix-errno()
 end function unix-errno-value;
 
 define function unix-error (syscall :: <string>, #key errno = #f) => ()

Added: trunk/fundev/sources/lib/unix-portability/freebsd-portability.dylan
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/lib/unix-portability/freebsd-portability.dylan	Fri May  5 00:57:08 2006
@@ -0,0 +1,22 @@
+module: unix-portability
+author: Hannes Mehnert <hannes at mehnert.org>
+
+define function unix-lseek (fd :: <integer>, position :: <integer>, mode :: <integer>) => (position :: <integer>)
+raw-as-integer(
+  %call-c-function ("mylseek")
+    (fd :: <raw-c-unsigned-int>, position :: <raw-c-unsigned-long>, 
+     mode :: <raw-c-unsigned-int>) 
+   => (result :: <raw-c-signed-int>)
+    (integer-as-raw(fd), integer-as-raw(position), integer-as-raw(mode))
+  end)
+end;
+
+define function unix-errno () => (res :: <raw-c-signed-int>)
+ primitive-c-signed-int-at(
+  %call-c-function ("__error") () => (errnop :: <raw-pointer>) () end,
+   integer-as-raw(0), integer-as-raw(0))
+end;
+
+define constant $proc-path = "file";
+
+define constant $errno-location = "__errno";
\ No newline at end of file

Added: trunk/fundev/sources/lib/unix-portability/freebsd-portability.lid
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/lib/unix-portability/freebsd-portability.lid	Fri May  5 00:57:08 2006
@@ -0,0 +1,6 @@
+Library: unix-portability
+Author: Hannes Mehnert <hannes at mehnert.org>
+Synopsis: Hide unix specifica (__error, __errno_location)
+Linker-Options: freebsd.o
+Files: library
+       freebsd-portability
\ No newline at end of file

Added: trunk/fundev/sources/lib/unix-portability/freebsd.c
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/lib/unix-portability/freebsd.c	Fri May  5 00:57:08 2006
@@ -0,0 +1,5 @@
+#include <unistd.h>
+
+int mylseek (int fildes, int offset, int whence) {
+  return lseek(fildes, offset, whence);
+}

Added: trunk/fundev/sources/lib/unix-portability/library.dylan
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/lib/unix-portability/library.dylan	Fri May  5 00:57:08 2006
@@ -0,0 +1,15 @@
+module: dylan-user
+author: Hannes Mehnert <hannes at mehnert.org>
+
+define library unix-portability
+  use dylan;
+
+  export unix-portability;
+end;
+
+define module unix-portability
+  use dylan;
+  use dylan-direct-c-ffi;
+
+  export unix-errno, $proc-path, $errno-location, unix-lseek;
+end;
\ No newline at end of file

Added: trunk/fundev/sources/lib/unix-portability/linux-portability.dylan
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/lib/unix-portability/linux-portability.dylan	Fri May  5 00:57:08 2006
@@ -0,0 +1,22 @@
+module: unix-portability
+author: Hannes Mehnert <hannes at mehnert.org>
+
+define function unix-lseek (fd :: <integer>, position :: <integer>, mode :: <integer>) => (position :: <integer>)
+raw-as-integer(
+  %call-c-function ("lseek")
+    (fd :: <raw-c-unsigned-int>, position :: <raw-c-unsigned-long>, 
+     mode :: <raw-c-unsigned-int>) 
+   => (result :: <raw-c-signed-int>)
+    (integer-as-raw(fd), integer-as-raw(position), integer-as-raw(mode))
+  end)
+end;
+
+define function unix-errno () => (res :: <raw-c-signed-int>)
+ primitive-c-signed-int-at(
+  %call-c-function ("__errno_location") () => (errnop :: <raw-pointer>) () end,
+   integer-as-raw(0), integer-as-raw(0))
+end;
+
+define constant $proc-path = "exe";
+
+define constant $errno-location = "__errno_location";
\ No newline at end of file

Added: trunk/fundev/sources/lib/unix-portability/linux-portability.lid
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/lib/unix-portability/linux-portability.lid	Fri May  5 00:57:08 2006
@@ -0,0 +1,5 @@
+Library: unix-portability
+Author: Hannes Mehnert <hannes at mehnert.org>
+Synopsis: Hide unix specifica (__error, __errno_location)
+Files: library
+       linux-portability
\ No newline at end of file

Added: trunk/fundev/sources/lib/unix-portability/win32-portability.dylan
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/lib/unix-portability/win32-portability.dylan	Fri May  5 00:57:08 2006
@@ -0,0 +1,12 @@
+module: unix-portability
+author: Hannes Mehnert <hannes at mehnert.org>
+
+define function unix-lseek (fd :: <integer>, position :: <integer>, mode :: <integer>) => (position :: <integer>)
+end;
+
+define function unix-errno () => (res)
+end;
+
+define constant $proc-path = "";
+
+define constant $errno-location = "";

Added: trunk/fundev/sources/lib/unix-portability/win32-portability.lid
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/lib/unix-portability/win32-portability.lid	Fri May  5 00:57:08 2006
@@ -0,0 +1,5 @@
+Library: unix-portability
+Author: Hannes Mehnert <hannes at mehnert.org>
+Synopsis: Hide unix specifica (__error, __errno_location)
+Files: library
+       win32-portability
\ No newline at end of file

Copied: trunk/fundev/sources/lib/variable-search/freebsd-variable-search.lid (from r10708, trunk/fundev/sources/lib/variable-search/unix-variable-search.lid)
==============================================================================
--- trunk/fundev/sources/lib/variable-search/unix-variable-search.lid	(original)
+++ trunk/fundev/sources/lib/variable-search/freebsd-variable-search.lid	Fri May  5 00:57:08 2006
@@ -2,7 +2,6 @@
 Files:   unix-variable-search-library
          protocol
          unix-variable-search
-C-Libraries: -ldl
 Copyright:    Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
               All rights reserved.
 License:      Functional Objects Library Public License Version 1.0

Modified: trunk/fundev/sources/network/unix-network-library.dylan
==============================================================================
--- trunk/fundev/sources/network/unix-network-library.dylan	(original)
+++ trunk/fundev/sources/network/unix-network-library.dylan	Fri May  5 00:57:08 2006
@@ -10,6 +10,7 @@
   use functional-dylan;
   use C-FFI;
   use IO;
+  use unix-portability;
   export unix-sockets,
          sockets;
 end;
@@ -19,6 +20,7 @@
   use functional-dylan,
     exclude: { close };
   use C-FFI;
+  use unix-portability;
 
   // Misc
   export

Modified: trunk/fundev/sources/network/unix-sockets/errno.dylan
==============================================================================
--- trunk/fundev/sources/network/unix-sockets/errno.dylan	(original)
+++ trunk/fundev/sources/network/unix-sockets/errno.dylan	Fri May  5 00:57:08 2006
@@ -7,7 +7,7 @@
 
 define inline-only C-function errno-location
   result val :: <C-int*>;
-  c-name: "__errno_location";
+  c-name: $errno-location;
 end C-function;
 
 define function errno() => (error-number :: <integer>)

Copied: trunk/fundev/sources/registry/generic/pentium-freebsd-runtime-generator (from r10708, trunk/fundev/sources/registry/generic/pentium-linux-runtime-generator)
==============================================================================
--- trunk/fundev/sources/registry/generic/pentium-linux-runtime-generator	(original)
+++ trunk/fundev/sources/registry/generic/pentium-freebsd-runtime-generator	Fri May  5 00:57:08 2006
@@ -1 +1 @@
-abstract://dylan/app/runtime-generator/pentium-linux-runtime-generator.lid
\ No newline at end of file
+abstract://dylan/app/runtime-generator/pentium-freebsd-runtime-generator.lid
\ No newline at end of file

Copied: trunk/fundev/sources/registry/x86-freebsd/pentium-linux-glue-rtg (from r10708, trunk/fundev/sources/registry/generic/pentium-linux-glue-rtg)
==============================================================================
--- trunk/fundev/sources/registry/generic/pentium-linux-glue-rtg	(original)
+++ trunk/fundev/sources/registry/x86-freebsd/pentium-linux-glue-rtg	Fri May  5 00:57:08 2006
@@ -1 +1 @@
-abstract://dylan/harp/pentium-linux-rtg/pentium-linux-glue-rtg.lid
\ No newline at end of file
+abstract://dylan/harp/pentium-linux-rtg/pentium-freebsd-glue-rtg.lid
\ No newline at end of file

Added: trunk/fundev/sources/registry/x86-freebsd/unix-portability
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-freebsd/unix-portability	Fri May  5 00:57:08 2006
@@ -0,0 +1 @@
+abstract://dylan/lib/unix-portability/freebsd-portability.lid

Modified: trunk/fundev/sources/registry/x86-freebsd/variable-search
==============================================================================
--- trunk/fundev/sources/registry/x86-freebsd/variable-search	(original)
+++ trunk/fundev/sources/registry/x86-freebsd/variable-search	Fri May  5 00:57:08 2006
@@ -1 +1 @@
-abstract://dylan/lib/variable-search/unix-variable-search.lid
+abstract://dylan/lib/variable-search/freebsd-variable-search.lid

Added: trunk/fundev/sources/registry/x86-linux/unix-portability
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-linux/unix-portability	Fri May  5 00:57:08 2006
@@ -0,0 +1 @@
+abstract://dylan/lib/unix-portability/linux-portability.lid

Added: trunk/fundev/sources/registry/x86-win32/unix-portability
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-win32/unix-portability	Fri May  5 00:57:08 2006
@@ -0,0 +1 @@
+abstract://dylan/lib/unix-portability/win32-portability.lid

Modified: trunk/fundev/sources/system/file-system/unix-ffi.dylan
==============================================================================
--- trunk/fundev/sources/system/file-system/unix-ffi.dylan	(original)
+++ trunk/fundev/sources/system/file-system/unix-ffi.dylan	Fri May  5 00:57:08 2006
@@ -186,17 +186,11 @@
 /// Error handling
 
 define function unix-last-error () => (errno :: <integer>)
-  raw-as-integer
-    (primitive-c-signed-int-at
-      (%call-c-function ("__errno_location") () => (errnop :: <raw-pointer>) () end,
-       integer-as-raw(0), integer-as-raw(0)))
+  raw-as-integer(unix-errno())
 end function unix-last-error;
 
 define function unix-last-error-setter (errno :: <integer>) => (errno :: <integer>)
-  primitive-c-signed-int-at
-    (%call-c-function ("__errno_location") () => (errnop :: <raw-pointer>) () end,
-     integer-as-raw(0), integer-as-raw(0))
-    := integer-as-raw(errno);
+  unix-errno() := integer-as-raw(errno);
   errno
 end function unix-last-error-setter;
 

Modified: trunk/fundev/sources/system/file-system/unix-interface.dylan
==============================================================================
--- trunk/fundev/sources/system/file-system/unix-interface.dylan	(original)
+++ trunk/fundev/sources/system/file-system/unix-interface.dylan	Fri May  5 00:57:08 2006
@@ -88,14 +88,7 @@
 define function unix-lseek
     (fd :: <integer>, position :: <integer>, mode :: <integer>) => (position :: <integer>)
   with-interrupt-repeat
-    raw-as-integer
-      (%call-c-function ("lseek")
-           (fd :: <raw-c-unsigned-int>, position :: <raw-c-unsigned-long>, 
-            mode :: <raw-c-unsigned-int>) 
-        => (result :: <raw-c-signed-int>)
-         (integer-as-raw(fd), 
-	  integer-as-raw(position), integer-as-raw(mode))
-       end)
+    unix-lseek(fd, posittion, mode)
   end
 end function unix-lseek;
 
@@ -111,10 +104,7 @@
 end function get-unix-error;
 
 define function unix-errno-value () => (errno :: <integer>)
-  raw-as-integer
-    (primitive-c-signed-int-at
-      (%call-c-function ("__errno_location") () => (errnop :: <raw-pointer>) () end,
-       integer-as-raw(0), integer-as-raw(0)))
+  raw-as-integer(errno())
 end function unix-errno-value;
 
 

Modified: trunk/fundev/sources/system/library.dylan
==============================================================================
--- trunk/fundev/sources/system/library.dylan	(original)
+++ trunk/fundev/sources/system/library.dylan	Fri May  5 00:57:08 2006
@@ -10,6 +10,7 @@
 define library system
   use functional-dylan;
   use io;
+  use unix-portability;
   export
     operating-system,
     date,
@@ -350,6 +351,7 @@
   use threads;
   use simple-format;
   use streams-internals;
+  use unix-portability;
   use operating-system, export: all;
   use date, export: all;
   use locators-internals, export: all;



More information about the chatter mailing list