[Devel] [RFC PATCH 5/6] IPC/sem: .show operation for /proc/pid/semundo
Nadia.Derbey at bull.net
Nadia.Derbey at bull.net
Wed Jun 25 06:49:15 PDT 2008
PATCH [05/06]
This patch introduces the .show seq operation for /proc/pid/semundo.
Signed-off-by: Pierre Peiffer <pierre.peiffer at bull.net>
Signed-off-by: Nadia Derbey <Nadia.Derbey at bull.net>
---
ipc/sem.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
Index: linux-2.6.26-rc5-mm3/ipc/sem.c
===================================================================
--- linux-2.6.26-rc5-mm3.orig/ipc/sem.c 2008-06-24 12:54:40.000000000 +0200
+++ linux-2.6.26-rc5-mm3/ipc/sem.c 2008-06-24 12:59:15.000000000 +0200
@@ -1475,6 +1475,34 @@ static void semundo_stop(struct seq_file
static int semundo_show(struct seq_file *m, void *v)
{
+ struct undo_list_data *data = m->private;
+ struct ipc_namespace *ns = data->ipc_ns;
+ struct sem_undo *u = v;
+ int nsems, i;
+ struct sem_array *sma;
+
+ /*
+ * This semid has been deleted, ignore it.
+ * Even if we skipped all sem_undo belonging to deleted semid
+ * in semundo_next(), some more deletions may have happened.
+ */
+ if (u->semid == -1)
+ return 0;
+
+ seq_printf(m, "%10d", u->semid);
+
+ sma = sem_lock(ns, u->semid);
+ if (IS_ERR(sma))
+ goto out;
+
+ nsems = sma->sem_nsems;
+ sem_unlock(sma);
+
+ for (i = 0; i < nsems; i++)
+ seq_printf(m, " %6d", u->semadj[i]);
+
+out:
+ seq_putc(m, '\n');
return 0;
}
--
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list