summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_console.cc
Commit message (Collapse)AuthorAgeFilesLines
* Throughout, change 'cygwin_shared.mount' to 'mount_table'.Christopher Faylor2001-01-281-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * child_info.h (child_info): Move shared_h, console_h to cygheap. Add mount_h. * cygheap.h (init_cygheap): Add shared_h, console_h. * cygheap.cc (init_cheap): Initialize heap at a fixed location after the shared memory regions. Initialize cygheap->user name here. * dcrt0.cc (dll_crt0_1): Call getpagesize () to initialize constants. Remove cygheap_init since it is done in shared_init now. (_dll_crt0): Initialize mount_h, remove shared_h and console_h initialization. * fhandler_console.cc (console_shared_h): Eliminate. (get_tty_stuff): Use cygheap->console_h rather than console_shared_h. * heap.cc (heap_init): Use page size constant calculated earlier in initialization. * shared.cc: Eliminate cygwin_shared_h. Add cygwin_mount_h. (mount_table_init): New function for initializing a user mount table. (open_shared_file_map): Use constant for shared memory region. Initialize cygheap and mount table here. (open_shared): Improve debugging output. (shared_info::initialize): Eliminate call to mount.init. (shared_terminate): Use cygheap->shared_h. Close cygwin_mount_h. (open_shared_file_map): Eliminate. * shared_info.h (mount_info): Add a version field. (shared_align_past): New macro for calculating location for shared memory regions. * sigproc.cc (init_child_info): Eliminate shared_h, console_h. * spawn.cc (spawn_guts): Pass on cygwin_mount_h iff not a different user. * syscalls.cc (system_info): New global holding system memory defaults. (getpagesize): Use system_info. * uinfo.cc (internal_getlogin): Only fill in user name if nonexistent. * winsup.h: Declare system_info. * passwd.cc (read_etc_passwd): Use cygheap->user.name () rather than retrieving the name again.
* * autoload.cc (LoadDLLinitfunc): Remove debugging statement.Christopher Faylor2001-01-171-1/+1
| | | | | | | | | | | | | | | | | | * exceptions.cc (sig_handle_tty_stop): Move setting of PID_STOPPED to earlier in interrupt. ((interrupt_setup): i.e., here. (sig_handle): Don't queue multiple SIGSTOPS. * fhandler.h (bg_check_types): Enumerate return value of bg_check for clarity. * signal.cc (kill_pgrp): Minor cleanup. * fhandler_termios.cc (fhandler_termios::bg_check): Use enumerated type for function return. Don't raise signal if a signal is already queued. * fhandler_console.cc (fhandler_console::read): Use enumerated return type for bg_check. * select.cc: Ditto, throughout. * read.cc: Ditto, throughout. * termios.cc: Ditto, throughout. (_read): YA interrupt detect simplification. * wait.cc (wait4): Ditto.
* * pinfo.cc (codepage_init): Move function.Christopher Faylor2001-01-081-1/+1
| | | | | | | | | * environ.cc (codepage_init): To here. * exceptoins.cc (SIG_NONMASKABLE): Remove SIGCONT from consideration since it is supposed to be maskable. * signal.cc (sigaction): Ditto. * sigproc.cc (wait_sig): Ditto. * winsup.h: Eliminate global declaration of codepage_init.
* * fhandler_console.cc (fhandler_console::read): Restore missing test for codeChristopher Faylor2001-01-031-1/+1
| | | | page before doing OemToCharBuff.
* * fhandler_console.cc (read): Add support for xterm-style mouse eventChristopher Faylor2000-12-161-38/+146
| | | | | | | | reporting. (fhandler_console::char_command): Honor mouse events. (fhandler_console::open): Enable mouse input events. (fhandler_console::input_tcsetattr): Ditto. * select.cc (peek_console): Add check for mouse events.
* * fhandler.h (fhandler_console): Add additional argument to char_commandChristopher Faylor2000-12-151-126/+40
| | | | | | | | method. * fhandler_console.cc (fhandler_console::read): Revert previously misapplied patch. (fhandler_console::char_command): Add a second argument. (fhandler_console::write): Recognize when a '?' is found after a <esc>[.
* * autoload.cc: Autoload CharToOemA.Christopher Faylor2000-12-101-2/+5
| | | | | | | | | | | | | | | | | * dcrt0.cc (dll_crt0_1): Translate command line to OEM if current codepage is OEM. * environ.cc: Add new option 'codepage' to CYGWIN environment variable. * fhandler_clipboard.cc (fhandler_clipboard::read): Read clipboard in OEM mode if current codepage is OEM. * fhandler_console.cc (fhandler_console::read): Only translate console input if current codepage is ANSI. * fhandler_console.cc (fhandler_console::write_normal): Translate output data if current codepage is ANSI. * pinfo.cc (codepage_init): New function. Setup current codepage from CYGWIN environment variable and set codepage for file APIs. * security.cc (read_sd): Translate file name to it if current codepage is OEM. * winsup.h: (sys_wcstombs,sys_mbstowcs): Use current codepage for translations between multibyte and widechar string and vice versa.
* * path.cc (normalize_win32_path): Check for explicit use of two slashes at theChristopher Faylor2000-12-091-35/+124
| | | | | | beginning of a path. These should be treated specially regardless of whether they are UNC paths or old-style //a paths. Avoid adding cwd to a path if the path already begins with '/'.
* * fhandler_console.cc: New member variable `dwBufferSize' for `info'.Christopher Faylor2000-11-171-2/+4
| | | | | | (fillin_info): Set `dwBufferSize' to the size of the console buffer. (clear_screen): Use width of console buffer to calculate how many spaces to clear.
* * fork.cc (fork): Set sigframe here, since it can pause for a considerableChristopher Faylor2000-10-231-1/+1
| | | | | | | amount of time. * environ.cc (_addenv): Add debugging. * fhandler.cc: Eliminate unneeded include. * smallprint.c: Ditto.
* * fhandler.h (fhandler_console): Remove tcsetpgrp.Christopher Faylor2000-10-211-8/+1
| | | | | | | | | | | | * fhandler_console.cc (fhandler_console::tcsetpgrp): Eliminate. * fork.cc (fork_parent): Avoid returning same pid twice in a row regardless of OS. * pinfo.cc (pinfo::init): Rename create argument to flags and treat it as such. * signal.cc (set_sigcatchers): New function. (signal): Use set_sigcatchers to increment or decrement sigcatcher tracker. (sigaction): Ditto. Add debugging output. * spawn.cc (spawn_guts): Always quote first argv[0] argument when it's a COMSPEC shell.
* * Makefile.in: add miscfuncs.ccDJ Delorie2000-10-191-1/+1
| | | | | | | | | | * miscfuncs.cc: new, miscellaneous functions * winsup.h: define table-driven tolower/toupper * environ.cc: use them * fhandler_console.cc: ditto * fhandler_termios: ditto * path.cc: ditto (strncasematch, strcasematch, strcasestr): move to miscfuncs.cc
* * errno.cc (seterrno_from_win_error): Fix debugging output.Christopher Faylor2000-10-121-4/+3
| | | | | | | | | | | | | | * fhandler.cc (fhandler_base::fstat): Move to inline method in fhandler.h. (fhandler_base::set_io_handle): Ditto. * fhandler.h (fhandler_base): Make some methods inline. * fhandler_console.cc (fhandler_console::write_normal): Make buffer larger. * sigproc.h (sigframe::sigframe): Actually use set ebp parameter correctly. * spawn.cc (spawn_guts): Set dwProcessId when exec'ing. Just exit immediately after reparenting. * syscalls.cc: Sprinkle sigframe stuff throughout. * wait.cc (wait4): Set signal frame here. * dcrt0.cc (__api_fatal): Don't rely on small_printf to display errors. Always display problems to the console, if possible.
* Break out more header info into separate files. Use appropriate header filesChristopher Faylor2000-09-081-1/+2
| | | | | | | | | | | | throughout. * shared.h: Remove. * cygwin_version.h: New file. * delqueue.h: New file. * environ.h: New file. * host_dependent.h: New file. * perprocess.h: New file. * registry.h: New file. * security.h: New file.
* Split out tty and shared_info stuff into their own headers and use throughout.Christopher Faylor2000-09-071-0/+17
| | | | | | | | | | | | | | | | | Include sys/termios.h for files which need it. * tty.h: New file. * shared_info.h: New file. * fhandler.h: Move inline methods that rely on tty stuff to fhandler_console.cc. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Set output_done_event immediately after reading data to speed up tty output processing. (process_output): Set write_error to errno or zero. (fhandler_tty_slave::write): Check previous write error prior to writing to slave end of pipe. This allows tty output to be slightly less synchronous. * fhandler_console.cc (fhandler_console::tcsetpgrp): Moved here from fhandler.h. (fhandler_console::set_input_state): Ditto.
* * Makefile.in: Add cygheap.o.Christopher Faylor2000-09-031-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * child_info.h: Add specific exec class. * cygheap.h: New file. Contains declarations for cygwin heap. * cygheap.cc: New file. Implements cygwin heap functions. * dcrt0.cc (quoted): Simplify due to new method for passing arguments between cygwin programs. (alloc_stack_hard_way): Attempt to handle overlapped stack. (dll_crt0_1): Move child_info processing here. Accomodate new method for passing arguments between cygwin programs. Initialize cygwin heap. Establish __argc and __argv variables. (_dll_crt0): Move most of child_info processing to dll_crt0_1. (cygwin_dll_init): Remove duplication. * dtable.cc (dtable::extend): Allocate dtable using cygwin heap. (dtable::build_fhandler): Ditto for fhandler type being constructed. (dtable::dup_worker): Free new fhandler from cygwin heap on error. (dtable::select_*): Don't assume that this == fdtab. (dtable::linearize_fd_array): Delete. (dtable::delinearize_fd_array): Delete. (dtable::fixup_after_exec): New file. (dtable::vfork_child_dup): Use cygwin heap. (dtable::vfork_parent_restore): Ditto. * dtable.h: Remove obsolete methods. Add new method. * environ.cc (posify): Eliminate already_posix parameter and logic. (envsize): New function. (_addenv): Use envsize. (environ_init): Accept an argument pointing to an existing environment list. If supplied, allocate space for this in the the program's heap. * fhandler.cc (fhandler_base::operator =): Move here from fhandler.h. Use cygwin heap to allocate filenames. (fhandler_base::set_name): Allocate/free names from cygwin heap. (fhandler_base::linearize): Delete. (fhandler_base::de_linearize): Delete. (fhandler_base::operator delete): Free from cygwin heap. (fhandler_base::~fhandler_base): Ditto. * fhandler.h: Accomodate elimination of *linearize and other changes above. * fhandler_console.cc (fhandler_console::fixup_after_exec): Rename from de_linearize. * heap.h: New file. * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Use cygwin heap for name. fhandler_tty::fixup_after_exec): Rename from de_linearize. * fork.cc (fork): Call cygheap_fixup_in_child. * heap.cc: Use declarations in heap.h. * malloc.cc: Sprinkle assertions throughout to catch attempts to free/realloc something from the cygwin heap. * path.cc: Throughout, eliminate use of per-thread cache for cwd. Use cwd_* functions rather than cwd_* variables to access cwd_win32 and cwd_posix. (cwd_win32): New function. (cwd_posix): New function. (cwd_hash): New function. (cwd_fixup_after_exec): New function. * path.h: Accomodate path.cc changes. * pinfo.cc (pinfo_init): Accept a pointer to an environment table. Pass this to environ_init. Eliminate old 'title' tests. * pinfo.h: Accomodate above change in argument. * spawn.cc (struct av): New method for building argv list. (av::unshift): New method. (spawn_guts): Allocate everything that the child process needs in the cygwin heap and pass a pointer to this to the child. Build argv list using new method. Eliminate delinearize stuff. * thread.h: Eliminate _cwd_win32 and _cwd_posix buffers. * winsup.h: Eliminate obsolete functions. Add envsize() declaration.
* * winsup.h: Eliminate inclusion of most of the cygwin .h files. Use .h filesChristopher Faylor2000-08-221-1/+4
| | | | | only in sources which require them. * Makefile.in: Generate dependencies with -MD option.
* * cygerrno.h: New file. Use this throughout whenever errno manipulation isChristopher Faylor2000-08-221-0/+1
| | | | | | | | | | | | | | | required. * errno.cc: Use DWORD to hold Windows errors. (geterrno_from_win_error): New function. (seterrno_from_win_error): Use geterrno_from_win_error to convert supplied windows error (suggested by Corinna Vinschen). * path.cc (symlink_info): Add error element. * path.cc (path_conv::check): Remove errno setting. Use new symlink_info errno element to set path_conv error, where appropriate. (symlink_info::check): Set error element rather than attempting to manipulate errno. Add more checks for trailing / and /.. even though they are currently useless. Avoid setting EINVAL. * path.cc (normalize_posix_path): Correct check for trailing /.
* * winsup.h: Split out dtable definitions into separate header file.Christopher Faylor2000-08-121-0/+1
| | | | | | * dtable.h: New file. * sigproc.h: Eliminate pinfo.h usage here. Use it in source files that need it.
* * winsup.h: take out protections of environ, errno, allow C useDJ Delorie2000-08-021-1/+1
| | | | | | | | | | * *.cc: put winsup.h before other headers (for __INSIDE_CYGWIN__); use cur_environ() instead of just environ * times.cc: remove import protections * glob.c: add winsup.h * localtime.c: ditto * smallprint.c: ditto * Makefile.in: don't __INSIDE_CYGWIN__ as it messes up profiling.
* * fhandler_console.cc: Remove VK_DIVIDE detection.Christopher Faylor2000-07-301-10/+7
| | | | | | | (get_nonascii_key): Simplify previous patch to return ascii char if it is non-zero. Add a second "temporary buffer" argument to help with thread safety. * select.cc (peek_console): Pass a temporary buffer argument to get_nonascii_key.
* * fhandler_console.cc: Add VK_DIVIDE detection. Return virtual keycode if itChristopher Faylor2000-07-291-0/+9
| | | | is not detected and it is less than ' '.
* * include/cygwin/version.h: Bump DLL minor version number to 5 due to all ofChristopher Faylor2000-07-291-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the changes below. Redefine process structure to avoid a fixed size table. Redefine pinfo/_pinfo classes. Use these throughout. * dcrt0.cc (dll_crt0_1): Accomodate set_myself argument change. (__api_fatal): Accomodate _pinfo::record_death argument change. * exceptions.cc (really_exit): Ditto. (sig_handle_tty_stop): Use pinfo constructor to access process info. (events_init): Don't create pinfo_mutex since it is no longer required. * external.cc (fillout_pinfo): Use winpids class to iterate over all system pids. (cygwin_internal): lock_pinfo_for_update and unlock_pinfo are now noops. * fhandler_termios.cc (fhandler_termios::set_ctty): Use pinfo constructor to access process info. * fork.cc (fork): Reorganize to initialize child info after the child has started since that is when we know the child's winpid, which is necessary to allocate the pinfo shared memory. * mmap.cc (recreate_mmaps_after_fork): Change arg type to _pinfo. * pinfo.cc: Rename pinfo methods to _pinfo throughout. Eliminate pinfo_list stuff. (set_myself): Accept a pid argument now. Call pinfo initializer to initialize myself. Detect when this is an "execed" process and create an "indirect" pid block. (pinfo_init): Accomodate set_myself arg change. (procinfo): Remove. (pinfo::lock_pinfo): Remove. (pinfo::unlock_pinfo): Remove. (pinfo::init): New method. Allocates shared memory space for process pinfo structure. (pinfo::record_death): Don't call locking functions. (cygwin_winpid_to_pid): Simplify by using new pinfo constructor. (EnumProcessesW95): New function for iterating over processes on Windows 95. (winpids::winpids): New constructor for winpids class. Sets up a list of process ids. (enum_init): Initialize w95/wnt pid enumerators. * shared.cc (shared-info::initialize): Remove pid initialization. * shared.h: Move pinfo stuff into pinfo.h. (class shared_info): Remove pinfo_list element. * signal.cc (kill_worker): Use pinfo constructor to access process info. (kill_pgrp): Ditto. Use winpids methods to access list of processes. * sigproc.cc: Throughout, modify to use _pinfo where appropriate. (proc_exists (pid_t)): New function. Determines if a process exists based on the pid. (proc_exists (_pinfo *p): Use new proc_exists function above. (proc_subproc): Copy pinfo stuff around rather than _pinfo pointers. Try to be careful about releasing shared memory when we don't need it anymore. Remove pinfo locks. (remove_zombies): Remove pinfo memory when zombie is going away. * sigproc.h: Reflect _pinfo/pinfo changes in sigproc.cc. * spawn.cc (spawn_guts): Eliminate pinfo *child argument. Reorganize to only initialize child pinfo after process has been started and we know the windows pid. (_spawnve): Reflect spawn_guts changes. * syscalls.cc (setpgid): Use pinfo constructor to access process info. (getpgid): Ditto. (internal_getlogin): Use _pinfo. * winsup.h: Eliminate pinfo_mutex. Eliminate spawn_guts declaration since it is static now. Reflect set_myself argument change. * include/sys/cygwin.h: Add some PID_* enums to accomodate new pinfo stuff. * include/cygwin/version.h: Update minor version for cygdrive changes below.
* * testsuite/winsup.api/winsup.exp: ignore stdout by defaultDJ Delorie2000-07-271-0/+2
| | | | | | | | | | | | | | | | | | | * testsuite/winsup.api/crlf.c: non-verbose by default * winsup.h: prune out windows headers we don't normally need * assert.cc: add wingdi.h and winuser.h * fhandler_console.cc: ditto * fhandler_windows.cc: ditto * select.cc: ditto * spawn.cc: ditto * strace.cc: ditto * tty.cc: ditto * window.cc: ditto * hinfo.cc: add winsock.h * syscalls.cc: add winnls.h * uinfo.cc: ditto * include/windows.h: optimize non-inclusion of repeat headers
* * fhandler_console.cc (fhandler_console::read): Explicitly set cursor to makeChristopher Faylor2000-07-261-0/+1
| | | | it visible while waiting in WaitForMultipleObjects.
* * fhandler_console.cc (fhandler_console::read): Unicode interface toChristopher Faylor2000-07-101-2/+6
| | | | | ReadConsoleInput only exists on W2K, so use workaround from Kazuhiro Fujieda <fujieda@jaist.ac.jp>.
* * Makefile.in (install): Install textmode.o as well as binmode.o.Christopher Faylor2000-07-101-12/+15
|
* * dcrt0.cc (dll_crt0_1): Eliminate SetFileApisToOEM and CharToOem.Christopher Faylor2000-07-041-4/+16
| | | | | | | | | | * (dummy_autoload): Add functions used in fhandler_console. * fhandler_console.cc (fhandler_console::read): Use ENCHANCED_KEY flag to distinguish extended keys. Translate an input character from the OEM code page to the ANSI code page. * (fhandler_console::write_normal): Translate output characters from the ANSI code page to the OEM code page. * syscalls.cc (_link): Use MultiByteToWideChar instead of OemToCharW.
* * fhandler_console.cc (fhandler_console::read): Detect extended keycodeChristopher Faylor2000-04-241-1/+1
| | | | information for Windows 9x so that function keys will work correctly.
* * fhandler_console.cc (keytable): Add support for keypad 5 key, which MS seemsChristopher Faylor2000-04-151-0/+1
| | | | | | to think is equivalent to VK_CLEAR. * debug.cc (thread_stub): Eliminate initialization of reent stuff. * init.cc (dll_entry): Move it here.
* * fhandler.cc (fhandler_base::get_readahead_into_buffer): New function.Christopher Faylor2000-03-121-9/+2
| | | | | | | | | | | | | * fhandler.h: Declare new function. Add extra argument to process_slave_output. * fhandler_console.cc (fhandler_console::read): Move read ahead code to new function. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Move common code here. (fhandler_tty_slave::read): Understand readahead. (fhandler_pty_master::read): Move code to process_slave_output. * select.cc (peek_pipe): Avoid performing certain checks when non-read and on inappropriate fh types.
* * fhandler_console.cc (fhandler_console::read): Don't even think about breakingChristopher Faylor2000-03-121-4/+8
| | | | | | | on interrupt if executing in a "cygwin" thread. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Streamline, simplify code. * sigproc.cc (sig_send): Remove debugging statement.
* * exceptions.cc (interruptible): Make a little more structured.Christopher Faylor2000-02-261-1/+0
| | | | | | | | | | | | | (call_handler): Allow signals to be sent even if signalled thread is stopped. Change order of signal_arrived arming/waiting threads clearing to eliminate a race. (reset_signal_arrived): New helper function. * malloc.cc (malloc_init): Use mutos so that signal handler can keep track of who owns the lock. (__malloc_lock): Ditto. (__malloc_unlock): Ditto. * sync.h (new_muto): Actually use a muto for the "buffer". * Makefile.in: Fix a dependency.
* Fix final round of gcc warnings relating to unused parameters.Christopher Faylor2000-02-241-1/+2
| | | | | | | | | | | | | | * debug.cc (iscygthread): New function. * debug.h: Declare it. * exceptions.cc (set_process_mask): Flush pending signals. (handle_sigsuspend): No need to flush pending signals. (call_handler): Refine previous tests of muto ownership. Only clear wait()'s when we have definitely responded to a signal. * fhandler_console.cc (fhandler_console::read): Don't set EINTR if executing in a "cygwin" thread. * sigproc.cc (proc_subproc): Use second argument to control whether CLEARWAIT actually sets "signalled" flag. * sync.h (muto): Add 'unstable' method.
* Respond to a multitude of g++ warnings.Christopher Faylor2000-02-211-2/+2
|
* import winsup-2000-02-17 snapshotChristopher Faylor2000-02-171-0/+1387