[RFC][PATCH 08/11] expose file checkpointability and reasoning in /proc

Dave Hansen
2009-03-05T16:41:50Z

This is the first in a set of things that checked to
ensure that a process or entire container is
able to be checkpointed.

Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com>
---

linux-2.6.git-dave/fs/proc/base.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff -puN fs/proc/base.c~proc-part-of-f_op-conversion fs/proc/base.c
--- linux-2.6.git/fs/proc/base.c~proc-part-of-f_op-conversion 2009-03-05 08:37:03.000000000 -0800
+++ linux-2.6.git-dave/fs/proc/base.c 2009-03-05 08:37:03.000000000 -0800
@@ -80,6 +80,7 @@
#include <linux/oom.h>
#include <linux/elf.h>
#include <linux/pid_namespace.h>
+#include <linux/checkpoint.h>
#include "internal.h"

/* NOTE:
@@ -1645,6 +1646,7 @@ out:

static void proc_fd_write_info(struct file *file, char *info)
{
+ int checkpointable = 0;
int max = PROC_FDINFO_MAX;
int p = 0;
if (!info)
@@ -1652,6 +1654,12 @@ static void proc_fd_write_info(struct fi

p += scnprintf(info+p, max-p, "pos:\t%lli\n", (long long) file->f_pos);
p += scnprintf(info+p, max-p, "flags:\t0%o\n", file->f_flags);
+
+ if (file->f_op->checkpoint)
+ checkpointable = 1;
+ p += scnprintf(info+p, max-p, "checkpointable:\t%d", checkpointable);
+ if (!checkpointable)
+ p += cr_explain_file(file, info+p, max-p);
}

static int proc_fd_info(struct inode *inode, struct path *path, char *info)
_