* small cleanups. Mostly killing of already commented code in unix etc

This commit is contained in:
marco 2003-09-16 20:52:24 +00:00
parent 76a53a375d
commit 2877df766c
3 changed files with 18 additions and 154 deletions

View File

@ -111,7 +111,7 @@ procedure CursorOff;
Implementation
uses BaseUnix,unix;
uses BaseUnix ,unix;
{
The definitions of TextRec and FileRec are in separate files.
@ -1121,7 +1121,7 @@ Procedure Delay(DTime: Word);
Wait for DTime milliseconds.
}
Begin
Select(0,nil,nil,nil,DTime);
fpSelect(0,nil,nil,nil,DTime);
End;
@ -1476,8 +1476,7 @@ end;
Procedure TextMode(Mode: Integer);
{
Only Clears Screen under linux
}
Only Clears Screen under linux}
begin
ClrScr;
end;
@ -1583,7 +1582,7 @@ begin
fpWrite(0,s[1],length(s));
fpFD_ZERO(fds);
fpFD_SET(1,fds);
if (Select(2,@fds,nil,nil,1000)>0) then
if (fpSelect(2,@fds,nil,nil,1000)>0) then
begin
readed:=fpRead(1,buf,sizeof(buf));
i:=0;
@ -1682,7 +1681,10 @@ Finalization
End.
{
$Log$
Revision 1.12 2003-09-16 16:13:56 marco
Revision 1.13 2003-09-16 20:52:24 marco
* small cleanups. Mostly killing of already commented code in unix etc
Revision 1.12 2003/09/16 16:13:56 marco
* fdset functions renamed to fp<posix name>
Revision 1.11 2003/09/14 20:15:01 marco

View File

@ -589,6 +589,7 @@ begin
LinuxError:=fpgetErrno;
end;
{
function MMap(const m:tmmapargs):pointer;
begin
mmap:=fpmmap(pointer(m.address),m.size,m.prot, m.flags,m.fd, m.offset);
@ -601,6 +602,7 @@ begin
MUnMap:=fpmunmap(p,size)=0;
LinuxError:=fpgetErrno;
end;
}
{--------------------------------
Port IO functions
@ -636,7 +638,10 @@ end;
{
$Log$
Revision 1.3 2003-09-16 16:06:02 peter
Revision 1.4 2003-09-16 20:52:24 marco
* small cleanups. Mostly killing of already commented code in unix etc
Revision 1.3 2003/09/16 16:06:02 peter
* add typecasts for oldlinuxstat
Revision 1.2 2003/09/15 21:07:41 marco

View File

@ -30,7 +30,6 @@ Uses BaseUnix;
{$i ostypes.inc}
var
// ErrNo,
LinuxError : Longint;
{********************
@ -112,26 +111,6 @@ const
{$I termios.inc}
{********************
Info
********************}
Type
TSysinfo = packed record
uptime : longint;
loads : array[1..3] of longint;
totalram,
freeram,
sharedram,
bufferram,
totalswap,
freeswap : longint;
procs : integer;
s : string[18];
end;
PSysInfo = ^TSysInfo;
{******************************************************************************
Procedure/Functions
******************************************************************************}
@ -151,8 +130,6 @@ procedure GetLocalTimezone(timer:longint);
procedure ReadTimezoneFile(fn:string);
function GetTimezoneFile:string;
//Procedure GetTimeOfDay(var tv:timeval);
//Function GetTimeOfDay:longint;
Function GetEpochTime: longint;
Procedure EpochToLocal(epoch:longint;var year,month,day,hour,minute,second:Word);
Function LocalToEpoch(year,month,day,hour,minute,second:Word):Longint;
@ -208,7 +185,6 @@ Function Flock (var F : File;mode : longint) : boolean;
Function StatFS(Path:Pathstr;Var Info:tstatfs):Boolean;
Function StatFS(Fd: Longint;Var Info:tstatfs):Boolean;
Function Select(N:cint;readfds,writefds,exceptfds:pfdset;TimeOut:cint):cint;
Function SelectText(var T:Text;TimeOut :PTimeVal):Longint;
Function SelectText(var T:Text;TimeOut :Longint):Longint;
@ -282,19 +258,6 @@ const
MAP_LOCKED = $2000; { pages are locked }
MAP_NORESERVE = $4000; { don't check for reservations }
type
tmmapargs=record
address : longint;
size : longint;
prot : longint;
flags : longint;
fd : longint;
offset : longint;
end;
//function MMap(const m:tmmapargs):longint;
function MUnMap (P : Pointer; Size : Longint) : Boolean;
{**************************
Utility functions
***************************}
@ -821,20 +784,6 @@ end;
FileSystem calls
******************************************************************************}
Function fdOpen(pathname:string;flags:longint):longint;
begin
pathname:=pathname+#0;
fdOpen:=fpOpen(@pathname[1],flags,438);
linuxerror:=fpgeterrno;;
end;
Function fdOpen(pathname:string;flags,mode:longint):longint;
begin
pathname:=pathname+#0;
fdOpen:=fpOpen(@pathname[1],flags,mode);
linuxerror:=fpgeterrno;;
end;
Procedure Execl(const Todo:Ansistring);
{
@ -845,70 +794,6 @@ begin
ExecLE(ToDo,EnvP);
end;
{$ifdef BSD}
Function Fcntl(Fd:longint;Cmd:longint):longint;
{
Read or manipulate a file.(See also fcntl (2) )
Possible values for Cmd are :
F_GetFd,F_GetFl,F_GetOwn
Errors are reported in Linuxerror;
If Cmd is different from the allowed values, linuxerror=ESysEninval.
}
begin
if (cmd in [F_GetFd,F_GetFl,F_GetOwn]) then
begin
Linuxerror:=fpfcntl(fd,cmd,0);
if linuxerror=-1 then
begin
linuxerror:=fpgeterrno;;
fcntl:=0;
end
else
begin
fcntl:=linuxerror;
linuxerror:=0;
end;
end
else
begin
linuxerror:=ESysEinval;
Fcntl:=0;
end;
end;
Procedure Fcntl(Fd:longint;Cmd:longint;Arg:Longint);
{
Read or manipulate a file. (See also fcntl (2) )
Possible values for Cmd are :
F_setFd,F_SetFl,F_GetLk,F_SetLk,F_SetLkW,F_SetOwn;
Errors are reported in Linuxerror;
If Cmd is different from the allowed values, linuxerror=ESysEninval.
F_DupFD is not allowed, due to the structure of Files in Pascal.
}
begin
if (cmd in [F_SetFd,F_SetFl,F_GetLk,F_SetLk,F_SetLkw,F_SetOwn]) then
begin
fpfcntl(fd,cmd,arg);
linuxerror:=fpgeterrno;;
end
else
linuxerror:=ESysEinval;
end;
{$endif}
Function Fcntl(var Fd:Text;Cmd:longint):longint;
begin
Fcntl := Fcntl(textrec(Fd).handle, Cmd);
end;
Procedure Fcntl(var Fd:Text;Cmd,Arg:Longint);
begin
Fcntl(textrec(Fd).handle, Cmd, Arg);
end;
Function Flock (var T : text;mode : longint) : boolean;
begin
Flock:=Flock(TextRec(T).Handle,mode);
@ -920,30 +805,6 @@ begin
Flock:=Flock(FileRec(F).Handle,mode);
end;
Function Select(N:cint;readfds,writefds,exceptfds:pfdset;TimeOut:cint):cint;
{
Select checks whether the file descriptor sets in readfs/writefs/exceptfs
have changed.
This function allows specification of a timeout as a longint.
}
var
p : PTimeVal;
tv : TimeVal;
begin
if TimeOut=-1 then
p:=nil
else
begin
tv.tv_Sec:=Timeout div 1000;
tv.tv_Usec:=(Timeout mod 1000)*1000;
p:=@tv;
end;
Select:=fpSelect(N,Readfds,WriteFds,ExceptFds,p);
end;
Function SelectText(var T:Text;TimeOut :PTimeval):Longint;
Var
F:TfdSet;
@ -1130,7 +991,6 @@ begin
PClose(f);
end;
Procedure POpen(var F:text;const Prog:String;rw:char);
{
Starts the program in 'Prog' and makes it's input or out put the
@ -1802,11 +1662,6 @@ begin
end;
end;
{
function FExpand (const Path: PathStr): PathStr;
- declared in fexpand.inc
}
{$DEFINE FPC_FEXPAND_TILDE} { Tilde is expanded to home }
{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PChar }
@ -2150,12 +2005,14 @@ Initialization
finalization
DoneLocalTime;
End.
{
$Log$
Revision 1.33 2003-09-16 16:13:56 marco
Revision 1.34 2003-09-16 20:52:24 marco
* small cleanups. Mostly killing of already commented code in unix etc
Revision 1.33 2003/09/16 16:13:56 marco
* fdset functions renamed to fp<posix name>
Revision 1.32 2003/09/15 20:08:49 marco