delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
X-Recipient: | djgpp AT delorie DOT com |
X-Original-DKIM-Signature: | v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; |
s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: | |
mime-version; bh=GWXboaxhz1KnDWujG0fWjF4AXZ8OiykHcYBw1Cj50ms=; b=Yr7ILVfVKNkA | |
rEwqMSDSeoUGl1wwxr9focwe57XZzps5/+sgN+UBeAy3HtzTR5KVIG4Ngewoam/FWGZQI8GOD8Per | |
Xovk1GdJNPn0EkiwQgX7CQITMqVQLbj9pf7Qn0A2xw//taQ7HiDfwlcias1a3+q1yCGSMsnZSZ13t | |
fOIBfQOiKMfHa6F2T4D3vhMIm7T4VkfXkIASdp1YXPuQKMO46/bE3VbagDH433kOYf9NzQCElzZhn | |
d18+728Lg0RTvLng48brT7N4SUCdZJ7YLhsneOd9jBg62MDGhCHDhBNGEaHelBAQvVj4c1+xh/iFW | |
sQ/sfEOsACEN9LMtybKMVw==; | |
Date: | Mon, 22 Apr 2024 08:24:59 +0300 |
Message-Id: | <86jzkq6kb8.fsf@gnu.org> |
From: | "Eli Zaretskii (eliz AT gnu DOT org) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com> |
To: | Pali <pali AT pali DOT im> |
Cc: | djgpp AT delorie DOT com |
In-Reply-To: | <20240421193338.ankqza2y2ukxjtir@pali> (message from Pali on Sun, |
21 Apr 2024 21:33:38 +0200) | |
Subject: | Re: Error handling in __djgpp_map_physical_memory() |
References: | <20240421102444 DOT zjl5mmuhqbmuknhn AT pali> |
<86le567cmf DOT fsf AT gnu DOT org> <20240421193338 DOT ankqza2y2ukxjtir AT pali> | |
Reply-To: | djgpp AT delorie DOT com |
Errors-To: | nobody AT delorie DOT com |
X-Mailing-List: | djgpp AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
> Date: Sun, 21 Apr 2024 21:33:38 +0200 > From: Pali <pali AT pali DOT im> > Cc: djgpp AT delorie DOT com > > > > + /* Base address of the memory handle must be page aligned too. */ > > > + if (d->address & 0xfff) > > > + { > > > + errno = EFAULT; > > > > I think this should be EINVAL. An unaligned address is not really > > "bad address", it's just that it's not valid for this function. > > This is base address of the memory handle found by the DJGPP's > __djgpp_memory_handle function. Not the address passed as input > parameter by caller. So I thought that EFAULT is better there. > > > > + case 0x8023: /* Invalid handle (in ESI) */ > > > + case 0x8025: /* Invalid linear address (specified range is not within specified block or EBX/EDX is not page-aligned) */ > > > + errno = EFAULT; > > > > These two should also be EINVAL, IMO. > > EFAULT errno is mostly returned when the passed pointer is invalid, e.g. > out of the process space. So I thought that EFAULT is better error code > than EINVAL for the case when the DPMI server say that it rejected > linear address. Linear address for this DPMI call is defined by the > handle and offset. > > That is the reason why I chose these errno codes. Maybe we should first agree what is "bad address", then? To me, it means address that is outside of the program's address space, or something that cannot be an address at all. That's not what happens here. > Anyway, I used exactly same errno codes as in merged change for the > __djgpp_set_page_attributes function. And I think that these two > functions should use same errno codes for common errors. So in case you > think that there should be EINVAL (and not EFAULT) then it should be > changed for both functions. If agree about the above, then yes, they both should be modified.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |