Re: SysV Shared Memory Problems
Hi Alec, I've had a play with shmget out of interest - boring Sunday! ;-) I do not have any problem with allocating a shared memory area larger than 1024B. The only time I got an error back from shmget was as so, * I used my test program to create a 4*1024 block to both write to that area and - with a different process - read. No probs. * I then wanted to see how big I could make it, so changed the size to 512 *1024. * At this point I received an error, 'shmget failed: Invalid argument'. * What I did *NOT* do was change the key - it was just '1'. If I then changed the key to something obvious like '2' I could allocate the 512*1024 memory block successfully. Could this possibly be your problem...? You have initially created a 1024 byte block under key 'X'. Calling your program again with the same size block size and a key of 'X' gives no trouble as the system merely returns the same block. Attempting to create any other sized block with the same key is invalid and so the system does not return the block you had previously created but instead gives you your error? So a change of key may help you? I suppose I should be destroying my shared block and may not then see the above. Shall see how to do that... regards, aid On 25 Apr 2004, at 05:53, Alec Ellsworth wrote: Hi All, I'm trying to port one of my apps from FreeBSD to OSX and am having a problem during runtime. This app is a processor emulator for a proprietary architecture and uses SysV shared memory for IPC. On FreeBSD 4 and 5 (with SysV shared memory turned on) I don't have a problem allocating large amounts of shared space, but under OSX I'm getting a -1 returned if I try to allocate more than 1024 _bytes_! Here's the code line that returns false: id=shmget(key,kreq*1024, 0777 | IPC_CREAT); Any time kreq>1, it fails. I've made sure I'm set up for larger spaces via sysctl, but I must be missing something. My app only allocates the block once and there is no other shm activity before this point.
From sysctl -a:
kern.sysv.shmmax: 167772160 kern.sysv.shmmin: 1 kern.sysv.shmmni: 32 kern.sysv.shmseg: 8 kern.sysv.shmall: 65536 Thanks for any input. So far I absolutely love working in Xcode! -Alec Ellsworth Alec Ellsworth Resilient Networks, LLC. 3701 W. Burnham Street Suite A Milwaukee, WI 53215 alec@resilientnets.net _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored. _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.
participants (1)
-
Adrian Bool