delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/08/19:37:05

Date: Tue, 9 Mar 1999 00:49:10 +0100
From: Frank Heckenbach <frank AT tim DOT gerwinski DOT de>
Message-Id: <12EF1A9E.19990309004910.FOO-3D28.frank@goedel.fjf.gnu.de>
X-Mailer: smtphack 0.3.3 by Jan Andres
To: djgpp AT delorie DOT com, peter AT gerwinski DOT de
Subject: Patch for select()
X-Counter: 886 peter AT gerwinski DOT de
Reply-To: djgpp AT delorie DOT com

Hello again,

sorry, the last patch was not enough. Here's the next try:

*** src/libc/compat/time/select.c.orig	Sun Sep 27 15:18:24 1998
--- src/libc/compat/time/select.c	Tue Mar  9 00:45:21 1999
***************
*** 47,54 ****
    if (fp->_cnt)
      return 1;
  
!   /* The `feof' part is only correct in a single-tasked environment.  */
!   if (ferror (fp) || feof (fp))
      return 0;
  
    /* There is nothing in the buffer (perhaps because we read unbuffered).
--- 47,53 ----
    if (fp->_cnt)
      return 1;
  
!   if (ferror (fp))
      return 0;
  
    /* There is nothing in the buffer (perhaps because we read unbuffered).
***************
*** 83,88 ****
--- 82,101 ----
  {
  
    __dpmi_regs regs;
+ 
+   /* If it's a disk file, always return 1, since according to Un*x
+      semantics, select() returns ``ready'' at EOF (and before EOF,
+      anyway). */
+   regs.x.ax = 0x4400;
+   regs.x.bx = fd;
+   __dpmi_int (0x21, &regs);
+   if (regs.x.flags & 1)
+   {
+     errno = __doserr_to_errno (regs.x.ax);
+     return -1;
+   }
+   if (!(regs.x.dx & 0x80))
+     return 1;
  
    regs.x.ax = 0x4406;
    regs.x.bx = fd;

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019