python-linux-procfs: Add some functions for affinity from tuna

Add cannot_set_affinity and cannot_set_thread_affinity from tuna

Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
diff --git a/procfs/procfs.py b/procfs/procfs.py
index f97668c..c70fe2a 100755
--- a/procfs/procfs.py
+++ b/procfs/procfs.py
@@ -210,6 +210,22 @@
 
 		return sflags
 
+def cannot_set_affinity(self, pid):
+                PF_NO_SETAFFINITY = 0x04000000
+                try:
+                        return int(self.processes[pid]["stat"]["flags"]) & \
+                                PF_NO_SETAFFINITY and True or False
+                except:
+                        return True
+
+def cannot_set_thread_affinity(self, pid, tid):
+                PF_NO_SETAFFINITY = 0x04000000
+                try:
+                        return int(self.processes[pid].threads[tid]["stat"]["flags"]) & \
+                                PF_NO_SETAFFINITY and True or False
+                except:
+                        return True
+
 class pidstatus:
 	"""
 	Provides a dictionary to access the fields in the per process /proc/PID/status