This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: check_iovec cleanup
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin-developers at cygwin dot com
- Date: Thu, 27 Jul 2006 22:29:34 +0200
- Subject: Re: check_iovec cleanup
- References: <Pine.CYG.4.58.0607261730550.2352@PC1163-8460-XP.flightsafety.com> <20060726232029.GB5680@trixie.casa.cgf.cx> <Pine.CYG.4.58.0607261823240.1740@PC1163-8460-XP.flightsafety.com> <20060727001959.GA9442@trixie.casa.cgf.cx> <Pine.CYG.4.58.0607262117030.3760@PC1163-8460-XP.flightsafety.com>
- Reply-to: cygwin-developers at cygwin dot com
On Jul 26 21:36, Brian Ford wrote:
> Ok, patch withdrawn to avoid arguing over a not very important change.
>
> I've moved the discussion to cygwin-developers because I had a few more
> questions. If anyone feels kind enough to educate me, I'd appreciate it.
>
> On Wed, 26 Jul 2006, Christopher Faylor wrote:
> > On Wed, Jul 26, 2006 at 07:15:43PM -0500, Brian Ford wrote:
> > >Doesn't it need to check a byte on every system page to be complete
> > >(because buffers could start in or span across invalid/protected
> > >virtual addresses)?
>
> This is still valid, right? I know it is a fairly corner case.
Yes it is valid, and a corner case as long as MAP_NORESERVE doesn't come
into play.
I assume you're working towards getting MAP_NORESERVE for all read/write
cases? If we implement the EFAULT stuff in all read/write cases, it
might actually be possible to do without this test in check_iovec.
However, it would also be nice if the test as you implemented in
fhandler_base::raw_read is not just duplicated to all other cases, but
instead we could get a more generalized method like a wrapper macro,
inline function, whatever, which encapsulate most of the
mmap_is_attached_or_noreserve handling. For instance a macro like this:
#define _MMWRAP(__ptr, __len, __func) \
({ \
BOOL __res = __func; \
for (int i = 0; i < 2; i++) \
{ \
if ((__res = __func)) \
break; \
if (ERROR_NOACCESS && i == 0) \
switch (mmap_is_attached_or_noreserve (__ptr, __len)) \
[...]
} \
__res; \
})
[...]
fhandler_base::raw_read()
{
BOOL res = _MMWRAP (ptr, len,
ReadFile (get_handle (), ptr, len, (DWORD *) &ulen, 0));
}
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat