From 54030e2146f80ba055f4b7efa20467beab1487e9 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 14 Oct 2002 20:25:52 +0000 Subject: * child_info.h (CURR_CHILD_INFO_MAGIC): Reset. (child_info_fork::heaptop): Remove obsolete element. (child_info_fork::heabbase): Ditto. (child_info_fork::heapptr): Ditto. (child_info_fork::mount_table): New element. (child_info_fork::myself_addr): Ditto. * dcrt0.cc (dll_crt0_1): Set mount_table and myself_addr when forking. (initial_env): Add newline to "sleeping" message. * dll_init.cc (reserve_upto): Accommodate cygwin heap when freeing memory. Make debugging output a little more descriptive. * fork.cc (fork_parent): Save mount_table and myself_addr. * pinfo.cc (myself_addr): New variable. (set_myself): Pass PID_MYSELF flag to init. (pinfo::Init): Honor PID_MYSELF. Save address where myself shared memory resides in myself_addr, for fork. * pinfo.h (myself_addr): Declare. * shared.cc (memory_init): On fork, use previously saved address for location of mount table. * include/sys/cygwin.h (PID_MYSELF): New value. * dtable.cc (dtable::stdio_init): Don't pass access type to init_std_file_from_handle. It's always the same. (dtable::init_std_file_from_handle): Remove access type argument. Assume read/write. * dtable.h (dtable::init_std_file_from_handle): Ditto for declaration. * exceptions.cc (try_to_debug): Don't try to debug if already being debugged. * fhandler_console.cc (shared_console_info_save): New variable. (fhandler_console::get_tty_stuff): Save address of shared console stuff for fork. --- winsup/cygwin/dtable.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'winsup/cygwin/dtable.cc') diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index d18f99b6b..6b5ee88e9 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -139,7 +139,7 @@ dtable::stdio_init () HANDLE out = GetStdHandle (STD_OUTPUT_HANDLE); HANDLE err = GetStdHandle (STD_ERROR_HANDLE); - init_std_file_from_handle (0, in, GENERIC_READ); + init_std_file_from_handle (0, in); /* STD_ERROR_HANDLE has been observed to be the same as STD_OUTPUT_HANDLE. We need separate handles (e.g. using pipes @@ -157,8 +157,8 @@ dtable::stdio_init () } } - init_std_file_from_handle (1, out, GENERIC_WRITE); - init_std_file_from_handle (2, err, GENERIC_WRITE); + init_std_file_from_handle (1, out); + init_std_file_from_handle (2, err); /* Assign the console as the controlling tty for this process if we actually have a console and no other controlling tty has been assigned. */ if (myself->ctty < 0 && GetConsoleCP () > 0) @@ -213,7 +213,7 @@ cygwin_attach_handle_to_fd (char *name, int fd, HANDLE handle, mode_t bin, } void -dtable::init_std_file_from_handle (int fd, HANDLE handle, DWORD myaccess) +dtable::init_std_file_from_handle (int fd, HANDLE handle) { const char *name; CONSOLE_SCREEN_BUFFER_INFO buf; @@ -269,11 +269,11 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle, DWORD myaccess) path_conv pc; unsigned bin; fhandler_base *fh = build_fhandler_from_name (fd, name, handle, pc); - bin = fh->get_default_fmode (myaccess == GENERIC_READ ? O_RDONLY : O_WRONLY); + bin = fh->get_default_fmode (O_RDWR); if (!bin && name != unknown_file) bin = pc.binmode (); - fh->init (handle, myaccess, bin); + fh->init (handle, GENERIC_READ | GENERIC_WRITE, bin); set_std_handle (fd); paranoid_printf ("fd %d, handle %p", fd, handle); } -- cgit v1.2.3