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:
authorChristopher Faylor <me@cgf.cx>2011-05-06 02:30:53 +0400
committerChristopher Faylor <me@cgf.cx>2011-05-06 02:30:53 +0400
commit92ddb74290655b6f9394801dac4242c93e03f9ed (patch)
tree5c0055dd6ea6b04758afe3e49bf66ee39c231030 /winsup/cygwin/syscalls.cc
parentd8ff96389f6beb97defd285b224fead3f37398f5 (diff)
* cygheap.cc (cygheap::close_ctty): Close ctty via close_with_arch().
* debug.cc (close_handle): Call debugger on failure. * devices.in (device::tty_to_real_device): Delete. * devices.h (device::tty_to_real_device): Ditto. * devices.cc: Regenerate. * dtable.cc: Delete old ifdef'ed vfork code. (dtable::release): Don't handle archetype here. (dtable::init_std_file_from_handle): Consolidate console tests. Generate major/minor for tty ASAP. Fix incorrect setting of DEV_TTYS* for serial. (fh_alloc): New function derived from build_fh_pc. Pass current tty when building tty. (build_pc_pc): Use fh_alloc to create. Set name from fh->dev if appropriate. Generate an archetype or point to one here. (dtable::dup_worker): Deal with archetypes. Rely on = operator copying whole class rather than just fhandler_base. (dtable::fixup_after_exec): Call close_with_arch to handle closing of fhandlers with archetypes. * fhandler.cc (fhandler_base::operator =): Call memcpy with fhandler's size() rather than sizeof fhandler_base. (fhandler_base::open_with_arch): New function. Handles opening of fhandler's with archetypes, dealing with usecounts, etc. (fhandler_base::close_with_arch): Ditto for close. * fhandler.h: Many changes for archetypes. (fhandler_base::set_name): Set both normalized path and regular path. (fhandler_base::open_with_arch): New function. (fhandler_base::open_setup): Ditto. (fhandler_base::use_archetype): Ditto. (fhandler_base::_archetype_usecount): Ditto. (fhandler_*::size): Ditto. (fhandler_dev_tape::open): Remove virtual decoration. (fhandler_console::use_archetype): New function. Return true. (fhandler_console::open_setup): New function. (fhandler_console::dup): Delete. (fhandler_tty_slave::fhandler_tty_slave): Redeclare to take an argument. (fhandler_tty_slave::use_archetype): New function. Return true. (fhandler_tty_slave::cleanup): New function. (fhandler_pty_master::use_archetype): New function. Return true. (fhandler_pty_master::cleanup): New function. (fhandler_pty_master::is_tty_master): New function. Return false. (fhandler_tty_master::is_tty_master): New function. Return true. (fhandler_dev_dsp::fhandler_dev_dsp): New function. Return true. (report_tty_counts): Only report on archetype's usecount if there is one. * fhandler_console.cc (fhandler_console::get_tty_stuff): Remove handling of setsid, set_ctty, set_flags, and manage_console_count. (fhandler_console::open_setup): New function. Implement functionality removed from get_tty_stuff. (fhandler_console::dup): Delete. (fhandler_console::output_tcsetattr): Set errno on error. (fhandler_console::fhandler_console): Set device early. (fhandler_console::init): Use open_with_arch to open console handles. (fhandler_console::fixup_after_fork_exec): Nuke most of the stuff for dealing with console handles. * fhandler_dsp.cc (fhandler_dev_dsp::open): Remove archetype handling. (fhandler_dev_dsp::write): Ditto. (fhandler_dev_dsp::read): Ditto. (fhandler_dev_dsp::close): Ditto. (fhandler_dev_dsp::dup): Ditto. (fhandler_dev_dsp::ioctl): Ditto. (fhandler_dev_dsp::fixup_after_fork): Ditto. (fhandler_dev_dsp::fixup_after_exec): Ditto. * fhandler_tty.cc (fhandler_tty_common::__acquire_output_mutex): Add a little more debugging. (fhandler_tty_common::__release_output_mutex): Ditto. (fhandler_pty_master::process_slave_output): Ditto. Don't do signal handling or pthread_cancel handling in the tty master thread. (process_output): Minor reorg. (fhandler_tty_slave::fhandler_tty_slave): Set device based on new ntty argument. (fhandler_tty_slave::open): Remove archetype handling. Move some processing into open_setup(). (fhandler_tty_slave::open_setup): New function. (fhandler_tty_slave::cleanup): New function. (fhandler_tty_slave::close): Remove archetype handling. Move some processing into cleanup(). (fhandler_tty_slave::init): Rename argument from f to h. Open device using open_with_arch(). Remove archetype handling. (fhandler_pty_master::dup): Ditto. (fhandler_pty_master::open): Ditto. (fhandler_pty_master::close): Ditto. Move some handling to cleanup(). (fhandler_pty_master::cleanup): New function. (fhandler_tty_master::init_console): Give unique name to captive console fhandler. * pinfo.cc (_pinfo::set_ctty): Rename argument from arch to fh. Eliminate archetype assumption. * syscalls.cc (close_all_files): Use close_with_arch for closing. (open): Use open_with_arch() rather than open(). (close): Use close_with_arch() rather than close().
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc31
1 files changed, 12 insertions, 19 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 5585b332a..d122c8dc2 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -101,7 +101,7 @@ close_all_files (bool norelease)
DuplicateHandle (GetCurrentProcess (), fh->get_output_handle (),
GetCurrentProcess (), &h,
0, false, DUPLICATE_SAME_ACCESS);
- fh->close ();
+ fh->close_with_arch ();
if (!norelease)
cygheap->fdtab.release (i);
}
@@ -601,7 +601,7 @@ unlink_nt (path_conv &pc)
NFS implements its own mechanism to remove in-use files which
looks quite similar to what we do in try_to_bin for remote files.
That's why we don't call try_to_bin on NFS.
-
+
Netapp filesystems don't understand the "move and delete" method
at all and have all kinds of weird effects. Just setting the delete
dispositon usually works fine, though. */
@@ -721,7 +721,7 @@ unlink_nt (path_conv &pc)
http://msdn.microsoft.com/en-us/library/ff545765%28VS.85%29.aspx
"Subsequently, the only legal operation by such a caller is
to close the open file handle."
-
+
FIXME? On Vista and later, we could use FILE_HARD_LINK_INFORMATION
to find all hardlinks and use one of them to restore the R/O bit,
after the NtClose, but before we stop the transaction. This
@@ -1107,25 +1107,18 @@ open (const char *unix_path, int flags, ...)
res = -1;
set_errno (EEXIST);
}
- else if (fh->is_fs_special () && fh->device_access_denied (flags))
+ else if ((fh->is_fs_special () && fh->device_access_denied (flags))
+ || !fh->open_with_arch (flags, (mode & 07777) & ~cygheap->umask))
{
delete fh;
res = -1;
}
else
{
- fh->close_on_exec (flags & O_CLOEXEC);
- if (!fh->open (flags, (mode & 07777) & ~cygheap->umask))
- {
- delete fh;
- res = -1;
- }
- else
- {
- cygheap->fdtab[fd] = fh;
- if ((res = fd) <= 2)
- set_std_handle (res);
- }
+ fd = fh;
+ if (fd <= 2)
+ set_std_handle (fd);
+ res = fd;
}
}
}
@@ -1185,7 +1178,7 @@ close (int fd)
res = -1;
else
{
- res = cfd->close ();
+ res = cfd->close_with_arch ();
cfd.release ();
}
@@ -1974,7 +1967,7 @@ rename (const char *oldpath, const char *newpath)
filename has one of the blessed executable suffixes. */
if (!old_explicit_suffix && oldpc.known_suffix
&& !newpc.is_binary ()
- && !nt_path_has_executable_suffix (newpc.get_nt_native_path ()))
+ && !nt_path_has_executable_suffix (newpc.get_nt_native_path ()))
{
rename_append_suffix (new2pc, newpath, nlen, ".exe");
removepc = &newpc;
@@ -2040,7 +2033,7 @@ retry:
a temporary filename and then rename the temp filename to the
target filename. This renaming fails due to the jealous virus
scanner and the application fails to create the target file.
-
+
This kludge tries to work around that by yielding until the
sharing violation goes away, or a signal arrived, or after
about a second, give or take. */