64-@@ gdb /drv/e/grep/b3.1/src/grep GNU gdb (GDB) (Cygwin 7.12.1-2) 7.12.1 ... For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /drv/e/grep/b3.1/src/grep...done. (gdb) set args . (gdb) br main Breakpoint 1 at 0x10040419a: file ../../grep-3.1/src/grep.c, line 2415. (gdb) br reset Breakpoint 2 at 0x1004032bc: file ../../grep-3.1/src/grep.c, line 847. (gdb) br grep.c:856 <==== break-point on "if (seek_failed)" in grep.c/reset() Breakpoint 3 at 0x100403850: file ../../grep-3.1/src/grep.c, line 856. (gdb) run Starting program: /drv/e/grep/b3.1/src/grep . [New Thread 4684.0xe28] [New Thread 4684.0x834] Thread 1 hit Breakpoint 1, main (argc=2, argv=0xffffcc40) at ../../grep-3.1/src/grep.c:2415 2415 { (gdb) p dup2(open("fifo", 0), 0) # make stdin refer to the fifo ... Using another terminal, execute: echo aaa > fifo (open() for write resumes the open() call above) $1 = 0 (gdb) cont Continuing. Thread 1 hit Breakpoint 2, grep (ineof=, st=0xffffc940, fd=0) at ../../grep-3.1/src/grep.c:1447 1447 if (! reset (fd, st)) (gdb) cont Continuing. Thread 1 hit Breakpoint 3, reset (st=0xffffc940, fd=0) at ../../grep-3.1/src/grep.c:856 856 if (seek_failed) (gdb) p seek_failed $2 = true (gdb) p bufoffset $3 = -1 (gdb) p errno $4 = 22 # EINVAL, because NT returns ERROR_INVALID_PARAMETER (= 87) (gdb) p errno=29 # replace w/ ESPIPE (= illegal seek) $5 = 29 (gdb) cont Continuing. aaa # output of grep as expected/desired [Inferior 1 (process 4684) exited normally] (gdb) quit 64-@@ Q: why is the fifo not recognized as a pipe by Cygwin? (why does Linux recognize it a fifo/pipe?) =====