At 12:15 AM 6/9/99 +0100, Alan Cox wrote:
>> 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);
>}
this code can't work. this code is for 1 process only.
i want 1 process to create it and a second , third and n-th to
to the same, then
printf("shm_game = %i\n",shmgame);
should give for all processes the same.
>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.
You are running it for 1 process here.
You need to run 1 process, then run a second one attaching,
before OK OK :)
>
>
>
-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]