From: Lionel Sambuc Date: Mon, 19 May 2014 09:18:20 +0000 (+0200) Subject: Message type for {PM,VFS,VM}_GETRUSAGE X-Git-Tag: v3.3.0~238 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/openssl_button.gif?a=commitdiff_plain;h=6c313721d3a20e77239d16459a5fb7586f3b17c8;p=minix.git Message type for {PM,VFS,VM}_GETRUSAGE Change-Id: I793d2e9fa8eb0562a46ccbd81aae3dbb517671cc --- diff --git a/include/minix/com.h b/include/minix/com.h index 36a071375..444db2677 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -1239,11 +1239,6 @@ #define SVRCTL_REQ m2_i1 /* int */ #define SVRCTL_ARG m2_p1 /* void * */ -/* Field names for the getrusage(2) call. */ -#define RU_ENDPT m1_i1 /* endpoint_t */ -#define RU_WHO m1_i1 /* int */ -#define RU_RUSAGE_ADDR m1_p1 /* struct rusage * */ - /*===========================================================================* * Internal codes used by several services * *===========================================================================*/ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 6a961d5c7..21cea5168 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -251,6 +251,14 @@ typedef struct { } mess_lc_pm_reboot; _ASSERT_MSG_SIZE(mess_lc_pm_reboot); +typedef struct { + endpoint_t who; + vir_bytes addr; + + uint8_t padding[48]; +} mess_lc_pm_rusage; +_ASSERT_MSG_SIZE(mess_lc_pm_rusage); + typedef struct { gid_t gid; @@ -529,6 +537,13 @@ typedef struct { } mess_lc_vfs_readwrite; _ASSERT_MSG_SIZE(mess_lc_vfs_readwrite); +typedef struct { + vir_bytes addr; + + uint8_t padding[52]; +} mess_lc_vfs_rusage; +_ASSERT_MSG_SIZE(mess_lc_vfs_rusage); + typedef struct { uint32_t nfds; fd_set *readfds; @@ -588,6 +603,13 @@ typedef struct { } mess_lc_vfs_umount; _ASSERT_MSG_SIZE(mess_lc_vfs_umount); +typedef struct { + vir_bytes addr; + + uint8_t padding[52]; +} mess_lc_vm_rusage; +_ASSERT_MSG_SIZE(mess_lc_vm_rusage); + typedef struct { endpoint_t endpt; vir_bytes ptr; /* struct exec_info * */ @@ -1289,6 +1311,7 @@ typedef struct { mess_lc_pm_priority m_lc_pm_priority; mess_lc_pm_ptrace m_lc_pm_ptrace; mess_lc_pm_reboot m_lc_pm_reboot; + mess_lc_pm_rusage m_lc_pm_rusage; mess_lc_pm_setgid m_lc_pm_setgid; mess_lc_pm_setuid m_lc_pm_setuid; mess_lc_pm_sig m_lc_pm_sig; @@ -1316,6 +1339,7 @@ typedef struct { mess_lc_vfs_pipe2 m_lc_vfs_pipe2; mess_lc_vfs_readlink m_lc_vfs_readlink; mess_lc_vfs_readwrite m_lc_vfs_readwrite; + mess_lc_vfs_rusage m_lc_vfs_rusage; mess_lc_vfs_select m_lc_vfs_select; mess_lc_vfs_stat m_lc_vfs_stat; mess_lc_vfs_statvfs1 m_lc_vfs_statvfs1; @@ -1323,6 +1347,8 @@ typedef struct { mess_lc_vfs_umask m_lc_vfs_umask; mess_lc_vfs_umount m_lc_vfs_umount; + mess_lc_vm_rusage m_lc_vm_rusage; + mess_lexec_pm_exec_new m_lexec_pm_exec_new; mess_li2cdriver_i2c_busc_i2c_exec m_li2cdriver_i2c_busc_i2c_exec; diff --git a/lib/libc/sys-minix/getrusage.c b/lib/libc/sys-minix/getrusage.c index faeb83230..43767e32e 100644 --- a/lib/libc/sys-minix/getrusage.c +++ b/lib/libc/sys-minix/getrusage.c @@ -12,8 +12,8 @@ int getrusage(int who, struct rusage *r_usage) message m; memset(&m, 0, sizeof(m)); - m.RU_WHO = who; - m.RU_RUSAGE_ADDR = (char *) r_usage; + m.m_lc_pm_rusage.who = who; + m.m_lc_pm_rusage.addr = (vir_bytes)r_usage; if (r_usage == NULL) { errno = EFAULT; @@ -29,11 +29,11 @@ int getrusage(int who, struct rusage *r_usage) return rc; memset(&m, 0, sizeof(m)); - m.RU_RUSAGE_ADDR = (char *) r_usage; + m.m_lc_vfs_rusage.addr = (vir_bytes)r_usage; if ((rc = _syscall(VFS_PROC_NR, VFS_GETRUSAGE, &m)) < 0) return rc; memset(&m, 0, sizeof(m)); - m.RU_RUSAGE_ADDR = (char *) r_usage; + m.m_lc_vm_rusage.addr = (vir_bytes)r_usage; return _syscall(VM_PROC_NR, VM_GETRUSAGE, &m); } diff --git a/servers/pm/misc.c b/servers/pm/misc.c index 8649ad639..63de747fb 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -407,12 +407,13 @@ int do_getrusage() clock_t sys_time = 0; struct rusage r_usage; u64_t usec; - if (m_in.RU_WHO != RUSAGE_SELF && m_in.RU_WHO != RUSAGE_CHILDREN) + if (m_in.m_lc_pm_rusage.who != RUSAGE_SELF && + m_in.m_lc_pm_rusage.who != RUSAGE_CHILDREN) return EINVAL; if ((res = sys_getrusage(&r_usage, who_e)) < 0) return res; - if (m_in.RU_WHO == RUSAGE_CHILDREN) { + if (m_in.m_lc_pm_rusage.who == RUSAGE_CHILDREN) { usec = mp->mp_child_utime * 1000000 / sys_hz(); r_usage.ru_utime.tv_sec = usec / 1000000; r_usage.ru_utime.tv_usec = usec % 1000000; @@ -421,6 +422,6 @@ int do_getrusage() r_usage.ru_stime.tv_usec = usec % 1000000; } - return sys_datacopy(SELF, (vir_bytes) &r_usage, who_e, - (vir_bytes) m_in.RU_RUSAGE_ADDR, (vir_bytes) sizeof(r_usage)); + return sys_datacopy(SELF, (vir_bytes)&r_usage, who_e, + m_in.m_lc_pm_rusage.addr, (vir_bytes) sizeof(r_usage)); } diff --git a/servers/vfs/misc.c b/servers/vfs/misc.c index b803d2c45..69dae6507 100644 --- a/servers/vfs/misc.c +++ b/servers/vfs/misc.c @@ -961,7 +961,7 @@ int do_getrusage(void) int res; struct rusage r_usage; - if ((res = sys_datacopy_wrapper(who_e, (vir_bytes) m_in.RU_RUSAGE_ADDR, SELF, + if ((res = sys_datacopy_wrapper(who_e, m_in.m_lc_vfs_rusage.addr, SELF, (vir_bytes) &r_usage, (vir_bytes) sizeof(r_usage))) < 0) return res; @@ -972,5 +972,5 @@ int do_getrusage(void) r_usage.ru_isrss = DEFAULT_STACK_LIMIT; return sys_datacopy_wrapper(SELF, (vir_bytes) &r_usage, who_e, - (vir_bytes) m_in.RU_RUSAGE_ADDR, (phys_bytes) sizeof(r_usage)); + m_in.m_lc_vfs_rusage.addr, (phys_bytes) sizeof(r_usage)); } diff --git a/servers/vm/utility.c b/servers/vm/utility.c index aa00c95ba..936391807 100644 --- a/servers/vm/utility.c +++ b/servers/vm/utility.c @@ -344,7 +344,7 @@ int do_getrusage(message *m) vmp = &vmproc[slot]; - if ((res = sys_datacopy(m->m_source, (vir_bytes) m->RU_RUSAGE_ADDR, + if ((res = sys_datacopy(m->m_source, m->m_lc_vm_rusage.addr, SELF, (vir_bytes) &r_usage, (vir_bytes) sizeof(r_usage))) < 0) return res; @@ -353,5 +353,5 @@ int do_getrusage(message *m) r_usage.ru_majflt = vmp->vm_major_page_fault; return sys_datacopy(SELF, (vir_bytes) &r_usage, m->m_source, - (vir_bytes) m->RU_RUSAGE_ADDR, (vir_bytes) sizeof(r_usage)); + m->m_lc_vm_rusage.addr, (vir_bytes) sizeof(r_usage)); }