OpenVZ Forum


Home » Mailing lists » Devel » [RFC PATCH 5/6] IPC/sem: .show operation for /proc/pid/semundo
[RFC PATCH 5/6] IPC/sem: .show operation for /proc/pid/semundo [message #31358] Wed, 25 June 2008 13:49 Go to next message
Nadia Derbey is currently offline  Nadia Derbey
Messages: 114
Registered: January 2008
Senior Member
PATCH [05/06]

This patch introduces the .show seq operation for /proc/pid/semundo.


Signed-off-by: Pierre Peiffer <pierre.peiffer@bull.net>
Signed-off-by: Nadia Derbey <Nadia.Derbey@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@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [RFC PATCH 5/6] IPC/sem: .show operation for /proc/pid/semundo [message #31371 is a reply to message #31358] Wed, 25 June 2008 20:58 Go to previous message
serue is currently offline  serue
Messages: 750
Registered: February 2006
Senior Member
Quoting Nadia.Derbey@bull.net (Nadia.Derbey@bull.net):
> PATCH [05/06]
> 
> This patch introduces the .show seq operation for /proc/pid/semundo.
> 
> 
> Signed-off-by: Pierre Peiffer <pierre.peiffer@bull.net>
> Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>

Acked-by: Serge Hallyn <serue@us.ibm.com>

> ---
>  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@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Previous Topic: [RFC PATCH 1/6] IPC/sem: RCU-protect the process semundo list
Next Topic: [RFC][v2][patch 0/12][CFQ-cgroup]Yet another I/O bandwidth controlling subsystem for CGroups based o
Goto Forum:
  


Current Time: Tue Nov 19 08:33:43 GMT 2024

Total time taken to generate the page: 0.03079 seconds