Mail Archives: cygwin/2000/01/07/10:20:07
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\mounts\00
(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\mounts\00
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\01
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\02
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\03
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\04
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\05
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\06
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\07
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\08
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\09
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\0A
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\0B
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\0C
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\0D
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\0E
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\0F
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\10
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\11
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\12
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\13
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\14
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\15
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\16
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\17
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\18
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\19
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\1A
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\1B
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\1C
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\1D
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 AT sourceware DOT cygnus DOT com
- Raw text -