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>
+ 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.
* autoload.cc: Remove all symbols from advapi32.dll, kernel32.dll and
ntdll.dll available on all platforms since NT4.
int res = 0;
HANDLE x;
int file_attributes;
- int shared;
int creation_distribution;
SECURITY_ATTRIBUTES sa = sec_none;
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;
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)
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 (),
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;
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);
}
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);
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);
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);
__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)
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)
{
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
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);
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 ();
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)
{
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)
{
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))
{
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)
{
{
/* 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)
/* 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.
}
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)
{
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,
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,
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,
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,
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,
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,
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,
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;
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)