Procházet zdrojové kódy

* NetBSD rtl compiles again

git-svn-id: trunk@5049 -
florian před 19 roky
rodič
revize
4626f2c489

+ 6 - 2
.gitattributes

@@ -4694,8 +4694,9 @@ rtl/morphos/utility.pp svneol=native#text/plain
 rtl/morphos/varutils.pp svneol=native#text/plain
 rtl/morphos/varutils.pp svneol=native#text/plain
 rtl/netbsd/Makefile svneol=native#text/plain
 rtl/netbsd/Makefile svneol=native#text/plain
 rtl/netbsd/Makefile.fpc svneol=native#text/plain
 rtl/netbsd/Makefile.fpc svneol=native#text/plain
-rtl/netbsd/classes.pp svneol=native#text/plain
 rtl/netbsd/errno.inc svneol=native#text/plain
 rtl/netbsd/errno.inc svneol=native#text/plain
+rtl/netbsd/errnostr.inc -text
+rtl/netbsd/i386/bsyscall.inc svneol=native#text/plain
 rtl/netbsd/i386/cprt0.as -text
 rtl/netbsd/i386/cprt0.as -text
 rtl/netbsd/i386/prt0.as -text
 rtl/netbsd/i386/prt0.as -text
 rtl/netbsd/i386/prt0_10.as -text
 rtl/netbsd/i386/prt0_10.as -text
@@ -4717,7 +4718,10 @@ rtl/netbsd/termios.inc svneol=native#text/plain
 rtl/netbsd/termiosproc.inc svneol=native#text/plain
 rtl/netbsd/termiosproc.inc svneol=native#text/plain
 rtl/netbsd/tthread.inc svneol=native#text/plain
 rtl/netbsd/tthread.inc svneol=native#text/plain
 rtl/netbsd/unixsock.inc svneol=native#text/plain
 rtl/netbsd/unixsock.inc svneol=native#text/plain
-rtl/netbsd/unixsysc.inc svneol=native#text/plain
+rtl/netbsd/unxconst.inc svneol=native#text/plain
+rtl/netbsd/unxfunc.inc svneol=native#text/plain
+rtl/netbsd/unxsockh.inc svneol=native#text/plain
+rtl/netbsd/unxsysc.inc svneol=native#text/plain
 rtl/netware/Makefile svneol=native#text/plain
 rtl/netware/Makefile svneol=native#text/plain
 rtl/netware/Makefile.fpc svneol=native#text/plain
 rtl/netware/Makefile.fpc svneol=native#text/plain
 rtl/netware/README -text
 rtl/netware/README -text

+ 8 - 0
rtl/bsd/ipcbsd.inc

@@ -27,7 +27,11 @@ end;
 
 
 function shmget(key:key_t;size:cint;flag:cint):cint;
 function shmget(key:key_t;size:cint;flag:cint):cint;
 begin
 begin
+{$ifdef NetBSD}
+  shmget:=do_syscall(syscall_nr_shmget,3, key, size, flag);
+{$else NetBSD}
   shmget:=do_syscall(syscall_nr_shmsys,3, key, size, flag);
   shmget:=do_syscall(syscall_nr_shmsys,3, key, size, flag);
+{$endif NetBSD}
 end;
 end;
 
 
 Function shmat (shmid:cint; shmaddr:pointer; shmflg:cint):pointer;
 Function shmat (shmid:cint; shmaddr:pointer; shmflg:cint):pointer;
@@ -38,7 +42,11 @@ end;
 Function shmdt (shmaddr:pointer):cint;
 Function shmdt (shmaddr:pointer):cint;
 
 
 begin
 begin
+{$ifdef NetBSD}
+  shmdt:=do_syscall(syscall_nr_shmdt,2, TSysParam(shmaddr));
+{$else NetBSD}
   shmdt:=do_syscall(syscall_nr_shmsys,2, TSysParam(shmaddr));
   shmdt:=do_syscall(syscall_nr_shmsys,2, TSysParam(shmaddr));
+{$endif NetBSD}
 end;
 end;
 
 
 Function shmctl(shmid:cint; cmd:cint; buf: pshmid_ds): cint;
 Function shmctl(shmid:cint; cmd:cint; buf: pshmid_ds): cint;

+ 98 - 99
rtl/netbsd/Makefile

@@ -235,22 +235,17 @@ override PACKAGE_NAME=rtl
 PACKAGEDIR_MAIN:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
 PACKAGEDIR_MAIN:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
 RTL=..
 RTL=..
 INC=$(RTL)/inc
 INC=$(RTL)/inc
+COMMON=$(RTL)/common
 PROCINC=$(RTL)/$(CPU_TARGET)
 PROCINC=$(RTL)/$(CPU_TARGET)
 BSDINC=$(RTL)/bsd
 BSDINC=$(RTL)/bsd
 BSDPROCINC=$(BSDINC)/$(CPU_TARGET)
 BSDPROCINC=$(BSDINC)/$(CPU_TARGET)
 UNIXINC=$(RTL)/unix
 UNIXINC=$(RTL)/unix
 UNITPREFIX=rtl
 UNITPREFIX=rtl
 TARGETPROCINC=$(RTL)/netbsd/$(CPU_TARGET)
 TARGETPROCINC=$(RTL)/netbsd/$(CPU_TARGET)
-ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
 SYSTEMUNIT=system
 SYSTEMUNIT=system
 LINUXUNIT=
 LINUXUNIT=
 PRT0=prt0
 PRT0=prt0
-else
-SYSTEMUNIT=sysbsd
-LINUXUNIT=
-override FPCOPT+=-dUNIX
-PRT0=prt0_10
-endif
+override FPCOPT+=-dNOMOUSE
 ifdef RELEASE
 ifdef RELEASE
 override FPCOPT+=-Ur
 override FPCOPT+=-Ur
 endif
 endif
@@ -265,127 +260,127 @@ else
 CPU_UNITS=
 CPU_UNITS=
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix initc systhrds dos crt objects printer matrix sysutils classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types classes typinfo math varutils charset ucomplex getopts heaptrc lineinfo errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_LOADERS+=prt0 cprt0
 override TARGET_LOADERS+=prt0 cprt0
@@ -511,127 +506,127 @@ ifeq ($(FULL_TARGET),powerpc64-linux)
 override TARGET_LOADERS+=prt0 cprt0
 override TARGET_LOADERS+=prt0 cprt0
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
 endif
 endif
 override INSTALL_FPCPACKAGE=y y
 override INSTALL_FPCPACKAGE=y y
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
@@ -2161,14 +2156,14 @@ objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
 strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 		   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
 		   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
 		   $(SYSTEMUNIT)$(PPUEXT)
 		   $(SYSTEMUNIT)$(PPUEXT)
-baseunix$(PPUEXT) : errno.inc $(BSDINC)/bunxtype.inc ptypes.inc $(BSDINC)/ctypes.inc \
-  signal.inc $(UNIXINC)/bunxh.inc $(BSDINC)/bunxmain.inc $(BSDINC)/ostypes.inc \
-  $(BSDINC)/bunxfunc.inc $(BSDPROCINC)/syscallh.inc sysnr.inc \
-  $(BSDINC)/ostypes.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.inc $(UNIXINC)/gensigset.inc \
-  $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
+baseunix$(PPUEXT) : errno.inc ptypes.inc $(UNIXINC)/ctypes.inc \
+  signal.inc $(UNIXINC)/bunxh.inc \
+  $(BSDINC)/bunxsysc.inc $(BSDPROCINC)/syscallh.inc sysnr.inc \
+  $(BSDINC)/ostypes.inc $(BSDINC)/osmacro.inc $(UNIXINC)/gensigset.inc \
+  $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT) sysctl$(PPUEXT)
 unix$(PPUEXT) : $(UNIXINC)/unix.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
 unix$(PPUEXT) : $(UNIXINC)/unix.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
 		 syscalls.inc systypes.inc sysconst.inc $(UNIXINC)/timezone.inc \
 		 syscalls.inc systypes.inc sysconst.inc $(UNIXINC)/timezone.inc \
-		 unixsysc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+		 unxsysc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 dos$(PPUEXT) : $(UNIXINC)/dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
 dos$(PPUEXT) : $(UNIXINC)/dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
 	       unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 	       unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 crt$(PPUEXT) : $(UNIXINC)/crt.pp $(INC)/textrec.inc unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 crt$(PPUEXT) : $(UNIXINC)/crt.pp $(INC)/textrec.inc unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
@@ -2177,9 +2172,11 @@ printer$(PPUEXT) : $(UNIXINC)/printer.pp $(INC)/textrec.inc unix$(PPUEXT) $(SYST
 sysutils$(PPUEXT) : $(UNIXINC)/sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
 sysutils$(PPUEXT) : $(UNIXINC)/sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
 		    objpas$(PPUEXT) unix$(PPUEXT) errors$(PPUEXT) sysconst$(PPUEXT)
 		    objpas$(PPUEXT) unix$(PPUEXT) errors$(PPUEXT) sysconst$(PPUEXT)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $(UNIXINC)/sysutils.pp
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $(UNIXINC)/sysutils.pp
-classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
-		   sysutils$(PPUEXT) typinfo$(PPUEXT)
-	$(COMPILER) -Fi$(OBJPASDIR)/classes classes.pp
+rtlconsts$(PPUEXT) : $(OBJPASDIR)/rtlconsts.pp
+	$(COMPILER): $(OBJPASDIR)/rtlconsts.pp
+classes$(PPUEXT) : $(UNIXINC)/classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
+		   sysutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT)
+	$(COMPILER) -Fi$(OBJPASDIR)/classes $(UNIXINC)/classes.pp
 typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
 typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
 	$(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp
 	$(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp
 math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
 math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
@@ -2201,6 +2198,7 @@ heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
 lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
 lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
 charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
 charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
 ucomplex$(PPUEXT) : $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 ucomplex$(PPUEXT) : $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+fpmkunit$(PPUEXT) : $(COMMON)/fpmkunit.pp classes$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 sockets$(PPUEXT) : $(UNIXINC)/sockets.pp $(INC)/textrec.inc $(INC)/filerec.inc \
 sockets$(PPUEXT) : $(UNIXINC)/sockets.pp $(INC)/textrec.inc $(INC)/filerec.inc \
 		   unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 		   unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 errors$(PPUEXT) : $(UNIXINC)/errors.pp strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 errors$(PPUEXT) : $(UNIXINC)/errors.pp strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
@@ -2211,4 +2209,5 @@ sysctl$(PPUEXT) : $(BSDINC)/sysctl.pp $(SYSTEMUNIT)$(PPUEXT)
 syscall$(PPUEXT) : $(UNIXINC)/syscall.pp
 syscall$(PPUEXT) : $(UNIXINC)/syscall.pp
 sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) $(OBJPASDIR)/sysconst.pp
 	$(COMPILER) $(OBJPASDIR)/sysconst.pp
-cthreads$(PPUEXT) : $(UNIXINC)/cthreads.pp systhrds$(PPUEXT)
+sysctl$(PPUEXT) : $(BSDINC)/sysctl.pp unixtype$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+cthreads$(PPUEXT) : $(UNIXINC)/cthreads.pp $(SYSTEMUNIT)$(PPUEXT)

+ 27 - 23
rtl/netbsd/Makefile.fpc

@@ -11,13 +11,15 @@ fpcpackage=y
 [target]
 [target]
 loaders=prt0 cprt0
 loaders=prt0 cprt0
 units=$(SYSTEMUNIT) objpas macpas strings syscall baseunix \
 units=$(SYSTEMUNIT) objpas macpas strings syscall baseunix \
-      $(LINUXUNIT) unix initc systhrds \
+      $(LINUXUNIT) unix rtlconsts initc \
       dos crt objects printer matrix \
       dos crt objects printer matrix \
-      sysutils classes typinfo math varutils \
-       charset ucomplex getopts heaptrc lineinfo \
-      errors sockets gpm ipc terminfo \
-      video mouse keyboard  serial variants types systhrds sysctl sysconst $(CPU_UNITS)
-rsts=math varutils typinfo variants classes sysconst
+      sysutils types classes typinfo math varutils \
+      charset ucomplex getopts heaptrc lineinfo \
+      errors sockets terminfo \
+      video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+      # ipc
+
+rsts=math varutils typinfo variants classes sysconst fpmkunit
 
 
 [require]
 [require]
 nortl=y
 nortl=y
@@ -47,6 +49,7 @@ libunits=$(SYSTEMUNIT) objpas strings \
 [prerules]
 [prerules]
 RTL=..
 RTL=..
 INC=$(RTL)/inc
 INC=$(RTL)/inc
+COMMON=$(RTL)/common
 PROCINC=$(RTL)/$(CPU_TARGET)
 PROCINC=$(RTL)/$(CPU_TARGET)
 BSDINC=$(RTL)/bsd
 BSDINC=$(RTL)/bsd
 BSDPROCINC=$(BSDINC)/$(CPU_TARGET)
 BSDPROCINC=$(BSDINC)/$(CPU_TARGET)
@@ -54,16 +57,10 @@ UNIXINC=$(RTL)/unix
 UNITPREFIX=rtl
 UNITPREFIX=rtl
 TARGETPROCINC=$(RTL)/netbsd/$(CPU_TARGET)
 TARGETPROCINC=$(RTL)/netbsd/$(CPU_TARGET)
 
 
-ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
 SYSTEMUNIT=system
 SYSTEMUNIT=system
 LINUXUNIT=
 LINUXUNIT=
 PRT0=prt0
 PRT0=prt0
-else
-SYSTEMUNIT=sysbsd
-LINUXUNIT=
-override FPCOPT+=-dUNIX
-PRT0=prt0_10
-endif
+override FPCOPT+=-dNOMOUSE
 
 
 # Use new feature from 1.0.5 version
 # Use new feature from 1.0.5 version
 # that generates release PPU files
 # that generates release PPU files
@@ -137,16 +134,16 @@ strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 # System Dependent Units
 # System Dependent Units
 #
 #
 
 
-baseunix$(PPUEXT) : errno.inc $(BSDINC)/bunxtype.inc ptypes.inc $(BSDINC)/ctypes.inc \
-  signal.inc $(UNIXINC)/bunxh.inc $(BSDINC)/bunxmain.inc $(BSDINC)/ostypes.inc \
-  $(BSDINC)/bunxfunc.inc $(BSDPROCINC)/syscallh.inc sysnr.inc \
-  $(BSDINC)/ostypes.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.inc $(UNIXINC)/gensigset.inc \
-  $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
+baseunix$(PPUEXT) : errno.inc ptypes.inc $(UNIXINC)/ctypes.inc \
+  signal.inc $(UNIXINC)/bunxh.inc \
+  $(BSDINC)/bunxsysc.inc $(BSDPROCINC)/syscallh.inc sysnr.inc \
+  $(BSDINC)/ostypes.inc $(BSDINC)/osmacro.inc $(UNIXINC)/gensigset.inc \
+  $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT) sysctl$(PPUEXT)
 
 
 
 
 unix$(PPUEXT) : $(UNIXINC)/unix.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
 unix$(PPUEXT) : $(UNIXINC)/unix.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
                  syscalls.inc systypes.inc sysconst.inc $(UNIXINC)/timezone.inc \
                  syscalls.inc systypes.inc sysconst.inc $(UNIXINC)/timezone.inc \
-                 unixsysc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+                 unxsysc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 
 
 
 
 #
 #
@@ -174,9 +171,12 @@ sysutils$(PPUEXT) : $(UNIXINC)/sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.in
                     objpas$(PPUEXT) unix$(PPUEXT) errors$(PPUEXT) sysconst$(PPUEXT)
                     objpas$(PPUEXT) unix$(PPUEXT) errors$(PPUEXT) sysconst$(PPUEXT)
         $(COMPILER) -Fi$(OBJPASDIR)/sysutils $(UNIXINC)/sysutils.pp
         $(COMPILER) -Fi$(OBJPASDIR)/sysutils $(UNIXINC)/sysutils.pp
 
 
-classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
-                   sysutils$(PPUEXT) typinfo$(PPUEXT)
-        $(COMPILER) -Fi$(OBJPASDIR)/classes classes.pp
+rtlconsts$(PPUEXT) : $(OBJPASDIR)/rtlconsts.pp
+	$(COMPILER): $(OBJPASDIR)/rtlconsts.pp
+
+classes$(PPUEXT) : $(UNIXINC)/classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
+                   sysutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT)
+        $(COMPILER) -Fi$(OBJPASDIR)/classes $(UNIXINC)/classes.pp
 
 
 typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
 typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
         $(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp
         $(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp
@@ -220,6 +220,8 @@ charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
 
 
 ucomplex$(PPUEXT) : $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 ucomplex$(PPUEXT) : $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 
 
+fpmkunit$(PPUEXT) : $(COMMON)/fpmkunit.pp classes$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+
 #
 #
 # Other system-dependent RTL Units
 # Other system-dependent RTL Units
 #
 #
@@ -242,4 +244,6 @@ syscall$(PPUEXT) : $(UNIXINC)/syscall.pp
 sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
         $(COMPILER) $(OBJPASDIR)/sysconst.pp
         $(COMPILER) $(OBJPASDIR)/sysconst.pp
 
 
-cthreads$(PPUEXT) : $(UNIXINC)/cthreads.pp systhrds$(PPUEXT)
+sysctl$(PPUEXT) : $(BSDINC)/sysctl.pp unixtype$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+
+cthreads$(PPUEXT) : $(UNIXINC)/cthreads.pp $(SYSTEMUNIT)$(PPUEXT)

+ 0 - 51
rtl/netbsd/classes.pp

@@ -1,51 +0,0 @@
-{
-    This file is part of the Free Component Library (FCL)
-    Copyright (c) 1999-2000 by Michael Van Canneyt and Florian Klaempfl
-
-    Classes unit for FreeBSD
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-{$mode objfpc}
-
-{ determine the type of the resource/form file }
-{$define Win16Res}
-
-unit Classes;
-
-interface
-
-uses
-  sysutils,
-  rtlconsts,
-  types,
-  typinfo;
-
-{$i classesh.inc}
-
-implementation
-
-uses
-  baseunix,unix,Systhrds
-  ;
-
-{ OS - independent class implementations are in /inc directory. }
-{$i classes.inc}
-
-
-initialization
-  CommonInit;
-
-finalization
-  CommonCleanup;
-
-  if ThreadsInited then
-     DoneThreads;
-end.

+ 123 - 0
rtl/netbsd/errnostr.inc

@@ -0,0 +1,123 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2005 by Ales Katona
+
+    Contains BSD specific errors for error.pp in rtl/unix
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$warning FIX ME, I'am from FreeBSD }
+const
+  sys_errn=93;
+  sys_errlist:array[0..sys_errn-1] of pchar = (
+        'Success',                              { 0 }
+        'Operation not permitted',              { EPERM }
+        'No such file or directory',            { ENOENT }
+        'No such process',                      { ESRCH }
+        'Interrupted system call',              { EINTR }
+        'I/O error',                            { EIO }
+        'No such device or address',            { ENXIO }
+        'Arg list too long',                    { E2BIG }
+        'Exec format error',                    { ENOEXEC }
+        'Bad file number',                      { EBADF }
+        'No child processes',                   { ECHILD }
+        'Resource deadlock avoided',   { EDEADLK was EAGAIN }
+        'Out of memory',                        { ENOMEM }
+        'Permission denied',                    { EACCES }
+        'Bad address',                          { EFAULT }
+        'Block device required',                { ENOTBLK }
+        'Device or resource busy',              { EBUSY }
+        'File exists',                          { EEXIST }
+        'Cross-device link',                    { EXDEV }
+        'No such device',                       { ENODEV }
+        'Not a directory',                      { ENOTDIR }
+        'Is a directory',                       { EISDIR }
+        'Invalid argument',                     { EINVAL }
+        'File table overflow',                  { ENFILE }
+        'Too many open files',                  { EMFILE }
+        'Not a typewriter',                     { ENOTTY }
+        'Text (code segment) file busy',        { ETXTBSY  Text file busy.  The new process was
+                                                    a pure procedure (shared text) file which was
+                                                    open for writing by another process, or file
+                                                    which was open for writing by another process,
+                                                    or while the pure procedure file was being
+                                                    executed an open(2) call requested write access
+                                                    requested write access.}
+        'File too large',                       { EFBIG }
+        'No space left on device',              { ENOSPC }
+        'Illegal seek',                         { ESPIPE }
+        'Read-only file system',                { EROFS }
+        'Too many links',                       { EMLINK }
+        'Broken pipe',                          { EPIPE }
+        'Math argument out of domain of func',  { EDOM }
+        'Math result not representable',        { ERANGE }
+        'Resource temporarily unavailable',        { EAGAIN }
+        'Operation now in progress',      { EINPROGRESS }
+        'Operation already in progress', { EALREADY	}
+// ipc/network software -- argument errors
+        'Socket operation on non-socket',    { ENOTSOCK }
+        'Destination address required',     { EDESTADDRREQ }
+        'Message too long',                     { EMSGSIZE }
+        'Protocol wrong type for socket', { EPROTOTYPE }
+        'Protocol not available',               { ENOPROTOOPT }
+        'Protocol not supported',              { EPROTONOSUPPORT }
+        'Socket type not supported',         { ESOCKTNOSUPPORT }
+        'Operation not supported',             { EOPNOTSUPP }
+        'Protocol family not supported',      { EPFNOSUPPORT }
+        'Address family not supported by protocol family',  { EAFNOSUPPORT }
+        'Address already in use',                { EADDRINUSE }
+        'Can''t assign requested address',  { EADDRNOTAVAIL }
+// ipc/network software -- operational errors
+        'Network is down',                            { ENETDOWN }
+        'Network is unreachable',                 { ENETUNREACH }
+        'Network dropped connection on reset', { ENETRESET }
+        'Software caused connection abort',   { ECONNABORTED }
+        'Connection reset by peer',                 { ECONNRESET }
+        'No buffer space available',                { ENOBUFS }
+        'Socket is already connected',            { EISCONN }
+        'Socket is not connected',                    { ENOTCONN }
+        'Can''t send after socket shutdown',    { ESHUTDOWN }
+        'Too many references: can''t splice',   { ETOOMANYREFS }
+        'Operation timed out',                           { ETIMEDOUT }
+        'Connection refused',                           { ECONNREFUSED }
+        'Too many levels of symbolic links',     { ELOOP }
+        'File name too long',                              { ENAMETOOLONG }
+        'Host is down',                                       { EHOSTDOWN }
+        'No route to host',                                  { EHOSTUNREACH }
+        'Directory not empty',                            { ENOTEMPTY }
+        'Too many processes',                           { EPROCLIM }
+        'Too many users',                                   { EUSERS }
+        'Disc quota exceeded',                           { EDQUOT }
+// Network File System
+        'Stale NFS file handle',                              { ESTALE }
+        'Too many levels of remote in path',        { EREMOTE }
+        'RPC struct is bad',                                    { EBADRPC }
+        'RPC version wrong',                                { ERPCMISMATCH }
+        'RPC prog. not avail',                                { EPROGUNAVAIL }
+        'Program version wrong',                          { EPROGMISMATCH }
+        'Bad procedure for program',                    { EPROCUNAVAIL }
+        'No locks available',                                   { ENOLCK }
+        'Function not implemented',                       { ENOSYS }
+        'Inappropriate file type or format',              { EFTYPE }
+        'Authentication error',                                 { EAUTH }
+        'Need authenticator',                                   { ENEEDAUTH }
+        'Identifier removed',                                   { EIDRM }
+        'No message of desired type',                   { ENOMSG }
+        'Value too large to be stored in data type', { EOVERFLOW }
+        'Operation canceled',                                  { ECANCELED }
+        'Illegal byte sequence',                                { EILSEQ }
+        'Attribute not found',                                    { ENOATTR }
+        'Programming error',                                    { EDOOFUS }
+        'Bad message',                                            { EBADMSG }
+        'Multihop attempted',                                   { EMULTIHOP }
+        'Link has been severed',                              { ENOLINK }
+        'Protocol error'                                             { EPROTO }
+);
+

+ 14 - 0
rtl/netbsd/i386/bsyscall.inc

@@ -0,0 +1,14 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2005 by Michael Van Canneyt,
+    member of the Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+

+ 205 - 204
rtl/netbsd/i386/prt0.as

@@ -1,204 +1,205 @@
-#
-#   $Id: prt0.as,v 1.2 2004/01/04 01:13:23 marco Exp $
-#   This file is part of the Free Pascal run time library.
-#   Copyright (c) 1999-2000 by Marco van de Voort, Michael Van Canneyt
-#                                                  and Peter Vreman
-#   members of the Free Pascal development team.
-#
-#   See the file COPYING.FPC, included in this distribution,
-#   for details about the copyright.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY;without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-#**********************************************************************}
-#
-# NetBSD standard (static) ELF/i386 startup code for Free Pascal
-#
-
-
-	.file	"prt0.s"
-	.version	"01.01"
-gcc2_compiled.:
-.globl __progname
-
-.section	.rodata
-.LC0:
-	.ascii "\0"
-.data
-	.align 4
-	.type	 __progname,@object
-	.size	 __progname,4
-__progname:
-	.long .LC0
-.globl __ps_strings
-	.align 4
-	.type	 __ps_strings,@object
-	.size	 __ps_strings,4
-__ps_strings:
-	.long 0
-	.align 4
-___fpucw:
-        .long   0x1332
-
-        .globl  ___fpc_brk_addr         /* heap management */
-        .type   ___fpc_brk_addr,@object
-        .size   ___fpc_brk_addr,4
-___fpc_brk_addr:
-        .long   0
-
-#APP
-	
-	.text
-	.align	4
-	.globl	__start
-	.globl	_start
-_start:
-__start:
-	pushl	%ebx			# ps_strings
-	pushl	%ecx			# obj
-	pushl	%edx			# cleanup
-	movl	12(%esp),%eax
-	leal	20(%esp,%eax,4),%ecx
-	leal	16(%esp),%edx
-	pushl	%ecx
-	pushl	%edx
-	pushl	%eax
-	call	___start
-
-#NO_APP
-.text
-	.align 4
-.globl ___start
-	.type	 ___start,@function
-___start:
-	pushl %ebp
-	movl %esp,%ebp
-	movl 16(%ebp),%eax
-	movl %eax,environ
-	movl %eax,U_SYSTEM_ENVP
-	movl 8(%ebp),%eax
-	movl %eax,U_SYSTEM_ARGC
-	movl 12(%ebp),%eax
-	movl %eax,U_SYSTEM_ARGV
-	movl (%eax),%edx
-	movl %edx,__progname
-	testl %edx,%edx
-	je .L2
-	pushl $47
-	movl __progname,%eax
-	pushl %eax
-	call _strrchr
-	addl $8,%esp
-	movl %eax,%eax
-	movl %eax,__progname
-	cmpl $0,__progname
-	jne .L3
-	movl 12(%ebp),%eax
-	movl (%eax),%edx
-	movl %edx,__progname
-	jmp .L2
-	.align 4
-.L3:
-	incl __progname
-.L4:
-.L2:
-	cmpl $0,28(%ebp)
-	je .L5
-	movl 28(%ebp),%eax
-	movl %eax,__ps_strings
-.L5:
-#	pushl $_fini
-#	call atexit
-#	addl $4,%esp
-#	call _init
-# copied from linux
-
-        finit                           /* initialize fpu */
-        fwait
-        fldcw   ___fpucw
-
-        xorl    %ebp,%ebp
-
-	call _main
-	pushl %eax
-	jmp  _haltproc
-        
-.p2align 2,0x90
-.globl _haltproc
-.type _haltproc,@function
-
-_haltproc:
-           mov $1,%eax  
-           movzwl U_SYSTEM_EXITCODE,%ebx
-           pushl %ebx
-           call _actualsyscall
-           addl  $4,%esp
-           jmp   _haltproc
-
-_actualsyscall:
-         int $0x80
-         jb .LErrorcode
-         xor %ebx,%ebx
-         ret
-.LErrorcode:
-         mov %eax,%ebx
-         mov $-1,%eax
-         ret
-        .p2align 2,0x90 	
-
-.Lfe1:
-	.size	 ___start,.Lfe1-___start
-	.align 4
-	.type	 _strrchr,@function
-_strrchr:
-	pushl %ebp
-	movl %esp,%ebp
-	subl $8,%esp
-	movl 12(%ebp),%eax
-	movb %al,-1(%ebp)
-	movl $0,-8(%ebp)
-	.align 4
-.L7:
-	movl 8(%ebp),%eax
-	movb (%eax),%dl
-	cmpb -1(%ebp),%dl
-	jne .L10
-	movl 8(%ebp),%eax
-	movl %eax,-8(%ebp)
-.L10:
-	movl 8(%ebp),%eax
-	cmpb $0,(%eax)
-	jne .L9
-	movl -8(%ebp),%edx
-	movl %edx,%eax
-	jmp .L6
-	.align 4
-.L11:
-.L9:
-	incl 8(%ebp)
-	jmp .L7
-	.align 4
-.L8:
-.L6:
-	leave
-	ret
-
-
-.Lfe2:
-	.size	 _strrchr,.Lfe2-_strrchr
-	.comm	environ,4,4
-
-# This section is needed for NetBSD to recognize a NetBSD binary as such.
-# otherwise it will be startup in Linux emulation mode.
-
-.section ".note.netbsd.ident","a"
-.p2align 2
-
-.long 7
-.long 4
-# ELF NOTE TYPE NETBSD TAG
-.long 1
-.ascii "NetBSD\0\0"
-.long 199905
+#
+#   $Id: prt0.as,v 1.2 2004/01/04 01:13:23 marco Exp $
+#   This file is part of the Free Pascal run time library.
+#   Copyright (c) 1999-2000 by Marco van de Voort, Michael Van Canneyt
+#                                                  and Peter Vreman
+#   members of the Free Pascal development team.
+#
+#   See the file COPYING.FPC, included in this distribution,
+#   for details about the copyright.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY;without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+#**********************************************************************}
+#
+# NetBSD standard (static) ELF/i386 startup code for Free Pascal
+#
+
+http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/csu/i386/crt0.c?rev=1.33&content-type=text/x-cvsweb-markup
+
+	.file	"prt0.s"
+	.version	"01.01"
+gcc2_compiled.:
+.globl __progname
+
+.section	.rodata
+.LC0:
+	.ascii "\0"
+.data
+	.align 4
+	.type	 __progname,@object
+	.size	 __progname,4
+__progname:
+	.long .LC0
+.globl __ps_strings
+	.align 4
+	.type	 __ps_strings,@object
+	.size	 __ps_strings,4
+__ps_strings:
+	.long 0
+	.align 4
+___fpucw:
+        .long   0x1332
+
+        .globl  ___fpc_brk_addr         /* heap management */
+        .type   ___fpc_brk_addr,@object
+        .size   ___fpc_brk_addr,4
+___fpc_brk_addr:
+        .long   0
+
+#APP
+	
+	.text
+	.align	4
+	.globl	__start
+	.globl	_start
+_start:
+__start:
+	pushl	%ebx			# ps_strings
+	pushl	%ecx			# obj
+	pushl	%edx			# cleanup
+	movl	12(%esp),%eax
+	leal	20(%esp,%eax,4),%ecx
+	leal	16(%esp),%edx
+	pushl	%ecx
+	pushl	%edx
+	pushl	%eax
+	call	___start
+
+#NO_APP
+.text
+	.align 4
+.globl ___start
+	.type	 ___start,@function
+___start:
+	pushl %ebp
+	movl %esp,%ebp
+	movl 16(%ebp),%eax
+	movl %eax,environ
+	movl %eax,U_SYSTEM_ENVP
+	movl 8(%ebp),%eax
+	movl %eax,U_SYSTEM_ARGC
+	movl 12(%ebp),%eax
+	movl %eax,U_SYSTEM_ARGV
+	movl (%eax),%edx
+	movl %edx,__progname
+	testl %edx,%edx
+	je .L2
+	pushl $47
+	movl __progname,%eax
+	pushl %eax
+	call _strrchr
+	addl $8,%esp
+	movl %eax,%eax
+	movl %eax,__progname
+	cmpl $0,__progname
+	jne .L3
+	movl 12(%ebp),%eax
+	movl (%eax),%edx
+	movl %edx,__progname
+	jmp .L2
+	.align 4
+.L3:
+	incl __progname
+.L4:
+.L2:
+	cmpl $0,28(%ebp)
+	je .L5
+	movl 28(%ebp),%eax
+	movl %eax,__ps_strings
+.L5:
+#	pushl $_fini
+#	call atexit
+#	addl $4,%esp
+#	call _init
+# copied from linux
+
+        finit                           /* initialize fpu */
+        fwait
+        fldcw   ___fpucw
+
+        xorl    %ebp,%ebp
+
+	call _main
+	pushl %eax
+	jmp  _haltproc
+
+.p2align 2,0x90
+.globl _haltproc
+.type _haltproc,@function
+
+_haltproc:
+           mov $1,%eax
+           movzwl U_SYSTEM_EXITCODE,%ebx
+           pushl %ebx
+           call _actualsyscall
+           addl  $4,%esp
+           jmp   _haltproc
+
+_actualsyscall:
+         int $0x80
+         jb .LErrorcode
+         xor %ebx,%ebx
+         ret
+.LErrorcode:
+         mov %eax,%ebx
+         mov $-1,%eax
+         ret
+        .p2align 2,0x90 	
+
+.Lfe1:
+	.size	 ___start,.Lfe1-___start
+	.align 4
+	.type	 _strrchr,@function
+_strrchr:
+	pushl %ebp
+	movl %esp,%ebp
+	subl $8,%esp
+	movl 12(%ebp),%eax
+	movb %al,-1(%ebp)
+	movl $0,-8(%ebp)
+	.align 4
+.L7:
+	movl 8(%ebp),%eax
+	movb (%eax),%dl
+	cmpb -1(%ebp),%dl
+	jne .L10
+	movl 8(%ebp),%eax
+	movl %eax,-8(%ebp)
+.L10:
+	movl 8(%ebp),%eax
+	cmpb $0,(%eax)
+	jne .L9
+	movl -8(%ebp),%edx
+	movl %edx,%eax
+	jmp .L6
+	.align 4
+.L11:
+.L9:
+	incl 8(%ebp)
+	jmp .L7
+	.align 4
+.L8:
+.L6:
+	leave
+	ret
+
+
+.Lfe2:
+	.size	 _strrchr,.Lfe2-_strrchr
+	.comm	environ,4,4
+
+# This section is needed for NetBSD to recognize a NetBSD binary as such.
+# otherwise it will be startup in Linux emulation mode.
+
+.section ".note.netbsd.ident","a"
+.p2align 2
+
+.long 7
+.long 4
+# ELF NOTE TYPE NETBSD TAG
+.long 1
+.ascii "NetBSD\0\0"
+.long 199905

+ 52 - 2
rtl/netbsd/ptypes.inc

@@ -52,11 +52,21 @@ type
     TPid     = pid_t;
     TPid     = pid_t;
     pPid     = ^pid_t;
     pPid     = ^pid_t;
 
 
+ {$ifdef CPU64}
+    size_t   = cuint64;
+{$else}
     size_t   = cuint32;         { as definied in the C standard}
     size_t   = cuint32;         { as definied in the C standard}
+{$endif}
     TSize    = size_t;
     TSize    = size_t;
     pSize    = ^size_t;
     pSize    = ^size_t;
+    pSize_t  = ^size_t;
+
+{$ifdef CPU64}
+    ssize_t  = cint64;          { used by function for returning number of bytes }
+{$else}
+    ssize_t  = cint32;          { used by function for returning number of bytes}
+{$endif}
 
 
-    ssize_t  = cint32;          { used by function for returning number of bytes }
     TsSize   = ssize_t;
     TsSize   = ssize_t;
     psSize   = ^ssize_t;
     psSize   = ^ssize_t;
 
 
@@ -77,6 +87,40 @@ type
     TSocklen = socklen_t;
     TSocklen = socklen_t;
     pSocklen = ^socklen_t;
     pSocklen = ^socklen_t;
 
 
+Const
+{$warning Check me, I'am from FreeBSD}
+    MNAMLEN   = 80;      // slightly machine specific.
+    MFSNamLen = 16;	
+type
+{$warning Check me, I'am from FreeBSD}
+    fsid_t  = array[0..1] of cint;
+    // Kernel statfs
+{$warning Check me, I'am from FreeBSD}
+    TStatfs = packed record
+      spare2,            { place holder}
+      bsize,             { fundamental block size}
+      iosize,            { optimal block size }
+      blocks,            {  total blocks}
+      bfree,             { blocks free}
+      bavail,            { block available for mortal users}
+      files,             { Total file nodes}
+      ffree          : clong ;    { file nodes free}
+      fsid           : fsid_t;
+      fowner         : tuid; {mounter uid}
+      ftype          : cint;
+      fflags         : cint; {copy of mount flags}
+      fsyncwrites,
+      fasyncwrites   : clong;
+      fstypename     : array[0..MFSNamLen-1] of char;
+      mountpoint     : array[0..MNAMLEN-1] of char;
+      fsyncreads,            { count of sync reads since mount }
+      fasyncreads    : clong;
+      fspares1       : cshort;
+      mnfromname     : array[0..MNAMLEN-1] of char;
+      fspares2       : cshort;
+      fspare3        : array[0..1] of clong;
+    end;
+    PStatFS=^TStatFS;
     timeval = packed record
     timeval = packed record
                 tv_sec,
                 tv_sec,
                 tv_usec : clong;
                 tv_usec : clong;
@@ -93,7 +137,7 @@ type
 
 
    pthread_t            = pointer;
    pthread_t            = pointer;
    pthread_attr_t       = pointer;
    pthread_attr_t       = pointer;
-   pthread_mutex_t      = {$ pmutext.inc}
+   pthread_mutex_t      = {$i pmutext.inc}
    pthread_mutexattr_t  = pointer;
    pthread_mutexattr_t  = pointer;
    pthread_cond_t       = pointer;
    pthread_cond_t       = pointer;
    pthread_condattr_t   = pointer;
    pthread_condattr_t   = pointer;
@@ -102,6 +146,8 @@ type
    pthread_rwlockattr_t = pointer;
    pthread_rwlockattr_t = pointer;
 
 
    sem_t                = pointer;
    sem_t                = pointer;
+   rlim_t		= int64;
+   TRlim		= rlim_t;
 
 
   {
   {
      Mutex types (Single UNIX Specification, Version 2, 1997).
      Mutex types (Single UNIX Specification, Version 2, 1997).
@@ -144,3 +190,7 @@ const
 
 
     SIG_MAXSIG      = 128;      // highest signal version
     SIG_MAXSIG      = 128;      // highest signal version
 
 
+    { For getting/setting priority }
+    Prio_Process = 0;
+    Prio_PGrp    = 1;
+    Prio_User    = 2;

+ 4 - 4
rtl/netbsd/signal.inc

@@ -126,13 +126,13 @@ type sigset_t = array[0..3] of cardinal;
   PSignalRestorer = ^SignalRestorer;
   PSignalRestorer = ^SignalRestorer;
 
 
 {$ifdef powerpc}
 {$ifdef powerpc}
-  TSigaction=  procedure(Sig: Longint); cdecl;
+  SigactionHandler =  procedure(Sig: Longint); cdecl;
 {$else}
 {$else}
 {$define BSDHandler}
 {$define BSDHandler}
 {$ifdef BSDHandler}
 {$ifdef BSDHandler}
-  TSigAction = procedure(Sig: Longint; code:longint;var SigContext: SigContextRec);cdecl;
+  SigActionHandler  = procedure(Sig: Longint; code:longint;var SigContext: SigContextRec);cdecl;
 {$else}
 {$else}
-  TSigAction = procedure(Sig: Longint; var sininfo:tsiginfo_t;var SigContext: SigContextRec);cdecl;
+  SigActionHandler  = procedure(Sig: Longint; var sininfo:tsiginfo_t;var SigContext: SigContextRec);cdecl;
 {$endif}
 {$endif}
 {$endif}
 {$endif}
 
 
@@ -142,7 +142,7 @@ type sigset_t = array[0..3] of cardinal;
 
 
   SigActionRec = packed record
   SigActionRec = packed record
 //    Handler  : record
 //    Handler  : record
-    sa_handler : TSigAction;
+    sa_handler : SigActionHandler;
 //      case byte of
 //      case byte of
 //        0: (Sh: SignalHandler);
 //        0: (Sh: SignalHandler);
 //        1: (Sa: TSigAction);
 //        1: (Sa: TSigAction);

+ 50 - 148
rtl/netbsd/unixsock.inc

@@ -6,7 +6,7 @@
    See the file COPYING.FPC, included in this distribution,
    See the file COPYING.FPC, included in this distribution,
    for details about the copyright.
    for details about the copyright.
 
 
-   socket call implementations for FreeBSD
+   socket call implementations for NetBSD
 
 
    This program is distributed in the hope that it will be useful,
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY;without even the implied warranty of
    but WITHOUT ANY WARRANTY;without even the implied warranty of
@@ -14,198 +14,100 @@
 }
 }
 
 
 
 
+
+{$warning Taken from FreeBSD, please check }
 {******************************************************************************
 {******************************************************************************
                           Basic Socket Functions
                           Basic Socket Functions
 ******************************************************************************}
 ******************************************************************************}
 
 
-Function socket(Domain,SocketType,Protocol:Longint):Longint;
-begin
-  Socket:=Do_Syscall(syscall_nr_socket,Domain,SocketType,Protocol);
-end;
-
-Function CloseSocket (Sock:Longint):Longint;
-begin
-  if fpclose(Sock)=0 then
-    CloseSocket := 0 else
-    CloseSocket := -1;
-end;
-
-Function Send(Sock:Longint;Const Buf;BufLen,Flags:Longint):Longint;
-begin
-  Send:=do_syscall(syscall_nr_sendto,Sock,Longint(@Buf),BufLen,Flags,0,0);
-end;
+function  fpsocket (domain:cint; xtype:cint; protocol: cint):cint;
+Begin
+  fpSocket:=Do_Syscall(syscall_nr_socket,Domain,xtype,Protocol);
+  socketerror:=fpgeterrno;
+End;
 
 
-Function SendTo(Sock:Longint;Const Buf;BufLen,Flags:Longint;Var Addr; AddrLen : Longint):Longint;
+function  fpsend (s:cint; msg:pointer; len:size_t; flags:cint):ssize_t;
 begin
 begin
-  Sendto:=do_syscall(syscall_nr_Sendto,Sock,Longint(@Buf),BufLen,Flags,Longint(@Addr),AddrLen);
+  fpSend:=do_syscall(syscall_nr_sendto,S,TSysParam(msg),Len,Flags,0,0);
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
-Function Recv(Sock:Longint;Var Buf;BufLen,Flags:Longint):Longint;
+function  fpsendto (s:cint; msg:pointer; len:size_t; flags:cint; tox :psockaddr; tolen: tsocklen):ssize_t;
 begin
 begin
-  Recv:=do_syscall(syscall_nr_Recvfrom,Sock,Longint(@Buf),BufLen,Flags,0,0);
+  fpSendto:=do_syscall(syscall_nr_sendto,S,TSysParam(msg),Len,Flags,TSysParam(tox),tolen);
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
-Function RecvFrom(Sock : Longint; Var Buf; Buflen,Flags : Longint; Var Addr ; AddrLen : Integer) : longint;
-
+function  fprecv (s:cint; buf: pointer; len: size_t; flags:cint):ssize_t;
 begin
 begin
-  RecvFrom:=do_syscall(syscall_nr_Recvfrom,Sock,Longint(@buf),buflen,flags,Longint(@Addr),AddrLen);
+  fpRecv:=do_syscall(syscall_nr_Recvfrom,S,tsysparam(buf),len,flags,0,0);
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
-Function Bind(Sock:Longint;Const Addr;AddrLen:Longint):Boolean;
+function  fprecvfrom (s:cint; buf: pointer; len: size_t; flags: cint; from : psockaddr; fromlen : psocklen):ssize_t;
 begin
 begin
-  Bind:=(do_syscall(syscall_nr_Bind,Sock,Longint(@Addr),AddrLen)=0);
+  fpRecvFrom:=do_syscall(syscall_nr_Recvfrom,S,TSysParam(buf),len,flags,TSysParam(from),TSysParam(fromlen));
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
-Function Listen(Sock,MaxConnect:Longint):Boolean;
+function  fpbind (s:cint; addrx : psockaddr; addrlen : tsocklen):cint;
 begin
 begin
-  Listen:=(do_syscall(syscall_nr_Listen,Sock,MaxConnect,0)=0);
+  fpBind:=do_syscall(syscall_nr_Bind,S,TSysParam(addrx),addrlen);
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
-Function Accept(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
-begin
-  Accept:=do_syscall(syscall_nr_accept,Sock,longint(@Addr),longint(@AddrLen));
-  If Accept<0 Then
-    Accept:=-1;
-end;
-
-Function Connect(Sock:Longint;Const Addr;Addrlen:Longint): boolean;
-
+function  fplisten (s:cint; backlog : cint):cint;
 begin
 begin
-  Connect:=do_syscall(syscall_nr_connect,Sock,longint(@Addr),AddrLen)=0;
+  fpListen:=do_syscall(syscall_nr_Listen,S,backlog);
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
-
-Function Shutdown(Sock:Longint;How:Longint):Longint;
+function  fpaccept (s:cint; addrx : psockaddr; addrlen : psocklen):cint;
 begin
 begin
-  ShutDown:=do_syscall(syscall_nr_shutdown,Sock,How);
+  fpAccept:=do_syscall(syscall_nr_accept,S,TSysParam(addrx),TSysParam(addrlen));
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
-
-Function GetSocketName(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
+function  fpconnect (s:cint; name  : psockaddr; namelen : tsocklen):cint;
 begin
 begin
-  GetSocketName:=do_syscall(syscall_nr_GetSockName,Sock,longint(@Addr),longint(@AddrLen));
+  fpConnect:=do_syscall(syscall_nr_connect,S,TSysParam(name),namelen);
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
-
-
-Function GetPeerName(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
+function  fpshutdown (s:cint; how:cint):cint;
 begin
 begin
-  GetPeerName:=do_syscall(syscall_nr_GetPeerName,Sock,longint(@Addr),longint(@AddrLen));
+  fpShutDown:=do_syscall(syscall_nr_shutdown,S,how);
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
-
-
-Function SetSocketOptions(Sock,Level,OptName:Longint;Const OptVal;optlen:longint):Longint;
+function  fpgetsockname (s:cint; name  : psockaddr; namelen : psocklen):cint;
 begin
 begin
-  SetSocketOptions:=do_syscall(syscall_nr_SetSockOpt,Sock,Level,OptName,Longint(@OptVal),OptLen,0);
+  fpGetSockName:=do_syscall(syscall_nr_GetSockName,S,TSysParam(name),TSysParam(namelen));
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
-
-
-Function GetSocketOptions(Sock,Level,OptName:Longint;Var OptVal;Var optlen:longint):Longint;
+function  fpgetpeername (s:cint; name  : psockaddr; namelen : psocklen):cint;
 begin
 begin
-  GetSocketOptions:=do_syscall(syscall_nr_GetSockOpt,Sock,Level,OptName,Longint(@OptVal),OptLen,0);
+  fpGetPeerName:=do_syscall(syscall_nr_GetPeerName,S,TSysParam(name),TSysParam(namelen));
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
-
-
-Function SocketPair(Domain,SocketType,Protocol:Longint;var Pair:TSockArray):Longint;
+function  fpsetsockopt  (s:cint; level:cint; optname:cint; optval:pointer; optlen : tsocklen):cint;
 begin
 begin
-  SocketPair:=do_syscall(syscall_nr_SocketPair,Domain,SocketType,Protocol,longint(@Pair),0,0);
+  fpSetSockOpt:=do_syscall(syscall_nr_SetSockOpt,S,level,optname,TSysParam(optval),optlen);
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
-{******************************************************************************
-                               UnixSock
-******************************************************************************}
-
-Procedure Str2UnixSockAddr(const addr:string;var t:TUnixSockAddr;var len:longint);
+function  fpgetsockopt  (s:cint; level:cint; optname:cint; optval:pointer; optlen : psocklen):cint;
 begin
 begin
-  Move(Addr[1],t.Path,length(Addr));
-  t.Family:=AF_UNIX;
-  t.Path[length(Addr)]:=#0;
-  Len:=Length(Addr)+3;
+  fpGetSockOpt:=do_syscall(syscall_nr_GetSockOpt,S,level,TSysParam(optname),TSysParam(optval),TSysParam(optlen));
+  socketerror:=fpgeterrno;
 end;
 end;
 
 
+function  fpsocketpair (d:cint; xtype:cint; protocol:cint; sv:pcint):cint;
 
 
-Function Bind(Sock:longint;const addr:string):boolean;
-var
-  UnixAddr : TUnixSockAddr;
-  AddrLen  : longint;
-begin
-  Str2UnixSockAddr(addr,UnixAddr,AddrLen);
-  Bind(Sock,UnixAddr,AddrLen);
-  Bind:=(SocketError=0);
-end;
-
-
-
-Function DoAccept(Sock:longint;var addr:string):longint;
-var
-  UnixAddr : TUnixSockAddr;
-  AddrLen  : longint;
-begin
-  AddrLen:=length(addr)+3;
-  DoAccept:=Accept(Sock,UnixAddr,AddrLen);
-  Move(UnixAddr.Path,Addr[1],AddrLen);
-  SetLength(Addr,AddrLen);
-end;
-
-
-
-Function DoConnect(Sock:longint;const addr:string):Boolean;
-var
-  UnixAddr : TUnixSockAddr;
-  AddrLen  : longint;
-begin
-  Str2UnixSockAddr(addr,UnixAddr,AddrLen);
-  DoConnect:=Connect(Sock,UnixAddr,AddrLen);
-end;
-
-Function Accept(Sock:longint;var addr:string;var SockIn,SockOut:text):Boolean;
-var
-  s : longint;
-begin
-  S:=DoAccept(Sock,addr);
-  if S>0 then
-   begin
-     Sock2Text(S,SockIn,SockOut);
-     Accept:=true;
-   end
-  else
-   Accept:=false;
-end;
-
-
-
-Function Accept(Sock:longint;var addr:string;var SockIn,SockOut:File):Boolean;
-var
-  s : longint;
-begin
-  S:=DoAccept(Sock,addr);
-  if S>0 then
-   begin
-     Sock2File(S,SockIn,SockOut);
-     Accept:=true;
-   end
-  else
-   Accept:=false;
-end;
-
-
-
-Function Connect(Sock:longint;const addr:string;var SockIn,SockOut:text):Boolean;
-begin
-  Connect:=DoConnect(Sock,addr);
-  If Connect then
-     Sock2Text(Sock,SockIn,SockOut);
-end;
-
-
-
-Function Connect(Sock:longint;const addr:string;var SockIn,SockOut:file):Boolean;
 begin
 begin
-  Connect:=DoConnect(Sock,addr);
-  if Connect then
-     Sock2File(Sock,SockIn,SockOut);
+  fpSocketPair:=do_syscall(syscall_nr_SocketPair,d,xtype,protocol,TSysParam(sv));
+  socketerror:=fpgeterrno;
 end;
 end;
 
 

+ 113 - 0
rtl/netbsd/unxconst.inc

@@ -0,0 +1,113 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by Michael Van Canneyt,
+    member of the Free Pascal development team.
+
+    Constants for Unix unit.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+
+{$warning taken from FreeBSD, please check and fix }
+
+const
+  { Things for LSEEK call}
+  Seek_set = 0;
+  Seek_Cur = 1;
+  Seek_End = 2;
+
+  { Things for OPEN call - after include/sys/fcntl.h,
+   BSD specifies these constants in hex }
+  Open_Accmode  = 3;
+  Open_RdOnly   = 0;
+  Open_WrOnly   = 1;
+  Open_RdWr     = 2;
+  Open_NonBlock = 4;
+  Open_Append   = 8;
+  Open_ShLock   = $10;
+  Open_ExLock   = $20;
+  Open_ASync    = $40;
+  Open_FSync    = $80;
+  Open_NoFollow = $100;
+  Open_Create   = $200;       {BSD convention}
+  Open_Creat    = $200;       {Linux convention}
+  Open_Trunc    = $400;
+  Open_Excl     = $800;
+  Open_NoCTTY   = $8000;
+
+  { The waitpid uses the following options:}
+  Wait_NoHang   = 1;
+  Wait_UnTraced = 2;
+  Wait_Any      = -1;
+  Wait_MyPGRP   = 0;
+
+
+  { Constants to check stat.mode -  checked all STAT constants with BSD}
+  STAT_IFMT   = $f000; {00170000 }
+  STAT_IFSOCK = $c000; {0140000 }
+  STAT_IFLNK  = $a000; {0120000 }
+  STAT_IFREG  = $8000; {0100000 }
+  STAT_IFBLK  = $6000; {0060000 }
+  STAT_IFDIR  = $4000; {0040000 }
+  STAT_IFCHR  = $2000; {0020000 }
+  STAT_IFIFO  = $1000; {0010000 }
+  STAT_ISUID  = $0800; {0004000 }
+  STAT_ISGID  = $0400; {0002000 }
+  STAT_ISVTX  = $0200; {0001000}
+  { Constants to check permissions all }
+  STAT_IRWXO = $7;
+  STAT_IROTH = $4;
+  STAT_IWOTH = $2;
+  STAT_IXOTH = $1;
+
+  STAT_IRWXG = STAT_IRWXO shl 3;
+  STAT_IRGRP = STAT_IROTH shl 3;
+  STAT_IWGRP = STAT_IWOTH shl 3;
+  STAT_IXGRP = STAT_IXOTH shl 3;
+
+  STAT_IRWXU = STAT_IRWXO shl 6;
+  STAT_IRUSR = STAT_IROTH shl 6;
+  STAT_IWUSR = STAT_IWOTH shl 6;
+  STAT_IXUSR = STAT_IXOTH shl 6;
+
+  { Constants to test the type of filesystem }
+  fs_old_ext2 = $ef51;
+  fs_ext2     = $ef53;
+  fs_ext      = $137d;
+  fs_iso      = $9660;
+  fs_minix    = $137f;
+  fs_minix_30 = $138f;
+  fs_minux_V2 = $2468;
+  fs_msdos    = $4d44;
+  fs_nfs      = $6969;
+  fs_proc     = $9fa0;
+  fs_xia      = $012FD16D;
+
+  {Constansts Termios/Ioctl (used in Do_IsDevice) }
+  IOCtl_TCGETS= $40000000+$2C7400+ 19; // TCGETS is also in termios.inc, but the sysunix needs only this
+
+  ITimer_Real    =0;
+  ITimer_Virtual =1;
+  ITimer_Prof    =2;
+
+{
+  {Checked for BSD using Linuxthreads port}
+  { cloning flags }
+  CSIGNAL       = $000000ff; // signal mask to be sent at exit
+  CLONE_VM      = $00000100; // set if VM shared between processes
+  CLONE_FS      = $00000200; // set if fs info shared between processes
+  CLONE_FILES   = $00000400; // set if open files shared between processes
+  CLONE_SIGHAND = $00000800; // set if signal handlers shared
+  CLONE_PID     = $00001000; // set if pid shared
+
+type
+ TCloneFunc=function(args:pointer):longint;cdecl;
+}
+

+ 68 - 0
rtl/netbsd/unxfunc.inc

@@ -0,0 +1,68 @@
+{
+   This file is part of the Free Pascal run time library.
+   Copyright (c) 2000 by Marco van de Voort
+     member of the Free Pascal development team.
+
+   See the file COPYING.FPC, included in this distribution,
+   for details about the copyright.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY;without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+
+{$ifndef HAS_LIBC_PIPING}
+Function PClose(Var F:file) : cint;
+var
+  pl : ^cint;
+  res : cint;
+begin
+  fpclose(filerec(F).Handle);
+{ closed our side, Now wait for the other - this appears to be needed ?? }
+  pl:=@(filerec(f).userdata[2]);
+  fpwaitpid(pl^,@res,0);
+  pclose:=res shr 8;
+end;
+
+
+Function PClose(Var F:text) :cint;
+var
+  pl  : pcint;
+  res : cint;
+begin
+  fpclose(Textrec(F).Handle);
+{ closed our side, Now wait for the other - this appears to be needed ?? }
+  pl:=@(textrec(f).userdata[2]);
+  fpwaitpid(pl^,@res,0);
+  pclose:=res shr 8;
+end;{$ENDIF}
+
+
+// can't have oldfpccall here, linux doesn't need it.
+Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
+{
+  Sets up a pair of file variables, which act as a pipe. The first one can
+  be read from, the second one can be written to.
+  If the operation was unsuccesful, linuxerror is set.
+}
+var
+  ret  : cint;
+  errn : cint;
+  {$ifdef FPC_USE_LIBC}
+   fdis : array[0..1] of cint;
+  {$endif}
+begin
+{$ifndef FPC_USE_LIBC}
+ ret:=intAssignPipe(pipe_in,pipe_out,errn);
+ if ret=-1 Then
+  fpseterrno(errn);
+{$ELSE}
+ fdis[0]:=pipe_in;
+ fdis[1]:=pipe_out;
+ ret:=pipe(fdis);
+ pipe_in:=fdis[0];
+ pipe_out:=fdis[1];
+{$ENDIF}
+ AssignPipe:=ret;
+end;

+ 275 - 0
rtl/netbsd/unxsockh.inc

@@ -0,0 +1,275 @@
+{
+   This file is part of the Free Pascal run time library.
+   (c) 2000-2003 by Marco van de Voort
+   member of the Free Pascal development team.
+
+   See the file COPYING.FPC, included in this distribution,
+   for details about the copyright.
+
+   OS dependant part of the header.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY;without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+}
+
+{$warning taken from FreeBSD, please check and fix }
+
+Const
+  AF_AX25         = 3;      { Amateur Radio AX.25          }
+  AF_IPX          = 4;      { Novell IPX                   }
+  AF_APPLETALK    = 5;      { Appletalk DDP                }
+  AF_NETROM       = 6;      { Amateur radio NetROM         }
+  AF_BRIDGE       = 7;       { Multiprotocol bridge         }
+  AF_AAL5         = 8;       { Reserved for Werner's ATM    }
+  AF_X25          = 9;       { Reserved for X.25 project    }
+  AF_INET6        = 10;      { IP version 6                 }
+  AF_MAX          = 12;
+
+  SOCK_PACKET     = 10;
+
+  PF_AX25         = AF_AX25;
+  PF_IPX          = AF_IPX;
+  PF_APPLETALK    = AF_APPLETALK;
+  PF_NETROM       = AF_NETROM;
+  PF_BRIDGE       = AF_BRIDGE;
+  PF_AAL5         = AF_AAL5;
+  PF_X25          = AF_X25;
+  PF_INET6        = AF_INET6;
+
+  PF_MAX          = AF_MAX;
+
+
+{ Maximum queue length specifiable by listen.  }
+  SOMAXCONN     = 128;
+
+        SOL_SOCKET 	 = $FFFF;
+        SO_DEBUG         = $0001;        { turn on debugging info recording }
+        SO_ACCEPTCONN    = $0002;        { socket has had listen() }
+        SO_REUSEADDR     = $0004;        { allow local address reuse }
+        SO_KEEPALIVE     = $0008;        { keep connections alive }
+        SO_DONTROUTE     = $0010;        { just use interface addresses }
+        SO_BROADCAST     = $0020;        { permit sending of broadcast msgs }
+        SO_USELOOPBACK   = $0040;        { bypass hardware when possible }
+        SO_LINGER        = $0080;        { linger on close if data present }
+        SO_OOBINLINE     = $0100;        { leave received OOB data in line }
+        SO_REUSEPORT     = $0200;        { allow local address & port reuse }
+        SO_TIMESTAMP     = $0400;        { timestamp received dgram traffic }
+
+{
+ * Additional options, not kept in so_options.
+ }
+        SO_SNDBUF        =$1001;        { send buffer size }
+        SO_RCVBUF        =$1002;        { receive buffer size }
+        SO_SNDLOWAT      =$1003;        { send low-water mark }
+        SO_RCVLOWAT      =$1004;        { receive low-water mark }
+        SO_SNDTIMEO      =$1005;        { send timeout }
+        SO_RCVTIMEO      =$1006;        { receive timeout }
+        SO_ERROR         =$1007;        { get error status and clear }
+        SO_TYPE          =$1008;        { get socket type }
+
+
+        SHUT_RD         =0;             { shut down the reading side }
+        SHUT_WR         =1;             { shut down the writing side }
+        SHUT_RDWR       =2;             { shut down both sides }
+
+	IPPROTO_IP              = 0;               { dummy for IP }
+	IPPROTO_ICMP            = 1;               { control message protocol }
+	IPPROTO_TCP             = 6;               { tcp }
+	IPPROTO_UDP             = 17;              { user datagram protocol }
+
+
+	IPPROTO_HOPOPTS		= 0 ; 		{ IP6 hop-by-hop options }
+	IPPROTO_IGMP		= 2 ; 		{ group mgmt protocol }
+	IPPROTO_GGP		= 3 ; 		{ gateway^2 (deprecated) }
+	IPPROTO_IPV4		= 4 ; 		{ IPv4 encapsulation }
+	IPPROTO_IPIP		= IPPROTO_IPV4;	{ for compatibility }
+	IPPROTO_ST		= 7 ; 		{ Stream protocol II }
+	IPPROTO_EGP		= 8 ; 		{ exterior gateway protocol }
+	IPPROTO_PIGP		= 9 ; 		{ private interior gateway }
+	IPPROTO_RCCMON		= 10; 		{ BBN RCC Monitoring }
+	IPPROTO_NVPII		= 11; 		{ network voice protocol}
+	IPPROTO_PUP		= 12; 		{ pup }
+	IPPROTO_ARGUS		= 13; 		{ Argus }
+	IPPROTO_EMCON		= 14; 		{ EMCON }
+	IPPROTO_XNET		= 15; 		{ Cross Net Debugger }
+	IPPROTO_CHAOS		= 16; 		{ Chaos}
+	IPPROTO_MUX		= 18; 		{ Multiplexing }
+	IPPROTO_MEAS		= 19; 		{ DCN Measurement Subsystems }
+	IPPROTO_HMP		= 20; 		{ Host Monitoring }
+	IPPROTO_PRM		= 21; 		{ Packet Radio Measurement }
+	IPPROTO_IDP		= 22; 		{ xns idp }
+	IPPROTO_TRUNK1		= 23; 		{ Trunk-1 }
+	IPPROTO_TRUNK2		= 24; 		{ Trunk-2 }
+	IPPROTO_LEAF1		= 25; 		{ Leaf-1 }
+	IPPROTO_LEAF2		= 26; 		{ Leaf-2 }
+	IPPROTO_RDP		= 27; 		{ Reliable Data }
+	IPPROTO_IRTP		= 28; 		{ Reliable Transaction }
+	IPPROTO_TP		= 29; 		{ tp-4 w/ class negotiation }
+	IPPROTO_BLT		= 30; 		{ Bulk Data Transfer }
+	IPPROTO_NSP		= 31; 		{ Network Services }
+	IPPROTO_INP		= 32; 		{ Merit Internodal }
+	IPPROTO_SEP		= 33; 		{ Sequential Exchange }
+	IPPROTO_3PC		= 34; 		{ Third Party Connect }
+	IPPROTO_IDPR		= 35; 		{ InterDomain Policy Routing }
+	IPPROTO_XTP		= 36; 		{ XTP }
+	IPPROTO_DDP		= 37; 		{ Datagram Delivery }
+	IPPROTO_CMTP		= 38; 		{ Control Message Transport }
+	IPPROTO_TPXX		= 39; 		{ TP++ Transport }
+	IPPROTO_IL		= 40; 		{ IL transport protocol }
+	IPPROTO_IPV6		= 41; 		{ IP6 header }
+	IPPROTO_SDRP		= 42; 		{ Source Demand Routing }
+	IPPROTO_ROUTING		= 43; 		{ IP6 routing header }
+	IPPROTO_FRAGMENT	= 44; 		{ IP6 fragmentation header }
+	IPPROTO_IDRP		= 45; 		{ InterDomain Routing}
+	IPPROTO_RSVP		= 46; 		{ resource reservation }
+	IPPROTO_GRE		= 47; 		{ General Routing Encap. }
+	IPPROTO_MHRP		= 48; 		{ Mobile Host Routing }
+	IPPROTO_BHA		= 49; 		{ BHA }
+	IPPROTO_ESP		= 50; 		{ IP6 Encap Sec. Payload }
+	IPPROTO_AH		= 51; 		{ IP6 Auth Header }
+	IPPROTO_INLSP		= 52; 		{ Integ. Net Layer Security }
+	IPPROTO_SWIPE		= 53; 		{ IP with encryption }
+	IPPROTO_NHRP		= 54; 		{ Next Hop Resolution }
+	IPPROTO_MOBILE		= 55; 		{ IP Mobility }
+	IPPROTO_TLSP		= 56; 		{ Transport Layer Security }
+	IPPROTO_SKIP		= 57; 		{ SKIP }
+	IPPROTO_ICMPV6		= 58; 		{ ICMP6 }
+	IPPROTO_NONE		= 59; 		{ IP6 no next header }
+	IPPROTO_DSTOPTS		= 60; 		{ IP6 destination option }
+	IPPROTO_AHIP		= 61; 		{ any host internal protocol }
+	IPPROTO_CFTP		= 62; 		{ CFTP }
+	IPPROTO_HELLO		= 63; 		{ "hello" routing protocol }
+	IPPROTO_SATEXPAK	= 64; 		{ SATNET/Backroom EXPAK }
+	IPPROTO_KRYPTOLAN	= 65; 		{ Kryptolan }
+	IPPROTO_RVD		= 66; 		{ Remote Virtual Disk }
+	IPPROTO_IPPC		= 67; 		{ Pluribus Packet Core }
+	IPPROTO_ADFS		= 68; 		{ Any distributed FS }
+	IPPROTO_SATMON		= 69; 		{ Satnet Monitoring }
+	IPPROTO_VISA		= 70; 		{ VISA Protocol }
+	IPPROTO_IPCV		= 71; 		{ Packet Core Utility }
+	IPPROTO_CPNX		= 72; 		{ Comp. Prot. Net. Executive }
+	IPPROTO_CPHB		= 73; 		{ Comp. Prot. HeartBeat }
+	IPPROTO_WSN		= 74; 		{ Wang Span Network }
+	IPPROTO_PVP		= 75; 		{ Packet Video Protocol }
+	IPPROTO_BRSATMON	= 76; 		{ BackRoom SATNET Monitoring }
+	IPPROTO_ND		= 77; 		{ Sun net disk proto (temp.) }
+	IPPROTO_WBMON		= 78; 		{ WIDEBAND Monitoring }
+	IPPROTO_WBEXPAK		= 79; 		{ WIDEBAND EXPAK }
+	IPPROTO_EON		= 80; 		{ ISO cnlp }
+	IPPROTO_VMTP		= 81; 		{ VMTP }
+	IPPROTO_SVMTP		= 82; 		{ Secure VMTP }
+	IPPROTO_VINES		= 83; 		{ Banyon VINES }
+	IPPROTO_TTP		= 84; 		{ TTP }
+	IPPROTO_IGP		= 85; 		{ NSFNET-IGP }
+	IPPROTO_DGP		= 86; 		{ dissimilar gateway prot. }
+	IPPROTO_TCF		= 87; 		{ TCF }
+	IPPROTO_IGRP		= 88; 		{ Cisco/GXS IGRP }
+	IPPROTO_OSPFIGP		= 89; 		{ OSPFIGP }
+	IPPROTO_SRPC		= 90; 		{ Strite RPC protocol }
+	IPPROTO_LARP		= 91; 		{ Locus Address Resoloution }
+	IPPROTO_MTP		= 92; 		{ Multicast Transport }
+	IPPROTO_AX25		= 93; 		{ AX.25 Frames }
+	IPPROTO_IPEIP		= 94; 		{ IP encapsulated in IP }
+	IPPROTO_MICP		= 95; 		{ Mobile Int.ing control }
+	IPPROTO_SCCSP		= 96; 		{ Semaphore Comm. security }
+	IPPROTO_ETHERIP		= 97; 		{ Ethernet IP encapsulation }
+	IPPROTO_ENCAP		= 98; 		{ encapsulation header }
+	IPPROTO_APES		= 99; 		{ any private encr. scheme }
+	IPPROTO_GMTP		= 100;		{ GMTP}
+	IPPROTO_IPCOMP		= 108;		{ payload compression (IPComp) }
+{ 101-254: Partly Unassigned }
+	IPPROTO_PIM		= 103;		{ Protocol Independent Mcast }
+	IPPROTO_CARP		= 112;		{ CARP }
+	IPPROTO_PGM		= 113;		{ PGM }
+	IPPROTO_PFSYNC		= 240;		{ PFSYNC }
+
+{ last return value of *_input(), meaning "all job for this pkt is done".  }
+	IPPROTO_RAW             = 255;
+	IPPROTO_MAX		= 256;
+	IPPROTO_DONE		= 257;
+
+{
+ * Options for use with [gs]etsockopt at the IP level.
+ * First word of comment is data type; bool is stored in int.
+ }
+	IP_OPTIONS		= 1 ;   { buf/ip_opts; set/get IP options }
+	IP_HDRINCL		= 2 ;   { int; header is included with data }
+	IP_TOS			= 3 ;   { int; IP type of service and preced. }
+	IP_TTL			= 4 ;   { int; IP time to live }
+	IP_RECVOPTS		= 5 ;   { bool; receive all IP opts w/dgram }
+	IP_RECVRETOPTS		= 6 ;   { bool; receive IP opts for response }
+	IP_RECVDSTADDR		= 7 ;   { bool; receive IP dst addr w/dgram }
+	IP_SENDSRCADDR		= IP_RECVDSTADDR; { cmsg_type to set src addr }
+	IP_RETOPTS		= 8 ;   { ip_opts; set/get IP options }
+	IP_MULTICAST_IF		= 9 ;   { u_char; set/get IP multicast i/f  }
+	IP_MULTICAST_TTL	= 10;   { u_char; set/get IP multicast ttl }
+	IP_MULTICAST_LOOP	= 11;   { u_char; set/get IP multicast loopback }
+	IP_ADD_MEMBERSHIP	= 12;   { ip_mreq; add an IP group membership }
+	IP_DROP_MEMBERSHIP	= 13;   { ip_mreq; drop an IP group membership }
+	IP_MULTICAST_VIF	= 14;   { set/get IP mcast virt. iface }
+	IP_RSVP_ON		= 15;   { enable RSVP in kernel }
+	IP_RSVP_OFF		= 16;   { disable RSVP in kernel }
+	IP_RSVP_VIF_ON		= 17;   { set RSVP per-vif socket }
+	IP_RSVP_VIF_OFF		= 18;   { unset RSVP per-vif socket }
+	IP_PORTRANGE		= 19;   { int; range to choose for unspec port }
+	IP_RECVIF		= 20;   { bool; receive reception if w/dgram }
+
+{ for IPSEC }
+	IP_IPSEC_POLICY		= 21;   { int; set/get security policy }
+	IP_FAITH		= 22;   { bool; accept FAITH'ed connections }
+
+	IP_ONESBCAST		= 23;   { bool: send all-ones broadcast }
+
+	IP_FW_TABLE_ADD		= 40;   { add entry }
+	IP_FW_TABLE_DEL		= 41;   { delete entry }
+	IP_FW_TABLE_FLUSH	= 42;   { flush table }
+	IP_FW_TABLE_GETSIZE	= 43;   { get table size }
+	IP_FW_TABLE_LIST	= 44;   { list table contents }
+
+	IP_FW_ADD		= 50;   { add a firewall rule to chain }
+	IP_FW_DEL		= 51;   { delete a firewall rule from chain }
+	IP_FW_FLUSH		= 52;   { flush firewall rule chain }
+	IP_FW_ZERO		= 53;   { clear single/all firewall counter(s) }
+	IP_FW_GET		= 54;   { get entire firewall rule chain }
+	IP_FW_RESETLOG		= 55;   { reset logging counters }
+
+	IP_DUMMYNET_CONFIGURE	= 60;   { add/configure a dummynet pipe }
+	IP_DUMMYNET_DEL		= 61;   { delete a dummynet pipe from chain }
+	IP_DUMMYNET_FLUSH	= 62;   { flush dummynet }
+	IP_DUMMYNET_GET		= 64;   { get entire dummynet pipes }
+
+	IP_RECVTTL		= 65;   { bool; receive IP TTL w/dgram }
+
+	IPV6_SOCKOPT_RESERVED1	= 3 ; { reserved for future use }
+	IPV6_UNICAST_HOPS	= 4 ; { int; IP6 hops }
+	IPV6_MULTICAST_IF	= 9 ; { u_int; setget IP6 multicast if  }
+	IPV6_MULTICAST_HOPS	= 10; { int; setget IP6 multicast hops }
+	IPV6_MULTICAST_LOOP	= 11; { u_int; setget IP6 multicast loopback }
+	IPV6_JOIN_GROUP		= 12; { ip6_mreq; join a group membership }
+	IPV6_LEAVE_GROUP	= 13; { ip6_mreq; leave a group membership }
+	IPV6_PORTRANGE		= 14; { int; range to choose for unspec port }
+
+	IPV6_PKTINFO            = 46; { in6_pktinfo; send if, src addr }	
+ 	IPV6_HOPLIMIT           = 47; { int; send hop limit }
+ 	IPV6_NEXTHOP            = 48; { sockaddr; next hop addr }
+ 	IPV6_HOPOPTS            = 49; { ip6_hbh; send hop-by-hop option }
+ 	IPV6_DSTOPTS            = 50; { ip6_dest; send dst option befor rthdr }
+ 	IPV6_RTHDR              = 51; { ip6_rthdr; send routing header }
+ 	IPV6_PKTOPTIONS         = 52; { buf/cmsghdr; set/get IPv6 options }
+
+  { Flags for send, recv etc. }
+  MSG_OOB       = $0001;              { Process out-of-band data}
+  MSG_PEEK      = $0002;              { Peek at incoming messages }
+  MSG_DONTROUTE = $0004;              { Don't use local routing }
+  MSG_EOR       = $0008;              { End of record }
+  MSG_TRUNC     = $0010;
+  MSG_CTRUNC    = $0020;              { Control data lost before delivery }
+  MSG_WAITALL   = $0040;              { Wait for a full request }
+  MSG_DONTWAIT  = $0080;              { Non-blocking I/O }
+  MSG_EOF       = $0100;
+  MSG_NBIO      = $4000;
+  MSG_COMPAT    = $8000;
+  MSG_SOCALLBCK = $10000;
+  MSG_NOSIGNAL  = $20000;              { Do not generate SIGPIPE }
+

+ 6 - 53
rtl/netbsd/unixsysc.inc → rtl/netbsd/unxsysc.inc

@@ -68,10 +68,10 @@ begin
   fsync:=do_syscall(syscall_nr_fsync,fd);
   fsync:=do_syscall(syscall_nr_fsync,fd);
 end;
 end;
 
 
-Function  Flock (fd,mode : longint) : cint;
+Function  fpFlock (fd,mode : longint) : cint;
 
 
 begin
 begin
- Flock:=do_syscall(syscall_nr_flock,fd,mode);
+ fpFlock:=do_syscall(syscall_nr_flock,fd,mode);
 end;
 end;
 
 
 Function fStatFS(Fd:Longint;Var Info:tstatfs):cint;
 Function fStatFS(Fd:Longint;Var Info:tstatfs):cint;
@@ -128,6 +128,7 @@ begin
 end;
 end;
 
 
 
 
+{
 Function PClose(Var F:text) :cint;
 Function PClose(Var F:text) :cint;
 var
 var
   pl  : ^longint;
   pl  : ^longint;
@@ -153,6 +154,7 @@ begin
   fpwaitpid(pl^,@res,0);
   fpwaitpid(pl^,@res,0);
   pclose:=res shr 8;
   pclose:=res shr 8;
 end;
 end;
+}
 
 
 function MUnMap (P : Pointer; Size : size_t) : cint;
 function MUnMap (P : Pointer; Size : size_t) : cint;
 
 
@@ -161,60 +163,11 @@ begin
 end;
 end;
 {$else}
 {$else}
 
 
-Function PClose(Var F:file) : cint;
-var
-  pl : ^cint;
-  res : cint;
-
-begin
-  fpclose(filerec(F).Handle);
-{ closed our side, Now wait for the other - this appears to be needed ?? }
-  pl:=@(filerec(f).userdata[2]);
-  fpwaitpid(pl^,@res,0);
-  pclose:=res shr 8;
-end;
-
-Function PClose(Var F:text) :cint;
-var
-  pl  : ^longint;
-  res : longint;
+{
 
 
-begin
-  fpclose(Textrec(F).Handle);
-{ closed our side, Now wait for the other - this appears to be needed ?? }
-  pl:=@(textrec(f).userdata[2]);
-  fpwaitpid(pl^,@res,0);
-  pclose:=res shr 8;
-end;
+}
 
 
 {$endif}
 {$endif}
-// can't have oldfpccall here, linux doesn't need it.
-Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
-{
-  Sets up a pair of file variables, which act as a pipe. The first one can
-  be read from, the second one can be written to.
-  If the operation was unsuccesful, linuxerror is set.
-}
-var
-  ret  : longint;
-  errn : cint;
-  {$ifdef FPC_USE_LIBC}
-   fdis : array[0..1] of cint;
-  {$endif}
-begin
-{$ifndef FPC_USE_LIBC}
- ret:=intAssignPipe(pipe_in,pipe_out,errn);
- if ret=-1 Then
-  fpseterrno(errn);
-{$ELSE}
- fdis[0]:=pipe_in;
- fdis[1]:=pipe_out;
- ret:=pipe(fdis);
- pipe_in:=fdis[0];
- pipe_out:=fdis[1];
-{$ENDIF}
- AssignPipe:=ret;
-end;
 
 
 
 
 {
 {

+ 1 - 1
rtl/unix/ipc.pp

@@ -39,7 +39,7 @@ Type
 Const
 Const
   { IPC flags for get calls }
   { IPC flags for get calls }
 
 
-{$ifdef FreeBSD}  // BSD_VISIBLE
+{$if defined(FreeBSD) or defined(NetBSD)}  // BSD_VISIBLE
   IPC_R      =  4 shl 6;
   IPC_R      =  4 shl 6;
   IPC_W      =  2 shl 6;
   IPC_W      =  2 shl 6;
   IPC_M      =  2 shl 12;
   IPC_M      =  2 shl 12;