Re: Listing System V Semaphores on Tiger
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com -- Terry On Mar 26, 2008, at 6:31 AM, Ray Ruvinskiy <rruvinsk@sybase.com> wrote: Thanks Terry. Thanks, Ray On 25-Mar-08, at 4:35 PM, Terry Lambert wrote: -- Terry _______________________________________________ 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/tlambert%40apple.com _______________________________________________ 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... Yes, ioctl works fine. You just have to know the I'd, which you can not know from ipcs. There are plenty of Luther ways to know it though. The most common is to use ftok() on a known file to generate a key, which will deterministically generate the same key each time. Typically, programs which expect to crash will attempt to remove their resources (ignoring errors, if they do not exist) prior to allocating them, so that they will always be successful allocating them. Use of an ftok() key guarantees they will be trying to remove/create the right key each time, and buys them a means of rendezvous with other programs, which an also know the file name (typically, you pick the binary that creates the semaphore set/message queue/shared segment, or one of its well known data files). Another method is "not crashing", of course, but if it's not your program, that might not be under your control. Absolute worst case, it's possible to write an suid root program and grovel around in /dev/kmem to get the information, if you can't remember what you told the kernel to use as a key when the semaphore set was created. If you use that method, you are pretty much on your own, since there's no way to do it portable that can be guaranteed to work on arbitrary releases. On Tiger, is there a way to clean up System V semaphores that may have been left behind by processes that have gone away, possibly by writing code? On Mar 25, 2008, at 6:40 AM, Ray Ruvinskiy wrote: I seem to be unable to get a list of currently existing System V semaphores on Tiger using the ipcs utility. The list is always empty, whether or not I run the command as root. On Leopard, however, ipcs works as expected. Is this a known issue, or is there something I'm missing? The kernel support for the ipcs code and the structure changes necessary in the contract between kernel and user space was considered to risky to put in Tiger, so Tiger does not support it. This email sent to tlambert@apple.com This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert