Implement getrusage

Implement getrusage.
These fields of struct rusage are not supported and always set to zero at this time
long ru_nswap;           /* swaps */
long ru_inblock;         /* block input operations */
long ru_oublock;         /* block output operations */
long ru_msgsnd;          /* messages sent */
long ru_msgrcv;          /* messages received */
long ru_nvcsw;           /* voluntary context switches */
long ru_nivcsw;          /* involuntary context switches */

test75.c is the unit test for this new function

Change-Id: I3f1eb69de1fce90d087d76773b09021fc6106539
This commit is contained in:
Xiaoguang Sun
2013-06-25 20:41:01 +08:00
committed by Gerrit Code Review
parent 4241cc5d98
commit 64f10ee644
41 changed files with 403 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
#define NCALLS 118 /* number of system calls allowed */
#define NCALLS 124 /* number of system calls allowed */
/* In case it isn't obvious enough: this list is sorted numerically. */
#define EXIT 1
@@ -113,3 +113,4 @@
* really a standalone call.
*/
#define MAPDRIVER 122 /* to VFS, map a device */
#define GETRUSAGE 123 /* to PM, VFS */

View File

@@ -473,6 +473,7 @@
# define GET_IDLETSC 21 /* get cumulative idle time stamp counter */
# define GET_CPUINFO 23 /* get information about cpus */
# define GET_REGS 24 /* get general process registers */
# define GET_RUSAGE 25 /* get resource usage */
#define I_ENDPT m7_i4 /* calling process (may only be SELF) */
#define I_VAL_PTR m7_p1 /* virtual address at caller */
#define I_VAL_LEN m7_i1 /* max length of value */
@@ -1078,8 +1079,10 @@
#define VM_VFS_MMAP (VM_RQ_BASE+46)
#define VM_GETRUSAGE (VM_RQ_BASE+47)
/* Total. */
#define NR_VM_CALLS 47
#define NR_VM_CALLS 48
#define VM_CALL_MASK_SIZE BITMAP_CHUNKS(NR_VM_CALLS)
/* not handled as a normal VM call, thus at the end of the reserved rage */
@@ -1294,4 +1297,9 @@
# define BDEV_NOFLAGS 0x00 /* no flags are set */
# define BDEV_FORCEWRITE 0x01 /* force write to disk immediately */
/* Field names for GETRUSAGE related calls */
#define RU_ENDPT m1_i1 /* indicates a process for sys_getrusage */
#define RU_WHO m1_i1 /* who argument in getrusage call */
#define RU_RUSAGE_ADDR m1_p1 /* pointer to struct rusage */
/* _MINIX_COM_H */

View File

@@ -17,6 +17,7 @@
/* Forward declaration */
struct reg86u;
struct rs_pci;
struct rusage;
#define SYSTASK SYSTEM
@@ -178,6 +179,7 @@ int send_taskreply(endpoint_t who, endpoint_t endpoint, int status);
#define sys_getpriv(dst, nr) sys_getinfo(GET_PRIV, dst, 0,0, nr)
#define sys_getidletsc(dst) sys_getinfo(GET_IDLETSC, dst, 0,0,0)
#define sys_getregs(dst,nr) sys_getinfo(GET_REGS, dst, 0,0, nr)
#define sys_getrusage(dst, nr) sys_getinfo(GET_RUSAGE, dst, 0,0, nr)
int sys_getinfo(int request, void *val_ptr, int val_len, void *val_ptr2,
int val_len2);
int sys_whoami(endpoint_t *ep, char *name, int namelen, int