> No. it doesn't work for 2.2.x
> NOT FOR MORE THAN 1 PROCESS.
> 
> try the source please before saying it works. 

Credit me with a little bit of intelligence. Not only did I test your
code I also tested reattaches too.


#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>

static void alloc_one(char c)
{
    int shm_game;
    int *partij;
    shm_game = shmget(ftok(".",c),150000000,IPC_CREAT|0777);
    partij = (int *)shmat(shm_game,0,0);
    if( partij == (int *)-1 ) {
      perror("Error allocating Game");
      exit(1);
   }
   printf("OK\n");
}

int main(int argc, char *argv[])
{
        alloc_one('a');
        alloc_one('b');
        exit(0);
}


Run straight off reports invalid arugment for the first allocation as it should

Then when I configure the machine to allow large blocks..

        echo "700000000" >/proc/sys/kernel/shmmax

        ./x1

and it reports

OK
OK

and both memory blocks are created.

Running it again correctly reattaches the existing segments.


-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]

Reply via email to