浏览代码

* fix Mantis #21665 for net/free/openbsd

git-svn-id: trunk@21232 -
marco 13 年之前
父节点
当前提交
2213b67134
共有 3 个文件被更改,包括 47 次插入5 次删除
  1. 16 2
      rtl/freebsd/termiosproc.inc
  2. 16 2
      rtl/netbsd/termiosproc.inc
  3. 15 1
      rtl/openbsd/termiosproc.inc

+ 16 - 2
rtl/freebsd/termiosproc.inc

@@ -109,9 +109,23 @@ begin
     end;
 end;
 
-Function TCFlush(fd,qsel:cint):cint; {$ifdef VER2_0}inline;{$endif}
+const FREAD  = 1; // marked "BSD visible"
+      FWRITE = 2;
+
+Function TCFlush(fd,qsel:cint):cint;  {$ifdef VER2_0}inline;{$endif}
+var comval : cint;
 begin
-  TCFlush:=fpIOCtl(fd,TIOCFLUSH,pointer(qsel));
+  case qsel of
+     TCIFlush  : comval:=FREAD;
+     TCOFlush  : comval:=FWRITE;
+     TCIOFlush : comval:=FREAD or FWRITE;
+    else
+     begin
+       errno:=ESysEINVAL;
+       exit(-1);
+     end;
+   end;
+  TCFlush:=fpIOCtl(fd,TIOCFLUSH,pointer(@comval));
 end;
 
 Function IsATTY (Handle:cint):cint;

+ 16 - 2
rtl/netbsd/termiosproc.inc

@@ -105,9 +105,23 @@ begin
     end;
 end;
 
-Function TCFlush(fd,qsel:cint):cint;
+const FREAD  = 1; // marked "BSD visible"
+      FWRITE = 2;
+
+Function TCFlush(fd,qsel:cint):cint;  {$ifdef VER2_0}inline;{$endif}
+var comval : cint;
 begin
-  TCFlush:=fpIOCtl(fd,TIOCFLUSH,pointer(qsel));
+  case qsel of
+     TCIFlush  : comval:=FREAD;
+     TCOFlush  : comval:=FWRITE;
+     TCIOFlush : comval:=FREAD or FWRITE;
+    else
+     begin
+       errno:=ESysEINVAL;
+       exit(-1);
+     end;
+   end;
+  TCFlush:=fpIOCtl(fd,TIOCFLUSH,pointer(@comval));
 end;
 
 Function IsATTY (Handle:cint):cint;

+ 15 - 1
rtl/openbsd/termiosproc.inc

@@ -105,9 +105,23 @@ begin
     end;
 end;
 
+const FREAD  = 1; // marked "BSD visible"
+      FWRITE = 2;
+
 Function TCFlush(fd,qsel:cint):cint;  {$ifdef VER2_0}inline;{$endif}
+var comval : cint;
 begin
-  TCFlush:=fpIOCtl(fd,TIOCFLUSH,pointer(qsel));
+  case qsel of 
+     TCIFlush  : comval:=FREAD;
+     TCOFlush  : comval:=FWRITE;
+     TCIOFlush : comval:=FREAD or FWRITE;
+    else
+     begin
+       errno:=ESysEINVAL;
+       exit(-1);
+     end;
+   end;
+  TCFlush:=fpIOCtl(fd,TIOCFLUSH,pointer(@comval));
 end;
 
 Function IsATTY (Handle:cint):cint;