mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kamran Karimi" <kamrankarimi@hotmail.com>
To: linux-kernel@vger.kernel.org
Subject: How to find all the tasks with a Sys V shm?
Date: Tue, 07 Mar 2006 12:41:21 -0600	[thread overview]
Message-ID: <BAY104-F1181301637BB5A23C2C731C0EE0@phx.gbl> (raw)

Hello all,

In 2.2 kernels one could access the vma segments of a Sys V shared memory 
(shm) through:
shp->attaches. In 2.6 kernels a shm is managed through a file. The question 
is: given a Sys V  key value, how can we find all the tasks that have 
attached the corresponding shm?

We can do the following (with error checking ignored):

    id = ipc_findkey(&shm_ids, key);
    shp = shm_lock(id);

    tsk = find_task_by_pid(shp->shm_cprid);

    vma = tsk->mm->mmap;
    while(vma) {
                 if(vma->vm_file == shp->shm_file)
                  break;
                 vma = vma->vm_next;
    }
    shm_unlock(shp);

But here we only get the vma of the task that created the shm, and not any 
other task who has attached it.

How can we find all the vma structures that represent a shm?

-Kamran



             reply	other threads:[~2006-03-07 18:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-07 18:41 Kamran Karimi [this message]
2006-03-07 21:14 ` Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY104-F1181301637BB5A23C2C731C0EE0@phx.gbl \
    --to=kamrankarimi@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®