|
@@ -31,6 +31,10 @@ const
|
|
BIAS4 = $7f-1;
|
|
BIAS4 = $7f-1;
|
|
{$endif}
|
|
{$endif}
|
|
|
|
|
|
|
|
+{$ifdef BSD}
|
|
|
|
+ {$define newsignal}
|
|
|
|
+{$endif}
|
|
|
|
+
|
|
{$I systemh.inc}
|
|
{$I systemh.inc}
|
|
{$I heaph.inc}
|
|
{$I heaph.inc}
|
|
|
|
|
|
@@ -172,6 +176,19 @@ end ['D0'];
|
|
{$endif}
|
|
{$endif}
|
|
|
|
|
|
|
|
|
|
|
|
+{$ifdef bsd}
|
|
|
|
+Function sbrk(size : longint) : Longint;
|
|
|
|
+
|
|
|
|
+CONST MAP_PRIVATE =2;
|
|
|
|
+ MAP_ANONYMOUS =$1000; {$20 under linux}
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ Sbrk:=do_syscall(syscall_nr_mmap,0,size,3,MAP_PRIVATE+MAP_ANONYMOUS,-1,0,0);
|
|
|
|
+ if ErrNo<>0 then
|
|
|
|
+ Sbrk:=0;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+{$else}
|
|
Function sbrk(size : longint) : Longint;
|
|
Function sbrk(size : longint) : Longint;
|
|
type
|
|
type
|
|
tmmapargs=packed record
|
|
tmmapargs=packed record
|
|
@@ -197,7 +214,7 @@ begin
|
|
if ErrNo<>0 then
|
|
if ErrNo<>0 then
|
|
Sbrk:=0;
|
|
Sbrk:=0;
|
|
end;
|
|
end;
|
|
-
|
|
|
|
|
|
+{$endif}
|
|
|
|
|
|
{ include standard heap management }
|
|
{ include standard heap management }
|
|
{$I heap.inc}
|
|
{$I heap.inc}
|
|
@@ -333,7 +350,24 @@ begin
|
|
{$endif}
|
|
{$endif}
|
|
end;
|
|
end;
|
|
|
|
|
|
-
|
|
|
|
|
|
+{$ifdef BSD}
|
|
|
|
+Function Do_FileSize(Handle:Longint): Longint;
|
|
|
|
+{$ifndef crtlib}
|
|
|
|
+var
|
|
|
|
+ Info : Stat;
|
|
|
|
+{$endif}
|
|
|
|
+Begin
|
|
|
|
+{$ifdef crtlib}
|
|
|
|
+ Do_FileSize:=_rtl_filesize(Handle);
|
|
|
|
+{$else}
|
|
|
|
+ if do_SysCall(syscall_nr_fstat,handle,longint(@info))=0 then
|
|
|
|
+ Do_FileSize:=Info.Size
|
|
|
|
+ else
|
|
|
|
+ Do_FileSize:=0;
|
|
|
|
+ Errno2Inoutres;
|
|
|
|
+{$endif}
|
|
|
|
+End;
|
|
|
|
+{$ELSE}
|
|
Function Do_FileSize(Handle:Longint): Longint;
|
|
Function Do_FileSize(Handle:Longint): Longint;
|
|
{$ifndef crtlib}
|
|
{$ifndef crtlib}
|
|
var
|
|
var
|
|
@@ -353,18 +387,24 @@ Begin
|
|
Errno2Inoutres;
|
|
Errno2Inoutres;
|
|
{$endif}
|
|
{$endif}
|
|
End;
|
|
End;
|
|
-
|
|
|
|
|
|
+{$endif}
|
|
|
|
|
|
Procedure Do_Truncate(Handle,Pos:longint);
|
|
Procedure Do_Truncate(Handle,Pos:longint);
|
|
{$ifndef crtlib}
|
|
{$ifndef crtlib}
|
|
|
|
+{$ifndef bsd}
|
|
var
|
|
var
|
|
sr : syscallregs;
|
|
sr : syscallregs;
|
|
{$endif}
|
|
{$endif}
|
|
|
|
+{$endif}
|
|
begin
|
|
begin
|
|
{$ifndef crtlib}
|
|
{$ifndef crtlib}
|
|
|
|
+ {$ifdef bsd}
|
|
|
|
+ do_syscall(syscall_nr_ftruncate,handle,pos,0);
|
|
|
|
+ {$else}
|
|
sr.reg2:=Handle;
|
|
sr.reg2:=Handle;
|
|
sr.reg3:=Pos;
|
|
sr.reg3:=Pos;
|
|
syscall(syscall_nr_ftruncate,sr);
|
|
syscall(syscall_nr_ftruncate,sr);
|
|
|
|
+ {$endif}
|
|
Errno2Inoutres;
|
|
Errno2Inoutres;
|
|
{$endif}
|
|
{$endif}
|
|
end;
|
|
end;
|
|
@@ -463,13 +503,19 @@ Function Do_IsDevice(Handle:Longint):boolean;
|
|
data is function-dependent.
|
|
data is function-dependent.
|
|
}
|
|
}
|
|
var
|
|
var
|
|
|
|
+{$ifndef BSD}
|
|
sr: SysCallRegs;
|
|
sr: SysCallRegs;
|
|
|
|
+{$endif}
|
|
Data : array[0..255] of byte; {Large enough for termios info}
|
|
Data : array[0..255] of byte; {Large enough for termios info}
|
|
begin
|
|
begin
|
|
|
|
+ {$ifdef BSD}
|
|
|
|
+ Do_IsDevice:=(do_SysCall(syscall_nr_ioctl,handle,$5401,longint(@data))=0);
|
|
|
|
+ {$else}
|
|
sr.reg2:=Handle;
|
|
sr.reg2:=Handle;
|
|
sr.reg3:=$5401; {=TCGETS}
|
|
sr.reg3:=$5401; {=TCGETS}
|
|
sr.reg4:=Longint(@Data);
|
|
sr.reg4:=Longint(@Data);
|
|
Do_IsDevice:=(SysCall(Syscall_nr_ioctl,sr)=0);
|
|
Do_IsDevice:=(SysCall(Syscall_nr_ioctl,sr)=0);
|
|
|
|
+ {$endif}
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -596,9 +642,9 @@ begin
|
|
d:=sys_readdir (dirstream);
|
|
d:=sys_readdir (dirstream);
|
|
validdir:=false;
|
|
validdir:=false;
|
|
if (d<>nil) and
|
|
if (d<>nil) and
|
|
- (not ((d^.name[0]='.') and ((d^.name[1]=#0) or ((d^.name[1]='.') and (
|
|
|
|
-d^.name[2]=#0))))) and
|
|
|
|
- (mountpoint or (d^.ino=thisino)) then
|
|
|
|
|
|
+ (not ((d^.name[0]='.') and ((d^.name[1]=#0) or ((d^.name[1]='.')
|
|
|
|
+ and (d^.name[2]=#0))))) and
|
|
|
|
+ (mountpoint or (d^.ino=thisino)) then
|
|
begin
|
|
begin
|
|
dummy:=predot+'../'+strpas(@(d^.name[0]))+#0;
|
|
dummy:=predot+'../'+strpas(@(d^.name[0]))+#0;
|
|
validdir:=not (sys_stat (@(dummy[1]),thisdir)<0);
|
|
validdir:=not (sys_stat (@(dummy[1]),thisdir)<0);
|
|
@@ -625,6 +671,7 @@ end;
|
|
SystemUnit Initialization
|
|
SystemUnit Initialization
|
|
*****************************************************************************}
|
|
*****************************************************************************}
|
|
|
|
|
|
|
|
+
|
|
{$ifdef I386}
|
|
{$ifdef I386}
|
|
{ this should be defined in i386 directory !! PM }
|
|
{ this should be defined in i386 directory !! PM }
|
|
const
|
|
const
|
|
@@ -655,6 +702,8 @@ begin
|
|
{$endif I386}
|
|
{$endif I386}
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+{$ifndef BSD}
|
|
|
|
+
|
|
{$ifndef newSignal}
|
|
{$ifndef newSignal}
|
|
Procedure SignalToRunError(Sig:longint);
|
|
Procedure SignalToRunError(Sig:longint);
|
|
begin
|
|
begin
|
|
@@ -736,7 +785,7 @@ begin
|
|
end;
|
|
end;
|
|
{$endif newSignal}
|
|
{$endif newSignal}
|
|
|
|
|
|
-
|
|
|
|
|
|
+{$endif bsd}
|
|
|
|
|
|
procedure SetupCmdLine;
|
|
procedure SetupCmdLine;
|
|
var
|
|
var
|
|
@@ -797,7 +846,9 @@ end;
|
|
|
|
|
|
Begin
|
|
Begin
|
|
{ Set up signals handlers }
|
|
{ Set up signals handlers }
|
|
- InstallSignals;
|
|
|
|
|
|
+ {$ifndef bsd}
|
|
|
|
+ InstallSignals;
|
|
|
|
+ {$endif}
|
|
{ Setup heap }
|
|
{ Setup heap }
|
|
InitHeap;
|
|
InitHeap;
|
|
InitExceptions;
|
|
InitExceptions;
|
|
@@ -814,7 +865,10 @@ End.
|
|
|
|
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.43 2000-04-07 14:56:36 peter
|
|
|
|
|
|
+ Revision 1.44 2000-04-14 13:04:53 marco
|
|
|
|
+ * Merged bsd/syslinux.pp and 1.43 linux/syslinux.pp to this file with ifdefs
|
|
|
|
+
|
|
|
|
+ Revision 1.43 2000/04/07 14:56:36 peter
|
|
* switch to direct asm if not correctfldcw defined
|
|
* switch to direct asm if not correctfldcw defined
|
|
|
|
|
|
Revision 1.42 2000/03/31 23:26:32 pierre
|
|
Revision 1.42 2000/03/31 23:26:32 pierre
|