+
+ if (!whole) {
+#ifdef CONFIG_TASK_XACCT
Can't we abstract this into a function for ease?
+ rchar = task->rchar;
+ wchar = task->wchar;
+ syscr = task->syscr;
+ syscw = task->syscw;
+#endif
+ memcpy(&ioac, &task->ioac, sizeof(ioac));
+ } else {
+ rchar = wchar = syscr = syscw = 0;
+ memset(&ioac, 0, sizeof(ioac));
+ rcu_read_lock();
+ if (lock_task_sighand(task, &flags)) {
If lock(), what happens otherwise?
--+ struct signal_struct *sig = task->signal;
+ struct task_struct *t = task;
+
+ do {
+#ifdef CONFIG_TASK_XACCT
+ rchar += t->rchar;
+ wchar += t->wchar;
+ syscr += t->syscr;
+ syscw += t->syscw;
+#endif
+ ioac.read_bytes += t->ioac.read_bytes;
+ ioac.write_bytes += t->ioac.write_bytes;
+ ioac.cancelled_write_bytes +=
+ t->ioac.cancelled_write_bytes;
+ t = next_thread(t);
+ } while (t != task);
+
+#ifdef CONFIG_TASK_XACCT
+ rchar += sig->rchar;
+ wchar += sig->wchar;
+ syscr += sig->syscr;
+ syscw += sig->syscw;
+#endif
+ ioac.read_bytes += sig->ioac.read_bytes;
+ ioac.write_bytes += sig->ioac.write_bytes;
+ ioac.cancelled_write_bytes +=
+ sig->ioac.cancelled_write_bytes;
+
+ unlock_task_sighand(task, &flags);
+ }
+ rcu_read_unlock();
+ }