linux/kernel/taskstats.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * taskstats.c - Export per-task statistics to userland
 *
 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
 *           (C) Balbir Singh,   IBM Corp. 2006
 */

#include <linux/kernel.h>
#include <linux/taskstats_kern.h>
#include <linux/tsacct_kern.h>
#include <linux/acct.h>
#include <linux/delayacct.h>
#include <linux/cpumask.h>
#include <linux/percpu.h>
#include <linux/slab.h>
#include <linux/cgroupstats.h>
#include <linux/cgroup.h>
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/pid_namespace.h>
#include <net/genetlink.h>
#include <linux/atomic.h>
#include <linux/sched/cputime.h>

/*
 * Maximum length of a cpumask that can be specified in
 * the TASKSTATS_CMD_ATTR_REGISTER/DEREGISTER_CPUMASK attribute
 */
#define TASKSTATS_CPUMASK_MAXLEN

static DEFINE_PER_CPU(__u32, taskstats_seqnum);
static int family_registered;
struct kmem_cache *taskstats_cache;

static struct genl_family family;

static const struct nla_policy taskstats_cmd_get_policy[] =;

static const struct nla_policy cgroupstats_cmd_get_policy[] =;

struct listener {};

struct listener_list {};
static DEFINE_PER_CPU(struct listener_list, listener_array);

enum actions {};

static int prepare_reply(struct genl_info *info, u8 cmd, struct sk_buff **skbp,
				size_t size)
{}

/*
 * Send taskstats data in @skb to listener with nl_pid @pid
 */
static int send_reply(struct sk_buff *skb, struct genl_info *info)
{}

/*
 * Send taskstats data in @skb to listeners registered for @cpu's exit data
 */
static void send_cpu_listeners(struct sk_buff *skb,
					struct listener_list *listeners)
{}

static void exe_add_tsk(struct taskstats *stats, struct task_struct *tsk)
{}

static void fill_stats(struct user_namespace *user_ns,
		       struct pid_namespace *pid_ns,
		       struct task_struct *tsk, struct taskstats *stats)
{}

static int fill_stats_for_pid(pid_t pid, struct taskstats *stats)
{}

static int fill_stats_for_tgid(pid_t tgid, struct taskstats *stats)
{}

static void fill_tgid_exit(struct task_struct *tsk)
{}

static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd)
{}

static int parse(struct nlattr *na, struct cpumask *mask)
{}

static struct taskstats *mk_reply(struct sk_buff *skb, int type, u32 pid)
{}

static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
{}

static int cmd_attr_register_cpumask(struct genl_info *info)
{}

static int cmd_attr_deregister_cpumask(struct genl_info *info)
{}

static size_t taskstats_packet_size(void)
{}

static int cmd_attr_pid(struct genl_info *info)
{}

static int cmd_attr_tgid(struct genl_info *info)
{}

static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
{}

static struct taskstats *taskstats_tgid_alloc(struct task_struct *tsk)
{}

/* Send pid data out on exit */
void taskstats_exit(struct task_struct *tsk, int group_dead)
{}

static const struct genl_ops taskstats_ops[] =;

static struct genl_family family __ro_after_init =;

/* Needed early in initialization */
void __init taskstats_init_early(void)
{}

static int __init taskstats_init(void)
{}

/*
 * late initcall ensures initialization of statistics collection
 * mechanisms precedes initialization of the taskstats interface
 */
late_initcall(taskstats_init);