Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MMap

92 views
Skip to first unread message

Tellerbop

unread,
Jul 27, 2009, 5:17:43 PM7/27/09
to
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 ??


--
With the best regards from the Netherlands,

Dave Yeo

unread,
Jul 27, 2009, 6:30:19 PM7/27/09
to

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

Message has been deleted

Tellerbop

unread,
Jul 28, 2009, 11:24:05 AM7/28/09
to
Hi Allen,


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

Dave Yeo

unread,
Jul 29, 2009, 1:12:09 AM7/29/09
to
On 07/28/09 08:24 am, Tellerbop wrote:
> 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.)
>

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

Tellerbop

unread,
Jul 29, 2009, 4:32:15 PM7/29/09
to
On Wed, 29 Jul 2009 05:12:09 UTC, Dave Yeo <dave....@gmail.com>
wrote:

> 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);

Dave Yeo

unread,
Aug 6, 2009, 11:40:35 PM8/6/09
to

Sorry for the delayed reply. Finally needed mmap and refreshed my memory :)
Try make LDFLAGS="-Zomf -lpthread -lmmap"
Dave

Tellerbop

unread,
Aug 7, 2009, 9:10:45 AM8/7/09
to
On Fri, 7 Aug 2009 03:40:35 UTC, Dave Yeo <dave....@gmail.com>
wrote:

Hi Dave,
Thankz this did the trick :P
Also had to add to file:
#define mlock(a,b)
#define munlock(a,b)

Dave Yeo

unread,
Aug 7, 2009, 8:09:12 PM8/7/09
to
On 08/07/09 06:10 am, Tellerbop wrote:
> 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

0 new messages