* flock.cc (fhandler_base::lock): Only refuse to lock nohandle and

old-style console devices when called to perform BSD flock locking.
	Add a FIXME to comment and align description.

	* ntdll.h (THREADINFOCLASS): Following MSDN, rename throughout from
	THREAD_INFORMATION_CLASS.
This commit is contained in:
Corinna Vinschen 2013-10-25 18:40:57 +00:00
parent 2118eee1ce
commit 7a1dc2a940
4 changed files with 26 additions and 12 deletions

View File

@ -1,3 +1,12 @@
2013-10-25 Corinna Vinschen <corinna@vinschen.de>
* flock.cc (fhandler_base::lock): Only refuse to lock nohandle and
old-style console devices when called to perform BSD flock locking.
Add a FIXME to comment and align description.
* ntdll.h (THREADINFOCLASS): Following MSDN, rename throughout from
THREAD_INFORMATION_CLASS.
2013-10-25 Corinna Vinschen <corinna@vinschen.de>
* devices.in (dev_storage): Map /dev/clipboard to \Device\Null.

View File

@ -927,15 +927,21 @@ fhandler_base::lock (int a_op, struct flock *fl)
short a_flags = fl->l_type & (F_POSIX | F_FLOCK);
short type = fl->l_type & (F_RDLCK | F_WRLCK | F_UNLCK);
if (nohandle ())
if (!a_flags)
a_flags = F_POSIX; /* default */
/* FIXME: For BSD flock(2) we need a valid, per file table entry OS handle.
Therefore we can't allow using flock(2) on nohandle devices and
pre-Windows 8 console handles (recognized by their odd handle value). */
if ((a_flags & F_FLOCK)
&& (nohandle () || (((uintptr_t) get_handle () & 0x3) == 0x3)))
{
set_errno (EINVAL);
debug_printf ("Locking on nohandle device, return EINVAL.");
debug_printf ("BSD locking on nohandle and old-style console devices "
"not supported");
return -1;
}
if (!a_flags)
a_flags = F_POSIX; /* default */
if (a_op == F_SETLKW)
{
a_op = F_SETLK;

View File

@ -1116,12 +1116,12 @@ typedef enum _SEMAPHORE_INFORMATION_CLASS
SemaphoreBasicInformation = 0
} SEMAPHORE_INFORMATION_CLASS, *PSEMAPHORE_INFORMATION_CLASS;
typedef enum _THREAD_INFORMATION_CLASS
typedef enum _THREADINFOCLASS
{
ThreadBasicInformation = 0,
ThreadTimes = 1,
ThreadImpersonationToken = 5
} THREAD_INFORMATION_CLASS, *PTHREAD_INFORMATION_CLASS;
} THREADINFOCLASS, *PTHREADINFOCLASS;
/* Checked on 64 bit. */
typedef struct _THREAD_BASIC_INFORMATION
@ -1283,8 +1283,8 @@ extern "C"
ULONG, FILE_INFORMATION_CLASS);
NTSTATUS NTAPI NtQueryInformationProcess (HANDLE, PROCESSINFOCLASS,
PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryInformationThread (HANDLE, THREAD_INFORMATION_CLASS,
PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryInformationThread (HANDLE, THREADINFOCLASS, PVOID,
ULONG, PULONG);
NTSTATUS NTAPI NtQueryInformationToken (HANDLE, TOKEN_INFORMATION_CLASS,
PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryObject (HANDLE, OBJECT_INFORMATION_CLASS, VOID *,
@ -1316,8 +1316,7 @@ extern "C"
NTSTATUS NTAPI NtSetEvent (HANDLE, PULONG);
NTSTATUS NTAPI NtSetInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG,
FILE_INFORMATION_CLASS);
NTSTATUS NTAPI NtSetInformationThread (HANDLE, THREAD_INFORMATION_CLASS,
PVOID, ULONG);
NTSTATUS NTAPI NtSetInformationThread (HANDLE, THREADINFOCLASS, PVOID, ULONG);
NTSTATUS NTAPI NtSetInformationToken (HANDLE, TOKEN_INFORMATION_CLASS, PVOID,
ULONG);
NTSTATUS NTAPI NtSetSecurityObject (HANDLE, SECURITY_INFORMATION,

View File

@ -8,8 +8,8 @@ What changed:
- Slightly improve randomness of /dev/random emulation.
- Allow to use advisory locking on any device which is backed by an OS handle.
Right now this excludes /dev/dsp as well as almost all virtual files under
/proc.
Right now this excludes /dev/dsp, console windows on pre Windows 8, as well
as almost all virtual files under /proc.
Bug fixes: