B20.1: select bug (win 95/98 only)

Michele Liberi mliberi@hotmail.com
Fri Jan 7 07:21:00 GMT 2000


The select function hangs while waiting for data from a pipe and the child 
process exit.
The following program well illustrates the problem.
/*************************************************************/
/* bug.c M.Liberi, 1999 */
/*************************************************************/
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/select.h>
int main(int argc, char **argv, char **envp)
{
 int 			p1[2], p2[2], maxfd;
 fd_set		fdread;
 if (pipe(p1)) return 1;
 if (pipe(p2)) return 1;
 switch(fork())
 {
 case -1: /* error */
 return 1;
 case 0: /* child */
 close(p1[0]);
 dup2(p1[1],1);
 close(p2[0]);
 dup2(p2[1],2);
 sleep(3);
 return 0;
 }
 close(p1[1]);
 close(p2[1]);
 FD_ZERO(&fdread);
 FD_SET(p1[0],&fdread);
 FD_SET(p2[0],&fdread);
 if (p1[0]>p2[0]) 	maxfd=p1[0];
 else		maxfd=p2[0];
 printf("select input %d\n", fdread);
 select(maxfd+1,&fdread,NULL,NULL,NULL);
 printf("select output %d\n", fdread);
 return 0;
} /* main */
>>cygcheck -s -v -r output

Cygnus Win95/NT Configuration Diagnostics
Current System Time: Fri Jan 07 16:16:10 2000
Win9X Ver 4.10 build 67766446 A
Path:	/bin
	/usr/bin
	/cygnus/cygwin-b20/H-i586-cygwin32/bin
	/usr/X11r6.4/bin
	/u/mic/bin
	/dbin
	/usr/dbin
	/usr/bp/bin
	/u/mic/dbin
	/wbin
	/usr/wbin
	/u/mic/wbin
	.
SysDir: C:\WINDOWS\SYSTEM
WinDir: C:\WINDOWS
HOME = `/u/mic'
MAKE_MODE = `UNIX'
PWD = `/u/mic'
!C: = `C:\u\mic'
BLASTER = `A220 I7 D1 T2 '
CLASSPATH = `C:\PROGRA~1\PHOTOD~1.0\ADOBEC~1'
CMDLINE = `C:\BIN\BASH.EXE '
COMSPEC = `C:\WINDOWS\COMMAND.COM'
DISPLAY = `:0'
HOSTNAME = `IT024504'
HOSTTYPE = `i586'
MACHTYPE = `i586-pc-cygwin32'
OSTYPE = `cygwin32'
PROMPT = `$p$g'
SHELL = `/bin/ksh'
SHLVL = `1'
SNDSCAPE = `C:\WINDOWS'
TEMP = `C:\windows\TEMP'
TERM = `cygwin'
TMP = `c:\windows\TEMP'
TZ = `NFT-1DFT'
VIM = `c:\usr\vim5-3'
WINBOOTDIR = `C:\WINDOWS'
WINDIR = `C:\WINDOWS'
_ = `/cygnus/cygwin-b20/H-i586-cygwin32/bin/cygcheck'
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start 
Menu\&Programs\Cygnus Solutions
 (default) = (unsupported type)
HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts00円
 (default) = `C:'
 unix = `/'
 fbinary = 0x00000000
 fsilent = 0x00000000
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Cygnus 
Cygwin B20
 (default) = `C:\WINDOWS\IsUninst.exe -fc:\cygnus\cygwin-b20\Uninst.isu'
 DisplayName = `Cygwin B20'
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin B20
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin B20\B20.1
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\GNUPro
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\GNUPro\i586-cygwin32
HKEY_LOCAL_MACHINE\Software\Cygnus 
Solutions\GNUPro\i586-cygwin32\i586-cygwin32
HKEY_LOCAL_MACHINE\Software\Cygnus 
Solutions\GNUPro\i586-cygwin32\i586-cygwin32\cygwin-B20.1
 (default) = `c:\cygnus\cygwin-b20'
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL setup
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts00円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts01円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts02円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts03円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts04円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts05円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts06円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts07円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts08円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts09円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts0円A
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts0円B
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts0円C
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts0円D
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts0円E
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts0円F
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts10円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts11円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts12円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts13円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts14円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts15円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts16円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts17円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts18円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts19円
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts1円A
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts1円B
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts1円C
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL 
setup\b15.0\mounts1円D
a:\ fd N/A N/A
c:\ hd FAT32 7995Mb 64% CP UN
d:\ cd N/A N/A
e:\ cd N/A N/A
C: / native text!=binary
Found: C:\bin\bash.exe
Found: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\bash.exe
Warning: C:\bin\bash.exe hides 
C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\bash.exe
Found: \bin\bash.exe
Warning: C:\bin\bash.exe hides \bin\bash.exe
Found: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\cat.exe
Found: C:\u\mic\bin\cat.exe
Warning: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\cat.exe hides 
C:\u\mic\bin\cat.exe
Not Found: cpp (good!)
Found: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\find.exe
Found: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\gcc.exe
Found: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\gdb.exe
Found: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\ld.exe
Found: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\ls.exe
Found: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\make.exe
Found: C:\usr\bp\bin\make.exe
Warning: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\make.exe hides 
C:\usr\bp\bin\make.exe
Found: C:\bin\sh.exe
Found: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\sh.exe
Warning: C:\bin\sh.exe hides C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\sh.exe
Found: \bin\sh.exe
Warning: C:\bin\sh.exe hides \bin\sh.exe
 371k 1998年12月01日 C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\cygtcl80.dll - 
os=4.0 img=1.0 sys=4.0
 "cygtcl80.dll" v0.0 ts=1998年12月1日 9:25
 5k 1998年12月01日 C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\cygtclpip80.dll - 
os=4.0 img=1.0 sys=4.0
 10k 1998年12月01日 C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\cygtclreg80.dll - 
os=4.0 img=1.0 sys=4.0
 "cygtclreg80.dll" v0.0 ts=1998年12月1日 9:25
 600k 1998年12月01日 C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\cygtk80.dll - 
os=4.0 img=1.0 sys=4.0
 "cygtk80.dll" v0.0 ts=1998年12月1日 9:28
 446k 1998年12月03日 C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\cygwin1.dll - 
os=4.0 img=1.0 sys=4.0
 "cygwin1.dll" v0.0 ts=1998年12月4日 5:39
Use -h to see help about each section
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /