From 679b2ec5e4f7c771faad7d973e3304439b88dfcf Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 28 Dec 2000 20:50:04 +0000 Subject: [PATCH] * merged fixes from 1.0.x --- rtl/unix/linsysca.inc | 14 +++++++++++++- rtl/unix/serial.pp | 25 +++++++++++++++++-------- rtl/unix/sysutils.pp | 31 ++++++++++++++++--------------- 3 files changed, 46 insertions(+), 24 deletions(-) diff --git a/rtl/unix/linsysca.inc b/rtl/unix/linsysca.inc index 579a578e11..39b7187914 100644 --- a/rtl/unix/linsysca.inc +++ b/rtl/unix/linsysca.inc @@ -914,6 +914,15 @@ begin LinuxError:=Errno; end; +Function IoPL(Level : longint) : Boolean; + +Var + Sr : Syscallregs; +begin + Sr.Reg2:=Level; + IOPL:=Syscall(Syscall_nr_iopl,sr)=0; + LinuxError:=Errno; +end; {$IFDEF I386} @@ -1184,7 +1193,10 @@ end; { $Log$ - Revision 1.4 2000-10-26 22:51:12 peter + Revision 1.5 2000-12-28 20:50:04 peter + * merged fixes from 1.0.x + + Revision 1.4 2000/10/26 22:51:12 peter * nano sleep (merged) Revision 1.3 2000/10/02 17:57:37 peter diff --git a/rtl/unix/serial.pp b/rtl/unix/serial.pp index a2b85fcc92..6f8bbde33c 100644 --- a/rtl/unix/serial.pp +++ b/rtl/unix/serial.pp @@ -99,7 +99,8 @@ procedure SerSetParams(Handle: TSerialHandle; BitsPerSec: LongInt; var tios: termios; begin - ioctl(Handle, TCGETS, @tios); + TcGetAttr(handle,tios); + // ioctl(Handle, TCGETS, @tios); case BitsPerSec of 50: tios.c_cflag := B50; @@ -119,7 +120,9 @@ begin 57600: tios.c_cflag := B57600; 115200: tios.c_cflag := B115200; 230400: tios.c_cflag := B230400; +{$ifndef BSD} 460800: tios.c_cflag := B460800; +{$endif} else tios.c_cflag := B9600; end; @@ -142,20 +145,23 @@ begin tios.c_cflag := tios.c_cflag or CRTSCTS; tios.c_cflag := tios.c_cflag or CLOCAL or CREAD; - - ioctl(Handle, TCSETS, @tios); + TCSetAttr(handle,TCSANOW,tios) +// ioctl(Handle, TCSETS, @tios); end; function SerSaveState(Handle: TSerialHandle): TSerialState; begin ioctl(Handle, TIOCMGET, @Result.LineState); - ioctl(Handle, TCGETS, @Result.tios); +// ioctl(Handle, TCGETS, @Result.tios); + TcGetAttr(handle,result.tios); + end; procedure SerRestoreState(Handle: TSerialHandle; State: TSerialState); begin - ioctl(Handle, TCSETS, @State.tios); - ioctl(Handle, TIOCMSET, @State.LineState); +// ioctl(Handle, TCSETS, @State.tios); + TCSetAttr(handle,TCSANOW,State.tios); + ioctl(Handle, TIOCMSET, @State.LineState); end; procedure SerSetDTR(Handle: TSerialHandle; State: Boolean); @@ -207,7 +213,10 @@ end. { $Log$ - Revision 1.3 2000-10-10 14:12:36 sg + Revision 1.4 2000-12-28 20:50:04 peter + * merged fixes from 1.0.x + + Revision 1.3 2000/10/10 14:12:36 sg * Some cosmetic improvements (no changes in interface, only within the source itself (comments etc.) @@ -216,5 +225,5 @@ end. Revision 1.2 2000/07/13 11:33:49 michael + removed logs - + } diff --git a/rtl/unix/sysutils.pp b/rtl/unix/sysutils.pp index dc46917e0d..fc11e44811 100644 --- a/rtl/unix/sysutils.pp +++ b/rtl/unix/sysutils.pp @@ -119,14 +119,14 @@ begin end; -Function LinuxToWinAttr (FN : Char; Const Info : Stat) : Longint; +Function LinuxToWinAttr (FN : Pchar; Const Info : Stat) : Longint; begin Result:=faArchive; - If FN='.' then - Result:=Result or faHidden; If (Info.Mode and STAT_IFDIR)=STAT_IFDIR then Result:=Result or faDirectory; + If (FN[0]='.') and (not (FN[1] in [#0,'.'])) then + Result:=Result or faHidden; If (Info.Mode and STAT_IWUSR)=0 Then Result:=Result or faReadOnly; If (Info.Mode and @@ -144,18 +144,16 @@ Type TGlobSearchRec = Record Path : String; GlobHandle : PGlob; - end; + end; PGlobSearchRec = ^TGlobSearchRec; - + Function GlobToTSearchRec (Var Info : TSearchRec) : Boolean; Var SInfo : Stat; p : Pglob; - TAttr : Longint; GlobSearchRec : PGlobSearchrec; - + begin - TAttr:=longint($ffffffff); GlobSearchRec:=PGlobSearchrec(Info.FindHandle); P:=GlobSearchRec^.GlobHandle; Result:=P<>Nil; @@ -165,8 +163,8 @@ begin Result:=Fstat(GlobSearchRec^.Path+StrPas(p^.name),SInfo); If Result then begin - Info.Attr:=LinuxToWinAttr(p^.name[0],SInfo); - Result:=(Info.ExcludeAttr and TAttr)<>0; + Info.Attr:=LinuxToWinAttr(p^.name,SInfo); + Result:=(Info.ExcludeAttr and Info.Attr)=0; If Result Then With Info do begin @@ -199,14 +197,14 @@ end; Function FindFirst (Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint; -Var +Var GlobSearchRec : PGlobSearchRec; - + begin New(GlobSearchRec); GlobSearchRec^.Path:=ExpandFileName(ExtractFilePath(Path)); GlobSearchRec^.GlobHandle:=Glob(Path); - Rslt.ExcludeAttr:=Attr; //!! Not correct !! + Rslt.ExcludeAttr:=Not Attr; //!! Not correct !! Rslt.FindHandle:=Longint(GlobSearchRec); Result:=DoFind (Rslt); end; @@ -259,7 +257,7 @@ begin If Not FStat (FileName,Info) then Result:=-1 Else - Result:=LinuxToWinAttr(FileName[1],Info); + Result:=LinuxToWinAttr(Pchar(FileName),Info); end; @@ -458,7 +456,10 @@ end. { $Log$ - Revision 1.4 2000-12-18 14:01:42 jonas + Revision 1.5 2000-12-28 20:50:04 peter + * merged fixes from 1.0.x + + Revision 1.4 2000/12/18 14:01:42 jonas * fixed constant range error Revision 1.3 2000/11/28 20:06:12 michael