Exemplo n.º 1
0
asmlinkage long sys_vperfctr_control(int fd,
				     const struct vperfctr_control __user *argp,
				     unsigned int argbytes)
{
	struct vperfctr *perfctr;
	struct task_struct *tsk;
	int ret;

	perfctr = fd_get_vperfctr(fd);
	if (IS_ERR(perfctr)) {
		printk ("sys_vperfctr_control(): fd: %d, perfctr == NULL\n", fd);
		return PTR_ERR(perfctr);
	}
	tsk = vperfctr_get_tsk(perfctr);
	if (IS_ERR(tsk)) {
		ret = PTR_ERR(tsk);
		goto out;
	}

	// About the arguments:
	// perfctr: kernel-level 'struct vperfctr'
	// argp: pointer to a user level 'struct vperfctr_control'
    // argp: sizeof(struct vperfctr_control)
	// tsk, the task_struct associated with 'perfctr'

	ret = do_vperfctr_control(perfctr, argp, argbytes, tsk);
	vperfctr_put_tsk(tsk);
 out:
	put_vperfctr(perfctr);
	return ret;
}
Exemplo n.º 2
0
asmlinkage long sys_vperfctr_control(unsigned int cmd)
{
	struct vperfctr *perfctr;
	struct task_struct *tsk;
	int ret;

	tsk = current;
	if (IS_ERR(tsk)) {
		printk(KERN_INFO __FILE__ "vperfctr control: tsk is empty\n");
		return PTR_ERR(tsk);
	}

	perfctr = tsk->arch.thread.perfctr;

	if (IS_ERR(perfctr)) {
		printk(KERN_INFO __FILE__ "vperfctr control: perfct is empty\n");
		return PTR_ERR(perfctr);
	}

	ret = do_vperfctr_control(perfctr, cmd, tsk);
	return ret;
}