re: 2.2 and shmat()

New Message Reply Date view Thread view Subject view Author view

Rob King (king++at++ait.nrl.navy.mil)
Tue, 04 Aug 1998 13:47:09 -0400


pfThanks to SRC for the insightful nudge in the right direction! It
wasn't, per se, a Performer 2.2 problem but here is how we resolved it.

src wrote:
>->Shared memory is allocated by the data process. We attach to it
>->in the render process... or at least we used to. Having recompiled
>->and linked with Performer 2.2, our call to shmat() in our render
>->process as shown below now fails, with errno=ENOMEM.
>->
>->key_t memKey = 0x1234567 // our unique key, unique eh?
>->size_t ttlSize = 0x210000 // big enough for our purposes
>->#define SHM_ADRESS 0x04200000 // the result of some tuning
>
>Are you sure this address is still valid?
>Possibly some DSO is getting loaded in your range from this address now,
>maybe only in your main process where you do the attach.

The 'fix' involved calling shmat in each process with the following snippet:

int ipcArenaId = shmget (memKey, ttlSize, 0);
void *ipcArena = shmat(ipcArenaId, (void *)0, 0);
cout << "base load address is " << hex << ipcArena << endl;

this permitted the system to choose the attachment addresses:
base load address is 0x4000000 <<< data base process
base load address is 0x4280000 <<< render process

taking the larger of the two into our original code:
key_t memKey = 0x1234567 // our unique key, unique eh?
size_t ttlSize = 0x210000 // big enough for our purposes
#define SHM_ADRESS 0x04280000 // the result of some *MORE* tuning
int ipcArenaId = shmget (memKey, ttlSize, 0);
void *ipcArena = (IPCMemArena *) shmat(ipcArenaId, (void *)SHM_ADDRESS, 0);

This permitted our code to work satisfactorily once again.
Thanks 1.0E+06,
--------------------------------------------------------
king++at++ait.nrl.navy.mil http://www.ait.nrl.navy.mil/people/king
On site: (202) 767-6025 Office: (703) 938-2032
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Tue Aug 11 1998 - 13:42:34 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.