diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2001-09-12 17:46:37 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2001-09-12 17:46:37 +0000 |
commit | ba94682838272afc87b73833c02aaf6cea40815e (patch) | |
tree | 33443e904759c4bb192f674b2e8c30c59641f138 /winsup/cygwin/mmap.cc | |
parent | c88bb51c3ca08f1cf79dd0215ff5f46817267ddb (diff) | |
download | cygnal-ba94682838272afc87b73833c02aaf6cea40815e.tar.gz cygnal-ba94682838272afc87b73833c02aaf6cea40815e.tar.bz2 cygnal-ba94682838272afc87b73833c02aaf6cea40815e.zip |
* Makefile.in: Build wincap.o.
* wincap.cc: New file.
* wincap.h: Ditto.
* autoload.cc: Add dynamic load statement for `CreateHardLinkA'.
* dcrt0.cc (os_being_run): Eliminated.
(osname): Ditto.
(iswinnt): Ditto.
(set_os_type): Ditto.
(dll_crt0_1): Call wincap.init() instead of set_os_type().
(_dll_crt0): Ditto.
* environ.cc (set_chunksize): New function.
(parse_thing): `forkchunk' setting now invokes function `set_chunksize'.
* fork.cc (chunksize): Eliminated. Moved to be member of wincap.
* host_dependent.h: Removed.
* syscalls.cc (_link): Try using `CreateHardLinkA' first, if available.
* cygheap.cc, dcrt0.cc, delqueue.cc, dir.cc,
environ.cc, fhandler.cc, fhandler.h, fhandler_console.cc,
fhandler_mem.cc, fork.cc, mmap.cc, net.cc, pinfo.cc, pinfo.h,
security.cc, syscalls.cc, sysconf.cc, syslog.cc, thread.cc,
times.cc, tty.cc, uinfo.cc, uname.cc, winsup.h: Use new wincap
capability check throughout.
* winsup.h: Include wincap.h. Eliminate extern declarations of
`os_being_run' and `iswinnt'. Eliminate `os_type" definition.
* include/cygwin/version.h: Bump version to 1.3.4.
Diffstat (limited to 'winsup/cygwin/mmap.cc')
-rw-r--r-- | winsup/cygwin/mmap.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 2ac18e9e4..b88deb872 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -83,7 +83,7 @@ class mmap_record /* Allocate one bit per page */ map_map_ = (DWORD *) calloc (MAPSIZE(PAGE_CNT (size_to_map_)), sizeof (DWORD)); - if (iswinnt) + if (wincap.virtual_protect_works_on_shared_pages ()) { DWORD old_prot; if (!VirtualProtect (base_address_, size_to_map_, @@ -144,7 +144,7 @@ mmap_record::map_map (DWORD off, DWORD len) off = find_empty (len); if (off != (DWORD)-1) { - if (iswinnt + if (wincap.virtual_protect_works_on_shared_pages () && !VirtualProtect (base_address_ + off * getpagesize (), len * getpagesize (), prot, &old_prot)) syscall_printf ("-1 = map_map (): %E"); @@ -157,7 +157,7 @@ mmap_record::map_map (DWORD off, DWORD len) } off -= offset_; DWORD start = off / getpagesize (); - if (iswinnt + if (wincap.virtual_protect_works_on_shared_pages () && !VirtualProtect (base_address_ + start * getpagesize (), len * getpagesize (), prot, &old_prot)) syscall_printf ("-1 = map_map (): %E"); @@ -174,7 +174,7 @@ mmap_record::unmap_map (caddr_t addr, DWORD len) DWORD off = addr - base_address_; off /= getpagesize (); len = PAGE_CNT (len); - if (iswinnt + if (wincap.virtual_protect_works_on_shared_pages () && !VirtualProtect (base_address_ + off * getpagesize (), len * getpagesize (), PAGE_NOACCESS, &old_prot)) syscall_printf ("-1 = unmap_map (): %E"); @@ -192,7 +192,7 @@ mmap_record::unmap_map (caddr_t addr, DWORD len) void mmap_record::fixup_map () { - if (!iswinnt) + if (!wincap.virtual_protect_works_on_shared_pages ()) return; DWORD prot, old_prot; @@ -426,7 +426,8 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t off) /* copy-on-write doesn't work correctly on 9x. To have at least read access we use *READ mapping on 9x when appropriate. It will still fail when needing write access, though. */ - if ((flags & MAP_PRIVATE) && (iswinnt || (prot & ~PROT_READ))) + if ((flags & MAP_PRIVATE) && (wincap.has_working_copy_on_write () + || (prot & ~PROT_READ))) access = FILE_MAP_COPY; SetResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); @@ -437,7 +438,7 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t off) * CV: This assumption isn't correct. See Microsoft Platform SDK, Memory, * description of call `MapViewOfFileEx'. */ - if ((!iswinnt) && (flags & MAP_FIXED)) + if ((!wincap.is_winnt ()) && (flags & MAP_FIXED)) { set_errno (EINVAL); syscall_printf ("-1 = mmap(): win95 and MAP_FIXED"); @@ -745,7 +746,7 @@ fhandler_disk_file::mmap (caddr_t *addr, size_t len, DWORD access, /* On 9x/ME try first to open the mapping by name when opening a shared file object. This is needed since 9x/ME only shares objects between processes by name. What a mess... */ - if (!iswinnt + if (wincap.share_mmaps_only_by_name () && get_handle () != INVALID_HANDLE_VALUE && get_device () == FH_DISK && !(access & FILE_MAP_COPY)) |