Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvs2svn <>2014-12-18 23:30:12 +0300
committercvs2svn <>2014-12-18 23:30:12 +0300
commit7e72fffc61b29325ac5a875c5318cdf2f294ae28 (patch)
tree21635bf002197fe261c776d70f866b65aad82975 /winsup/cygwin/fhandler_tty.cc
parent0615b4bb5f38a738377d4856aed167f0ab6aa52d (diff)
This commit was manufactured by cvs2svn to create branch 'newlib-2_2_0'.newlib-2_2_0
Sprout from master 2014-12-18 20:30:11 UTC Jeff Johnston <jjohnstn@redhat.com> '' Cherrypick from cygnus 1999-05-03 07:29:06 UTC Richard Henderson <rth@redhat.com> '19990502 sourceware import': README config/mt-d30v config/mt-ospace etc/add-log.el etc/add-log.vi etc/configbuild.ein etc/configbuild.fig etc/configbuild.jin etc/configbuild.tin etc/configdev.ein etc/configdev.fig etc/configdev.jin etc/configdev.tin makefile.vms Delete: djunpack.bat include/COPYING include/COPYING3 include/ChangeLog include/ChangeLog-9103 include/MAINTAINERS include/alloca-conf.h include/ansidecl.h include/aout/ChangeLog include/aout/adobe.h include/aout/aout64.h include/aout/ar.h include/aout/dynix3.h include/aout/encap.h include/aout/host.h include/aout/hp.h include/aout/hp300hpux.h include/aout/hppa.h include/aout/ranlib.h include/aout/reloc.h include/aout/stab.def include/aout/stab_gnu.h include/aout/sun4.h include/bfdlink.h include/binary-io.h include/bout.h include/cgen/ChangeLog include/cgen/basic-modes.h include/cgen/basic-ops.h include/cgen/bitset.h include/coff/ChangeLog include/coff/ChangeLog-9103 include/coff/alpha.h include/coff/apollo.h include/coff/arm.h include/coff/aux-coff.h include/coff/ecoff.h include/coff/external.h include/coff/go32exe.h include/coff/h8300.h include/coff/h8500.h include/coff/i386.h include/coff/i860.h include/coff/i960.h include/coff/ia64.h include/coff/internal.h include/coff/m68k.h include/coff/m88k.h include/coff/mcore.h include/coff/mips.h include/coff/mipspe.h include/coff/or32.h include/coff/pe.h include/coff/powerpc.h include/coff/rs6000.h include/coff/rs6k64.h include/coff/sh.h include/coff/sparc.h include/coff/sym.h include/coff/symconst.h include/coff/ti.h include/coff/tic30.h include/coff/tic4x.h include/coff/tic54x.h include/coff/tic80.h include/coff/w65.h include/coff/we32k.h include/coff/x86_64.h include/coff/xcoff.h include/coff/z80.h include/coff/z8k.h include/demangle.h include/dis-asm.h include/dwarf2.def include/dwarf2.h include/dyn-string.h include/elf/ChangeLog include/elf/ChangeLog-9103 include/elf/aarch64.h include/elf/alpha.h include/elf/arc.h include/elf/arm.h include/elf/avr.h include/elf/bfin.h include/elf/common.h include/elf/cr16.h include/elf/cr16c.h include/elf/cris.h include/elf/crx.h include/elf/d10v.h include/elf/d30v.h include/elf/dlx.h include/elf/dwarf.h include/elf/epiphany.h include/elf/external.h include/elf/fr30.h include/elf/frv.h include/elf/h8.h include/elf/hppa.h include/elf/i370.h include/elf/i386.h include/elf/i860.h include/elf/i960.h include/elf/ia64.h include/elf/internal.h include/elf/ip2k.h include/elf/iq2000.h include/elf/lm32.h include/elf/m32c.h include/elf/m32r.h include/elf/m68hc11.h include/elf/m68k.h include/elf/mcore.h include/elf/mep.h include/elf/metag.h include/elf/microblaze.h include/elf/mips.h include/elf/mmix.h include/elf/mn10200.h include/elf/mn10300.h include/elf/moxie.h include/elf/msp430.h include/elf/mt.h include/elf/nios2.h include/elf/openrisc.h include/elf/or32.h include/elf/pj.h include/elf/ppc.h include/elf/ppc64.h include/elf/reloc-macros.h include/elf/rl78.h include/elf/rx.h include/elf/s390.h include/elf/score.h include/elf/sh.h include/elf/sparc.h include/elf/spu.h include/elf/tic6x-attrs.h include/elf/tic6x.h include/elf/tilegx.h include/elf/tilepro.h include/elf/v850.h include/elf/vax.h include/elf/vxworks.h include/elf/x86-64.h include/elf/xc16x.h include/elf/xgate.h include/elf/xstormy16.h include/elf/xtensa.h include/fibheap.h include/filenames.h include/floatformat.h include/fnmatch.h include/fopen-bin.h include/fopen-same.h include/fopen-vms.h include/gcc-c-fe.def include/gcc-c-interface.h include/gcc-interface.h include/gdb/ChangeLog include/gdb/callback.h include/gdb/fileio.h include/gdb/gdb-index.h include/gdb/remote-sim.h include/gdb/signals.def include/gdb/signals.h include/gdb/sim-arm.h include/gdb/sim-bfin.h include/gdb/sim-cr16.h include/gdb/sim-d10v.h include/gdb/sim-frv.h include/gdb/sim-h8300.h include/gdb/sim-lm32.h include/gdb/sim-m32c.h include/gdb/sim-ppc.h include/gdb/sim-rl78.h include/gdb/sim-rx.h include/gdb/sim-sh.h include/gdbm.h include/getopt.h include/hashtab.h include/hp-symtab.h include/ieee.h include/leb128.h include/libiberty.h include/longlong.h include/lto-symtab.h include/mach-o/ChangeLog include/mach-o/arm.h include/mach-o/codesign.h include/mach-o/external.h include/mach-o/loader.h include/mach-o/reloc.h include/mach-o/x86-64.h include/md5.h include/nlm/ChangeLog include/nlm/alpha-ext.h include/nlm/common.h include/nlm/external.h include/nlm/i386-ext.h include/nlm/internal.h include/nlm/ppc-ext.h include/nlm/sparc32-ext.h include/oasys.h include/objalloc.h include/obstack.h include/opcode/ChangeLog include/opcode/ChangeLog-9103 include/opcode/aarch64.h include/opcode/alpha.h include/opcode/arc.h include/opcode/arm.h include/opcode/avr.h include/opcode/bfin.h include/opcode/cgen.h include/opcode/convex.h include/opcode/cr16.h include/opcode/cris.h include/opcode/crx.h include/opcode/d10v.h include/opcode/d30v.h include/opcode/dlx.h include/opcode/h8300.h include/opcode/hppa.h include/opcode/i370.h include/opcode/i386.h include/opcode/i860.h include/opcode/i960.h include/opcode/ia64.h include/opcode/m68hc11.h include/opcode/m68k.h include/opcode/m88k.h include/opcode/metag.h include/opcode/mips.h include/opcode/mmix.h include/opcode/mn10200.h include/opcode/mn10300.h include/opcode/moxie.h include/opcode/msp430-decode.h include/opcode/msp430.h include/opcode/nios2.h include/opcode/np1.h include/opcode/ns32k.h include/opcode/or32.h include/opcode/pdp11.h include/opcode/pj.h include/opcode/pn.h include/opcode/ppc.h include/opcode/pyr.h include/opcode/rl78.h include/opcode/rx.h include/opcode/s390.h include/opcode/score-datadep.h include/opcode/score-inst.h include/opcode/sparc.h include/opcode/spu-insns.h include/opcode/spu.h include/opcode/tahoe.h include/opcode/tic30.h include/opcode/tic4x.h include/opcode/tic54x.h include/opcode/tic6x-control-registers.h include/opcode/tic6x-insn-formats.h include/opcode/tic6x-opcode-table.h include/opcode/tic6x.h include/opcode/tic80.h include/opcode/tilegx.h include/opcode/tilepro.h include/opcode/v850.h include/opcode/vax.h include/opcode/xgate.h include/os9k.h include/partition.h include/plugin-api.h include/progress.h include/safe-ctype.h include/sha1.h include/simple-object.h include/som/ChangeLog include/som/aout.h include/som/clock.h include/som/internal.h include/som/lst.h include/som/reloc.h include/sort.h include/splay-tree.h include/symcat.h include/timeval-utils.h include/vms/ChangeLog include/vms/dcx.h include/vms/dmt.h include/vms/dsc.h include/vms/dst.h include/vms/eeom.h include/vms/egps.h include/vms/egsd.h include/vms/egst.h include/vms/egsy.h include/vms/eiaf.h include/vms/eicp.h include/vms/eidc.h include/vms/eiha.h include/vms/eihd.h include/vms/eihi.h include/vms/eihs.h include/vms/eihvn.h include/vms/eisd.h include/vms/emh.h include/vms/eobjrec.h include/vms/esdf.h include/vms/esdfm.h include/vms/esdfv.h include/vms/esgps.h include/vms/esrf.h include/vms/etir.h include/vms/internal.h include/vms/lbr.h include/vms/prt.h include/vms/shl.h include/vtv-change-permission.h include/xregex.h include/xregex2.h include/xtensa-config.h include/xtensa-isa-internal.h include/xtensa-isa.h winsup/COPYING winsup/CYGWIN_LICENSE winsup/ChangeLog winsup/Makefile.common winsup/Makefile.in winsup/README winsup/acinclude.m4 winsup/aclocal.m4 winsup/autogen.sh winsup/c++wrap winsup/ccwrap winsup/config.guess winsup/config.sub winsup/configure winsup/configure.ac winsup/configure.cygwin winsup/cygserver/ChangeLog winsup/cygserver/ChangeLog.64bit winsup/cygserver/Makefile.in winsup/cygserver/README winsup/cygserver/aclocal.m4 winsup/cygserver/autogen.sh winsup/cygserver/bsd_helper.cc winsup/cygserver/bsd_helper.h winsup/cygserver/bsd_log.cc winsup/cygserver/bsd_log.h winsup/cygserver/bsd_mutex.cc winsup/cygserver/bsd_mutex.h winsup/cygserver/client.cc winsup/cygserver/configure winsup/cygserver/configure.ac winsup/cygserver/cygserver-config winsup/cygserver/cygserver.cc winsup/cygserver/cygserver.conf winsup/cygserver/msg.cc winsup/cygserver/process.cc winsup/cygserver/process.h winsup/cygserver/pwdgrp.cc winsup/cygserver/sem.cc winsup/cygserver/setpwd.cc winsup/cygserver/shm.cc winsup/cygserver/sysv_msg.cc winsup/cygserver/sysv_sem.cc winsup/cygserver/sysv_shm.cc winsup/cygserver/threaded_queue.cc winsup/cygserver/threaded_queue.h winsup/cygserver/transport.cc winsup/cygserver/transport.h winsup/cygserver/transport_pipes.cc winsup/cygserver/transport_pipes.h winsup/cygserver/woutsup.h winsup/cygwin/ChangeLog winsup/cygwin/ChangeLog-1995 winsup/cygwin/ChangeLog-1996 winsup/cygwin/ChangeLog-1997 winsup/cygwin/ChangeLog-1998 winsup/cygwin/ChangeLog-1999 winsup/cygwin/ChangeLog-2000 winsup/cygwin/ChangeLog-2001 winsup/cygwin/ChangeLog-2002 winsup/cygwin/ChangeLog-2003 winsup/cygwin/ChangeLog-2004 winsup/cygwin/ChangeLog-2005 winsup/cygwin/ChangeLog-2006 winsup/cygwin/ChangeLog-2007 winsup/cygwin/ChangeLog-2008 winsup/cygwin/ChangeLog-2009 winsup/cygwin/ChangeLog-2010 winsup/cygwin/ChangeLog-2011 winsup/cygwin/ChangeLog-2012 winsup/cygwin/ChangeLog-2013 winsup/cygwin/ChangeLog.64bit winsup/cygwin/DevNotes winsup/cygwin/Makefile.in winsup/cygwin/ROADMAP winsup/cygwin/acconfig.h winsup/cygwin/aclocal.m4 winsup/cygwin/advapi32.cc winsup/cygwin/analyze_sigfe winsup/cygwin/assert.cc winsup/cygwin/autogen.sh winsup/cygwin/autoload.cc winsup/cygwin/automode.c winsup/cygwin/binmode.c winsup/cygwin/child_info.h winsup/cygwin/collate.h winsup/cygwin/common.din winsup/cygwin/config.h.in winsup/cygwin/configure winsup/cygwin/configure.ac winsup/cygwin/cpuid.h winsup/cygwin/crt0.c winsup/cygwin/ctype.cc winsup/cygwin/cxx.cc winsup/cygwin/cygerrno.h winsup/cygwin/cygheap.cc winsup/cygwin/cygheap.h winsup/cygwin/cygheap_malloc.h winsup/cygwin/cyglsa.h winsup/cygwin/cygmagic winsup/cygwin/cygmalloc.h winsup/cygwin/cygprops.h winsup/cygwin/cygserver.h winsup/cygwin/cygserver_ipc.h winsup/cygwin/cygserver_msg.h winsup/cygwin/cygserver_pwdgrp.h winsup/cygwin/cygserver_sem.h winsup/cygwin/cygserver_setpwd.h winsup/cygwin/cygserver_shm.h winsup/cygwin/cygthread.cc winsup/cygwin/cygthread.h winsup/cygwin/cygtls.cc winsup/cygwin/cygtls.h winsup/cygwin/cygwait.cc winsup/cygwin/cygwait.h winsup/cygwin/cygwin-cxx.h winsup/cygwin/cygwin-shilka winsup/cygwin/cygwin.ldif winsup/cygwin/cygwin.sc.in winsup/cygwin/cygwin_version.h winsup/cygwin/cygxdr.cc winsup/cygwin/cygxdr.h winsup/cygwin/dcrt0.cc winsup/cygwin/debug.cc winsup/cygwin/debug.h winsup/cygwin/devices.cc winsup/cygwin/devices.h winsup/cygwin/devices.in winsup/cygwin/dir.cc winsup/cygwin/dlfcn.cc winsup/cygwin/dll_init.cc winsup/cygwin/dll_init.h winsup/cygwin/dllfixdbg winsup/cygwin/dtable.cc winsup/cygwin/dtable.h winsup/cygwin/environ.cc winsup/cygwin/environ.h winsup/cygwin/errno.cc winsup/cygwin/exception.h winsup/cygwin/exceptions.cc winsup/cygwin/exec.cc winsup/cygwin/external.cc winsup/cygwin/fcntl.cc winsup/cygwin/fenv.cc winsup/cygwin/fhandler.cc winsup/cygwin/fhandler.h winsup/cygwin/fhandler_clipboard.cc winsup/cygwin/fhandler_console.cc winsup/cygwin/fhandler_dev.cc winsup/cygwin/fhandler_disk_file.cc winsup/cygwin/fhandler_dsp.cc winsup/cygwin/fhandler_fifo.cc winsup/cygwin/fhandler_floppy.cc winsup/cygwin/fhandler_mailslot.cc winsup/cygwin/fhandler_netdrive.cc winsup/cygwin/fhandler_nodevice.cc winsup/cygwin/fhandler_proc.cc winsup/cygwin/fhandler_process.cc winsup/cygwin/fhandler_procnet.cc winsup/cygwin/fhandler_procsys.cc winsup/cygwin/fhandler_procsysvipc.cc winsup/cygwin/fhandler_random.cc winsup/cygwin/fhandler_raw.cc winsup/cygwin/fhandler_registry.cc winsup/cygwin/fhandler_serial.cc winsup/cygwin/fhandler_socket.cc winsup/cygwin/fhandler_tape.cc winsup/cygwin/fhandler_termios.cc winsup/cygwin/fhandler_tty.cc winsup/cygwin/fhandler_virtual.cc winsup/cygwin/fhandler_virtual.h winsup/cygwin/fhandler_windows.cc winsup/cygwin/fhandler_zero.cc winsup/cygwin/flock.cc winsup/cygwin/fork.cc winsup/cygwin/gcrt0.c winsup/cygwin/gendef winsup/cygwin/gendevices winsup/cygwin/gentls_offsets winsup/cygwin/glob.cc winsup/cygwin/glob_pattern_p.cc winsup/cygwin/globals.cc winsup/cygwin/gmon.c winsup/cygwin/gmon.h winsup/cygwin/grp.cc winsup/cygwin/heap.cc winsup/cygwin/heap.h winsup/cygwin/hires.h winsup/cygwin/hookapi.cc winsup/cygwin/how-autoload-works.txt winsup/cygwin/how-cygheap-works.txt winsup/cygwin/how-cygtls-works.txt winsup/cygwin/how-fhandlers-work.txt winsup/cygwin/how-signals-work.txt winsup/cygwin/how-spawn-works.txt winsup/cygwin/how-startup-shutdown-works.txt winsup/cygwin/how-to-debug-cygwin.txt winsup/cygwin/how-vfork-works.txt winsup/cygwin/i686.din winsup/cygwin/import/rexec.c winsup/cygwin/include/a.out.h winsup/cygwin/include/arpa/ftp.h winsup/cygwin/include/arpa/inet.h winsup/cygwin/include/arpa/nameser.h winsup/cygwin/include/arpa/nameser_compat.h winsup/cygwin/include/arpa/telnet.h winsup/cygwin/include/asm/byteorder.h winsup/cygwin/include/asm/socket.h winsup/cygwin/include/asm/types.h winsup/cygwin/include/attr/xattr.h winsup/cygwin/include/bits/endian.h winsup/cygwin/include/bits/wordsize.h winsup/cygwin/include/byteswap.h winsup/cygwin/include/cygwin/_types.h winsup/cygwin/include/cygwin/acl.h winsup/cygwin/include/cygwin/config.h winsup/cygwin/include/cygwin/core_dump.h winsup/cygwin/include/cygwin/cygwin_dll.h winsup/cygwin/include/cygwin/fs.h winsup/cygwin/include/cygwin/grp.h winsup/cygwin/include/cygwin/hdreg.h winsup/cygwin/include/cygwin/icmp.h winsup/cygwin/include/cygwin/if.h winsup/cygwin/include/cygwin/in.h winsup/cygwin/include/cygwin/in6.h winsup/cygwin/include/cygwin/in_systm.h winsup/cygwin/include/cygwin/ipc.h winsup/cygwin/include/cygwin/kd.h winsup/cygwin/include/cygwin/msg.h winsup/cygwin/include/cygwin/mtio.h winsup/cygwin/include/cygwin/rdevio.h winsup/cygwin/include/cygwin/sem.h winsup/cygwin/include/cygwin/shm.h winsup/cygwin/include/cygwin/signal.h winsup/cygwin/include/cygwin/socket.h winsup/cygwin/include/cygwin/sockios.h winsup/cygwin/include/cygwin/stat.h winsup/cygwin/include/cygwin/stdlib.h winsup/cygwin/include/cygwin/sys_time.h winsup/cygwin/include/cygwin/sysproto.h winsup/cygwin/include/cygwin/time.h winsup/cygwin/include/cygwin/types.h winsup/cygwin/include/cygwin/utmp.h winsup/cygwin/include/cygwin/version.h winsup/cygwin/include/cygwin/wait.h winsup/cygwin/include/dlfcn.h winsup/cygwin/include/elf.h winsup/cygwin/include/endian.h winsup/cygwin/include/err.h winsup/cygwin/include/error.h winsup/cygwin/include/fcntl.h winsup/cygwin/include/features.h winsup/cygwin/include/fenv.h winsup/cygwin/include/fnmatch.h winsup/cygwin/include/fts.h winsup/cygwin/include/ftw.h winsup/cygwin/include/getopt.h winsup/cygwin/include/glob.h winsup/cygwin/include/icmp.h winsup/cygwin/include/ifaddrs.h winsup/cygwin/include/inttypes.h winsup/cygwin/include/io.h winsup/cygwin/include/lastlog.h winsup/cygwin/include/libgen.h winsup/cygwin/include/limits.h winsup/cygwin/include/machine/elf.h winsup/cygwin/include/machine/stdlib.h winsup/cygwin/include/mapi.h winsup/cygwin/include/memory.h winsup/cygwin/include/mntent.h winsup/cygwin/include/monetary.h winsup/cygwin/include/mqueue.h winsup/cygwin/include/net/if.h winsup/cygwin/include/netdb.h winsup/cygwin/include/netinet/in.h winsup/cygwin/include/netinet/in_systm.h winsup/cygwin/include/netinet/ip.h winsup/cygwin/include/netinet/ip6.h winsup/cygwin/include/netinet/ip_icmp.h winsup/cygwin/include/netinet/tcp.h winsup/cygwin/include/netinet/udp.h winsup/cygwin/include/paths.h winsup/cygwin/include/poll.h winsup/cygwin/include/process.h winsup/cygwin/include/pthread.h winsup/cygwin/include/pty.h winsup/cygwin/include/regex.h winsup/cygwin/include/resolv.h winsup/cygwin/include/search.h winsup/cygwin/include/semaphore.h winsup/cygwin/include/stdint.h winsup/cygwin/include/sys/acl.h winsup/cygwin/include/sys/copying.dj winsup/cygwin/include/sys/cygwin.h winsup/cygwin/include/sys/dirent.h winsup/cygwin/include/sys/elf.h winsup/cygwin/include/sys/elf32.h winsup/cygwin/include/sys/elf64.h winsup/cygwin/include/sys/elf_common.h winsup/cygwin/include/sys/elf_generic.h winsup/cygwin/include/sys/file.h winsup/cygwin/include/sys/ioctl.h winsup/cygwin/include/sys/ipc.h winsup/cygwin/include/sys/kd.h winsup/cygwin/include/sys/lock.h winsup/cygwin/include/sys/mman.h winsup/cygwin/include/sys/mount.h winsup/cygwin/include/sys/msg.h winsup/cygwin/include/sys/mtio.h winsup/cygwin/include/sys/param.h winsup/cygwin/include/sys/poll.h winsup/cygwin/include/sys/procfs.h winsup/cygwin/include/sys/quota.h winsup/cygwin/include/sys/resource.h winsup/cygwin/include/sys/select.h winsup/cygwin/include/sys/sem.h winsup/cygwin/include/sys/shm.h winsup/cygwin/include/sys/smallprint.h winsup/cygwin/include/sys/socket.h winsup/cygwin/include/sys/soundcard.h winsup/cygwin/include/sys/statfs.h winsup/cygwin/include/sys/statvfs.h winsup/cygwin/include/sys/stdio.h winsup/cygwin/include/sys/strace.h winsup/cygwin/include/sys/sysinfo.h winsup/cygwin/include/sys/syslimits.h winsup/cygwin/include/sys/syslog.h winsup/cygwin/include/sys/sysmacros.h winsup/cygwin/include/sys/sysproto.h winsup/cygwin/include/sys/termio.h winsup/cygwin/include/sys/termios.h winsup/cygwin/include/sys/ttychars.h winsup/cygwin/include/sys/uio.h winsup/cygwin/include/sys/un.h winsup/cygwin/include/sys/utime.h winsup/cygwin/include/sys/utmp.h winsup/cygwin/include/sys/utsname.h winsup/cygwin/include/sys/vfs.h winsup/cygwin/include/sys/wait.h winsup/cygwin/include/sys/xattr.h winsup/cygwin/include/sysexits.h winsup/cygwin/include/syslog.h winsup/cygwin/include/termio.h winsup/cygwin/include/tzfile.h winsup/cygwin/include/utmpx.h winsup/cygwin/include/wait.h winsup/cygwin/init.cc winsup/cygwin/ioctl.cc winsup/cygwin/ipc.cc winsup/cygwin/kernel32.cc winsup/cygwin/lc_era.h winsup/cygwin/lc_msg.h winsup/cygwin/ldap.cc winsup/cygwin/ldap.h winsup/cygwin/lib/_cygwin_crt0_common.cc winsup/cygwin/lib/atexit.c winsup/cygwin/lib/crt0.h winsup/cygwin/lib/cygwin_attach_dll.c winsup/cygwin/lib/cygwin_crt0.c winsup/cygwin/lib/dll_entry.c winsup/cygwin/lib/dll_main.cc winsup/cygwin/lib/dso_handle.c winsup/cygwin/lib/libcmain.c winsup/cygwin/lib/premain0.c winsup/cygwin/lib/premain1.c winsup/cygwin/lib/premain2.c winsup/cygwin/lib/premain3.c winsup/cygwin/lib/pseudo-reloc-dummy.c winsup/cygwin/libc/arc4random.cc winsup/cygwin/libc/base64.c winsup/cygwin/libc/bsdlib.cc winsup/cygwin/libc/fnmatch.c winsup/cygwin/libc/fts.c winsup/cygwin/libc/ftw.c winsup/cygwin/libc/getopt.c winsup/cygwin/libc/inet_addr.c winsup/cygwin/libc/inet_network.c winsup/cygwin/libc/minires-os-if.c winsup/cygwin/libc/minires.c winsup/cygwin/libc/minires.h winsup/cygwin/libc/nftw.c winsup/cygwin/libc/rcmd.cc winsup/cygwin/libc/rexec.cc winsup/cygwin/libc/strfmon.c winsup/cygwin/libc/strptime.cc winsup/cygwin/libc/xsique.cc winsup/cygwin/libstdcxx_wrapper.cc winsup/cygwin/localtime.cc winsup/cygwin/lsearch.cc winsup/cygwin/malloc.cc winsup/cygwin/malloc_wrapper.cc winsup/cygwin/mcount.c winsup/cygwin/mcountFunc.S winsup/cygwin/miscfuncs.cc winsup/cygwin/miscfuncs.h winsup/cygwin/mkglobals_h winsup/cygwin/mkimport winsup/cygwin/mkstatic winsup/cygwin/mktemp.cc winsup/cygwin/mkvers.sh winsup/cygwin/mmap.cc winsup/cygwin/mmap_helper.h winsup/cygwin/mount.cc winsup/cygwin/mount.h winsup/cygwin/msg.cc winsup/cygwin/mtinfo.h winsup/cygwin/net.cc winsup/cygwin/netdb.cc winsup/cygwin/nfs.cc winsup/cygwin/nfs.h winsup/cygwin/nlsfuncs.cc winsup/cygwin/ntdll.h winsup/cygwin/ntea.cc winsup/cygwin/passwd.cc winsup/cygwin/path.cc winsup/cygwin/path.h winsup/cygwin/perprocess.h winsup/cygwin/pinfo.cc winsup/cygwin/pinfo.h winsup/cygwin/pipe.cc winsup/cygwin/poll.cc winsup/cygwin/posix_ipc.cc winsup/cygwin/profil.c winsup/cygwin/profil.h winsup/cygwin/pseudo-reloc.cc winsup/cygwin/pthread.cc winsup/cygwin/pwdgrp.h winsup/cygwin/quotactl.cc winsup/cygwin/random.cc winsup/cygwin/regex/COPYRIGHT winsup/cygwin/regex/cname.h winsup/cygwin/regex/engine.c winsup/cygwin/regex/regcomp.c winsup/cygwin/regex/regerror.c winsup/cygwin/regex/regex.3 winsup/cygwin/regex/regex.7 winsup/cygwin/regex/regex2.h winsup/cygwin/regex/regexec.c winsup/cygwin/regex/regfree.c winsup/cygwin/regex/utils.h winsup/cygwin/registry.cc winsup/cygwin/registry.h winsup/cygwin/regparm.h winsup/cygwin/release/1.7.10 winsup/cygwin/release/1.7.11 winsup/cygwin/release/1.7.12 winsup/cygwin/release/1.7.13 winsup/cygwin/release/1.7.14 winsup/cygwin/release/1.7.15 winsup/cygwin/release/1.7.16 winsup/cygwin/release/1.7.17 winsup/cygwin/release/1.7.18 winsup/cygwin/release/1.7.19 winsup/cygwin/release/1.7.20 winsup/cygwin/release/1.7.21 winsup/cygwin/release/1.7.22 winsup/cygwin/release/1.7.23 winsup/cygwin/release/1.7.24 winsup/cygwin/release/1.7.25 winsup/cygwin/release/1.7.26 winsup/cygwin/release/1.7.27 winsup/cygwin/release/1.7.28 winsup/cygwin/release/1.7.29 winsup/cygwin/release/1.7.30 winsup/cygwin/release/1.7.31 winsup/cygwin/release/1.7.32 winsup/cygwin/release/1.7.33 winsup/cygwin/release/1.7.34 winsup/cygwin/resource.cc winsup/cygwin/scandir.cc winsup/cygwin/sched.cc winsup/cygwin/sec_acl.cc winsup/cygwin/sec_auth.cc winsup/cygwin/sec_helper.cc winsup/cygwin/security.cc winsup/cygwin/security.h winsup/cygwin/select.cc winsup/cygwin/select.h winsup/cygwin/sem.cc winsup/cygwin/setlsapwd.cc winsup/cygwin/shared.cc winsup/cygwin/shared_info.h winsup/cygwin/shm.cc winsup/cygwin/signal.cc winsup/cygwin/sigproc.cc winsup/cygwin/sigproc.h winsup/cygwin/smallprint.cc winsup/cygwin/sortdin winsup/cygwin/spawn.cc winsup/cygwin/speclib winsup/cygwin/spinlock.h winsup/cygwin/strace.cc winsup/cygwin/strfuncs.cc winsup/cygwin/string.h winsup/cygwin/strsep.cc winsup/cygwin/strsig.cc winsup/cygwin/sync.cc winsup/cygwin/sync.h winsup/cygwin/syscalls.cc winsup/cygwin/sysconf.cc winsup/cygwin/syslog.cc winsup/cygwin/termios.cc winsup/cygwin/textmode.c winsup/cygwin/textreadmode.c winsup/cygwin/thread.cc winsup/cygwin/thread.h winsup/cygwin/timer.cc winsup/cygwin/times.cc winsup/cygwin/tls_pbuf.cc winsup/cygwin/tls_pbuf.h winsup/cygwin/tlsoffsets.h winsup/cygwin/tlsoffsets64.h winsup/cygwin/tmpbuf.h winsup/cygwin/tty.cc winsup/cygwin/tty.h winsup/cygwin/tz_posixrules.h winsup/cygwin/uinfo.cc winsup/cygwin/uname.cc winsup/cygwin/update-copyright winsup/cygwin/wait.cc winsup/cygwin/wchar.h winsup/cygwin/winbase.h winsup/cygwin/wincap.cc winsup/cygwin/wincap.h winsup/cygwin/window.cc winsup/cygwin/winf.cc winsup/cygwin/winf.h winsup/cygwin/wininfo.h winsup/cygwin/winlean.h winsup/cygwin/winsup.h winsup/cygwin/winver.rc winsup/cygwin/wow64.cc winsup/cygwin/wow64.h winsup/cygwin/x86_64.din winsup/doc/.cvsignore winsup/doc/ChangeLog winsup/doc/Makefile.in winsup/doc/README winsup/doc/Wishlist winsup/doc/aclocal.m4 winsup/doc/bodysnatcher.pl winsup/doc/configure winsup/doc/configure.ac winsup/doc/cygserver.xml winsup/doc/cygwin-api.xml winsup/doc/cygwin-ug-net.xml winsup/doc/cygwin.xsl winsup/doc/cygwinenv.xml winsup/doc/dll.xml winsup/doc/effectively.xml winsup/doc/faq-api.xml winsup/doc/faq-copyright.xml winsup/doc/faq-programming.xml winsup/doc/faq-resources.xml winsup/doc/faq-setup.xml winsup/doc/faq-using.xml winsup/doc/faq-what.xml winsup/doc/faq.xml winsup/doc/fhandler-tut.txt winsup/doc/filemodes.xml winsup/doc/fo.xsl winsup/doc/gcc.xml winsup/doc/gdb.xml winsup/doc/highlights.xml winsup/doc/legal.xml winsup/doc/logon-funcs.xml winsup/doc/misc-funcs.xml winsup/doc/new-features.xml winsup/doc/ntsec.xml winsup/doc/ov-ex-unix.xml winsup/doc/ov-ex-win.xml winsup/doc/overview.xml winsup/doc/path.xml winsup/doc/pathnames.xml winsup/doc/posix.xml winsup/doc/programming.xml winsup/doc/setup-env.xml winsup/doc/setup-files.xml winsup/doc/setup-locale.xml winsup/doc/setup-maxmem.xml winsup/doc/setup-net.xml winsup/doc/specialnames.xml winsup/doc/textbinary.xml winsup/doc/ug-info.xml winsup/doc/using.xml winsup/doc/utils.xml winsup/doc/windres.xml winsup/doc/xidepend winsup/install-sh winsup/lsaauth/ChangeLog winsup/lsaauth/ChangeLog.64bit winsup/lsaauth/Makefile.in winsup/lsaauth/aclocal.m4 winsup/lsaauth/configure winsup/lsaauth/configure.ac winsup/lsaauth/cyglsa-config winsup/lsaauth/cyglsa.c winsup/lsaauth/cyglsa.din winsup/lsaauth/cyglsa64.def winsup/testsuite/ChangeLog winsup/testsuite/Makefile.in winsup/testsuite/README winsup/testsuite/aclocal.m4 winsup/testsuite/config/default.exp winsup/testsuite/configure winsup/testsuite/configure.ac winsup/testsuite/cygrun.c winsup/testsuite/libltp/include/dataascii.h winsup/testsuite/libltp/include/databin.h winsup/testsuite/libltp/include/file_lock.h winsup/testsuite/libltp/include/forker.h winsup/testsuite/libltp/include/open_flags.h winsup/testsuite/libltp/include/pattern.h winsup/testsuite/libltp/include/random_range.h winsup/testsuite/libltp/include/rmobj.h winsup/testsuite/libltp/include/search_path.h winsup/testsuite/libltp/include/str_to_bytes.h winsup/testsuite/libltp/include/string_to_tokens.h winsup/testsuite/libltp/include/test.h winsup/testsuite/libltp/include/tlibio.h winsup/testsuite/libltp/include/usctest.h winsup/testsuite/libltp/include/write_log.h winsup/testsuite/libltp/lib/dataascii.c winsup/testsuite/libltp/lib/databin.c winsup/testsuite/libltp/lib/datapid.c winsup/testsuite/libltp/lib/forker.c winsup/testsuite/libltp/lib/get_high_address.c winsup/testsuite/libltp/lib/libtestsuite.c winsup/testsuite/libltp/lib/open_flags.c winsup/testsuite/libltp/lib/parse_opts.c winsup/testsuite/libltp/lib/pattern.c winsup/testsuite/libltp/lib/rmobj.c winsup/testsuite/libltp/lib/search_path.c winsup/testsuite/libltp/lib/str_to_bytes.c winsup/testsuite/libltp/lib/string_to_tokens.c winsup/testsuite/libltp/lib/tst_res.c winsup/testsuite/libltp/lib/tst_sig.c winsup/testsuite/libltp/lib/tst_tmpdir.c winsup/testsuite/libltp/lib/write_log.c winsup/testsuite/winsup.api/checksignal.c winsup/testsuite/winsup.api/crlf.c winsup/testsuite/winsup.api/cygload.cc winsup/testsuite/winsup.api/cygload.exp winsup/testsuite/winsup.api/cygload.h winsup/testsuite/winsup.api/devdsp.c winsup/testsuite/winsup.api/devdsp_okay.h winsup/testsuite/winsup.api/devzero.c winsup/testsuite/winsup.api/iospeed.c winsup/testsuite/winsup.api/known_bugs.tcl winsup/testsuite/winsup.api/ltp/access01.c winsup/testsuite/winsup.api/ltp/access03.c winsup/testsuite/winsup.api/ltp/access04.c winsup/testsuite/winsup.api/ltp/access05.c winsup/testsuite/winsup.api/ltp/alarm01.c winsup/testsuite/winsup.api/ltp/alarm02.c winsup/testsuite/winsup.api/ltp/alarm03.c winsup/testsuite/winsup.api/ltp/alarm07.c winsup/testsuite/winsup.api/ltp/asyncio02.c winsup/testsuite/winsup.api/ltp/chdir02.c winsup/testsuite/winsup.api/ltp/chdir04.c winsup/testsuite/winsup.api/ltp/chmod01.c winsup/testsuite/winsup.api/ltp/chmod02.c winsup/testsuite/winsup.api/ltp/chown01.c winsup/testsuite/winsup.api/ltp/close01.c winsup/testsuite/winsup.api/ltp/close02.c winsup/testsuite/winsup.api/ltp/close08.c winsup/testsuite/winsup.api/ltp/creat01.c winsup/testsuite/winsup.api/ltp/creat03.c winsup/testsuite/winsup.api/ltp/creat09.c winsup/testsuite/winsup.api/ltp/dup01.c winsup/testsuite/winsup.api/ltp/dup02.c winsup/testsuite/winsup.api/ltp/dup03.c winsup/testsuite/winsup.api/ltp/dup04.c winsup/testsuite/winsup.api/ltp/dup05.c winsup/testsuite/winsup.api/ltp/execl01.c winsup/testsuite/winsup.api/ltp/execle01.c winsup/testsuite/winsup.api/ltp/execlp01.c winsup/testsuite/winsup.api/ltp/execv01.c winsup/testsuite/winsup.api/ltp/execve01.c winsup/testsuite/winsup.api/ltp/execvp01.c winsup/testsuite/winsup.api/ltp/exit01.c winsup/testsuite/winsup.api/ltp/exit02.c winsup/testsuite/winsup.api/ltp/fchdir01.c winsup/testsuite/winsup.api/ltp/fchdir02.c winsup/testsuite/winsup.api/ltp/fchmod01.c winsup/testsuite/winsup.api/ltp/fchown01.c winsup/testsuite/winsup.api/ltp/fcntl02.c winsup/testsuite/winsup.api/ltp/fcntl03.c winsup/testsuite/winsup.api/ltp/fcntl04.c winsup/testsuite/winsup.api/ltp/fcntl05.c winsup/testsuite/winsup.api/ltp/fcntl07.c winsup/testsuite/winsup.api/ltp/fcntl07B.c winsup/testsuite/winsup.api/ltp/fcntl08.c winsup/testsuite/winsup.api/ltp/fcntl09.c winsup/testsuite/winsup.api/ltp/fcntl10.c winsup/testsuite/winsup.api/ltp/fork01.c winsup/testsuite/winsup.api/ltp/fork02.c winsup/testsuite/winsup.api/ltp/fork03.c winsup/testsuite/winsup.api/ltp/fork04.c winsup/testsuite/winsup.api/ltp/fork06.c winsup/testsuite/winsup.api/ltp/fork07.c winsup/testsuite/winsup.api/ltp/fork09.c winsup/testsuite/winsup.api/ltp/fork10.c winsup/testsuite/winsup.api/ltp/fork11.c winsup/testsuite/winsup.api/ltp/fpathconf01.c winsup/testsuite/winsup.api/ltp/fstat01.c winsup/testsuite/winsup.api/ltp/fstat02.c winsup/testsuite/winsup.api/ltp/fstat03.c winsup/testsuite/winsup.api/ltp/fstat04.c winsup/testsuite/winsup.api/ltp/fsync01.c winsup/testsuite/winsup.api/ltp/ftruncate01.c winsup/testsuite/winsup.api/ltp/ftruncate02.c winsup/testsuite/winsup.api/ltp/ftruncate03.c winsup/testsuite/winsup.api/ltp/getegid01.c winsup/testsuite/winsup.api/ltp/geteuid01.c winsup/testsuite/winsup.api/ltp/getgid01.c winsup/testsuite/winsup.api/ltp/getgid02.c winsup/testsuite/winsup.api/ltp/getgid03.c winsup/testsuite/winsup.api/ltp/getgroups01.c winsup/testsuite/winsup.api/ltp/getgroups02.c winsup/testsuite/winsup.api/ltp/gethostid01.c winsup/testsuite/winsup.api/ltp/gethostname01.c winsup/testsuite/winsup.api/ltp/getpgid01.c winsup/testsuite/winsup.api/ltp/getpgid02.c winsup/testsuite/winsup.api/ltp/getpgrp01.c winsup/testsuite/winsup.api/ltp/getpid01.c winsup/testsuite/winsup.api/ltp/getpid02.c winsup/testsuite/winsup.api/ltp/getppid01.c winsup/testsuite/winsup.api/ltp/getppid02.c winsup/testsuite/winsup.api/ltp/getuid01.c winsup/testsuite/winsup.api/ltp/getuid02.c winsup/testsuite/winsup.api/ltp/getuid03.c winsup/testsuite/winsup.api/ltp/kill01.c winsup/testsuite/winsup.api/ltp/kill02.c winsup/testsuite/winsup.api/ltp/kill03.c winsup/testsuite/winsup.api/ltp/kill04.c winsup/testsuite/winsup.api/ltp/kill09.c winsup/testsuite/winsup.api/ltp/link02.c winsup/testsuite/winsup.api/ltp/link03.c winsup/testsuite/winsup.api/ltp/link04.c winsup/testsuite/winsup.api/ltp/link05.c winsup/testsuite/winsup.api/ltp/lseek01.c winsup/testsuite/winsup.api/ltp/lseek02.c winsup/testsuite/winsup.api/ltp/lseek03.c winsup/testsuite/winsup.api/ltp/lseek04.c winsup/testsuite/winsup.api/ltp/lseek05.c winsup/testsuite/winsup.api/ltp/lseek06.c winsup/testsuite/winsup.api/ltp/lseek07.c winsup/testsuite/winsup.api/ltp/lseek08.c winsup/testsuite/winsup.api/ltp/lseek09.c winsup/testsuite/winsup.api/ltp/lseek10.c winsup/testsuite/winsup.api/ltp/lstat02.c winsup/testsuite/winsup.api/ltp/mkdir01.c winsup/testsuite/winsup.api/ltp/mkdir08.c winsup/testsuite/winsup.api/ltp/mknod01.c winsup/testsuite/winsup.api/ltp/mmap001.c winsup/testsuite/winsup.api/ltp/mmap02.c winsup/testsuite/winsup.api/ltp/mmap03.c winsup/testsuite/winsup.api/ltp/mmap04.c winsup/testsuite/winsup.api/ltp/mmap05.c winsup/testsuite/winsup.api/ltp/mmap06.c winsup/testsuite/winsup.api/ltp/mmap07.c winsup/testsuite/winsup.api/ltp/mmap08.c winsup/testsuite/winsup.api/ltp/munmap01.c winsup/testsuite/winsup.api/ltp/munmap02.c winsup/testsuite/winsup.api/ltp/nice05.c winsup/testsuite/winsup.api/ltp/open02.c winsup/testsuite/winsup.api/ltp/open03.c winsup/testsuite/winsup.api/ltp/pathconf01.c winsup/testsuite/winsup.api/ltp/pause01.c winsup/testsuite/winsup.api/ltp/pipe01.c winsup/testsuite/winsup.api/ltp/pipe08.c winsup/testsuite/winsup.api/ltp/pipe09.c winsup/testsuite/winsup.api/ltp/pipe10.c winsup/testsuite/winsup.api/ltp/pipe11.c winsup/testsuite/winsup.api/ltp/poll01.c winsup/testsuite/winsup.api/ltp/read01.c winsup/testsuite/winsup.api/ltp/read04.c winsup/testsuite/winsup.api/ltp/readdir01.c winsup/testsuite/winsup.api/ltp/readlink01.c winsup/testsuite/winsup.api/ltp/readlink02.c winsup/testsuite/winsup.api/ltp/readlink03.c winsup/testsuite/winsup.api/ltp/rename01.c winsup/testsuite/winsup.api/ltp/rename02.c winsup/testsuite/winsup.api/ltp/rename08.c winsup/testsuite/winsup.api/ltp/rename10.c winsup/testsuite/winsup.api/ltp/rmdir01.c winsup/testsuite/winsup.api/ltp/rmdir04.c winsup/testsuite/winsup.api/ltp/rmdir05.c winsup/testsuite/winsup.api/ltp/sbrk01.c winsup/testsuite/winsup.api/ltp/select01.c winsup/testsuite/winsup.api/ltp/select02.c winsup/testsuite/winsup.api/ltp/select03.c winsup/testsuite/winsup.api/ltp/setgid01.c winsup/testsuite/winsup.api/ltp/setgroups01.c winsup/testsuite/winsup.api/ltp/setpgid01.c winsup/testsuite/winsup.api/ltp/setregid01.c winsup/testsuite/winsup.api/ltp/setreuid01.c winsup/testsuite/winsup.api/ltp/setuid01.c winsup/testsuite/winsup.api/ltp/setuid02.c winsup/testsuite/winsup.api/ltp/signal03.c winsup/testsuite/winsup.api/ltp/stat01.c winsup/testsuite/winsup.api/ltp/stat02.c winsup/testsuite/winsup.api/ltp/stat03.c winsup/testsuite/winsup.api/ltp/stat05.c winsup/testsuite/winsup.api/ltp/stat06.c winsup/testsuite/winsup.api/ltp/symlink01.c winsup/testsuite/winsup.api/ltp/symlink02.c winsup/testsuite/winsup.api/ltp/symlink03.c winsup/testsuite/winsup.api/ltp/symlink04.c winsup/testsuite/winsup.api/ltp/symlink05.c winsup/testsuite/winsup.api/ltp/sync01.c winsup/testsuite/winsup.api/ltp/sync02.c winsup/testsuite/winsup.api/ltp/time01.c winsup/testsuite/winsup.api/ltp/time02.c winsup/testsuite/winsup.api/ltp/times01.c winsup/testsuite/winsup.api/ltp/times02.c winsup/testsuite/winsup.api/ltp/times03.c winsup/testsuite/winsup.api/ltp/truncate01.c winsup/testsuite/winsup.api/ltp/truncate02.c winsup/testsuite/winsup.api/ltp/ulimit01.c winsup/testsuite/winsup.api/ltp/umask01.c winsup/testsuite/winsup.api/ltp/umask02.c winsup/testsuite/winsup.api/ltp/umask03.c winsup/testsuite/winsup.api/ltp/uname01.c winsup/testsuite/winsup.api/ltp/unlink05.c winsup/testsuite/winsup.api/ltp/unlink06.c winsup/testsuite/winsup.api/ltp/unlink07.c winsup/testsuite/winsup.api/ltp/unlink08.c winsup/testsuite/winsup.api/ltp/vfork01.c winsup/testsuite/winsup.api/ltp/wait02.c winsup/testsuite/winsup.api/ltp/wait401.c winsup/testsuite/winsup.api/ltp/wait402.c winsup/testsuite/winsup.api/ltp/write01.c winsup/testsuite/winsup.api/ltp/write02.c winsup/testsuite/winsup.api/ltp/write03.c winsup/testsuite/winsup.api/mmaptest01.c winsup/testsuite/winsup.api/mmaptest02.c winsup/testsuite/winsup.api/mmaptest03.c winsup/testsuite/winsup.api/mmaptest04.c winsup/testsuite/winsup.api/msgtest.c winsup/testsuite/winsup.api/nullgetcwd.c winsup/testsuite/winsup.api/pthread/cancel1.c winsup/testsuite/winsup.api/pthread/cancel10.c winsup/testsuite/winsup.api/pthread/cancel11.c winsup/testsuite/winsup.api/pthread/cancel12.c winsup/testsuite/winsup.api/pthread/cancel2.c winsup/testsuite/winsup.api/pthread/cancel3.c winsup/testsuite/winsup.api/pthread/cancel4.c winsup/testsuite/winsup.api/pthread/cancel5.c winsup/testsuite/winsup.api/pthread/cancel6.c winsup/testsuite/winsup.api/pthread/cancel7.c winsup/testsuite/winsup.api/pthread/cancel8.c winsup/testsuite/winsup.api/pthread/cancel9.c winsup/testsuite/winsup.api/pthread/cleanup2.c winsup/testsuite/winsup.api/pthread/cleanup3.c winsup/testsuite/winsup.api/pthread/condvar1.c winsup/testsuite/winsup.api/pthread/condvar2.c winsup/testsuite/winsup.api/pthread/condvar2_1.c winsup/testsuite/winsup.api/pthread/condvar3.c winsup/testsuite/winsup.api/pthread/condvar3_1.c winsup/testsuite/winsup.api/pthread/condvar3_2.c winsup/testsuite/winsup.api/pthread/condvar3_3.c winsup/testsuite/winsup.api/pthread/condvar4.c winsup/testsuite/winsup.api/pthread/condvar5.c winsup/testsuite/winsup.api/pthread/condvar6.c winsup/testsuite/winsup.api/pthread/condvar7.c winsup/testsuite/winsup.api/pthread/condvar8.c winsup/testsuite/winsup.api/pthread/condvar9.c winsup/testsuite/winsup.api/pthread/count1.c winsup/testsuite/winsup.api/pthread/create1.c winsup/testsuite/winsup.api/pthread/create2.c winsup/testsuite/winsup.api/pthread/equal1.c winsup/testsuite/winsup.api/pthread/exit1.c winsup/testsuite/winsup.api/pthread/exit2.c winsup/testsuite/winsup.api/pthread/exit3.c winsup/testsuite/winsup.api/pthread/inherit1.c winsup/testsuite/winsup.api/pthread/join0.c winsup/testsuite/winsup.api/pthread/join1.c winsup/testsuite/winsup.api/pthread/join2.c winsup/testsuite/winsup.api/pthread/mainthreadexits.c winsup/testsuite/winsup.api/pthread/mutex1.c winsup/testsuite/winsup.api/pthread/mutex1d.c winsup/testsuite/winsup.api/pthread/mutex1e.c winsup/testsuite/winsup.api/pthread/mutex1n.c winsup/testsuite/winsup.api/pthread/mutex1r.c winsup/testsuite/winsup.api/pthread/mutex2.c winsup/testsuite/winsup.api/pthread/mutex3.c winsup/testsuite/winsup.api/pthread/mutex4.c winsup/testsuite/winsup.api/pthread/mutex5.c winsup/testsuite/winsup.api/pthread/mutex6d.c winsup/testsuite/winsup.api/pthread/mutex6e.c winsup/testsuite/winsup.api/pthread/mutex6n.c winsup/testsuite/winsup.api/pthread/mutex6r.c winsup/testsuite/winsup.api/pthread/mutex7.c winsup/testsuite/winsup.api/pthread/mutex7d.c winsup/testsuite/winsup.api/pthread/mutex7e.c winsup/testsuite/winsup.api/pthread/mutex7n.c winsup/testsuite/winsup.api/pthread/mutex7r.c winsup/testsuite/winsup.api/pthread/mutex8e.c winsup/testsuite/winsup.api/pthread/mutex8n.c winsup/testsuite/winsup.api/pthread/mutex8r.c winsup/testsuite/winsup.api/pthread/once1.c winsup/testsuite/winsup.api/pthread/priority1.c winsup/testsuite/winsup.api/pthread/priority2.c winsup/testsuite/winsup.api/pthread/rwlock1.c winsup/testsuite/winsup.api/pthread/rwlock2.c winsup/testsuite/winsup.api/pthread/rwlock3.c winsup/testsuite/winsup.api/pthread/rwlock4.c winsup/testsuite/winsup.api/pthread/rwlock5.c winsup/testsuite/winsup.api/pthread/rwlock6.c winsup/testsuite/winsup.api/pthread/rwlock7.c winsup/testsuite/winsup.api/pthread/self1.c winsup/testsuite/winsup.api/pthread/self2.c winsup/testsuite/winsup.api/pthread/test.h winsup/testsuite/winsup.api/pthread/threadidafterfork.c winsup/testsuite/winsup.api/pthread/tsd1.c winsup/testsuite/winsup.api/resethand.c winsup/testsuite/winsup.api/samples/sample-fail.c winsup/testsuite/winsup.api/samples/sample-miscompile.c winsup/testsuite/winsup.api/samples/sample-pass.c winsup/testsuite/winsup.api/semtest.c winsup/testsuite/winsup.api/shmtest.c winsup/testsuite/winsup.api/sigchld.c winsup/testsuite/winsup.api/signal-into-win32-api.c winsup/testsuite/winsup.api/systemcall.c winsup/testsuite/winsup.api/user_malloc.c winsup/testsuite/winsup.api/waitpid.c winsup/testsuite/winsup.api/winsup.exp winsup/utils/COPYING.dumper winsup/utils/ChangeLog winsup/utils/ChangeLog-2000 winsup/utils/ChangeLog.64bit winsup/utils/Makefile.in winsup/utils/aclocal.m4 winsup/utils/autogen.sh winsup/utils/bloda.cc winsup/utils/configure winsup/utils/configure.ac winsup/utils/cygcheck.cc winsup/utils/cygpath.cc winsup/utils/cygwin-console-helper.cc winsup/utils/dump_setup.cc winsup/utils/dumper.cc winsup/utils/dumper.h winsup/utils/getconf.c winsup/utils/getfacl.c winsup/utils/kill.cc winsup/utils/ldd.cc winsup/utils/ldh.cc winsup/utils/loadlib.h winsup/utils/locale.cc winsup/utils/minidumper.cc winsup/utils/mkgroup.c winsup/utils/mkpasswd.c winsup/utils/module_info.cc winsup/utils/mount.cc winsup/utils/parse_pe.cc winsup/utils/passwd.c winsup/utils/path.cc winsup/utils/path.h winsup/utils/pldd.c winsup/utils/ps.cc winsup/utils/regtool.cc winsup/utils/setfacl.c winsup/utils/setmetamode.c winsup/utils/ssp.c winsup/utils/ssp.txt winsup/utils/strace.cc winsup/utils/testsuite.cc winsup/utils/testsuite.h winsup/utils/tzmap-from-unicode.org winsup/utils/tzmap.h winsup/utils/tzset.c winsup/utils/umount.cc winsup/utils/wide_path.h
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r--winsup/cygwin/fhandler_tty.cc1764
1 files changed, 0 insertions, 1764 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
deleted file mode 100644
index 25076810e..000000000
--- a/winsup/cygwin/fhandler_tty.cc
+++ /dev/null
@@ -1,1764 +0,0 @@
-/* fhandler_tty.cc
-
- Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include "winsup.h"
-#include <stdlib.h>
-#include <sys/param.h>
-#include <cygwin/kd.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "path.h"
-#include "fhandler.h"
-#include "dtable.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include "ntdll.h"
-#include "cygheap.h"
-#include "shared_info.h"
-#include "cygthread.h"
-#include "child_info.h"
-#include <asm/socket.h>
-#include "cygwait.h"
-
-#define close_maybe(h) \
- do { \
- if (h && h != INVALID_HANDLE_VALUE) \
- CloseHandle (h); \
- } while (0)
-
-/* pty master control pipe messages */
-struct pipe_request {
- DWORD pid;
-};
-
-struct pipe_reply {
- HANDLE from_master;
- HANDLE to_master;
- DWORD error;
-};
-
-bool
-bytes_available (DWORD& n, HANDLE h)
-{
- DWORD navail, nleft;
- navail = nleft = 0;
- bool succeeded = PeekNamedPipe (h, NULL, 0, NULL, &navail, &nleft);
- if (succeeded)
- /* nleft should always be the right choice unless something has written 0
- bytes to the pipe. In that pathological case we return the actual number
- of bytes available in the pipe. See cgf-000008 for more details. */
- n = nleft ?: navail;
- else
- {
- termios_printf ("PeekNamedPipe(%p) failed, %E", h);
- n = 0;
- }
- debug_only_printf ("n %u, nleft %u, navail %u", n, nleft, navail);
- return succeeded;
-}
-
-bool
-fhandler_pty_common::bytes_available (DWORD &n)
-{
- return ::bytes_available (n, get_handle ());
-}
-
-#ifdef DEBUGGING
-static class mutex_stack
-{
-public:
- const char *fn;
- int ln;
- const char *tname;
-} ostack[100];
-
-static int osi;
-#endif /*DEBUGGING*/
-
-void
-fhandler_pty_master::flush_to_slave ()
-{
- if (get_readahead_valid () && !(get_ttyp ()->ti.c_lflag & ICANON))
- accept_input ();
-}
-
-DWORD
-fhandler_pty_common::__acquire_output_mutex (const char *fn, int ln,
- DWORD ms)
-{
- if (strace.active ())
- strace.prntf (_STRACE_TERMIOS, fn, "(%d): pty output_mutex (%p): waiting %d ms", ln, output_mutex, ms);
- if (ms == INFINITE)
- ms = 100;
- DWORD res = WaitForSingleObject (output_mutex, ms);
- if (res == WAIT_OBJECT_0)
- {
-#ifndef DEBUGGING
- if (strace.active ())
- strace.prntf (_STRACE_TERMIOS, fn, "(%d): pty output_mutex: acquired", ln, res);
-#else
- ostack[osi].fn = fn;
- ostack[osi].ln = ln;
- ostack[osi].tname = cygthread::name ();
- termios_printf ("acquired for %s:%d, osi %d", fn, ln, osi);
- osi++;
-#endif
- }
- return res;
-}
-
-void
-fhandler_pty_common::__release_output_mutex (const char *fn, int ln)
-{
- if (ReleaseMutex (output_mutex))
- {
-#ifndef DEBUGGING
- if (strace.active ())
- strace.prntf (_STRACE_TERMIOS, fn, "(%d): pty output_mutex(%p) released", ln, output_mutex);
-#else
- if (osi > 0)
- osi--;
- termios_printf ("released(%p) at %s:%d, osi %d", output_mutex, fn, ln, osi);
- termios_printf (" for %s:%d (%s)", ostack[osi].fn, ostack[osi].ln, ostack[osi].tname);
- ostack[osi].ln = -ln;
-#endif
- }
-#ifdef DEBUGGING
- else if (osi > 0)
- {
- system_printf ("couldn't release output mutex but we seem to own it, %E");
- try_to_debug ();
- }
-#endif
-}
-
-/* Process pty input. */
-
-void
-fhandler_pty_master::doecho (const void *str, DWORD len)
-{
- acquire_output_mutex (INFINITE);
- if (!WriteFile (to_master, str, len, &len, NULL))
- termios_printf ("Write to %p failed, %E", to_master);
- release_output_mutex ();
-}
-
-int
-fhandler_pty_master::accept_input ()
-{
- DWORD bytes_left;
- int ret = 1;
-
- WaitForSingleObject (input_mutex, INFINITE);
-
- bytes_left = eat_readahead (-1);
-
- if (!bytes_left)
- {
- termios_printf ("sending EOF to slave");
- get_ttyp ()->read_retval = 0;
- }
- else
- {
- char *p = rabuf;
- DWORD rc;
- DWORD written = 0;
-
- paranoid_printf ("about to write %u chars to slave", bytes_left);
- rc = WriteFile (get_output_handle (), p, bytes_left, &written, NULL);
- if (!rc)
- {
- debug_printf ("error writing to pipe %p %E", get_output_handle ());
- get_ttyp ()->read_retval = -1;
- ret = -1;
- }
- else
- {
- get_ttyp ()->read_retval = 1;
- p += written;
- bytes_left -= written;
- if (bytes_left > 0)
- {
- debug_printf ("to_slave pipe is full");
- puts_readahead (p, bytes_left);
- ret = 0;
- }
- }
- }
-
- SetEvent (input_available_event);
- ReleaseMutex (input_mutex);
- return ret;
-}
-
-bool
-fhandler_pty_master::hit_eof ()
-{
- if (get_ttyp ()->was_opened && !get_ttyp ()->slave_alive ())
- {
- /* We have the only remaining open handle to this pty, and
- the slave pty has been opened at least once. We treat
- this as EOF. */
- termios_printf ("all other handles closed");
- return 1;
- }
- return 0;
-}
-
-/* Process pty output requests */
-
-int
-fhandler_pty_master::process_slave_output (char *buf, size_t len, int pktmode_on)
-{
- size_t rlen;
- char outbuf[OUT_BUFFER_SIZE + 1];
- DWORD n;
- int column = 0;
- int rc = 0;
-
- flush_to_slave ();
-
- if (len == 0)
- goto out;
-
- if (need_nl)
- {
- /* We need to return a left over \n character, resulting from
- \r\n conversion. Note that we already checked for FLUSHO and
- output_stopped at the time that we read the character, so we
- don't check again here. */
- if (buf)
- buf[0] = '\n';
- need_nl = 0;
- rc = 1;
- goto out;
- }
-
- for (;;)
- {
- /* Set RLEN to the number of bytes to read from the pipe. */
- rlen = len;
- if (get_ttyp ()->ti.c_oflag & OPOST && get_ttyp ()->ti.c_oflag & ONLCR)
- {
- /* We are going to expand \n to \r\n, so don't read more than
- half of the number of bytes requested. */
- rlen /= 2;
- if (rlen == 0)
- rlen = 1;
- }
- if (rlen > sizeof outbuf)
- rlen = sizeof outbuf;
-
- n = 0;
- for (;;)
- {
- if (!bytes_available (n))
- goto err;
- if (n)
- break;
- if (hit_eof ())
- goto out;
- /* DISCARD (FLUSHO) and tcflush can finish here. */
- if ((get_ttyp ()->ti.c_lflag & FLUSHO || !buf))
- goto out;
-
- if (is_nonblocking ())
- {
- set_errno (EAGAIN);
- rc = -1;
- goto out;
- }
- pthread_testcancel ();
- if (cygwait (NULL, 10, cw_sig_eintr) == WAIT_SIGNALED
- && !_my_tls.call_signal_handler ())
- {
- set_errno (EINTR);
- rc = -1;
- goto out;
- }
- flush_to_slave ();
- }
-
- if (!ReadFile (get_handle (), outbuf, rlen, &n, NULL))
- {
- termios_printf ("ReadFile failed, %E");
- goto err;
- }
-
- termios_printf ("bytes read %u", n);
- get_ttyp ()->write_error = 0;
-
- if (get_ttyp ()->ti.c_lflag & FLUSHO || !buf)
- continue;
-
- char *optr;
- optr = buf;
- if (pktmode_on)
- *optr++ = TIOCPKT_DATA;
-
- if (!(get_ttyp ()->ti.c_oflag & OPOST)) // post-process output
- {
- memcpy (optr, outbuf, n);
- optr += n;
- }
- else // raw output mode
- {
- char *iptr = outbuf;
-
- while (n--)
- {
- switch (*iptr)
- {
- case '\r':
- if ((get_ttyp ()->ti.c_oflag & ONOCR) && column == 0)
- {
- iptr++;
- continue;
- }
- if (get_ttyp ()->ti.c_oflag & OCRNL)
- *iptr = '\n';
- else
- column = 0;
- break;
- case '\n':
- if (get_ttyp ()->ti.c_oflag & ONLCR)
- {
- *optr++ = '\r';
- column = 0;
- }
- if (get_ttyp ()->ti.c_oflag & ONLRET)
- column = 0;
- break;
- default:
- column++;
- break;
- }
-
- /* Don't store data past the end of the user's buffer. This
- can happen if the user requests a read of 1 byte when
- doing \r\n expansion. */
- if (optr - buf >= (int) len)
- {
- if (*iptr != '\n' || n != 0)
- system_printf ("internal error: %u unexpected characters", n);
- need_nl = 1;
- break;
- }
-
- *optr++ = *iptr++;
- }
- }
- rc = optr - buf;
- break;
-
- err:
- if (GetLastError () == ERROR_BROKEN_PIPE)
- rc = 0;
- else
- {
- __seterrno ();
- rc = -1;
- }
- break;
- }
-
-out:
- termios_printf ("returning %d", rc);
- return rc;
-}
-
-/* pty slave stuff */
-
-fhandler_pty_slave::fhandler_pty_slave (int unit)
- : fhandler_pty_common (), inuse (NULL)
-{
- if (unit >= 0)
- dev ().parse (DEV_PTYS_MAJOR, unit);
-}
-
-int
-fhandler_pty_slave::open (int flags, mode_t)
-{
- HANDLE pty_owner, from_master_local, to_master_local;
- HANDLE *handles[] =
- {
- &from_master_local, &input_available_event, &input_mutex, &inuse,
- &output_mutex, &to_master_local, &pty_owner,
- NULL
- };
-
- for (HANDLE **h = handles; *h; h++)
- **h = NULL;
-
- _tc = cygwin_shared->tty[get_minor ()];
-
- tcinit (false);
-
- cygwin_shared->tty.attach (get_minor ());
-
- /* Create synchronisation events */
- char buf[MAX_PATH];
-
- const char *errmsg = NULL;
-
- if (!(output_mutex = get_ttyp ()->open_output_mutex (MAXIMUM_ALLOWED)))
- {
- errmsg = "open output mutex failed, %E";
- goto err;
- }
- if (!(input_mutex = get_ttyp ()->open_input_mutex (MAXIMUM_ALLOWED)))
- {
- errmsg = "open input mutex failed, %E";
- goto err;
- }
- shared_name (buf, INPUT_AVAILABLE_EVENT, get_minor ());
- if (!(input_available_event = OpenEvent (MAXIMUM_ALLOWED, TRUE, buf)))
- {
- errmsg = "open input event failed, %E";
- goto err;
- }
-
- /* FIXME: Needs a method to eliminate tty races */
- {
- /* Create security attribute. Default permissions are 0620. */
- security_descriptor sd;
- sd.malloc (sizeof (SECURITY_DESCRIPTOR));
- RtlCreateSecurityDescriptor (sd, SECURITY_DESCRIPTOR_REVISION);
- SECURITY_ATTRIBUTES sa = { sizeof (SECURITY_ATTRIBUTES), NULL, TRUE };
- if (!create_object_sd_from_attribute (NULL, myself->uid, myself->gid,
- S_IFCHR | S_IRUSR | S_IWUSR | S_IWGRP,
- sd))
- sa.lpSecurityDescriptor = (PSECURITY_DESCRIPTOR) sd;
- acquire_output_mutex (INFINITE);
- inuse = get_ttyp ()->create_inuse (&sa);
- get_ttyp ()->was_opened = true;
- release_output_mutex ();
- }
-
- if (!get_ttyp ()->from_master () || !get_ttyp ()->to_master ())
- {
- errmsg = "pty handles have been closed";
- set_errno (EACCES);
- goto err_no_errno;
- }
-
- if (get_ttyp ()->is_master_closed ())
- {
- errmsg = "*** master is closed";
- set_errno (EAGAIN);
- goto err_no_errno;
- }
- /* Three case for duplicating the pipe handles:
- - Either we're the master. In this case, just duplicate the handles.
- - Or, we have the right to open the master process for handle duplication.
- In this case, just duplicate the handles.
- - Or, we have to ask the master process itself. In this case, send our
- pid to the master process and check the reply. The reply contains
- either the handles, or an error code which tells us why we didn't
- get the handles. */
- if (myself->pid == get_ttyp ()->master_pid)
- {
- /* This is the most common case, just calling openpty. */
- termios_printf ("dup handles within myself.");
- pty_owner = GetCurrentProcess ();
- }
- else
- {
- pinfo p (get_ttyp ()->master_pid);
- if (!p)
- termios_printf ("*** couldn't find pty master");
- else
- {
- pty_owner = OpenProcess (PROCESS_DUP_HANDLE, FALSE, p->dwProcessId);
- if (pty_owner)
- termios_printf ("dup handles directly since I'm the owner");
- }
- }
- if (pty_owner)
- {
- if (!DuplicateHandle (pty_owner, get_ttyp ()->from_master (),
- GetCurrentProcess (), &from_master_local, 0, TRUE,
- DUPLICATE_SAME_ACCESS))
- {
- termios_printf ("can't duplicate input from %u/%p, %E",
- get_ttyp ()->master_pid, get_ttyp ()->from_master ());
- __seterrno ();
- goto err_no_msg;
- }
- if (!DuplicateHandle (pty_owner, get_ttyp ()->to_master (),
- GetCurrentProcess (), &to_master_local, 0, TRUE,
- DUPLICATE_SAME_ACCESS))
- {
- errmsg = "can't duplicate output, %E";
- goto err;
- }
- if (pty_owner != GetCurrentProcess ())
- CloseHandle (pty_owner);
- }
- else
- {
- pipe_request req = { GetCurrentProcessId () };
- pipe_reply repl;
- DWORD len;
-
- __small_sprintf (buf, "\\\\.\\pipe\\cygwin-%S-pty%d-master-ctl",
- &cygheap->installation_key, get_minor ());
- termios_printf ("dup handles via master control pipe %s", buf);
- if (!CallNamedPipe (buf, &req, sizeof req, &repl, sizeof repl,
- &len, 500))
- {
- errmsg = "can't call master, %E";
- goto err;
- }
- from_master_local = repl.from_master;
- to_master_local = repl.to_master;
- if (!from_master_local || !to_master_local)
- {
- SetLastError (repl.error);
- errmsg = "error duplicating pipes, %E";
- goto err;
- }
- }
- VerifyHandle (from_master_local);
- VerifyHandle (to_master_local);
-
- termios_printf ("duplicated from_master %p->%p from pty_owner",
- get_ttyp ()->from_master (), from_master_local);
- termios_printf ("duplicated to_master %p->%p from pty_owner",
- get_ttyp ()->to_master (), to_master_local);
-
- set_io_handle (from_master_local);
- set_output_handle (to_master_local);
-
- fhandler_console::need_invisible ();
- set_open_status ();
- return 1;
-
-err:
- if (GetLastError () == ERROR_FILE_NOT_FOUND)
- set_errno (ENXIO);
- else
- __seterrno ();
-err_no_errno:
- termios_printf (errmsg);
-err_no_msg:
- for (HANDLE **h = handles; *h; h++)
- if (**h && **h != INVALID_HANDLE_VALUE)
- CloseHandle (**h);
- return 0;
-}
-
-void
-fhandler_pty_slave::open_setup (int flags)
-{
- set_flags ((flags & ~O_TEXT) | O_BINARY);
- myself->set_ctty (this, flags);
- report_tty_counts (this, "opened", "");
- fhandler_base::open_setup (flags);
-}
-
-void
-fhandler_pty_slave::cleanup ()
-{
- /* This used to always call fhandler_pty_common::close when we were execing
- but that caused multiple closes of the handles associated with this pty.
- Since close_all_files is not called until after the cygwin process has
- synced or before a non-cygwin process has exited, it should be safe to
- just close this normally. cgf 2006-05-20 */
- report_tty_counts (this, "closed", "");
- fhandler_base::cleanup ();
-}
-
-int
-fhandler_pty_slave::close ()
-{
- termios_printf ("closing last open %s handle", ttyname ());
- if (inuse && !CloseHandle (inuse))
- termios_printf ("CloseHandle (inuse), %E");
- if (!ForceCloseHandle (input_available_event))
- termios_printf ("CloseHandle (input_available_event<%p>), %E", input_available_event);
- if ((unsigned) myself->ctty == FHDEV (DEV_PTYS_MAJOR, get_minor ()))
- fhandler_console::free_console (); /* assumes that we are the last pty closer */
- return fhandler_pty_common::close ();
-}
-
-int
-fhandler_pty_slave::init (HANDLE h, DWORD a, mode_t)
-{
- int flags = 0;
-
- a &= GENERIC_READ | GENERIC_WRITE;
- if (a == GENERIC_READ)
- flags = O_RDONLY;
- if (a == GENERIC_WRITE)
- flags = O_WRONLY;
- if (a == (GENERIC_READ | GENERIC_WRITE))
- flags = O_RDWR;
-
- int ret = open_with_arch (flags);
-
- if (ret && !cygwin_finished_initializing && !being_debugged ())
- {
- /* This only occurs when called from dtable::init_std_file_from_handle
- We have been started from a non-Cygwin process. So we should become
- pty process group leader.
- TODO: Investigate how SIGTTIN should be handled with pure-windows
- programs. */
- pinfo p (tc ()->getpgid ());
- /* We should only grab this when the process group owner for this
- pty is a non-cygwin process or we've been started directly
- from a non-Cygwin process with no Cygwin ancestry. */
- if (!p || ISSTATE (p, PID_NOTCYGWIN))
- {
- termios_printf ("Setting process group leader to %d since %W(%d) is not a cygwin process",
- myself->pgid, p->progname, p->pid);
- tc ()->setpgid (myself->pgid);
- }
- }
-
- if (h != INVALID_HANDLE_VALUE)
- CloseHandle (h); /* Reopened by open */
-
- return ret;
-}
-
-ssize_t __stdcall
-fhandler_pty_slave::write (const void *ptr, size_t len)
-{
- DWORD n;
- ssize_t towrite = len;
-
- bg_check_types bg = bg_check (SIGTTOU);
- if (bg <= bg_eof)
- return (ssize_t) bg;
-
- termios_printf ("pty%d, write(%p, %lu)", get_minor (), ptr, len);
-
- push_process_state process_state (PID_TTYOU);
-
- while (len)
- {
- n = MIN (OUT_BUFFER_SIZE, len);
- char *buf = (char *)ptr;
- ptr = (char *) ptr + n;
- len -= n;
-
- while (tc ()->output_stopped)
- cygwait (10);
- acquire_output_mutex (INFINITE);
-
- /* Previous write may have set write_error to != 0. Check it here.
- This is less than optimal, but the alternative slows down pty
- writes enormously. */
- if (get_ttyp ()->write_error)
- {
- set_errno (get_ttyp ()->write_error);
- towrite = -1;
- get_ttyp ()->write_error = 0;
- release_output_mutex ();
- break;
- }
-
- BOOL res = WriteFile (get_output_handle (), buf, n, &n, NULL);
- release_output_mutex ();
- if (!res)
- {
- DWORD err = GetLastError ();
- termios_printf ("WriteFile failed, %E");
- switch (err)
- {
- case ERROR_NO_DATA:
- err = ERROR_IO_DEVICE;
- default:
- __seterrno_from_win_error (err);
- }
- raise (SIGHUP); /* FIXME: Should this be SIGTTOU? */
- towrite = -1;
- break;
- }
- }
- return towrite;
-}
-
-void __reg3
-fhandler_pty_slave::read (void *ptr, size_t& len)
-{
- ssize_t totalread = 0;
- int vmin = 0;
- int vtime = 0; /* Initialized to prevent -Wuninitialized warning */
- size_t readlen;
- DWORD bytes_in_pipe;
- char buf[INP_BUFFER_SIZE];
- DWORD time_to_wait;
-
- bg_check_types bg = bg_check (SIGTTIN);
- if (bg <= bg_eof)
- {
- len = (size_t) bg;
- return;
- }
-
- termios_printf ("read(%p, %lu) handle %p", ptr, len, get_handle ());
-
- push_process_state process_state (PID_TTYIN);
-
- if (is_nonblocking () || !ptr) /* Indicating tcflush(). */
- time_to_wait = 0;
- else if ((get_ttyp ()->ti.c_lflag & ICANON))
- time_to_wait = INFINITE;
- else
- {
- vmin = get_ttyp ()->ti.c_cc[VMIN];
- if (vmin > INP_BUFFER_SIZE)
- vmin = INP_BUFFER_SIZE;
- vtime = get_ttyp ()->ti.c_cc[VTIME];
- if (vmin < 0)
- vmin = 0;
- if (vtime < 0)
- vtime = 0;
- if (!vmin && !vtime)
- time_to_wait = 0;
- else
- time_to_wait = !vtime ? INFINITE : 100 * vtime;
- }
-
- while (len)
- {
- switch (cygwait (input_available_event, time_to_wait))
- {
- case WAIT_OBJECT_0:
- if (get_ttyp ()->is_master_closed ())
- {
- raise (SIGHUP);
- totalread = 0;
- goto out;
- }
- break;
- case WAIT_SIGNALED:
- if (totalread > 0)
- goto out;
- termios_printf ("wait catched signal");
- set_sig_errno (EINTR);
- totalread = -1;
- goto out;
- case WAIT_CANCELED:
- process_state.pop ();
- pthread::static_cancel_self ();
- /*NOTREACHED*/
- case WAIT_TIMEOUT:
- termios_printf ("wait timed out, time_to_wait %u", time_to_wait);
- if (!totalread)
- {
- set_sig_errno (EAGAIN);
- totalread = -1;
- }
- goto out;
- default:
- termios_printf ("wait for input event failed, %E");
- if (!totalread)
- {
- __seterrno ();
- totalread = -1;
- }
- goto out;
- }
- /* Now that we know that input is available we have to grab the
- input mutex. */
- switch (cygwait (input_mutex, 1000))
- {
- case WAIT_OBJECT_0:
- case WAIT_ABANDONED_0:
- break;
- case WAIT_SIGNALED:
- if (totalread > 0)
- goto out;
- termios_printf ("wait for mutex caught signal");
- set_sig_errno (EINTR);
- totalread = -1;
- goto out;
- case WAIT_CANCELED:
- process_state.pop ();
- pthread::static_cancel_self ();
- /*NOTREACHED*/
- case WAIT_TIMEOUT:
- termios_printf ("failed to acquire input mutex after input event "
- "arrived");
- /* If we have a timeout, we can simply handle this failure to
- grab the mutex as an EAGAIN situation. Otherwise, if this
- is an infinitely blocking read, restart the loop. */
- if (time_to_wait != INFINITE)
- {
- if (!totalread)
- {
- set_sig_errno (EAGAIN);
- totalread = -1;
- }
- goto out;
- }
- continue;
- default:
- termios_printf ("wait for input mutex failed, %E");
- if (!totalread)
- {
- __seterrno ();
- totalread = -1;
- }
- goto out;
- }
- if (!bytes_available (bytes_in_pipe))
- raise (SIGHUP);
-
- /* On first peek determine no. of bytes to flush. */
- if (!ptr && len == UINT_MAX)
- len = (size_t) bytes_in_pipe;
-
- if (ptr && !bytes_in_pipe && !vmin && !time_to_wait)
- {
- ReleaseMutex (input_mutex);
- len = (size_t) bytes_in_pipe;
- return;
- }
-
- readlen = MIN (bytes_in_pipe, MIN (len, sizeof (buf)));
-
-#if 0
- /* Why on earth is the read length reduced to vmin, even if more bytes
- are available *and* len is bigger *and* the local buf is big enough?
- Disable this code for now, it looks like a remnant of old. */
- if (ptr && vmin && readlen > (unsigned) vmin)
- readlen = vmin;
-#endif
-
- DWORD n = 0;
- if (readlen)
- {
- termios_printf ("reading %lu bytes (vtime %d)", readlen, vtime);
- if (!ReadFile (get_handle (), buf, readlen, &n, NULL))
- {
- termios_printf ("read failed, %E");
- raise (SIGHUP);
- bytes_in_pipe = 0;
- ptr = NULL;
- }
- else
- {
- /* MSDN states that 5th prameter can be used to determine total
- number of bytes in pipe, but for some reason this number doesn't
- change after successful read. So we have to peek into the pipe
- again to see if input is still available */
- if (!bytes_available (bytes_in_pipe))
- raise (SIGHUP);
- if (n)
- {
- len -= n;
- totalread += n;
- if (ptr)
- {
- memcpy (ptr, buf, n);
- ptr = (char *) ptr + n;
- }
- }
- }
- }
-
- if (!bytes_in_pipe)
- ResetEvent (input_available_event);
-
- ReleaseMutex (input_mutex);
-
- if (!ptr)
- {
- if (!bytes_in_pipe)
- break;
- continue;
- }
-
- if (get_ttyp ()->read_retval < 0) // read error
- {
- set_errno (-get_ttyp ()->read_retval);
- totalread = -1;
- break;
- }
- if (get_ttyp ()->read_retval == 0) //EOF
- {
- termios_printf ("saw EOF");
- break;
- }
- if (get_ttyp ()->ti.c_lflag & ICANON || is_nonblocking ())
- break;
- if (vmin && totalread >= vmin)
- break;
-
- /* vmin == 0 && vtime == 0:
- * we've already read all input, if any, so return immediately
- * vmin == 0 && vtime > 0:
- * we've waited for input 10*vtime ms in WFSO(input_available_event),
- * no matter whether any input arrived, we shouldn't wait any longer,
- * so return immediately
- * vmin > 0 && vtime == 0:
- * here, totalread < vmin, so continue waiting until more data
- * arrive
- * vmin > 0 && vtime > 0:
- * similar to the previous here, totalread < vmin, and timer
- * hadn't expired -- WFSO(input_available_event) != WAIT_TIMEOUT,
- * so "restart timer" and wait until more data arrive
- */
-
- if (vmin == 0)
- break;
- }
-out:
- termios_printf ("%d=read(%p, %lu)", totalread, ptr, len);
- len = (size_t) totalread;
-}
-
-int
-fhandler_pty_slave::dup (fhandler_base *child, int flags)
-{
- /* This code was added in Oct 2001 for some undisclosed reason.
- However, setting the controlling tty on a dup causes rxvt to
- hang when the parent does a dup since the controlling pgid changes.
- Specifically testing for -2 (ctty has been setsid'ed) works around
- this problem. However, it's difficult to see scenarios in which you
- have a dup'able fd, no controlling tty, and not having run setsid.
- So, we might want to consider getting rid of the set_ctty in tty-like dup
- methods entirely at some point */
- if (myself->ctty != -2)
- myself->set_ctty (this, flags);
- report_tty_counts (child, "duped slave", "");
- return 0;
-}
-
-int
-fhandler_pty_master::dup (fhandler_base *child, int)
-{
- report_tty_counts (child, "duped master", "");
- return 0;
-}
-
-int
-fhandler_pty_slave::tcgetattr (struct termios *t)
-{
- *t = get_ttyp ()->ti;
- return 0;
-}
-
-int
-fhandler_pty_slave::tcsetattr (int, const struct termios *t)
-{
- acquire_output_mutex (INFINITE);
- get_ttyp ()->ti = *t;
- release_output_mutex ();
- return 0;
-}
-
-int
-fhandler_pty_slave::tcflush (int queue)
-{
- int ret = 0;
-
- termios_printf ("tcflush(%d) handle %p", queue, get_handle ());
-
- if (queue == TCIFLUSH || queue == TCIOFLUSH)
- {
- size_t len = UINT_MAX;
- read (NULL, len);
- ret = ((int) len) >= 0 ? 0 : -1;
- }
- if (queue == TCOFLUSH || queue == TCIOFLUSH)
- {
- /* do nothing for now. */
- }
-
- termios_printf ("%d=tcflush(%d)", ret, queue);
- return ret;
-}
-
-int
-fhandler_pty_slave::ioctl (unsigned int cmd, void *arg)
-{
- termios_printf ("ioctl (%x)", cmd);
- int res = fhandler_termios::ioctl (cmd, arg);
- if (res <= 0)
- return res;
-
- if (myself->pgid && get_ttyp ()->getpgid () != myself->pgid
- && (unsigned) myself->ctty == FHDEV (DEV_PTYS_MAJOR, get_minor ())
- && (get_ttyp ()->ti.c_lflag & TOSTOP))
- {
- /* background process */
- termios_printf ("bg ioctl pgid %d, tpgid %d, %s", myself->pgid,
- get_ttyp ()->getpgid (), myctty ());
- raise (SIGTTOU);
- }
-
- int retval;
- switch (cmd)
- {
- case TIOCGWINSZ:
- case TIOCSWINSZ:
- break;
- case TIOCGPGRP:
- {
- pid_t pid = this->tcgetpgrp ();
- if (pid < 0)
- retval = -1;
- else
- {
- *((pid_t *) arg) = pid;
- retval = 0;
- }
- }
- goto out;
- case TIOCSPGRP:
- retval = this->tcsetpgrp ((pid_t) (intptr_t) arg);
- goto out;
- case FIONREAD:
- {
- DWORD n;
- if (!bytes_available (n))
- {
- set_errno (EINVAL);
- retval = -1;
- }
- else
- {
- *(int *) arg = (int) n;
- retval = 0;
- }
- }
- goto out;
- default:
- return fhandler_base::ioctl (cmd, arg);
- }
-
- acquire_output_mutex (INFINITE);
-
- get_ttyp ()->cmd = cmd;
- get_ttyp ()->ioctl_retval = 0;
- switch (cmd)
- {
- case TIOCGWINSZ:
- get_ttyp ()->arg.winsize = get_ttyp ()->winsize;
- *(struct winsize *) arg = get_ttyp ()->arg.winsize;
- get_ttyp ()->winsize = get_ttyp ()->arg.winsize;
- break;
- case TIOCSWINSZ:
- if (get_ttyp ()->winsize.ws_row != ((struct winsize *) arg)->ws_row
- || get_ttyp ()->winsize.ws_col != ((struct winsize *) arg)->ws_col)
- {
- get_ttyp ()->arg.winsize = *(struct winsize *) arg;
- get_ttyp ()->winsize = *(struct winsize *) arg;
- get_ttyp ()->kill_pgrp (SIGWINCH);
- }
- break;
- }
-
- release_output_mutex ();
- retval = get_ttyp ()->ioctl_retval;
- if (retval < 0)
- {
- set_errno (-retval);
- retval = -1;
- }
-
-out:
- termios_printf ("%d = ioctl(%x)", retval, cmd);
- return retval;
-}
-
-int __reg2
-fhandler_pty_slave::fstat (struct stat *st)
-{
- fhandler_base::fstat (st);
-
- bool to_close = false;
- if (!input_available_event)
- {
- char buf[MAX_PATH];
- shared_name (buf, INPUT_AVAILABLE_EVENT, get_minor ());
- input_available_event = OpenEvent (READ_CONTROL, TRUE, buf);
- if (input_available_event)
- to_close = true;
- }
- if (!input_available_event
- || get_object_attribute (input_available_event, &st->st_uid, &st->st_gid,
- &st->st_mode))
- {
- /* If we can't access the ACL, or if the tty doesn't actually exist,
- then fake uid and gid to strict, system-like values. */
- st->st_mode = S_IFCHR | S_IRUSR | S_IWUSR;
- st->st_uid = 18;
- st->st_gid = 544;
- }
- if (to_close)
- CloseHandle (input_available_event);
- return 0;
-}
-
-/* Helper function for fchmod and fchown, which just opens all handles
- and signals success via bool return. */
-bool
-fhandler_pty_slave::fch_open_handles (bool chown)
-{
- char buf[MAX_PATH];
- DWORD write_access = WRITE_DAC | (chown ? WRITE_OWNER : 0);
-
- _tc = cygwin_shared->tty[get_minor ()];
- shared_name (buf, INPUT_AVAILABLE_EVENT, get_minor ());
- input_available_event = OpenEvent (READ_CONTROL | write_access,
- TRUE, buf);
- output_mutex = get_ttyp ()->open_output_mutex (write_access);
- input_mutex = get_ttyp ()->open_input_mutex (write_access);
- inuse = get_ttyp ()->open_inuse (write_access);
- if (!input_available_event || !output_mutex || !input_mutex || !inuse)
- {
- __seterrno ();
- return false;
- }
- return true;
-}
-
-/* Helper function for fchmod and fchown, which sets the new security
- descriptor on all objects representing the pty. */
-int
-fhandler_pty_slave::fch_set_sd (security_descriptor &sd, bool chown)
-{
- security_descriptor sd_old;
-
- get_object_sd (input_available_event, sd_old);
- if (!set_object_sd (input_available_event, sd, chown)
- && !set_object_sd (output_mutex, sd, chown)
- && !set_object_sd (input_mutex, sd, chown)
- && !set_object_sd (inuse, sd, chown))
- return 0;
- set_object_sd (input_available_event, sd_old, chown);
- set_object_sd (output_mutex, sd_old, chown);
- set_object_sd (input_mutex, sd_old, chown);
- set_object_sd (inuse, sd_old, chown);
- return -1;
-}
-
-/* Helper function for fchmod and fchown, which closes all object handles in
- the pty. */
-void
-fhandler_pty_slave::fch_close_handles ()
-{
- close_maybe (get_io_handle ());
- close_maybe (get_output_handle ());
- close_maybe (input_available_event);
- close_maybe (output_mutex);
- close_maybe (input_mutex);
- close_maybe (inuse);
-}
-
-int __reg1
-fhandler_pty_slave::fchmod (mode_t mode)
-{
- int ret = -1;
- bool to_close = false;
- security_descriptor sd;
- uid_t uid;
- gid_t gid;
-
- if (!input_available_event)
- {
- to_close = true;
- if (!fch_open_handles (false))
- goto errout;
- }
- sd.malloc (sizeof (SECURITY_DESCRIPTOR));
- RtlCreateSecurityDescriptor (sd, SECURITY_DESCRIPTOR_REVISION);
- if (!get_object_attribute (input_available_event, &uid, &gid, NULL)
- && !create_object_sd_from_attribute (NULL, uid, gid, S_IFCHR | mode, sd))
- ret = fch_set_sd (sd, false);
-errout:
- if (to_close)
- fch_close_handles ();
- return ret;
-}
-
-int __reg2
-fhandler_pty_slave::fchown (uid_t uid, gid_t gid)
-{
- int ret = -1;
- bool to_close = false;
- mode_t mode = 0;
- uid_t o_uid;
- gid_t o_gid;
- security_descriptor sd;
-
- if (uid == ILLEGAL_UID && gid == ILLEGAL_GID)
- return 0;
- if (!input_available_event)
- {
- to_close = true;
- if (!fch_open_handles (true))
- goto errout;
- }
- sd.malloc (sizeof (SECURITY_DESCRIPTOR));
- RtlCreateSecurityDescriptor (sd, SECURITY_DESCRIPTOR_REVISION);
- if (!get_object_attribute (input_available_event, &o_uid, &o_gid, &mode))
- {
- if ((uid == ILLEGAL_UID || uid == o_uid)
- && (gid == ILLEGAL_GID || gid == o_gid))
- ret = 0;
- else if (!create_object_sd_from_attribute (input_available_event,
- uid, gid, S_IFCHR | mode, sd))
- ret = fch_set_sd (sd, true);
- }
-errout:
- if (to_close)
- fch_close_handles ();
- return ret;
-}
-
-/*******************************************************
- fhandler_pty_master
-*/
-fhandler_pty_master::fhandler_pty_master (int unit)
- : fhandler_pty_common (), pktmode (0), master_ctl (NULL),
- master_thread (NULL), from_master (NULL), to_master (NULL),
- dwProcessId (0), need_nl (0)
-{
- if (unit >= 0)
- dev ().parse (DEV_PTYM_MAJOR, unit);
- else if (!setup ())
- {
- dev ().parse (FH_ERROR);
- return;
- }
- set_name ("/dev/ptmx");
-}
-
-int
-fhandler_pty_master::open (int flags, mode_t)
-{
- set_open_status ();
- dwProcessId = GetCurrentProcessId ();
- return 1;
-}
-
-void
-fhandler_pty_master::open_setup (int flags)
-{
- set_flags ((flags & ~O_TEXT) | O_BINARY);
- char buf[sizeof ("opened pty master for ptyNNNNNNNNNNN")];
- __small_sprintf (buf, "opened pty master for pty%d", get_minor ());
- report_tty_counts (this, buf, "");
- fhandler_base::open_setup (flags);
-}
-
-off_t
-fhandler_pty_common::lseek (off_t, int)
-{
- set_errno (ESPIPE);
- return -1;
-}
-
-int
-fhandler_pty_common::close ()
-{
- termios_printf ("pty%d <%p,%p> closing", get_minor (), get_handle (), get_output_handle ());
- if (!ForceCloseHandle (input_mutex))
- termios_printf ("CloseHandle (input_mutex<%p>), %E", input_mutex);
- if (!ForceCloseHandle (output_mutex))
- termios_printf ("CloseHandle (output_mutex<%p>), %E", output_mutex);
- if (!ForceCloseHandle1 (get_handle (), from_pty))
- termios_printf ("CloseHandle (get_handle ()<%p>), %E", get_handle ());
- if (!ForceCloseHandle1 (get_output_handle (), to_pty))
- termios_printf ("CloseHandle (get_output_handle ()<%p>), %E", get_output_handle ());
-
- return 0;
-}
-
-void
-fhandler_pty_master::cleanup ()
-{
- report_tty_counts (this, "closing master", "");
- if (archetype)
- from_master = to_master = NULL;
- fhandler_base::cleanup ();
-}
-
-int
-fhandler_pty_master::close ()
-{
- termios_printf ("closing from_master(%p)/to_master(%p) since we own them(%u)",
- from_master, to_master, dwProcessId);
- if (cygwin_finished_initializing)
- {
- if (master_ctl && get_ttyp ()->master_pid == myself->pid)
- {
- char buf[MAX_PATH];
- pipe_request req = { (DWORD) -1 };
- pipe_reply repl;
- DWORD len;
-
- __small_sprintf (buf, "\\\\.\\pipe\\cygwin-%S-pty%d-master-ctl",
- &cygheap->installation_key, get_minor ());
- CallNamedPipe (buf, &req, sizeof req, &repl, sizeof repl, &len, 500);
- CloseHandle (master_ctl);
- master_thread->detach ();
- }
- }
-
- if (!ForceCloseHandle (from_master))
- termios_printf ("error closing from_master %p, %E", from_master);
- if (!ForceCloseHandle (to_master))
- termios_printf ("error closing from_master %p, %E", to_master);
- from_master = to_master = NULL;
-
- fhandler_pty_common::close ();
-
- if (have_execed || get_ttyp ()->master_pid != myself->pid)
- termios_printf ("not clearing: %d, master_pid %d", have_execed, get_ttyp ()->master_pid);
- else
- {
- get_ttyp ()->set_master_closed ();
- SetEvent (input_available_event);
- }
- if (!ForceCloseHandle (input_available_event))
- termios_printf ("CloseHandle (input_available_event<%p>), %E", input_available_event);
-
- return 0;
-}
-
-ssize_t __stdcall
-fhandler_pty_master::write (const void *ptr, size_t len)
-{
- ssize_t ret;
- char *p = (char *) ptr;
- termios ti = tc ()->ti;
-
- bg_check_types bg = bg_check (SIGTTOU);
- if (bg <= bg_eof)
- return (ssize_t) bg;
-
- push_process_state process_state (PID_TTYOU);
- line_edit_status status = line_edit (p++, len, ti, &ret);
- if (status > line_edit_signalled && status != line_edit_pipe_full)
- ret = -1;
- return ret;
-}
-
-void __reg3
-fhandler_pty_master::read (void *ptr, size_t& len)
-{
- bg_check_types bg = bg_check (SIGTTIN);
- if (bg <= bg_eof)
- {
- len = (size_t) bg;
- return;
- }
- push_process_state process_state (PID_TTYIN);
- len = (size_t) process_slave_output ((char *) ptr, len, pktmode);
-}
-
-int
-fhandler_pty_master::tcgetattr (struct termios *t)
-{
- *t = cygwin_shared->tty[get_minor ()]->ti;
- return 0;
-}
-
-int
-fhandler_pty_master::tcsetattr (int, const struct termios *t)
-{
- cygwin_shared->tty[get_minor ()]->ti = *t;
- return 0;
-}
-
-int
-fhandler_pty_master::tcflush (int queue)
-{
- int ret = 0;
-
- termios_printf ("tcflush(%d) handle %p", queue, get_handle ());
-
- if (queue == TCIFLUSH || queue == TCIOFLUSH)
- ret = process_slave_output (NULL, OUT_BUFFER_SIZE, 0);
- else if (queue == TCIFLUSH || queue == TCIOFLUSH)
- {
- /* do nothing for now. */
- }
-
- termios_printf ("%d=tcflush(%d)", ret, queue);
- return ret;
-}
-
-int
-fhandler_pty_master::ioctl (unsigned int cmd, void *arg)
-{
- int res = fhandler_termios::ioctl (cmd, arg);
- if (res <= 0)
- return res;
-
- switch (cmd)
- {
- case TIOCPKT:
- pktmode = *(int *) arg;
- break;
- case TIOCGWINSZ:
- *(struct winsize *) arg = get_ttyp ()->winsize;
- break;
- case TIOCSWINSZ:
- if (get_ttyp ()->winsize.ws_row != ((struct winsize *) arg)->ws_row
- || get_ttyp ()->winsize.ws_col != ((struct winsize *) arg)->ws_col)
- {
- get_ttyp ()->winsize = *(struct winsize *) arg;
- get_ttyp ()->kill_pgrp (SIGWINCH);
- }
- break;
- case TIOCGPGRP:
- *((pid_t *) arg) = this->tcgetpgrp ();
- break;
- case TIOCSPGRP:
- return this->tcsetpgrp ((pid_t) (intptr_t) arg);
- case FIONREAD:
- {
- DWORD n;
- if (!::bytes_available (n, to_master))
- {
- set_errno (EINVAL);
- return -1;
- }
- *(int *) arg = (int) n;
- }
- break;
- default:
- return fhandler_base::ioctl (cmd, arg);
- }
- return 0;
-}
-
-int
-fhandler_pty_master::ptsname_r (char *buf, size_t buflen)
-{
- char tmpbuf[TTY_NAME_MAX];
-
- __ptsname (tmpbuf, get_minor ());
- if (buflen <= strlen (tmpbuf))
- {
- set_errno (ERANGE);
- return ERANGE;
- }
- strcpy (buf, tmpbuf);
- return 0;
-}
-
-void
-fhandler_pty_common::set_close_on_exec (bool val)
-{
- // Cygwin processes will handle this specially on exec.
- close_on_exec (val);
-}
-
-void
-fhandler_pty_slave::fixup_after_fork (HANDLE parent)
-{
- // fork_fixup (parent, inuse, "inuse");
- // fhandler_pty_common::fixup_after_fork (parent);
- report_tty_counts (this, "inherited", "");
-}
-
-void
-fhandler_pty_slave::fixup_after_exec ()
-{
- if (!close_on_exec ())
- fixup_after_fork (NULL);
-}
-
-/* This thread function handles the master control pipe. It waits for a
- client to connect. Then it checks if the client process has permissions
- to access the tty handles. If so, it opens the client process and
- duplicates the handles into that process. If that fails, it sends a reply
- with at least one handle set to NULL and an error code. Last but not
- least, the client is disconnected and the thread waits for the next client.
-
- A special case is when the master side of the tty is about to be closed.
- The client side is the fhandler_pty_master::close function and it sends
- a PID -1 in that case. On Vista and later a check is performed that the
- request to leave really comes from the master process itself. On earlier
- OSes there's no function to check for the PID of the client process so
- we have to trust the client side.
-
- Since there's always only one pipe instance, there's a chance that clients
- have to wait to connect to the master control pipe. Therefore the client
- calls to CallNamedPipe should have a big enough timeout value. For now this
- is 500ms. Hope that's enough. */
-
-DWORD
-fhandler_pty_master::pty_master_thread ()
-{
- bool exit = false;
- GENERIC_MAPPING map = { EVENT_QUERY_STATE, EVENT_MODIFY_STATE, 0,
- EVENT_QUERY_STATE | EVENT_MODIFY_STATE };
- pipe_request req;
- DWORD len;
- security_descriptor sd;
- HANDLE token;
- PRIVILEGE_SET ps;
- DWORD pid;
- NTSTATUS status;
-
- termios_printf ("Entered");
- while (!exit && (ConnectNamedPipe (master_ctl, NULL)
- || GetLastError () == ERROR_PIPE_CONNECTED))
- {
- pipe_reply repl = { NULL, NULL, 0 };
- bool deimp = false;
- NTSTATUS allow = STATUS_ACCESS_DENIED;
- ACCESS_MASK access = EVENT_MODIFY_STATE;
- HANDLE client = NULL;
-
- if (!ReadFile (master_ctl, &req, sizeof req, &len, NULL))
- {
- termios_printf ("ReadFile, %E");
- goto reply;
- }
- /* This function is only available since Vista, unfortunately.
- In earlier OSes we simply have to believe that the client
- has no malicious intent (== sends arbitrary PIDs). */
- if (!GetNamedPipeClientProcessId (master_ctl, &pid))
- pid = req.pid;
- if (get_object_sd (input_available_event, sd))
- {
- termios_printf ("get_object_sd, %E");
- goto reply;
- }
- cygheap->user.deimpersonate ();
- deimp = true;
- if (!ImpersonateNamedPipeClient (master_ctl))
- {
- termios_printf ("ImpersonateNamedPipeClient, %E");
- goto reply;
- }
- status = NtOpenThreadToken (GetCurrentThread (), TOKEN_QUERY, TRUE,
- &token);
- if (!NT_SUCCESS (status))
- {
- termios_printf ("NtOpenThreadToken, %y", status);
- SetLastError (RtlNtStatusToDosError (status));
- goto reply;
- }
- len = sizeof ps;
- status = NtAccessCheck (sd, token, access, &map, &ps, &len, &access,
- &allow);
- NtClose (token);
- if (!NT_SUCCESS (status))
- {
- termios_printf ("NtAccessCheck, %y", status);
- SetLastError (RtlNtStatusToDosError (status));
- goto reply;
- }
- if (!RevertToSelf ())
- {
- termios_printf ("RevertToSelf, %E");
- goto reply;
- }
- if (req.pid == (DWORD) -1) /* Request to finish thread. */
- {
- /* Pre-Vista: Just believe in the good of the client process.
- Post-Vista: Check if the requesting process is the master
- process itself. */
- if (pid == (DWORD) -1 || pid == GetCurrentProcessId ())
- exit = true;
- goto reply;
- }
- if (NT_SUCCESS (allow))
- {
- client = OpenProcess (PROCESS_DUP_HANDLE, FALSE, pid);
- if (!client)
- {
- termios_printf ("OpenProcess, %E");
- goto reply;
- }
- if (!DuplicateHandle (GetCurrentProcess (), from_master,
- client, &repl.from_master,
- 0, TRUE, DUPLICATE_SAME_ACCESS))
- {
- termios_printf ("DuplicateHandle (from_master), %E");
- goto reply;
- }
- if (!DuplicateHandle (GetCurrentProcess (), to_master,
- client, &repl.to_master,
- 0, TRUE, DUPLICATE_SAME_ACCESS))
- {
- termios_printf ("DuplicateHandle (to_master), %E");
- goto reply;
- }
- }
-reply:
- repl.error = GetLastError ();
- if (client)
- CloseHandle (client);
- if (deimp)
- cygheap->user.reimpersonate ();
- sd.free ();
- termios_printf ("Reply: from %p, to %p, error %u",
- repl.from_master, repl.to_master, repl.error );
- if (!WriteFile (master_ctl, &repl, sizeof repl, &len, NULL))
- termios_printf ("WriteFile, %E");
- if (!DisconnectNamedPipe (master_ctl))
- termios_printf ("DisconnectNamedPipe, %E");
- }
- termios_printf ("Leaving");
- return 0;
-}
-
-static DWORD WINAPI
-pty_master_thread (VOID *arg)
-{
- return ((fhandler_pty_master *) arg)->pty_master_thread ();
-}
-
-bool
-fhandler_pty_master::setup ()
-{
- int res;
- security_descriptor sd;
- SECURITY_ATTRIBUTES sa = { sizeof (SECURITY_ATTRIBUTES), NULL, TRUE };
-
- /* Find an unallocated pty to use. */
- int unit = cygwin_shared->tty.allocate (from_master, get_output_handle ());
- if (unit < 0)
- return false;
-
- ProtectHandle1 (get_output_handle (), to_pty);
-
- tty& t = *cygwin_shared->tty[unit];
- _tc = (tty_min *) &t;
-
- tcinit (true); /* Set termios information. Force initialization. */
-
- const char *errstr = NULL;
- DWORD pipe_mode = PIPE_NOWAIT;
-
- if (!SetNamedPipeHandleState (get_output_handle (), &pipe_mode, NULL, NULL))
- termios_printf ("can't set output_handle(%p) to non-blocking mode",
- get_output_handle ());
-
- char pipename[sizeof("ptyNNNN-from-master")];
- __small_sprintf (pipename, "pty%d-to-master", unit);
- res = fhandler_pipe::create (&sec_none, &get_io_handle (), &to_master,
- fhandler_pty_common::pipesize, pipename, 0);
- if (res)
- {
- errstr = "output pipe";
- goto err;
- }
-
- ProtectHandle1 (get_io_handle (), from_pty);
-
- /* Create security attribute. Default permissions are 0620. */
- sd.malloc (sizeof (SECURITY_DESCRIPTOR));
- RtlCreateSecurityDescriptor (sd, SECURITY_DESCRIPTOR_REVISION);
- if (!create_object_sd_from_attribute (NULL, myself->uid, myself->gid,
- S_IFCHR | S_IRUSR | S_IWUSR | S_IWGRP,
- sd))
- sa.lpSecurityDescriptor = (PSECURITY_DESCRIPTOR) sd;
-
- /* Carefully check that the input_available_event didn't already exist.
- This is a measure to make sure that the event security descriptor
- isn't occupied by a malicious process. We must make sure that the
- event's security descriptor is what we expect it to be. */
- if (!(input_available_event = t.get_event (errstr = INPUT_AVAILABLE_EVENT,
- &sa, TRUE))
- || GetLastError () == ERROR_ALREADY_EXISTS)
- goto err;
-
- char buf[MAX_PATH];
- errstr = shared_name (buf, OUTPUT_MUTEX, unit);
- if (!(output_mutex = CreateMutex (&sa, FALSE, buf)))
- goto err;
-
- errstr = shared_name (buf, INPUT_MUTEX, unit);
- if (!(input_mutex = CreateMutex (&sa, FALSE, buf)))
- goto err;
-
- /* Create master control pipe which allows the master to duplicate
- the pty pipe handles to processes which deserve it. */
- __small_sprintf (buf, "\\\\.\\pipe\\cygwin-%S-pty%d-master-ctl",
- &cygheap->installation_key, unit);
- master_ctl = CreateNamedPipe (buf, PIPE_ACCESS_DUPLEX
- | FILE_FLAG_FIRST_PIPE_INSTANCE,
- PIPE_WAIT | PIPE_TYPE_MESSAGE
- | PIPE_READMODE_MESSAGE
- | (wincap.has_pipe_reject_remote_clients ()
- ? PIPE_REJECT_REMOTE_CLIENTS : 0),
- 1, 4096, 4096, 0, &sec_all_nih);
- if (master_ctl == INVALID_HANDLE_VALUE)
- {
- errstr = "pty master control pipe";
- goto err;
- }
- master_thread = new cygthread (::pty_master_thread, this, "ptym");
- if (!master_thread)
- {
- errstr = "pty master control thread";
- goto err;
- }
-
- t.set_from_master (from_master);
- t.set_to_master (to_master);
- t.winsize.ws_col = 80;
- t.winsize.ws_row = 25;
- t.master_pid = myself->pid;
-
- dev ().parse (DEV_PTYM_MAJOR, unit);
-
- termios_printf ("this %p, pty%d opened - from_pty %p, to_pty %p", this, unit,
- get_io_handle (), get_output_handle ());
- return true;
-
-err:
- __seterrno ();
- close_maybe (get_io_handle ());
- close_maybe (get_output_handle ());
- close_maybe (input_available_event);
- close_maybe (output_mutex);
- close_maybe (input_mutex);
- close_maybe (from_master);
- close_maybe (to_master);
- close_maybe (master_ctl);
- termios_printf ("pty%d open failed - failed to create %s", unit, errstr);
- return false;
-}
-
-void
-fhandler_pty_master::fixup_after_fork (HANDLE parent)
-{
- DWORD wpid = GetCurrentProcessId ();
- fhandler_pty_master *arch = (fhandler_pty_master *) archetype;
- if (arch->dwProcessId != wpid)
- {
- tty& t = *get_ttyp ();
- if (myself->pid == t.master_pid)
- {
- t.set_from_master (arch->from_master);
- t.set_to_master (arch->to_master);
- }
- arch->dwProcessId = wpid;
- }
- from_master = arch->from_master;
- to_master = arch->to_master;
- report_tty_counts (this, "inherited master", "");
-}
-
-void
-fhandler_pty_master::fixup_after_exec ()
-{
- if (!close_on_exec ())
- fixup_after_fork (spawn_info->parent);
- else
- from_master = to_master = NULL;
-}