Problems with shmat()

Jan Wielemaker wielemak at serc.nl
Thu Oct 11 23:44:41 AEST 1990


Hi,

I'm trying to attach a shared memory segment at a specific address.
The first time everything is fine, but the second time I want to
attach another shared memory segment at the same address (after
detaching the first) shmat() returns EINVAL.

I want to use this to enlarge a private shared memory segment.
Schematic:

  ....
  id = shmget(IPC_PRIVATE, size, S_IRUSR|S_IWUSR);
  shmat(id, addr, 0);
  shmctl(id, IPC_RMD, NULL);
  ...
  <later>
  ...
  id2 = shmget(IPC_PRIVATE, size2, S_IRUSR||S_IWUSR);
  addr2 = shmat(id2, NULL, 0);
  bcopy(addr, addr2, size);

  shmdt(addr);
  shmdt(addr2);
  shmat(id2, addr, 0); ---> EINVAL
  

This is schematic; in the actual code all calls are checked for their
return value and everything is initialised to sensible values.

I am using Ultrix 3.1C on a DEC-system 5400 (MIPS).

	Please reply by mail (wielemak at serc.nl),
	
	Thanks for any clue you can give me,
	
	Jan



More information about the Comp.unix.ultrix mailing list