summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-08-27 20:01:29 +0000
committerCorinna Vinschen <corinna@vinschen.de>2011-08-27 20:01:29 +0000
commitf4ec8743281979dcf223b961395a8a76a036b376 (patch)
treeb712bef24107dc5ee264871d88ff537191947d21 /winsup/cygwin/fhandler.cc
parent477215fe7db5277f44fe35c5a600597bbf957fa0 (diff)
downloadcygnal-f4ec8743281979dcf223b961395a8a76a036b376.tar.gz
cygnal-f4ec8743281979dcf223b961395a8a76a036b376.tar.bz2
cygnal-f4ec8743281979dcf223b961395a8a76a036b376.zip
* fhandler.cc (fhandler_base::open): Fix typo in comment.
(fhandler_base::close): Move call to del_my_locks from here... * fhandler_disk_file.cc (fhandler_disk_file::open): ...to here. * flock.cc (struct lockfattr_t): New type. (lockf_t::close_lock_obj): New method, use throughout. (lockf_t::create_lock_obj_attr): New method. (lockf_t::create_lock_obj): Use create_lock_obj_attr method. Handle STATUS_OBJECT_NAME_COLLISION in F_FLOCK case gracefully. Add lengthy comments to explain why and how. (lockf_t::open_lock_obj): Use create_lock_obj_attr method. (lockf_t::del_lock_obj): Call NtSetEvent rather than SetEvent for symmetry. (fhandler_disk_file::lock): Define n only where it's used. Call need_fork_fixup only if call was successful. Handle EINTR and ECANCELED return values from lf_setlock. (lf_setlock): Drop WAIT_UNLOCKED and WAIT_PROC_EXITED. Don't wait for event object handle count to become <= 1 in F_LOCK case. Simplify WFMO return value handling. Don't handle signal and cancel events here; just return with appropriate error code instead. (lf_getblock): Ignore locks for which the handle can't be opened. Use IsEventSignalled. * ntdll.h (STATUS_INVALID_INFO_CLASS): Undef if defined elsewhere to make sure the definition is casted to NTSTATUS. (STATUS_INVALID_HANDLE): Define and ditto. (STATUS_OBJECT_NAME_COLLISION): Define. (NtSetEvent): Declare.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc6
1 files changed, 1 insertions, 5 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 722f11102..23e631e0f 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -672,7 +672,7 @@ fhandler_base::open (int flags, mode_t mode)
status = NtSetInformationFile (fh, &io, &feofi, sizeof feofi,
FileEndOfFileInformation);
/* In theory, truncating the file should never fail, since the opened
- handle has FILE_READ_DATA permissions, which is all you need to
+ handle has FILE_WRITE_DATA permissions, which is all you need to
be allowed to truncate a file. Better safe than sorry. */
if (!NT_SUCCESS (status))
{
@@ -1130,10 +1130,6 @@ fhandler_base::close ()
int res = -1;
syscall_printf ("closing '%s' handle %p", get_name (), get_handle ());
- /* Delete all POSIX locks on the file. Delete all flock locks on the
- file if this is the last reference to this file. */
- if (unique_id)
- del_my_locks (on_close);
if (nohandle () || CloseHandle (get_handle ()))
res = 0;
else