Trouble with shmget (he

Steve Upp supp at tank.uchicago.edu
Thu Sep 7 07:17:16 AEST 1989


I need some help trying to get shmget to work on a Sun 3/60 running SunOS
4.0.3.  This same program runs just fine on a Sun 3/50 running SunOS 3.5.
I don't see any difference in the documentation between the two systems,
however something has changed.

I get the following as an error message:

$ a.out
shmget failed: Invalid argument

If you have any ideas I'd appreciate hearing from you.

Thanks for your help!

Steve Upp				InterNet:	supp at tank.uchicago.edu
University of Chicago			
Computing Organizations      	        

*--------------------------------- cut here ---------------------------------
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>
#include <stdio.h>


main ()
{
	int shmid, shmflag, size;
	key_t key;

	key 	= IPC_PRIVATE;
 	shmflag = IPC_CREAT | 0400 | 0200;
 	size 	= sizeof(int);

	if((shmid = shmget(key, size, shmflag)) < 0)
	{
		perror("shmget failed");
		exit(1);
	}
	printf("shmget successful\n");
}



More information about the Comp.sys.sun mailing list