* flock.cc (get_lock_parent_dir): Drop call to NtOpenDirectoryObject
and utilize OBJ_OPENIF flag in call to NtCreateDirectoryObject. (inode_t::inode_t): Ditto. Same for NtOpenMutant/NtCreateMutant.
This commit is contained in:
parent
682cf99346
commit
5cb524ee7d
|
@ -1,3 +1,9 @@
|
||||||
|
2008-04-02 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* flock.cc (get_lock_parent_dir): Drop call to NtOpenDirectoryObject
|
||||||
|
and utilize OBJ_OPENIF flag in call to NtCreateDirectoryObject.
|
||||||
|
(inode_t::inode_t): Ditto. Same for NtOpenMutant/NtCreateMutant.
|
||||||
|
|
||||||
2008-04-02 Corinna Vinschen <corinna@vinschen.de>
|
2008-04-02 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* posix.sgml: Change lockf to being implemented.
|
* posix.sgml: Change lockf to being implemented.
|
||||||
|
|
|
@ -262,16 +262,11 @@ get_lock_parent_dir ()
|
||||||
if (!dir)
|
if (!dir)
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString (&uname, L"\\BaseNamedObjects\\cygwin-fcntl-lk");
|
RtlInitUnicodeString (&uname, L"\\BaseNamedObjects\\cygwin-fcntl-lk");
|
||||||
InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT, NULL,
|
InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT | OBJ_OPENIF,
|
||||||
everyone_sd (FLOCK_PARENT_DIR_ACCESS));
|
NULL, everyone_sd (FLOCK_PARENT_DIR_ACCESS));
|
||||||
status = NtOpenDirectoryObject (&dir, FLOCK_PARENT_DIR_ACCESS, &attr);
|
status = NtCreateDirectoryObject (&dir, FLOCK_PARENT_DIR_ACCESS, &attr);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
{
|
api_fatal ("NtCreateDirectoryObject(parent): %p", status);
|
||||||
status = NtCreateDirectoryObject (&dir, FLOCK_PARENT_DIR_ACCESS,
|
|
||||||
&attr);
|
|
||||||
if (!NT_SUCCESS (status))
|
|
||||||
api_fatal ("NtCreateDirectoryObject(parent): %p", status);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
INODE_LIST_UNLOCK ();
|
INODE_LIST_UNLOCK ();
|
||||||
return dir;
|
return dir;
|
||||||
|
@ -526,27 +521,19 @@ inode_t::inode_t (__dev32_t dev, __ino64_t ino)
|
||||||
of the given file, in hex notation. */
|
of the given file, in hex notation. */
|
||||||
int len = __small_swprintf (name, L"%08x-%016X", dev, ino);
|
int len = __small_swprintf (name, L"%08x-%016X", dev, ino);
|
||||||
RtlInitCountedUnicodeString (&uname, name, len * sizeof (WCHAR));
|
RtlInitCountedUnicodeString (&uname, name, len * sizeof (WCHAR));
|
||||||
InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT, parent_dir,
|
InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT | OBJ_OPENIF,
|
||||||
everyone_sd (FLOCK_INODE_DIR_ACCESS));
|
parent_dir, everyone_sd (FLOCK_INODE_DIR_ACCESS));
|
||||||
status = NtOpenDirectoryObject (&i_dir, FLOCK_INODE_DIR_ACCESS, &attr);
|
status = NtCreateDirectoryObject (&i_dir, FLOCK_INODE_DIR_ACCESS, &attr);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
{
|
api_fatal ("NtCreateDirectoryObject(inode): %p", status);
|
||||||
status = NtCreateDirectoryObject (&i_dir, FLOCK_INODE_DIR_ACCESS, &attr);
|
|
||||||
if (!NT_SUCCESS (status))
|
|
||||||
api_fatal ("NtCreateDirectoryObject(inode): %p", status);
|
|
||||||
}
|
|
||||||
/* Create a mutex object in the file specific dir, which is used for
|
/* Create a mutex object in the file specific dir, which is used for
|
||||||
access synchronization on the dir and its objects. */
|
access synchronization on the dir and its objects. */
|
||||||
RtlInitUnicodeString (&uname, L"mtx");
|
RtlInitUnicodeString (&uname, L"mtx");
|
||||||
InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT, i_dir,
|
InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT | OBJ_OPENIF, i_dir,
|
||||||
everyone_sd (FLOCK_MUTANT_ACCESS));
|
everyone_sd (FLOCK_MUTANT_ACCESS));
|
||||||
status = NtOpenMutant (&i_mtx, FLOCK_MUTANT_ACCESS, &attr);
|
status = NtCreateMutant (&i_mtx, FLOCK_MUTANT_ACCESS, &attr, FALSE);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
{
|
api_fatal ("NtCreateMutant(inode): %p", status);
|
||||||
status = NtCreateMutant (&i_mtx, FLOCK_MUTANT_ACCESS, &attr, FALSE);
|
|
||||||
if (!NT_SUCCESS (status))
|
|
||||||
api_fatal ("NtCreateMutant(inode): %p", status);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enumerate all lock event objects for this file and create a lockf_t
|
/* Enumerate all lock event objects for this file and create a lockf_t
|
||||||
|
|
Loading…
Reference in New Issue