5749 retval = -ESRCH;
5750 read_lock(&tasklist_lock);
5751 p = find_process_by_pid(pid);
5752 if (!p)
5753 goto out_unlock;
5754
5755 retval = security_task_getscheduler(p);
5756 if (retval)
5757 goto out_unlock;
5758
5759
5760
5761
5762
5763 time_slice = 0;
5764 if (p->policy == SCHED_RR) {
5765 time_slice = DEF_TIMESLICE;
5766 } else if (p->policy != SCHED_FIFO) {
5767 struct sched_entity *se = &p->se;
5768 unsigned long flags;
5769 struct rq *rq;
5770
5771 rq = task_rq_lock(p, &flags);
5772 if (rq->cfs.load.weight)
5773 time_slice = NS_TO_JIFFIES(sched_slice(&rq->cfs, se));
5774 task_rq_unlock(rq, &flags);
5775 }
5776 read_unlock(&tasklist_lock);
5777 jiffies_to_timespec(time_slice, &t);
5778 retval = copy_to_user(interval, &t, sizeof(t)) ? -EFAULT : 0;
5779 return retval;
5780
5781out_unlock:
5782 read_unlock(&tasklist_lock);
5783 return retval;
5784}
5785
5786static const char stat_nam[] = TASK_STATE_TO_CHAR_STR;
5787
5788void sched_show_task(struct task_struct *p)
5789{