All pastes #342071 Raw Edit

Stuff

public text v1 · immutable
·published 2007-02-06 02:05 UTC
rendered paste body
getrusagepid.c:
#include <linux/getrusagepid.h>

asmlinkage int sys_getrusagepid (int pid) {
      struct task_struct *ts = find_task_by_pid(pid);

      if (ts == NULL) {
        return -1;
      }

      int who = RUSAGE_SELF;
      struct rusage r;
      int a = getrusage(ts,who,&r);
      a++;

      return 1;
}

Errors:
getrusagepid.c: In function `sys_getrusagepid':
getrusagepid.c:10: parse error before `int'
getrusagepid.c:13: `a' undeclared (first use in this function)

gerusagepid.h:

#ifndef __LINUX_GETRUSAGEPID_H
#define __LINUX_GETRUSAGEPID_H

#include <linux/linkage.h>

#endif

#ifndef _LINUX_SCHED_H
#include <linux/sched.h>
#endif


#ifndef _LINUX_RESOURCE_H
#include <sys/resource.h>
#endif