Throughout replace all usage of wincap.shared with the constant
FILE_SHARE_VALID_FLAGS. * fhandler.cc (fhandler_base::open_9x): Drop local variable shared. * wincap.cc: Remove shared member throughout. * wincap.h: Ditto.
This commit is contained in:
parent
570858c30f
commit
bd8f891e8a
|
@ -1,3 +1,11 @@
|
|||
2007-02-22 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
Throughout replace all usage of wincap.shared with the constant
|
||||
FILE_SHARE_VALID_FLAGS.
|
||||
* fhandler.cc (fhandler_base::open_9x): Drop local variable shared.
|
||||
* wincap.cc: Remove shared member throughout.
|
||||
* wincap.h: Ditto.
|
||||
|
||||
2007-02-22 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* Makefile.in (DLL_IMPORTS): Add libntdll.a.
|
||||
|
|
|
@ -465,7 +465,6 @@ fhandler_base::open_9x (int flags, mode_t mode)
|
|||
int res = 0;
|
||||
HANDLE x;
|
||||
int file_attributes;
|
||||
int shared;
|
||||
int creation_distribution;
|
||||
SECURITY_ATTRIBUTES sa = sec_none;
|
||||
|
||||
|
@ -509,9 +508,6 @@ fhandler_base::open_9x (int flags, mode_t mode)
|
|||
if (flags & O_APPEND)
|
||||
append_mode (true);
|
||||
|
||||
/* These flags are host dependent. */
|
||||
shared = wincap.shared ();
|
||||
|
||||
file_attributes = FILE_ATTRIBUTE_NORMAL;
|
||||
if (flags & O_DIROPEN)
|
||||
file_attributes |= FILE_FLAG_BACKUP_SEMANTICS;
|
||||
|
@ -540,7 +536,7 @@ fhandler_base::open_9x (int flags, mode_t mode)
|
|||
pc.file_attributes (file_attributes & FILE_ATTRIBUTE_VALID_SET_FLAGS);
|
||||
}
|
||||
|
||||
x = CreateFile (get_win32_name (), access, shared, &sa, creation_distribution,
|
||||
x = CreateFile (get_win32_name (), access, FILE_SHARE_VALID_FLAGS, &sa, creation_distribution,
|
||||
file_attributes, 0);
|
||||
|
||||
if (x == INVALID_HANDLE_VALUE)
|
||||
|
@ -567,7 +563,7 @@ fhandler_base::open_9x (int flags, mode_t mode)
|
|||
set_open_status ();
|
||||
done:
|
||||
debug_printf ("%p = CreateFile (%s, %p, %p, %p, %p, %p, 0)",
|
||||
x, get_win32_name (), access, shared, &sa,
|
||||
x, get_win32_name (), access, FILE_SHARE_VALID_FLAGS, &sa,
|
||||
creation_distribution, file_attributes);
|
||||
|
||||
syscall_printf ("%d = fhandler_base::open (%s, %p)", res, get_win32_name (),
|
||||
|
@ -589,7 +585,7 @@ fhandler_base::open (int flags, mode_t mode)
|
|||
int res = 0;
|
||||
HANDLE x;
|
||||
ULONG file_attributes = 0;
|
||||
ULONG shared = (get_major () == DEV_TAPE_MAJOR ? 0 : wincap.shared ());
|
||||
ULONG shared = (get_major () == DEV_TAPE_MAJOR ? 0 : FILE_SHARE_VALID_FLAGS);
|
||||
ULONG create_disposition;
|
||||
ULONG create_options;
|
||||
SECURITY_ATTRIBUTES sa = sec_none;
|
||||
|
|
|
@ -1511,7 +1511,7 @@ fhandler_disk_file::opendir ()
|
|||
NULL, sa.lpSecurityDescriptor);
|
||||
status = NtOpenFile (&dir->__handle,
|
||||
SYNCHRONIZE | FILE_LIST_DIRECTORY,
|
||||
&attr, &io, wincap.shared (),
|
||||
&attr, &io, FILE_SHARE_VALID_FLAGS,
|
||||
FILE_SYNCHRONOUS_IO_NONALERT
|
||||
| FILE_OPEN_FOR_BACKUP_INTENT
|
||||
| FILE_DIRECTORY_FILE);
|
||||
|
@ -1639,9 +1639,10 @@ readdir_get_ino (DIR *dir, const char *path, bool dot_dot)
|
|||
}
|
||||
else if (!pc.hasgood_inode ())
|
||||
ino = hash_path_name (0, pc);
|
||||
else if ((hdl = CreateFile (pc, GENERIC_READ, wincap.shared (), NULL,
|
||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS,
|
||||
NULL)) != INVALID_HANDLE_VALUE)
|
||||
else if ((hdl = CreateFile (pc, GENERIC_READ, FILE_SHARE_VALID_FLAGS,
|
||||
NULL, OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS, NULL))
|
||||
!= INVALID_HANDLE_VALUE)
|
||||
{
|
||||
ino = readdir_get_ino_by_handle (hdl);
|
||||
CloseHandle (hdl);
|
||||
|
@ -1776,7 +1777,8 @@ go_ahead:
|
|||
InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE,
|
||||
dir->__handle , NULL);
|
||||
if (!NtOpenFile (&hdl, READ_CONTROL, &attr, &io,
|
||||
wincap.shared (), FILE_OPEN_FOR_BACKUP_INTENT))
|
||||
FILE_SHARE_VALID_FLAGS,
|
||||
FILE_OPEN_FOR_BACKUP_INTENT))
|
||||
{
|
||||
de->d_ino = readdir_get_ino_by_handle (hdl);
|
||||
CloseHandle (hdl);
|
||||
|
@ -1849,7 +1851,7 @@ fhandler_disk_file::rewinddir (DIR *dir)
|
|||
InitializeObjectAttributes (&attr, &fname, OBJ_CASE_INSENSITIVE,
|
||||
dir->__handle, NULL);
|
||||
status = NtOpenFile (&new_dir, SYNCHRONIZE | FILE_LIST_DIRECTORY,
|
||||
&attr, &io, wincap.shared (),
|
||||
&attr, &io, FILE_SHARE_VALID_FLAGS,
|
||||
FILE_SYNCHRONOUS_IO_NONALERT
|
||||
| FILE_OPEN_FOR_BACKUP_INTENT
|
||||
| FILE_DIRECTORY_FILE);
|
||||
|
|
|
@ -79,7 +79,8 @@ fhandler_mailslot::open (int flags, mode_t mode)
|
|||
__seterrno ();
|
||||
break;
|
||||
}
|
||||
x = CreateFile (get_win32_name (), GENERIC_READ, wincap.shared (),
|
||||
x = CreateFile (get_win32_name (), GENERIC_READ,
|
||||
FILE_SHARE_VALID_FLAGS,
|
||||
&sec_none, OPEN_EXISTING, 0, 0);
|
||||
#endif
|
||||
if (x == INVALID_HANDLE_VALUE)
|
||||
|
@ -102,7 +103,7 @@ fhandler_mailslot::open (int flags, mode_t mode)
|
|||
set_errno (EPERM); /* As on Linux. */
|
||||
break;
|
||||
}
|
||||
x = CreateFile (get_win32_name (), GENERIC_WRITE, wincap.shared (),
|
||||
x = CreateFile (get_win32_name (), GENERIC_WRITE, FILE_SHARE_VALID_FLAGS,
|
||||
&sec_none, OPEN_EXISTING, 0, 0);
|
||||
if (x == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
|
|
@ -963,7 +963,7 @@ format_proc_partitions (char *destbuf, size_t maxsize)
|
|||
InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE,
|
||||
dirhdl, NULL);
|
||||
status = NtOpenFile (&devhdl, READ_CONTROL | FILE_READ_DATA, &attr, &io,
|
||||
wincap.shared (), 0);
|
||||
FILE_SHARE_VALID_FLAGS, 0);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
/* Retry with READ_CONTROL only for non-privileged users. This
|
||||
|
@ -972,7 +972,7 @@ format_proc_partitions (char *destbuf, size_t maxsize)
|
|||
a non-privileged user shouldn't get read access to the drive
|
||||
layout information. */
|
||||
status = NtOpenFile (&devhdl, READ_CONTROL, &attr, &io,
|
||||
wincap.shared (), 0);
|
||||
FILE_SHARE_VALID_FLAGS, 0);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
debug_printf ("NtOpenFile(%s) %x", devname, status);
|
||||
|
|
|
@ -82,8 +82,9 @@ get_inet_addr (const struct sockaddr *in, int inlen,
|
|||
set_errno (EBADF);
|
||||
return 0;
|
||||
}
|
||||
HANDLE fh = CreateFile (pc, GENERIC_READ, wincap.shared (), &sec_none,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
HANDLE fh = CreateFile (pc, GENERIC_READ, FILE_SHARE_VALID_FLAGS,
|
||||
&sec_none, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
|
||||
0);
|
||||
if (fh == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
__seterrno ();
|
||||
|
|
|
@ -913,7 +913,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
|
|||
the file isn't explicitely opened with EXECUTE access. */
|
||||
HANDLE h = CreateFile (fh->get_win32_name (),
|
||||
fh->get_access () | GENERIC_EXECUTE,
|
||||
wincap.shared (), &sec_none_nih,
|
||||
FILE_SHARE_VALID_FLAGS, &sec_none_nih,
|
||||
OPEN_EXISTING, 0, NULL);
|
||||
if (h != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
|
|
@ -4283,7 +4283,8 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
|
|||
if (wincap.can_open_directories ())
|
||||
{
|
||||
HANDLE h = CreateFile (win32_cwd, FILE_TRAVERSE,
|
||||
wincap.shared (), NULL, OPEN_EXISTING,
|
||||
FILE_SHARE_VALID_FLAGS, NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
|
|
@ -283,7 +283,8 @@ unlink_nt (path_conv &win32_name, bool setattrs)
|
|||
if (status == STATUS_SHARING_VIOLATION)
|
||||
{
|
||||
move_to_bin = true;
|
||||
status = NtOpenFile (&h, DELETE, &attr, &io, wincap.shared (), flags);
|
||||
status = NtOpenFile (&h, DELETE, &attr, &io, FILE_SHARE_VALID_FLAGS,
|
||||
flags);
|
||||
}
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
|
@ -1114,7 +1115,7 @@ EXPORT_ALIAS (fsync, fdatasync)
|
|||
static void
|
||||
sync_worker (const char *vol)
|
||||
{
|
||||
HANDLE fh = CreateFileA (vol, GENERIC_WRITE, wincap.shared (),
|
||||
HANDLE fh = CreateFileA (vol, GENERIC_WRITE, FILE_SHARE_VALID_FLAGS,
|
||||
&sec_none_nih, OPEN_EXISTING, 0, NULL);
|
||||
if (fh != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -1944,7 +1945,7 @@ statvfs (const char *fname, struct statvfs *sfs)
|
|||
{
|
||||
/* Quotas active. We can't trust totalc. */
|
||||
HANDLE hdl = CreateFile (full_path, READ_CONTROL,
|
||||
wincap.shared (), &sec_none_nih,
|
||||
FILE_SHARE_VALID_FLAGS, &sec_none_nih,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
if (hdl == INVALID_HANDLE_VALUE)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* uinfo.cc: user info (uid, gid, etc...)
|
||||
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
2006, 2007 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
|
@ -532,7 +533,7 @@ pwdgrp::load (const char *posix_fname)
|
|||
}
|
||||
else
|
||||
{
|
||||
HANDLE fh = CreateFile (pc, GENERIC_READ, wincap.shared (), NULL,
|
||||
HANDLE fh = CreateFile (pc, GENERIC_READ, FILE_SHARE_VALID_FLAGS, NULL,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
if (fh == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,6 @@ static NO_COPY wincaps wincap_unknown = {
|
|||
lock_file_highword:UINT32_MAX,
|
||||
chunksize:0,
|
||||
heapslop:0x0,
|
||||
shared:FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
is_server:false,
|
||||
access_denied_on_delete:false,
|
||||
has_delete_on_close:true,
|
||||
|
@ -81,7 +80,6 @@ static NO_COPY wincaps wincap_nt4 = {
|
|||
lock_file_highword:UINT32_MAX,
|
||||
chunksize:0,
|
||||
heapslop:0x0,
|
||||
shared:FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
is_server:false,
|
||||
access_denied_on_delete:false,
|
||||
has_delete_on_close:true,
|
||||
|
@ -146,7 +144,6 @@ static NO_COPY wincaps wincap_nt4sp4 = {
|
|||
lock_file_highword:UINT32_MAX,
|
||||
chunksize:0,
|
||||
heapslop:0x0,
|
||||
shared:FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
is_server:false,
|
||||
access_denied_on_delete:false,
|
||||
has_delete_on_close:true,
|
||||
|
@ -211,7 +208,6 @@ static NO_COPY wincaps wincap_2000 = {
|
|||
lock_file_highword:UINT32_MAX,
|
||||
chunksize:0,
|
||||
heapslop:0x0,
|
||||
shared:FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
is_server:false,
|
||||
access_denied_on_delete:false,
|
||||
has_delete_on_close:true,
|
||||
|
@ -276,7 +272,6 @@ static NO_COPY wincaps wincap_xp = {
|
|||
lock_file_highword:UINT32_MAX,
|
||||
chunksize:0,
|
||||
heapslop:0x0,
|
||||
shared:FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
is_server:false,
|
||||
access_denied_on_delete:false,
|
||||
has_delete_on_close:true,
|
||||
|
@ -341,7 +336,6 @@ static NO_COPY wincaps wincap_2003 = {
|
|||
lock_file_highword:UINT32_MAX,
|
||||
chunksize:0,
|
||||
heapslop:0x4,
|
||||
shared:FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
is_server:true,
|
||||
access_denied_on_delete:false,
|
||||
has_delete_on_close:true,
|
||||
|
@ -406,7 +400,6 @@ static NO_COPY wincaps wincap_vista = {
|
|||
lock_file_highword:UINT32_MAX,
|
||||
chunksize:0,
|
||||
heapslop:0x4,
|
||||
shared:FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
is_server:false,
|
||||
access_denied_on_delete:false,
|
||||
has_delete_on_close:true,
|
||||
|
|
|
@ -16,7 +16,6 @@ struct wincaps
|
|||
DWORD lock_file_highword;
|
||||
DWORD chunksize;
|
||||
DWORD heapslop;
|
||||
int shared;
|
||||
unsigned is_server : 1;
|
||||
unsigned access_denied_on_delete : 1;
|
||||
unsigned has_delete_on_close : 1;
|
||||
|
@ -97,7 +96,6 @@ public:
|
|||
DWORD IMPLEMENT (lock_file_highword)
|
||||
DWORD IMPLEMENT (chunksize)
|
||||
DWORD IMPLEMENT (heapslop)
|
||||
int IMPLEMENT (shared)
|
||||
bool IMPLEMENT (is_server)
|
||||
bool IMPLEMENT (access_denied_on_delete)
|
||||
bool IMPLEMENT (has_delete_on_close)
|
||||
|
|
Loading…
Reference in New Issue