static int uid_stat_show(struct seq_file *m, void *v)
{
struct uid_entry *uid_entry;
- struct task_struct *task;
+ struct task_struct *task, *temp;
cputime_t utime;
cputime_t stime;
unsigned long bkt;
}
read_lock(&tasklist_lock);
- for_each_process(task) {
+ do_each_thread(temp, task) {
uid_entry = find_or_register_uid(from_kuid_munged(
current_user_ns(), task_uid(task)));
if (!uid_entry) {
task_cputime_adjusted(task, &utime, &stime);
uid_entry->active_utime += utime;
uid_entry->active_stime += stime;
- }
+ } while_each_thread(temp, task);
read_unlock(&tasklist_lock);
hash_for_each(hash_table, bkt, uid_entry, hash) {
uid_entry->active_utime;
cputime_t total_stime = uid_entry->stime +
uid_entry->active_stime;
- seq_printf(m, "%d: %u %u\n", uid_entry->uid,
- cputime_to_usecs(total_utime),
- cputime_to_usecs(total_stime));
+ seq_printf(m, "%d: %llu %llu\n", uid_entry->uid,
+ (unsigned long long)jiffies_to_msecs(
+ cputime_to_jiffies(total_utime)) * USEC_PER_MSEC,
+ (unsigned long long)jiffies_to_msecs(
+ cputime_to_jiffies(total_stime)) * USEC_PER_MSEC);
}
mutex_unlock(&uid_lock);
kstrtol(end_uid, 10, &uid_end) != 0) {
return -EINVAL;
}
-
mutex_lock(&uid_lock);
for (; uid_start <= uid_end; uid_start++) {
hash_for_each_possible_safe(hash_table, uid_entry, tmp,
- hash, uid_start) {
- hash_del(&uid_entry->hash);
- kfree(uid_entry);
+ hash, (uid_t)uid_start) {
+ if (uid_start == uid_entry->uid) {
+ hash_del(&uid_entry->hash);
+ kfree(uid_entry);
+ }
}
}
proc_create_data("remove_uid_range", S_IWUGO, parent, &uid_remove_fops,
NULL);
- proc_create_data("show_uid_stat", S_IWUGO, parent, &uid_stat_fops,
+ proc_create_data("show_uid_stat", S_IRUGO, parent, &uid_stat_fops,
NULL);
profile_event_register(PROFILE_TASK_EXIT, &process_notifier_block);