How do we pass mmap errors?
I notice we often get mmap errors but din't find a good solution for
it.
Like this....
error: 'MAP_SHARED' undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
error: 'MAP_LOCKED' undeclared (first use in this function)
error: 'MAP_FAILED' undeclared (first use in this function)
I found that Ko wrote a mmap.h and a mmap.os2.c
But how to implanted this, so it works for most programs that need
mmap ??
--
With the best regards from the Netherlands,
Yuri also has a mmap implementation. I got it here,
http://web.os2power.com/download/lib/mmap-20080822-os2.zip.
Unluckily we don't have a full implementation so sometimes just have to
work around it.
There is also an article on writing an implementation on edm2
Dave
Thankz for the url :)
It helps a bit, only get now this error:
memtester.c: In function 'main':
memtester.c:230: error: 'MAP_LOCKED' undeclared (first use in this
function)
memtester.c:230: error: (Each undeclared identifier is reported only
once
memtester.c:230: error: for each function it appears in.)
> > > Hoi,
> > >
> > > How do we pass mmap errors?
> > > I notice we often get mmap errors but din't find a good solution for
> > > it.
> > > Like this....
> > > error: 'MAP_SHARED' undeclared (first use in this function)
> > > error: (Each undeclared identifier is reported only once
> > > error: for each function it appears in.)
> > > error: 'MAP_LOCKED' undeclared (first use in this function)
> > > error: 'MAP_FAILED' undeclared (first use in this function)
> > >
> > > I found that Ko wrote a mmap.h and a mmap.os2.c
> > > But how to implanted this, so it works for most programs that need
> > > mmap ??
> > >
> > >
> >
> > Yuri also has a mmap implementation. I got it here,
> > http://web.os2power.com/download/lib/mmap-20080822-os2.zip.
>
> Just updated with a bugfix:
> http://web.os2power.com/download/lib/mmap-20090727-os2.zip
Yuri's port seems to be missing this function. It is probably not to
important on OS/2 as not much uses memory mapping so it could be
commented out or defined as empty.
Often I have fallen back on using EMX since it did have a good mmap
implementation.
Dave
ps there is some interesting results from searching Google for MAP_LOCKED
> MAP_LOCKED
>
Hi Dave,
I ask Yuri he say try to use this
#define MAP_LOCKED 0
or
#define mlock(a,b)
or
#define munlock(a,b)
But when i use those i get this
Undefined symbol _mlock referenced from text segment
Undefined symbol _mmap referenced from text segment
Undefined symbol _mlock referenced from text segment
Undefined symbol _munlock referenced from text segment
This is the code that gives the error :
buf = (void volatile *) mmap(0, wantbytes, PROT_READ |
PROT_WRITE,
MAP_SHARED | MAP_LOCKED, memfd,
physaddrbase);
Sorry for the delayed reply. Finally needed mmap and refreshed my memory :)
Try make LDFLAGS="-Zomf -lpthread -lmmap"
Dave
Hi Dave,
Thankz this did the trick :P
Also had to add to file:
#define mlock(a,b)
#define munlock(a,b)
Wonder if it would be better to add these to mmap.h? Then they would
always be defined. Not sure how important the locking functions are,
especially on OS/2 though
Dave