Problem with access to shared memory

Mark Warren mwarren at rws1.ma30.bull.com
Fri May 31 22:23:32 AEST 1991


In Mips RISC/os 4.52, I have a program which allocates shared memory regions,
and would like to have the regions attached RDONLY sometimes, and READ-WRITE
at other times.  Essentially, it does:

	id = shmget(key, size, (IPC_CREAT | 0600));
	addr = shmat(shmid, 0, 0);
	strcpy(addr, "some stuff");
	shmdt(addr);
	addr = shmat(shmid, 0, SHM_RDONLY);
	strcpy(addr, "some other stuff");

I expect the second strcpy to fail with a SIGSEGV or SIGBUS, but instead
it succeeds.  What am I doing wrong?
--

 == Mark Warren                      Bull HN Information Systems Inc. ==
 == (508) 294-3171 (FAX 294-3020)    300 Concord Road     MS836A      ==
 == M.Warren at bull.com                Billerica, MA 01821              ==



More information about the Comp.unix.questions mailing list