浏览代码

Merged revisions 2518-2520,2528-2529,2531-2533,2593,2601,2605-2607,2623-2624,2628,2632-2634,2645-2646,2648,2654,2656,2665,2675,2681,2687-2688 via svnmerge from
http://[email protected]/svn/fpc/trunk

........
r2518 | marco | 2006-02-11 20:12:08 +0100 (Sat, 11 Feb 2006) | 2 lines

* Kqueue syscalls

........
r2519 | marco | 2006-02-11 21:02:13 +0100 (Sat, 11 Feb 2006) | 2 lines

* Initial implementation based on an implementation of Ales Katona.

........
r2520 | marco | 2006-02-11 21:02:40 +0100 (Sat, 11 Feb 2006) | 2 lines

* BSD unit added.

........
r2528 | marco | 2006-02-12 15:00:46 +0100 (Sun, 12 Feb 2006) | 2 lines

* iovec

........
r2529 | marco | 2006-02-12 15:12:15 +0100 (Sun, 12 Feb 2006) | 2 lines

* little fixes related to KQueue and Sendfile

........
r2531 | marco | 2006-02-12 15:34:04 +0100 (Sun, 12 Feb 2006) | 2 lines

* sendfile support FreeBSD fpc_use_libc etc

........
r2532 | marco | 2006-02-12 15:35:19 +0100 (Sun, 12 Feb 2006) | 2 lines

* sendfile call

........
r2533 | marco | 2006-02-12 15:50:51 +0100 (Sun, 12 Feb 2006) | 2 lines

* unit freebsd added

........
r2593 | jonas | 2006-02-15 12:48:26 +0100 (Wed, 15 Feb 2006) | 2 lines

* ifdef powerpc -> ifdef cpupowerpc

........
r2601 | marco | 2006-02-15 23:02:22 +0100 (Wed, 15 Feb 2006) | 2 lines

* fix for 4800

........
r2605 | daniel | 2006-02-16 00:43:27 +0100 (Thu, 16 Feb 2006) | 2 lines

* Faster and more compact integer str routines

........
r2606 | daniel | 2006-02-16 01:18:21 +0100 (Thu, 16 Feb 2006) | 2 lines

* It could be done even better.

........
r2607 | daniel | 2006-02-16 09:03:13 +0100 (Thu, 16 Feb 2006) | 2 lines

* var back to out

........
r2623 | marco | 2006-02-18 22:20:12 +0100 (Sat, 18 Feb 2006) | 2 lines

* Some TCP/IP constants added (for indy use)

........
r2624 | marco | 2006-02-18 22:36:11 +0100 (Sat, 18 Feb 2006) | 2 lines

* added fptimes which was already imported in the syscall port

........
r2628 | florian | 2006-02-19 15:37:48 +0100 (Sun, 19 Feb 2006) | 2 lines

* improved SetLength(<ansistring>,...);

........
r2632 | florian | 2006-02-19 16:48:15 +0100 (Sun, 19 Feb 2006) | 2 lines

* improved exception handling code

........
r2633 | florian | 2006-02-19 17:59:03 +0100 (Sun, 19 Feb 2006) | 2 lines

* small speed improvements

........
r2634 | florian | 2006-02-19 17:59:19 +0100 (Sun, 19 Feb 2006) | 2 lines

* small speed improvements

........
r2645 | peter | 2006-02-20 09:22:27 +0100 (Mon, 20 Feb 2006) | 2 lines

* fixed base

........
r2646 | peter | 2006-02-20 09:31:20 +0100 (Mon, 20 Feb 2006) | 3 lines

* faster int_str
* removed i386 int_str since the generic implementation is faster

........
r2648 | peter | 2006-02-20 11:37:42 +0100 (Mon, 20 Feb 2006) | 2 lines

* nostackframe directives

........
r2654 | peter | 2006-02-20 12:24:38 +0100 (Mon, 20 Feb 2006) | 2 lines

* fixed uninitialized var

........
r2656 | vincents | 2006-02-20 14:23:15 +0100 (Mon, 20 Feb 2006) | 1 line

fixed typo in comment
........
r2665 | vincents | 2006-02-22 23:28:56 +0100 (Wed, 22 Feb 2006) | 1 line

fixed TStrings.Assign from MvC
........
r2675 | peter | 2006-02-24 12:13:46 +0100 (Fri, 24 Feb 2006) | 2 lines

* stkptr is global

........
r2681 | florian | 2006-02-25 19:50:42 +0100 (Sat, 25 Feb 2006) | 1 line

+ from Martin Smat: adds hbmpItem into the record MENUITEMINFO and defines constant MIIM_BITMAP
........
r2687 | marco | 2006-02-26 01:51:19 +0100 (Sun, 26 Feb 2006) | 2 lines

* socketerror

........
r2688 | marco | 2006-02-26 01:53:11 +0100 (Sun, 26 Feb 2006) | 2 lines

* fixed sinlen

........

git-svn-id: branches/fixes_2_0@2796 -

peter 19 年之前
父节点
当前提交
6ef9b6257f

+ 2 - 0
.gitattributes

@@ -3425,6 +3425,7 @@ rtl/beos/sysfiles.inc svneol=native#text/plain
 rtl/beos/system.pp svneol=native#text/plain
 rtl/beos/sysutils.pp svneol=native#text/plain
 rtl/beos/timezone.inc svneol=native#text/plain
+rtl/bsd/bsd.pas -text
 rtl/bsd/bunxfunch.inc svneol=native#text/plain
 rtl/bsd/bunxsysc.inc svneol=native#text/plain
 rtl/bsd/i386/syscall.inc svneol=native#text/plain
@@ -3496,6 +3497,7 @@ rtl/freebsd/bsdport.txt svneol=native#text/plain
 rtl/freebsd/console.pp svneol=native#text/plain
 rtl/freebsd/errno.inc svneol=native#text/plain
 rtl/freebsd/errnostr.inc -text
+rtl/freebsd/freebsd.pas -text
 rtl/freebsd/i386/bsyscall.inc svneol=native#text/plain
 rtl/freebsd/i386/cprt0.as -text
 rtl/freebsd/i386/gprt0.as -text

+ 1 - 1
packages/extra/winunits/jwatlhelp32.pas

@@ -352,7 +352,7 @@ const
   {$IFDEF UNICODE}
   AWSuffix = 'W';
   {$ELSE}
-  AWSuffix = 'A';
+  AWSuffix = '';
   {$ENDIF UNICODE}
 
 {$IFDEF DYNAMIC_LINK}

+ 143 - 0
rtl/bsd/bsd.pas

@@ -0,0 +1,143 @@
+Unit BSD;
+{
+   This file is part of the Free Pascal run time library.
+   (c) 2005 by Marco van de Voort member of the 
+   Free Pascal development team.
+   Original kqueue implementation converted by Ales Katona 30.01.2006
+
+   See the file COPYING.FPC, included in this distribution,
+   for details about the copyright.
+
+   This unit is meant to contain all BSD specific routines. Not all
+   routines might be implemented on all BSD platforms. 
+ 
+   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.
+}
+
+{$IFDEF FPC}
+  {$PACKRECORDS C}
+  {$Inline On}
+  {$Macro On}
+  {$ifdef FPC_USE_LIBC}
+  {$define directives:=cdecl; external 'c';}
+  {$else}
+  {$define directives:=inline;}
+  {$endif}
+{$ENDIF}
+
+interface
+
+uses
+  {$IFDEF FPC_USE_LIBC} initc, {$endif}
+  Unix;
+
+const
+  EVFILT_READ     = -1;
+  EVFILT_WRITE    = -2;
+  EVFILT_AIO      = -3;  { attached to aio requests }
+  EVFILT_VNODE    = -4;  { attached to vnodes }
+  EVFILT_PROC     = -5;  { attached to struct proc }
+  EVFILT_SIGNAL   = -6;  { attached to struct proc }
+  EVFILT_TIMER    = -7;  { timers }
+  EVFILT_NETDEV   = -8;  { network devices }
+  EVFILT_FS       = -9;  { filesystem events }
+
+  EVFILT_SYSCOUNT = 9;
+
+  EV_ADD          = $0001;  { add event to kq }
+  EV_DELETE       = $0002;  { delete event from kq  }
+  EV_ENABLE       = $0004;  { enable event  }
+  EV_DISABLE      = $0008;  { disable event (not reported)  }
+  
+{ flags  }
+  EV_ONESHOT      = $0010;  { only report one occurrence  }
+  EV_CLEAR        = $0020;  { clear event state after reporting  }
+  EV_SYSFLAGS     = $F000;  { reserved by system  }
+  EV_FLAG1        = $2000;  { filter-specific flag  }
+  
+{ returned values  }
+  EV_EOF          = $8000;  { EOF detected  }
+  EV_ERROR        = $4000;  { error, data contains errno  }
+  
+{ data/hint flags for EVFILT_READ|WRITE, shared with userspace   }
+  NOTE_LOWAT      = $0001;  { low water mark  }
+  
+{ data/hint flags for EVFILT_VNODE, shared with userspace  }
+  NOTE_DELETE     = $0001;  { vnode was removed  }
+  NOTE_WRITE      = $0002;  { data contents changed  }
+  NOTE_EXTEND     = $0004;  { size increased  }
+  NOTE_ATTRIB     = $0008;  { attributes changed  }
+  NOTE_LINK       = $0010;  { link count changed  }
+  NOTE_RENAME     = $0020;  { vnode was renamed  }
+  NOTE_REVOKE     = $0040;  { vnode access was revoked  }
+  
+{ data/hint flags for EVFILT_PROC, shared with userspace   }
+  NOTE_EXIT       = $80000000;  { process exited  }
+  NOTE_FORK       = $40000000;  { process forked  }
+  NOTE_EXEC       = $20000000;  { process exec'd  }
+  NOTE_PCTRLMASK  = $f0000000;  { mask for hint bits  }
+  NOTE_PDATAMASK  = $000fffff;  { mask for pid  }
+  
+{ additional flags for EVFILT_PROC  }
+  NOTE_TRACK      = $00000001;  { follow across forks  }
+  NOTE_TRACKERR   = $00000002;  { could not track child  }
+  NOTE_CHILD      = $00000004;  { am a child process  }
+  
+{ data/hint flags for EVFILT_NETDEV, shared with userspace  }
+  NOTE_LINKUP     = $0001;  { link is up  }
+  NOTE_LINKDOWN   = $0002;  { link is down  }
+  NOTE_LINKINV    = $0004;  { link state is invalid  }
+
+type
+  PKEvent = ^TKEvent;
+  TKEvent = record
+    Ident  : cuint;      { identifier for this event }
+    Filter : cshort;     { filter for event }
+    Flags  : cushort;
+    FFlags : cuint;
+    Data   : cint;
+    uData  : Pointer;    { opaque user data identifier }
+  end;
+
+function kqueue: cint; directives
+  
+function kevent(kq: cint; ChangeList: PKEvent; nChanged: cint;
+                  EventList: PKevent; nEvents: cint; Timeout: PTimeSpec): cint; directives
+
+procedure EV_SET(kevp: PKEvent; const aIdent: cuint; const aFilter: cshort;
+                   const aFlags: cushort; const aFFlags: cuint;
+                   const aData: cint; const auData: Pointer);  inline;
+
+implementation
+
+uses
+  SysCall;
+
+procedure EV_SET(kevp: PKEvent; const aIdent: cuint; const aFilter: cshort; const aFlags: cushort;
+                                const aFFlags: cuint; const aData: cint; const auData: Pointer); inline;
+begin
+  kevp^.Ident  := aIdent;
+  kevp^.Filter := aFilter;
+  kevp^.Flags  := aFlags;
+  kevp^.FFlags := aFFlags;
+  kevp^.Data   := aData;
+  kevp^.uData  := auData;
+end;
+
+{$ifndef FPC_USE_LIBC}
+function KQueue: cint; inline;
+begin
+  KQueue:=Do_SysCall(syscall_nr_kqueue);
+end;
+
+function KEvent(kq: cint; ChangeList: PKEvent; nChanged: cint;
+                EventList: PKevent; nEvents: cint; Timeout: PTimeSpec): cint; inline;
+begin
+  KEvent:=Do_SysCall(syscall_nr_kevent, kq, TSysParam(ChangeList), nChanged,
+                     TSysParam(EventList), nEvents, TSysParam(Timeout));
+end;
+{$ENDIF}
+
+end.

+ 8 - 1
rtl/bsd/ostypes.inc

@@ -281,7 +281,14 @@ Type
           	     rlim_max : TRLim;     { maximum value for rlim_cur }
 		    end;	
         PRLimit  = ^TRLimit;
-       
+      
+  iovec = record
+            iov_base : pointer;
+	    iov_len  : size_t;
+	   end;
+  tiovec=iovec;
+  piovec=^tiovec;		
+ 
 CONST
  { Constansts for MMAP }
   MAP_PRIVATE   =2;

+ 148 - 0
rtl/darwin/unxsockh.inc

@@ -67,6 +67,154 @@ Const
         SHUT_WR         =1;             { shut down the writing side }
         SHUT_RDWR       =2;             { shut down both sides }
 
+      	IPPROTO_IP		= 0;		{ dummy for IP }
+      	IPPROTO_HOPOPTS		= 0;		{ IP6 hop-by-hop options }
+      	IPPROTO_ICMP		= 1;		{ control message protocol }
+      	IPPROTO_IGMP		= 2;		{ group mgmt protocol }
+      	IPPROTO_GGP		= 3;		{ gateway^2 (deprecated) }
+        IPPROTO_IPV4		= 4; 		{ IPv4 encapsulation }
+        IPPROTO_IPIP		= IPPROTO_IPV4;	{ for compatibility }
+      	IPPROTO_TCP		= 6;		{ tcp }
+      	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_UDP		= 17;		{ user datagram protocol }
+      	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 }
+{ 55-57: Unassigned }               
+       	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_PGM		=113;		{ PGM }
+{ 255: Reserved }		    
+{ BSD Private, local use, namespace incursion }
+      	IPPROTO_DIVERT		=254;		{ divert pseudo-protocol }
+      	IPPROTO_RAW		=255;		{ raw IP packet }
 
+      	IPPROTO_MAX		=256;
 
+      	IPPROTO_DONE		=257;
 
+        IPV6_OPTIONS		= 1;  { buf/ip6_opts; set/get IP6 options }
+        IPV6_RECVOPTS		= 5;  { bool; receive all IP6 opts w/dgram }
+        IPV6_RECVRETOPTS	= 6;  { bool; receive IP6 opts for response }
+        IPV6_RECVDSTADDR	= 7;  { bool; receive IP6 dst addr w/dgram }
+        IPV6_RETOPTS		= 8;  { ip6_opts; set/get IP6 options }
+        IPV6_SOCKOPT_RESERVED1	= 3;  { reserved for future use }
+        IPV6_UNICAST_HOPS	= 4;  { int; IP6 hops }
+        IPV6_MULTICAST_IF	= 9;  { __uint8_t; set/get IP6 multicast i/f  }
+        IPV6_MULTICAST_HOPS	=10; { __uint8_t; set/get IP6 multicast hops }
+        IPV6_MULTICAST_LOOP	=11; { __uint8_t; set/get IP6 mcast 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 }
+        ICMP6_FILTER		=18; { icmp6_filter; icmp6 filter }
+        IPV6_PKTINFO		=19; { bool; send/recv if, src/dst addr }
+        IPV6_HOPLIMIT		=20; { bool; hop limit }
+        IPV6_NEXTHOP		=21; { bool; next hop addr }
+        IPV6_HOPOPTS		=22; { bool; hop-by-hop option }
+        IPV6_DSTOPTS		=23; { bool; destination option }
+        IPV6_RTHDR		=24; { bool; routing header }
+        IPV6_PKTOPTIONS		=25; { buf/cmsghdr; set/get IPv6 options }
+        IPV6_CHECKSUM		=26; { int; checksum offset for raw socket }
+        IPV6_V6ONLY		=27; { bool; only bind INET6 at wildcard bind }
+        IPV6_BINDV6ONLY		=IPV6_V6ONLY;
+        IPV6_IPSEC_POLICY	=28; { struct; get/set security policy }
+      	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_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 }

+ 55 - 40
rtl/freebsd/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/02/06]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/02/13]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince powerpc64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince powerpc64-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
@@ -260,118 +260,121 @@ override FPCOPT+=-Ur
 endif
 OBJPASDIR=$(RTL)/objpas
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconsts initc cmem matrix dl termio  printer sysutils varutils math variants typinfo types classes   dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo bsd freebsd video mouse keyboard console serial dateutils sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_LOADERS+=prt0 cprt0 gprt0
@@ -409,6 +412,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override TARGET_LOADERS+=prt0 cprt0 gprt0
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_LOADERS+=prt0 cprt0 gprt0
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override TARGET_LOADERS+=prt0 cprt0 gprt0
 endif
@@ -523,6 +529,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils sysconst fpmkunit
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_RSTS+=math varutils typinfo classes variants dateutils sysconst fpmkunit
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils sysconst fpmkunit
 endif
@@ -638,6 +647,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
 endif
@@ -752,6 +764,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(COMMON)
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(COMMON)
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(COMMON)
 endif

+ 1 - 1
rtl/freebsd/Makefile.fpc

@@ -15,7 +15,7 @@ units=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseun
        dl termio  printer \
       sysutils varutils math variants typinfo types classes   dynlibs \
       $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo \
-      errors sockets ipc terminfo \
+      errors sockets ipc terminfo bsd freebsd \
       video mouse keyboard console serial dateutils \
       sysconst cthreads strutils convutils dos objects cwstring fpmkunit
 

+ 75 - 0
rtl/freebsd/freebsd.pas

@@ -0,0 +1,75 @@
+Unit FreeBSD;
+{
+   This file is part of the Free Pascal run time library.
+   (c) 2005 by Marco van de Voort
+   member of the Free Pascal development team.
+   based on the sendfile conversion of Ales Katona 30.01.2006
+
+   See the file COPYING.FPC, included in this distribution,
+   for details about the copyright.
+
+   Unit for FreeBSD specific calls. Calls may move to "BSD" unit in time,
+   if turns out that more BSDs include them. 
+   
+   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.
+}
+
+{$IFDEF FPC}
+  {$PACKRECORDS C}
+  {$inline on}
+  {$Macro On}
+  {$ifdef FPC_USE_LIBC}
+     {$define directives:=cdecl; external 'c';}
+  {$else}
+     {$define directives:=inline;}
+  {$endif}
+{$ENDIF}
+              
+interface
+
+uses
+  BaseUnix,Unix;
+
+const
+  SF_NODISKIO = $00000001;  // don't wait for disk IO, similar to non-blocking socket setting
+
+Type  
+  SF_HDTR = record
+    headers: PIOVec;   //* pointer to an array of header struct iovec's */
+    hdr_cnt: cint;         //* number of header iovec's */
+    trailers: PIOVec;     //* pointer to an array of trailer struct iovec's */
+    trl_cnt: cint;           //* number of trailer iovec's */
+  end;
+  TSF_HDTR = SF_HDTR; 
+  PSF_HDTR = ^TSF_HDTR;
+
+function sendfile(fd: cint; s: cint; Offset: TOff; nBytes: TSize;
+                    HDTR: PSF_HDTR; sBytes: POff; Flags: cint): cint; directives
+
+implementation
+
+Uses
+{$ifndef FPC_USE_LIBC}  SysCall; {$else} InitC; {$endif}
+
+{$IFNDEF FPC_USE_LIBC}  
+function SendFile(fd: cint; s: cint; Offset: TOff; nBytes: TSize;
+                  HDTR: PSF_HDTR; sBytes: POff; Flags: cint): cint;
+begin
+
+  SendFile:=Do_Syscall(syscall_nr_sendfile, fd, s, 
+ {$IFNDEF CPU64} 
+   {$IFDEF LITTLE_ENDIAN} // little endian is lo - hi
+      Lo(Offset), Hi(Offset), 
+   {$ELSE}  	          // big endian is hi - lo
+      Hi(Offset), Lo(Offset), 
+   {$ENDIF}
+ {$ELSE}  // 64-bit doesn't care. 
+    TSysParam(Offset),
+ {$ENDIF}
+    nBytes, TSysParam(HDTR), TSysParam(sBytes), Flags);
+end;
+{$ENDIF}
+
+end.

+ 5 - 2
rtl/freebsd/sysnr.inc

@@ -313,6 +313,9 @@ syscall_nr_getdirentries                =196;
  syscall_nr_getsockopt                  = 118;
  syscall_nr_rfork                       = 251;
  syscall_nr_nanosleep                   = 240;
- syscall_nr_getrusage                   =117;
- syscall_nr_uuidgen			=392; { 5.x+}
+ syscall_nr_getrusage                   = 117;
+ syscall_nr_uuidgen			= 392; { 5.x+}
+ syscall_nr_kqueue 			= 362;
+ syscall_nr_kevent 			= 363;
+ syscall_nr_sendfile 			= 393;
 

+ 47 - 140
rtl/i386/i386.inc

@@ -895,14 +895,14 @@ function fpc_pchar_length(p:pchar):longint;assembler;[public,alias:'FPC_PCHAR_LE
 
 
 {$define FPC_SYSTEM_HAS_GET_FRAME}
-function get_frame:pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
+function get_frame:pointer;assembler;nostackframe;{$ifdef SYSTEMINLINE}inline;{$endif}
 asm
         movl    %ebp,%eax
 end ['EAX'];
 
 
 {$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
-function get_caller_addr(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
+function get_caller_addr(framebp:pointer):pointer;nostackframe;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
 asm
 {$ifndef REGCALL}
         movl    framebp,%eax
@@ -915,7 +915,7 @@ end ['EAX'];
 
 
 {$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
-function get_caller_frame(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
+function get_caller_frame(framebp:pointer):pointer;nostackframe;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
 asm
 {$ifndef REGCALL}
         movl    framebp,%eax
@@ -932,7 +932,7 @@ end ['EAX'];
 ****************************************************************************}
 
 {$define FPC_SYSTEM_HAS_ABS_LONGINT}
-function abs(l:longint):longint; assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
+function abs(l:longint):longint; assembler;nostackframe;{$ifdef SYSTEMINLINE}inline;{$endif}
 asm
 {$ifndef REGCALL}
         movl    l,%eax
@@ -944,7 +944,7 @@ end ['EAX','EDX'];
 
 
 {$define FPC_SYSTEM_HAS_ODD_LONGINT}
-function odd(l:longint):boolean;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
+function odd(l:longint):boolean;assembler;nostackframe;{$ifdef SYSTEMINLINE}inline;{$endif}
 asm
 {$ifdef SYSTEMINLINE}
        movl     l,%eax
@@ -959,7 +959,7 @@ end ['EAX'];
 
 
 {$define FPC_SYSTEM_HAS_SQR_LONGINT}
-function sqr(l:longint):longint;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
+function sqr(l:longint):longint;assembler;nostackframe;{$ifdef SYSTEMINLINE}inline;{$endif}
 asm
 {$ifdef SYSTEMINLINE}
        movl     l,%eax
@@ -973,100 +973,12 @@ end ['EAX'];
 
 
 {$define FPC_SYSTEM_HAS_SPTR}
-Function Sptr : Pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
+Function Sptr : Pointer;assembler;nostackframe;{$ifdef SYSTEMINLINE}inline;{$endif}
 asm
         movl    %esp,%eax
 end;
 
 
-{****************************************************************************
-                                 Str()
-****************************************************************************}
-
-{$define FPC_SYSTEM_HAS_INT_STR_LONGINT}
-procedure int_str(l : longint;var s : string);
-var
-  buffer : array[0..15] of byte;
-  isneg  : byte;
-begin
-  { Workaround: }
-  if l=longint($80000000) then
-   begin
-     s:='-2147483648';
-     exit;
-   end;
-  asm
-        movl    l,%eax          // load Integer
-        xorl    %ecx,%ecx       // String length=0
-        leal    buffer,%ebx
-        movl    $0x0a,%esi      // load 10 as dividing constant.
-        movb    $0,isneg
-        orl     %eax,%eax       // Sign ?
-        jns     .LM2
-        movb    $1,isneg
-        negl    %eax
-.LM2:
-        cltd
-        idivl   %esi
-        addb    $0x30,%dl       // convert Rest to ASCII.
-        movb    %dl,(%ebx)
-        incl    %ecx
-        incl    %ebx
-        cmpl    $0,%eax
-        jnz     .LM2
-        { now copy the string }
-        movl    s,%edi          // Load String address
-        cmpb    $0,isneg
-        je      .LM3
-        movb    $0x2d,(%ebx)
-        incl    %ecx
-        incl    %ebx
-.LM3:
-        movb    %cl,(%edi)      // Copy String length
-        incl    %edi
-.LM4:
-        decl    %ebx
-        movb    (%ebx),%al
-        stosb
-        decl    %ecx
-        jnz     .LM4
-  end ['eax','ecx','edx','ebx','esi','edi'];
-end;
-
-
-{$define FPC_SYSTEM_HAS_INT_STR_LONGWORD}
-procedure int_str(c : longword;var s : string);
-var
-  buffer : array[0..15] of byte;
-begin
-  asm
-        movl    c,%eax          // load CARDINAL
-        xorl    %ecx,%ecx       // String length=0
-        leal    buffer,%ebx
-        movl    $0x0a,%esi      // load 10 as dividing constant.
-.LM4:
-        xorl    %edx,%edx
-        divl    %esi
-        addb    $0x30,%dl       // convert Rest to ASCII.
-        movb    %dl,(%ebx)
-        incl    %ecx
-        incl    %ebx
-        cmpl    $0,%eax
-        jnz     .LM4
-        { now copy the string }
-        movl    s,%edi          // Load String address
-        movb    %cl,(%edi)      // Copy String length
-        incl    %edi
-.LM5:
-        decl    %ebx
-        movb    (%ebx),%al
-        stosb
-        decl    %ecx
-        jnz     .LM5
-  end ['eax','ecx','edx','ebx','esi','edi'];
-end;
-
-
 {****************************************************************************
                                Bounds Check
 ****************************************************************************}
@@ -1074,7 +986,7 @@ end;
 
 { do a thread save inc/dec }
 {$define FPC_SYSTEM_HAS_DECLOCKED_LONGINT}
-function cpudeclocked(var l : longint) : boolean;assembler;
+function cpudeclocked(var l : longint) : boolean;assembler;nostackframe;
 
   asm
 {$ifndef REGCALL}
@@ -1088,7 +1000,7 @@ function cpudeclocked(var l : longint) : boolean;assembler;
   end;
 
 {$define FPC_SYSTEM_HAS_INCLOCKED_LONGINT}
-procedure cpuinclocked(var l : longint);assembler;
+procedure cpuinclocked(var l : longint);assembler;nostackframe;
 
   asm
 {$ifndef REGCALL}
@@ -1146,57 +1058,52 @@ asm
     fwait
 end;
 
+
 {$define FPC_SYSTEM_HAS_ANSISTR_DECR_REF}
 function fpc_freemem_x(p:pointer):ptrint; [external name 'FPC_FREEMEM_X'];
 
 Procedure fpc_AnsiStr_Decr_Ref (Var S : Pointer); [Public,Alias:'FPC_ANSISTR_DECR_REF']; compilerproc; nostackframe; assembler;
 asm
-  cmpl $0,(%eax)
-  jne .Ldecr_ref_continue
-  ret
+        cmpl $0,(%eax)
+        jne .Ldecr_ref_continue
+        ret
 .Ldecr_ref_continue:
 // Temps allocated between ebp-24 and ebp+0
-	subl	$4,%esp
+        subl    $4,%esp
 // Var S located in register
 // Var l located in register
-	movl	%eax,(%esp)
-.Lj3599:
+        movl    %eax,(%esp)
 // [101] l:=@PAnsiRec(S-FirstOff)^.Ref;
-	movl	(%esp),%edx
-	movl	(%edx),%edx
-	subl	$8,%edx
+        movl    (%eax),%edx
+        subl    $8,%edx
 // [102] If l^<0 then exit;
-	movl	(%edx),%eax
-	testl	%eax,%eax
-	jl	.Lj3596
+        cmpl    $0,(%edx)
+        jl      .Lj3596
 .Lj3603:
-// [104] If declocked(l^) then	
-	movb	ismultithread,%al
-	testb	%al,%al
-	jne	.Lj3610
-	decl	(%edx)
-	je .Lj3620
-	addl $4,%esp
-	ret
+// [104] If declocked(l^) then
+        cmpb    $0,ismultithread
+        jne     .Lj3610
+        decl    (%edx)
+        je      .Lj3620
+        addl    $4,%esp
+        ret
 .Lj3610:
-	movl	%edx,%eax
-	call	cpudeclocked
-	movb	%al,%cl
-.Lj3613:
-	testb	%cl,%cl
-	je	.Lj3605
+        movl    %edx,%eax
+        call    cpudeclocked
+        movb    %al,%al
+        je      .Lj3605
 .Lj3620:
-	movl	(%esp),%eax
-	movl	(%eax),%eax
-	subl  $8,%eax
-	call	FPC_FREEMEM_X
-	movl	(%esp),%eax
-	movl	$0,(%eax)
+        movl    (%esp),%eax
+        movl    (%eax),%eax
+        subl    $8,%eax
+        call    FPC_FREEMEM_X
+        movl    (%esp),%eax
+        movl    $0,(%eax)
 .Lj3618:
 .Lj3605:
 .Lj3596:
 // [107] end;
-  addl $4,%esp
+        addl $4,%esp
 end;
 
 function fpc_truely_ansistr_unique(Var S : Pointer): Pointer; forward;
@@ -1206,20 +1113,20 @@ Function fpc_ansistr_Unique(Var S : Pointer): Pointer; [Public,Alias : 'FPC_ANSI
 asm
 // Var S located in register
 // Var $result located in register
-	movl	%eax,%edx
+        movl    %eax,%edx
 // [437] pointer(result) := pointer(s);
-	movl	(%eax),%eax
+        movl    (%eax),%eax
 // [438] If Pointer(S)=Nil then
-	testl	%eax,%eax
-	je	.Lj4031
+        testl   %eax,%eax
+        je      .Lj4031
 .Lj4036:
-// [440] if PAnsiRec(Pointer(S)-Firstoff)^.Ref<>1 then	
-	movl	-8(%eax),%ecx
-	cmpl	$1,%ecx
-	je	.Lj4038
+// [440] if PAnsiRec(Pointer(S)-Firstoff)^.Ref<>1 then
+        movl    -8(%eax),%ecx
+        cmpl    $1,%ecx
+        je      .Lj4038
 // [441] result:=fpc_truely_ansistr_unique(s);
-	movl	%edx,%eax
-	call	fpc_truely_ansistr_unique
+        movl    %edx,%eax
+        call    fpc_truely_ansistr_unique
 .Lj4038:
 .Lj4031:
 // [442] end;

+ 18 - 14
rtl/inc/astrings.inc

@@ -344,16 +344,18 @@ Procedure fpc_AnsiStr_SetLength (Var S : AnsiString; l : SizeInt);[Public,Alias
 }
 Var
   Temp : Pointer;
+  lens,
   movelen : SizeInt;
 begin
   if (l>0) then
     begin
       if Pointer(S)=nil then
        begin
-         { Need a complete new string...}
-         Pointer(s):=NewAnsiString(l);
+         GetMem(Pointer(S),AnsiRecLen+L);
+         PAnsiRec(S)^.Ref:=1;
+         inc(Pointer(S),firstoff);
        end
-      else if (PAnsiRec(Pointer(S)-FirstOff)^.Ref = 1) then
+      else if PAnsiRec(Pointer(S)-FirstOff)^.Ref=1 then
         begin
           Dec(Pointer(S),FirstOff);
           if AnsiRecLen+L>MemSize(Pointer(s)) then
@@ -364,15 +366,17 @@ begin
         begin
           { Reallocation is needed... }
           Temp:=Pointer(NewAnsiString(L));
-          if Length(S)>0 then
-            begin
-              if l < succ(length(s)) then
-                movelen := l
-              { also move terminating null }
-              else movelen := succ(length(s));
-              Move(Pointer(S)^,Temp^,movelen);
-            end;
-          fpc_ansistr_decr_ref(Pointer(S));
+
+          { also move terminating null }
+          lens:=succ(length(s));
+          if l < lens then
+            movelen := l
+          else
+            movelen := lens;
+          Move(Pointer(S)^,Temp^,movelen);
+          { ref count dropped to zero in the mean time? }
+          If declocked(PAnsiRec(Pointer(S)-FirstOff)^.Ref) then
+            freemem(PAnsiRec(Pointer(s)-FirstOff));
           Pointer(S):=Temp;
        end;
       { Force nil termination in case it gets shorter }
@@ -419,7 +423,7 @@ end;
                      Public functions, In interface.
 *****************************************************************************}
 
-function fpc_truely_ansistr_unique(Var S : Pointer): Pointer; 
+function fpc_truely_ansistr_unique(Var S : Pointer): Pointer;
 Var
   SNew : Pointer;
   L    : SizeInt;
@@ -482,7 +486,7 @@ begin
    { needed in case s and str are the same string }
    strlength := length(str);
    ofs:=Length(S);
-   SetLength(S,ofs+length(Str));
+   SetLength(S,ofs+strlength);
    { the pbyte cast avoids an unique call which isn't necessary because SetLength was just called }
    move(Str[1],(pointer(S)+ofs)^,strlength+1);
 end;

+ 10 - 22
rtl/inc/except.inc

@@ -74,29 +74,15 @@ end;
 
 Function fpc_PushExceptAddr (Ft: Longint;_buf,_newaddr : pointer): PJmp_buf ;
   [Public, Alias : 'FPC_PUSHEXCEPTADDR'];compilerproc;
-
-var
-  Buf : PJmp_buf;
-  NewAddr : PExceptAddr;
 begin
 {$ifdef excdebug}
   writeln ('In PushExceptAddr');
 {$endif}
-  If ExceptAddrstack=Nil then
-    begin
-      ExceptAddrStack:=PExceptAddr(_newaddr);
-      ExceptAddrStack^.Next:=Nil;
-    end
-  else
-    begin
-      NewAddr:=PExceptAddr(_newaddr);
-      NewAddr^.Next:=ExceptAddrStack;
-      ExceptAddrStack:=NewAddr;
-    end;
-  buf:=PJmp_Buf(_buf);
-  ExceptAddrStack^.Buf:=Buf;
-  ExceptAddrStack^.FrameType:=ft;
-  fpc_PushExceptAddr:=Buf;
+  PExceptAddr(_newaddr)^.Next:=ExceptAddrstack;
+  ExceptAddrStack:=PExceptAddr(_newaddr);
+  PExceptAddr(_newaddr)^.Buf:=PJmp_Buf(_buf);
+  PExceptAddr(_newaddr)^.FrameType:=ft;
+  result:=PJmp_Buf(_buf);
 end;
 
 
@@ -193,19 +179,21 @@ end;
 
 
 Procedure fpc_PopAddrStack;[Public, Alias : 'FPC_POPADDRSTACK']; compilerproc;
-
+var
+  hp : ^PExceptAddr;
 begin
 {$ifdef excdebug}
   writeln ('In Popaddrstack');
 {$endif}
-  If ExceptAddrStack=nil then
+  hp:=@ExceptAddrStack;
+  If hp^=nil then
     begin
       writeln ('At end of ExceptionAddresStack');
       halt (255);
     end
   else
     begin
-      ExceptAddrStack:=ExceptAddrStack^.Next;
+      hp^:=hp^^.Next;
     end;
 end;
 

+ 94 - 90
rtl/inc/generic.inc

@@ -1012,120 +1012,124 @@ function align(addr : Pointer;alignment : PtrInt) : Pointer;{$ifdef SYSTEMINLINE
 
 {$ifndef FPC_SYSTEM_HAS_INT_STR_LONGINT}
 
-procedure int_str(l : longint;out s : string);
+procedure int_str(l:longint;out s:string);
 var
-  value: longint;
-  negative: boolean;
-
-  begin
-     negative := false;
-     s:='';
-     { Workaround: }
-     if l=longint($80000000) then
-       begin
-         s:='-2147483648';
-         exit;
-       end;
-     { handle case where l = 0 }
-     if l = 0 then
-       begin
-         s:='0';
-         exit;
-       end;
-     If l < 0 then
-       begin
-         negative := true;
-         value:=abs(l);
-       end
-     else
-         value:=l;
-     { handle non-zero case }
-     while value>0 do
-       begin
-         s:=char((value mod 10)+ord('0'))+s;
-         value := value div 10;
-       end;
-     if negative then
-       s := '-' + s;
-  end;
+  m,m1 : longword;
+  pc,pc2 : pchar;
+  hs : string[32];
+begin
+  pc2:=@s[1];
+  if (l<0) then
+    begin
+      pc2^:='-';
+      inc(pc2);
+      m:=longword(-l);
+    end
+  else
+    m:=longword(l);
+  pc:=@hs[0];
+  repeat
+    inc(pc);
+    m1:=m div 10;
+    pc^:=char(m-(m1*10)+byte('0'));
+    m:=m1;
+  until m=0;
+  while (pc>pchar(@hs[0])) do
+    begin
+      pc2^:=pc^;
+      dec(pc);
+      inc(pc2);
+    end;
+  s[0]:=char(pc2-pchar(@s[1]));
+end;
 
 {$endif ndef FPC_SYSTEM_HAS_INT_STR_LONGINT}
 
 {$ifndef FPC_SYSTEM_HAS_INT_STR_LONGWORD}
 
-procedure int_str(l : longword;out s : string);
+procedure int_str(l:longword;out s:string);
+var
+  m1 : longword;
+  pc,pc2 : pchar;
+  hs : string[32];
 begin
-  s:='';
-  if l = 0 then
-  begin
-    s := '0';
-    exit;
-  end;
-  while l>0 do
+  pc2:=@s[1];
+  pc:=@hs[0];
+  repeat
+    inc(pc);
+    m1:=l div 10;
+    pc^:=char(l-(m1*10)+byte('0'));
+    l:=m1;
+  until l=0;
+  while (pc>pchar(@hs[0])) do
     begin
-       s:=char(ord('0')+(l mod 10))+s;
-       l:=l div 10;
+      pc2^:=pc^;
+      dec(pc);
+      inc(pc2);
     end;
+  s[0]:=char(pc2-pchar(@s[1]));
 end;
 
 {$endif ndef FPC_SYSTEM_HAS_INT_STR_LONGWORD}
 
 {$ifndef FPC_SYSTEM_HAS_INT_STR_INT64}
 
-procedure int_str(l : int64;out s : string);
+procedure int_str(l:int64;out s:string);
 var
-  value: int64;
-  negative: boolean;
-
-  begin
-     negative := false;
-     s:='';
-     { Workaround: }
-     if l=int64($8000000000000000) then
-       begin
-         s:='-9223372036854775808';
-         exit;
-       end;
-     { handle case where l = 0 }
-     if l = 0 then
-       begin
-         s:='0';
-         exit;
-       end;
-     If l < 0 then
-       begin
-         negative := true;
-         value:=abs(l);
-       end
-     else
-         value:=l;
-     { handle non-zero case }
-     while value>0 do
-       begin
-         s:=char((value mod 10)+ord('0'))+s;
-         value := value div 10;
-       end;
-     if negative then
-       s := '-' + s;
-  end;
+  m,m1 : qword;
+  pc,pc2 : pchar;
+  hs : string[64];
+begin
+  pc2:=@s[1];
+  if (l<0) then
+    begin
+      pc2^:='-';
+      inc(pc2);
+      m:=qword(-l);
+    end
+  else
+    m:=qword(l);
+  pc:=@hs[0];
+  repeat
+    inc(pc);
+    m1:=m div 10;
+    pc^:=char(m-(m1*10)+byte('0'));
+    m:=m1;
+  until m=0;
+  while (pc>pchar(@hs[0])) do
+    begin
+      pc2^:=pc^;
+      dec(pc);
+      inc(pc2);
+    end;
+  s[0]:=char(pc2-pchar(@s[1]));
+end;
 
 {$endif ndef FPC_SYSTEM_HAS_INT_STR_INT64}
 
 {$ifndef FPC_SYSTEM_HAS_INT_STR_QWORD}
 
-procedure int_str(l : qword;out s : string);
+procedure int_str(l:qword;out s:string);
+var
+  m1 : qword;
+  pc,pc2 : pchar;
+  hs : string[64];
 begin
-  s:='';
-  if l = 0 then
-  begin
-    s := '0';
-    exit;
-  end;
-  while l>0 do
+  pc2:=@s[1];
+  pc:=@hs[0];
+  repeat
+    inc(pc);
+    m1:=l div 10;
+    pc^:=char(l-(m1*10)+byte('0'));
+    l:=m1;
+  until l=0;
+  while (pc>pchar(@hs[0])) do
     begin
-       s:=char(ord('0')+(l mod 10))+s;
-       l:=l div 10;
+      pc2^:=pc^;
+      dec(pc);
+      inc(pc2);
     end;
+  s[0]:=char(pc2-pchar(@s[1]));
 end;
 
 {$endif ndef FPC_SYSTEM_HAS_INT_STR_QWORD}

+ 27 - 22
rtl/inc/heap.inc

@@ -851,14 +851,14 @@ end;
 
 function SysGetMem_Fixed(size: ptrint): pointer;
 var
-  pmc : pmemchunk_fixed;
+  pmc,hp : pmemchunk_fixed;
   poc : poschunk;
   chunkindex : ptrint;
 begin
-  result:=nil;
   { try to find a block in one of the freelists per size }
   chunkindex := size shr blockshift;
   pmc := freelists_fixed[chunkindex];
+  result:=nil;
   { no free blocks ? }
   if not assigned(pmc) then
     begin
@@ -869,10 +869,11 @@ begin
   { get a pointer to the block we should return }
   result := pointer(pmc)+sizeof(tmemchunk_fixed_hdr);
   { update freelist }
-  freelists_fixed[chunkindex] := pmc^.next_fixed;
-  if assigned(freelists_fixed[chunkindex]) then
-    freelists_fixed[chunkindex]^.prev_fixed := nil;
+  hp:=pmc^.next_fixed;
   poc := pmc^.poc;
+  freelists_fixed[chunkindex] := hp;
+  if assigned(hp) then
+    hp^.prev_fixed := nil;
   if (poc^.used = 0) then
     freelists_free_chunk[chunkindex] := false;
   inc(poc^.used);
@@ -959,12 +960,12 @@ begin
 { calc to multiple of 16 after adding the needed bytes for memchunk header }
   if size <= (maxblocksize - sizeof(tmemchunk_fixed_hdr)) then
     begin
-      size := (size+sizeof(tmemchunk_fixed_hdr)+(blocksize-1)) and fixedsizemask;
+      size := (size+(sizeof(tmemchunk_fixed_hdr)+(blocksize-1))) and fixedsizemask;
       result := sysgetmem_fixed(size);
     end
   else
     begin
-      size := (size+sizeof(tmemchunk_var_hdr)+(blocksize-1)) and sizemask;
+      size := (size+(sizeof(tmemchunk_var_hdr)+(blocksize-1))) and sizemask;
       result := sysgetmem_var(size);
     end;
 end;
@@ -976,6 +977,7 @@ end;
 
 function SysFreeMem_Fixed(pmc: pmemchunk_fixed): ptrint;
 var
+  hp : pmemchunk_fixed;
   chunksize,
   chunkindex : ptrint;
   poc : poschunk;
@@ -985,18 +987,19 @@ begin
   chunksize:=chunkindex shl blockshift;
   { statistics }
   dec(internal_status.currheapused,chunksize);
+  hp:=freelists_fixed[chunkindex];
   { insert the block in it's freelist }
   pmc^.prev_fixed := nil;
-  pmc^.next_fixed := freelists_fixed[chunkindex];
-  if freelists_fixed[chunkindex]<>nil then
-    freelists_fixed[chunkindex]^.prev_fixed := pmc;
+  pmc^.next_fixed := hp;
+  if assigned(hp) then
+    hp^.prev_fixed := pmc;
   freelists_fixed[chunkindex] := pmc;
-  { decrease used blocks count }
-  if poc^.used = 0 then
-    HandleError(204);
   dec(poc^.used);
-  if poc^.used = 0 then
+  if poc^.used <= 0 then
     begin
+      { decrease used blocks count }
+      if poc^.used=-1 then
+        HandleError(204);
       { osblock can be freed? }
       if freelists_free_chunk[chunkindex] then
         append_to_oslist_fixed(poc)
@@ -1025,19 +1028,21 @@ end;
 
 function SysFreeMem(p: pointer): ptrint;
 var
-  size : ptrint;
+  hp : pmemchunk_fixed;
 begin
   if p=nil then
     begin
       result:=0;
       exit;
     end;
-  size := pmemchunk_fixed(p-sizeof(tmemchunk_fixed_hdr))^.size;
+
+  hp:=pmemchunk_fixed(p-sizeof(tmemchunk_fixed_hdr));
+
   { check if this is a fixed- or var-sized chunk }
-  if (size and fixedsizeflag) = 0 then
+  if (hp^.size and fixedsizeflag) = 0 then
     result := sysfreemem_var(pmemchunk_var(p-sizeof(tmemchunk_var_hdr)))
   else
-    result := sysfreemem_fixed(pmemchunk_fixed(p-sizeof(tmemchunk_fixed_hdr)));
+    result := sysfreemem_fixed(hp);
 end;
 
 {*****************************************************************************
@@ -1046,7 +1051,7 @@ end;
 
 Function SysFreeMemSize(p: pointer; size: ptrint):ptrint;
 var
-  chunksize: ptrint;
+  hp : pmemchunk_fixed;
 begin
   SysFreeMemSize := 0;
   if p=nil then
@@ -1058,14 +1063,14 @@ begin
       exit;
     end;
 
-  chunksize := pmemchunk_fixed(p-sizeof(tmemchunk_fixed_hdr))^.size;
+  hp:=pmemchunk_fixed(p-sizeof(tmemchunk_fixed_hdr));
   { check if this is a fixed- or var-sized chunk. We can't check the passed
     size parameter since the block can be resized (by reallocmem) to an
     optimized value that the user doesn't know }
-  if (chunksize and fixedsizeflag) = 0 then
+  if (hp^.size and fixedsizeflag) = 0 then
     result := sysfreemem_var(pmemchunk_var(p-sizeof(tmemchunk_var_hdr)))
   else
-    result := sysfreemem_fixed(pmemchunk_fixed(p-sizeof(tmemchunk_fixed_hdr)));
+    result := sysfreemem_fixed(hp);
 end;
 
 

+ 2 - 2
rtl/inc/macpas.pp

@@ -95,10 +95,10 @@ begin
 end;
 
 
-{$ifdef powerpc}
+{$ifdef cpupowerpc}
 begin
   asm
     mtfsfi 6,1
   end;
-{$endif powerpc}
+{$endif cpupowerpc}
 end.

+ 15 - 0
rtl/inc/stdsock.inc

@@ -39,75 +39,90 @@ function fpaccept      (s:cint; addrx : psockaddr; addrlen : psocklen):cint;
 
 begin
  fpaccept:=cfpaccept(s,addrx,addrlen);
+ socketerror:=fpgeterrno;
 end;
 
 function fpbind (s:cint; addrx : psockaddr; addrlen : tsocklen):cint;
 begin
   fpbind:=cfpbind (s,addrx,addrlen);
+  socketerror:=fpgeterrno;
 end;
 
 function fpconnect     (s:cint; name  : psockaddr; namelen : tsocklen):cint;
 begin
   fpconnect:=cfpconnect (s,name,namelen);
+  socketerror:=fpgeterrno;
 end;
 
 function fpgetpeername (s:cint; name  : psockaddr; namelen : psocklen):cint;
 begin
   fpgetpeername:=cfpgetpeername (s,name,namelen);
+  socketerror:=fpgeterrno;
 end;
 
 function fpgetsockname (s:cint; name  : psockaddr; namelen : psocklen):cint;
 begin
   fpgetsockname:=cfpgetsockname(s,name,namelen);
+  socketerror:=fpgeterrno;
 end;
 
 function fpgetsockopt  (s:cint; level:cint; optname:cint; optval:pointer; optlen : psocklen):cint;
 begin
   fpgetsockopt:=cfpgetsockopt(s,level,optname,optval,optlen);
+  socketerror:=fpgeterrno;
 end;
 
 function fplisten      (s:cint; backlog : cint):cint;
 begin
   fplisten:=cfplisten(s,backlog);
+  socketerror:=fpgeterrno;
 end;
 
 function fprecv         (s:cint; buf: pointer; len: size_t; flags:cint):ssize_t;
 begin
   fprecv:= cfprecv      (s,buf,len,flags);
+  socketerror:=fpgeterrno;
 end;
 
 function fprecvfrom    (s:cint; buf: pointer; len: size_t; flags: cint; from : psockaddr; fromlen : psocklen):ssize_t;
 begin
   fprecvfrom:= cfprecvfrom (s,buf,len,flags,from,fromlen);
+  socketerror:=fpgeterrno;
 end;
 
 function fpsend         (s:cint; msg:pointer; len:size_t; flags:cint):ssize_t;
 begin
   fpsend:=cfpsend (s,msg,len,flags);
+  socketerror:=fpgeterrno;
 end;
 
 function fpsendto       (s:cint; msg:pointer; len:size_t; flags:cint; tox :psockaddr; tolen: tsocklen):ssize_t;
 begin
   fpsendto:=cfpsendto (s,msg,len,flags,tox,tolen);
+  socketerror:=fpgeterrno;
 end;
 
 function fpsetsockopt  (s:cint; level:cint; optname:cint; optval:pointer; optlen :tsocklen):cint;
 begin
   fpsetsockopt:=cfpsetsockopt(s,level,optname,optval,optlen);
+  socketerror:=fpgeterrno;
 end;
 
 function fpshutdown     (s:cint; how:cint):cint;
 begin
   fpshutdown:=cfpshutdown(s,how);
+  socketerror:=fpgeterrno;
 end;
 
 function fpsocket       (domain:cint; xtype:cint; protocol: cint):cint;
 begin
   fpsocket:=cfpsocket(domain,xtype,protocol);
+  socketerror:=fpgeterrno;
 end;
 
 function fpsocketpair  (d:cint; xtype:cint; protocol:cint; sv:pcint):cint;
 begin
   fpsocketpair:=cfpsocketpair(d,xtype,protocol,sv);
+  socketerror:=fpgeterrno;
 end;
 

+ 1 - 1
rtl/linux/arm/sysnr.inc

@@ -21,7 +21,7 @@
 }
 
 Const
-  syscall_nr_base = syscall_nr_base;
+  syscall_nr_base = $900000;
 
   syscall_nr_exit                       =  syscall_nr_base+ 1;
   syscall_nr_fork                       =  syscall_nr_base+ 2;

+ 1 - 0
rtl/linux/i386/dllprt0.as

@@ -56,6 +56,7 @@ _haltproc2:             # GAS <= 2.15 bug: generates larger jump if a label is e
 .bss
         .type   __stkptr,@object
         .size   __stkptr,4
+        .global __stkptr
 __stkptr:
         .skip   4
 

+ 7 - 0
rtl/linux/ostypes.inc

@@ -326,6 +326,13 @@ type
     rlim_max : rlim_t;
   end;
 
+  iovec = record
+            iov_base : pointer;
+	    iov_len  : size_t;
+	   end;
+  tiovec=iovec;
+  piovec=^tiovec;		
+
     {*************************************************************************}
     {                               SIGNALS                                   }
     {*************************************************************************}

+ 1 - 0
rtl/unix/oscdeclh.inc

@@ -53,6 +53,7 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     function  FPSigProcMask(how:cint;const nset : sigset;var oset : sigset):cint;cdecl; external clib name 'sigprocmask';
     function  FpTime       (tloc:ptime_t): time_t; cdecl; external clib name 'time';
     Function  FpTime       (var tloc : TTime): TTime; cdecl; external clib name 'time';
+    function  FpTimes	(var buffer : tms): TClock; cdecl; external clib name 'times';
     function  FpUname   (var name: utsname): cint; cdecl; external clib name 'uname';
     function  FpUnlink  (path: pchar): cint; cdecl; external clib name 'unlink';
     function  FpWaitpid (pid : TPid; stat_loc : pcint; options: cint): TPid; cdecl; external clib name 'waitpid';

+ 4 - 0
rtl/unix/sockets.pp

@@ -21,6 +21,10 @@ Uses UnixType;
 {$DEFINE SOCK_HAS_SINLEN}               // BSD definition of scoketaddr
 {$endif}
 
+{$ifdef Darwin}
+{$DEFINE SOCK_HAS_SINLEN}               // BSD definition of scoketaddr
+{$endif}
+
 {$i unxsockh.inc}
 {$i socketsh.inc}
 

+ 1 - 1
rtl/win32/dos.pp

@@ -292,7 +292,7 @@ begin
   FillChar(SI, SizeOf(SI), 0);
   SI.cb:=SizeOf(SI);
   SI.wShowWindow:=1;
-  { always surroound the name of the application by quotes
+  { always surround the name of the application by quotes
     so that long filenames will always be accepted. But don't
     do it if there are already double quotes, since Win32 does not
     like double quotes which are duplicated!

+ 15 - 0
rtl/win32/wininc/defines.inc

@@ -4731,6 +4731,9 @@ Const
      MIIM_STATE = 1;
      MIIM_SUBMENU = 4;
      MIIM_TYPE = 16;
+     MIIM_STRING = 64;
+     MIIM_BITMAP = 128;
+     MIIM_FTYPE = 256;
      MFT_BITMAP = $4;
      MFT_MENUBARBREAK = $20;
      MFT_MENUBREAK = $40;
@@ -4738,6 +4741,7 @@ Const
      MFT_RADIOCHECK = $200;
      MFT_RIGHTJUSTIFY = $4000;
      MFT_SEPARATOR = $800;
+     MFT_RIGHTORDER = $2000;
      MFT_STRING = 0;
      MFS_CHECKED = $8;
      MFS_DEFAULT = $1000;
@@ -4747,6 +4751,17 @@ Const
      MFS_HILITE = $80;
      MFS_UNCHECKED = 0;
      MFS_UNHILITE = 0;
+     HBMMENU_CALLBACK = -1;
+     HBMMENU_SYSTEM = 1;
+     HBMMENU_MBAR_RESTORE = 2;
+     HBMMENU_MBAR_MINIMIZE = 3;
+     HBMMENU_MBAR_CLOSE = 5;
+     HBMMENU_MBAR_CLOSE_D = 6;
+     HBMMENU_MBAR_MINIMIZE_D = 7;
+     HBMMENU_POPUP_CLOSE = 8;
+     HBMMENU_POPUP_RESTORE = 9;
+     HBMMENU_POPUP_MAXIMIZE = 10;
+     HBMMENU_POPUP_MINIMIZE = 11;
   { SERIALKEYS structure  }
      SERKF_AVAILABLE = 2;
      SERKF_INDICATOR = 4;

+ 1 - 0
rtl/win32/wininc/struct.inc

@@ -3973,6 +3973,7 @@
           dwItemData : DWORD;
           dwTypeData : LPTSTR;
           cch : UINT;
+          hbmpItem : HBITMAP;
        end;
      LPMENUITEMINFO = ^MENUITEMINFO;
      LPCMENUITEMINFO = ^MENUITEMINFO;