diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2007-02-22 14:17:01 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2007-02-22 14:17:01 +0300 |
commit | bd8f891e8ac6ec88bc72cd8c446b6ccba5750821 (patch) | |
tree | 723b2939e16ac792c2e59725551868561a79680d | |
parent | 570858c30fa6add591bf74907de4a7fb93312f20 (diff) |
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.
-rw-r--r-- | winsup/cygwin/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.cc | 10 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 14 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_mailslot.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_proc.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/mmap.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/path.cc | 3 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 7 | ||||
-rw-r--r-- | winsup/cygwin/uinfo.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/wincap.cc | 7 | ||||
-rw-r--r-- | winsup/cygwin/wincap.h | 2 |
12 files changed, 37 insertions, 35 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b326f6e8e..6337ff34b 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,13 @@ 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. diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index c5f727781..ce1e9f7eb 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -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; diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index d68872bec..94a94b8fa 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -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); diff --git a/winsup/cygwin/fhandler_mailslot.cc b/winsup/cygwin/fhandler_mailslot.cc index 133df0414..0748a4807 100644 --- a/winsup/cygwin/fhandler_mailslot.cc +++ b/winsup/cygwin/fhandler_mailslot.cc @@ -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) { diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc index c08befea9..b2cf2caeb 100644 --- a/winsup/cygwin/fhandler_proc.cc +++ b/winsup/cygwin/fhandler_proc.cc @@ -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); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 6b8cd7539..d2ae0cca1 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -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 (); diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index e0154a898..df6ff585f 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -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) { diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 421cc35e9..68431276a 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -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) { diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index c72e2428b..5e2bb5b66 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -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) diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 5fd2117dd..4064bc07c 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -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) { diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index 74e1ec0ea..baa708c7a 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -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, diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h index 82a944207..da046a1e8 100644 --- a/winsup/cygwin/wincap.h +++ b/winsup/cygwin/wincap.h @@ -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) |