site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tugraz.at; s=mailrelay; t=1207132397; bh=bIYQLqU9ddMrLmoYF8T1gxg+m6LUETQB19R/p 5S10hA=; h=Cc:Message-Id:From:To:In-Reply-To:Content-Type: Content-Transfer-Encoding:Mime-Version:Subject:Date:References: X-Mailer; b=dvsbZxXK5eFBaq0heQZ76Ihlpue7PCXSk7Dl23tm+1RURtlpRgLUHh aaYaI8EuEfhkv6DnU2y2ZhujMxAAaH7XQtSuimWFkqYhY6mAm5jLs27d5MIxZlGcoy4 Jk2fsQriJqpGTHWSG3AgIMZMU/Y3U5KG8j//mcYgV3aKarZDbU= Hello Terry (and the rest of you), Use standard APIs instead: <http://www.opengroup.org/onlinepubs/009695399/functions/shmctl.html> ? Tim and Christof _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... I sent your notes to the lead programmer of the framework I try to compile and got a reply that I would love to forward to you: SHM_INFO you can emulate by writing code to popen the "ipcs" command. You are better off using ftok(0 to identify a shared memory segment key specifically, rather than trying to figure out the next available one. It's pretty bad that the ipcs code is not available to use the API that this program uses directly. What we are trying to do is enumerate all existing shared memory segment for peeking into them to see if we find our own shared memory segments. SHM_STAT does not appear to be a useful API, since it only returns an array index, and that array index could in no way be useful to you directly, since you can't access the array which is being indexed by the number which would be returned. Wrong. It is helpful for the mentioned enumeration. For IPC_STAT you need a shmem ID, for SHM_STAT you can use the kernel-internal array index and you can get the length of the array with SHM_INFO and thus you can iterate really smoothly over all existing shared memory segments. This code works on FreeBSD as well which makes it especially cumbersome that Apple left this part of useful code out. SHM_LOCK/SHM_UNLOCK are really dangerous, since you are asking that the memory region be wired down. You can ask for this via the standard interfaces mlock() and munlock(). Typically, this is a bad idea. Wiring down physical memory is constrained by administrative limits which can not be bypassed, so if you ask for too much, you will get none. These interfaces work equally well in Linux, and are more portable. True, but there are situation when you need it in a real-time robotics domain were you cannot afford if your critical data section has been swapped away... All I need is the ipcs source or a note on how this program enumerates all existing shared memory segments. This email sent to site_archiver@lists.apple.com
participants (1)
-
Christof Rath