public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: make check_invalid_virtual_addr a static inline function
@ 2022-08-10 16:13 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2022-08-10 16:13 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=56b7fd620fce86ab86cae2d22985cf7a385e3c5b
commit 56b7fd620fce86ab86cae2d22985cf7a385e3c5b
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Wed Aug 10 18:03:05 2022 +0200
Cygwin: make check_invalid_virtual_addr a static inline function
move it to mm/mmap.cc which uses it exclusively.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/local_includes/miscfuncs.h | 3 ---
winsup/cygwin/miscfuncs.cc | 13 -------------
winsup/cygwin/mm/mmap.cc | 13 +++++++++++++
3 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/winsup/cygwin/local_includes/miscfuncs.h b/winsup/cygwin/local_includes/miscfuncs.h
index fc791c2aa..eac1dbe20 100644
--- a/winsup/cygwin/local_includes/miscfuncs.h
+++ b/winsup/cygwin/local_includes/miscfuncs.h
@@ -101,9 +101,6 @@ PWCHAR transform_chars_af_unix (PWCHAR, const char *, __socklen_t);
/* Get handle count of an object. */
ULONG get_obj_handle_count (HANDLE h);
-/* Memory checking */
-int check_invalid_virtual_addr (const void *s, unsigned sz);
-
ssize_t check_iovec (const struct iovec *, int, bool);
#define check_iovec_for_read(a, b) check_iovec ((a), (b), false)
#define check_iovec_for_write(a, b) check_iovec ((a), (b), true)
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index 1513bc04e..f46e349e5 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -37,19 +37,6 @@ get_obj_handle_count (HANDLE h)
return hdl_cnt;
}
-int
-check_invalid_virtual_addr (const void *s, unsigned sz)
-{
- MEMORY_BASIC_INFORMATION mbuf;
- const void *end;
-
- for (end = (char *) s + sz; s < end;
- s = (char *) mbuf.BaseAddress + mbuf.RegionSize)
- if (!VirtualQuery (s, &mbuf, sizeof mbuf))
- return EINVAL;
- return 0;
-}
-
static char __attribute__ ((noinline))
dummytest (volatile char *p)
{
diff --git a/winsup/cygwin/mm/mmap.cc b/winsup/cygwin/mm/mmap.cc
index 4f383627a..c33342bc3 100644
--- a/winsup/cygwin/mm/mmap.cc
+++ b/winsup/cygwin/mm/mmap.cc
@@ -1112,6 +1112,19 @@ out:
/* munmap () removes all mmapped pages between addr and addr+len. */
+static inline int
+check_invalid_virtual_addr (const void *s, unsigned sz)
+{
+ MEMORY_BASIC_INFORMATION mbuf;
+ const void *end;
+
+ for (end = (char *) s + sz; s < end;
+ s = (char *) mbuf.BaseAddress + mbuf.RegionSize)
+ if (!VirtualQuery (s, &mbuf, sizeof mbuf))
+ return EINVAL;
+ return 0;
+}
+
extern "C" int
munmap (void *addr, size_t len)
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-08-10 16:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-10 16:13 [newlib-cygwin] Cygwin: make check_invalid_virtual_addr a static inline function Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).