Re: mmap on Linux-1.3.35

Michael Weller (eowmob@exp-math.uni-essen.de)
Tue, 24 Oct 1995 12:44:49 +0100 (MEZ)


On Thu, 19 Oct 1995, wrote:

[...]
> 2. I thought Linux now supports functions like mmap/mprotect.
> But I could not get the following test program to work on Linux. I always get address
> 0xFFFFFFFF back. This code works fine on AIX4.1. I am running Linux1.3.35 ELF on a
> 486/DX2 box.
[...]
> memaddr = mmap (addr,len,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);

[...]

I don't have access to my system right now aka no man pages or kernel
source. But I think you have to specify *either* MAP_FILE *or* MAP_ANON.
But you gave none.

Probably mmap set errno to EINVAL just to tell you used wrong parameters.
As you are just mmaping /dev/zero anyway you might be best of just using
MAP_ANON and not opening /dev/zero (and passing 0 as fd) at all.

Hope this helps,

Michael.

(eowmob@exp-math.uni-essen.de or eowmob@pollux.exp-math.uni-essen.de
Please do not use my vm or de0hrz1a accounts anymore. In case of real
problems reaching me try mat42b@aixrs1.hrz.uni-essen.de instead.)