Re: [linux-audio-dev] shared memory problems

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] shared memory problems
From: Paul Davis (pbd_AT_Op.Net)
Date: Sun Nov 11 2001 - 21:03:43 EET


>> static char *top_end_of_unmapped_memory = (char *) (1048576 * 1536); /* 1.5G
>B */
>> static char *low_end_of_unmapped_memory = (char *) (1048576 * 1024); /* 1GB
>*/
>>
>> static char *
>> fixed_shmat (int shmid, char *shmaddr, int shmflg, size_t size)
>> {
>> char *addr;
>> char *attempt;
>>
>> if (shmaddr != 0) {
>> return shmat (shmid, shmaddr, shmflg);
>> }
>>
>> attempt = (char *) (top_end_of_unmapped_memory - size);
>>
>> while (attempt > low_end_of_unmapped_memory) {
>> if ((addr = (char *) shmat (shmid, attempt, shmflg|SHM_RND)) !=
> (char *) -1) {
>> top_end_of_unmapped_memory = addr;
>> return addr;
>> }
>> attempt -= size;
>> }
> ^^^^^^^^^^^^
>which will unmap stuff already mapped at the regions you test (no?).

how? it sets top to 1.5GB, then maps at top-size, then moves top down
for each successful mapping.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Sun Nov 11 2001 - 21:05:21 EET