From 0f8e20a12ce891f0ea230592ef663a200f7166ca Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Sun, 27 Sep 2015 15:00:19 +0000 Subject: [PATCH] getrusage(2): zero out ru_nsignals field The current value was both wrong (counting spawned kernel signals rather than delivered user signals) and returned for the calling process even if the request was for the process's children. For now we are better off not populating this field at all. Change-Id: I6c660be266b5746b7c3db57ae88fa7f872961ee2 --- minix/kernel/proc.c | 5 ----- minix/kernel/proc.h | 2 -- minix/kernel/proto.h | 1 - minix/kernel/system.c | 2 -- minix/kernel/system/do_fork.c | 1 - minix/kernel/system/do_getinfo.c | 1 - minix/usr.bin/trace/service/pm.c | 2 -- 7 files changed, 14 deletions(-) diff --git a/minix/kernel/proc.c b/minix/kernel/proc.c index 57864dbe6..7076023cd 100644 --- a/minix/kernel/proc.c +++ b/minix/kernel/proc.c @@ -1983,8 +1983,3 @@ void ser_dump_proc() print_proc_recursive(pp); } } - -void increase_proc_signals(struct proc *p) -{ - p->p_signal_received++; -} diff --git a/minix/kernel/proc.h b/minix/kernel/proc.h index 3b80630d6..75cb0517c 100644 --- a/minix/kernel/proc.h +++ b/minix/kernel/proc.h @@ -126,8 +126,6 @@ struct proc { */ struct { reg_t r1, r2, r3; } p_defer; - u64_t p_signal_received; - #if DEBUG_TRACE int p_schedules; #endif diff --git a/minix/kernel/proto.h b/minix/kernel/proto.h index 08129f418..a0b8dee0b 100644 --- a/minix/kernel/proto.h +++ b/minix/kernel/proto.h @@ -83,7 +83,6 @@ int isokendpt_f(endpoint_t e, int *p, int f); #endif void proc_no_time(struct proc *p); void reset_proc_accounting(struct proc *p); -void increase_proc_signals(struct proc *p); void flag_account(struct proc *p, int flag); int try_deliver_senda(struct proc *caller_ptr, asynmsg_t *table, size_t size); diff --git a/minix/kernel/system.c b/minix/kernel/system.c index 08bc24a3a..78724262e 100644 --- a/minix/kernel/system.c +++ b/minix/kernel/system.c @@ -378,7 +378,6 @@ int send_sig(endpoint_t ep, int sig_nr) priv = priv(rp); if(!priv) return ENOENT; sigaddset(&priv->s_sig_pending, sig_nr); - increase_proc_signals(rp); mini_notify(proc_addr(SYSTEM), rp->p_endpoint); return OK; @@ -443,7 +442,6 @@ int sig_nr; /* signal to be sent */ /* Check if the signal is already pending. Process it otherwise. */ if (!s) { sigaddset(&rp->p_pending, sig_nr); - increase_proc_signals(rp); if (! (RTS_ISSET(rp, RTS_SIGNALED))) { /* other pending */ RTS_SET(rp, RTS_SIGNALED | RTS_SIG_PENDING); if(OK != send_sig(sig_mgr, SIGKSIG)) diff --git a/minix/kernel/system/do_fork.c b/minix/kernel/system/do_fork.c index 3873a2a2c..76324a00b 100644 --- a/minix/kernel/system/do_fork.c +++ b/minix/kernel/system/do_fork.c @@ -94,7 +94,6 @@ int do_fork(struct proc * caller, message * m_ptr) rpc->p_cycles = 0; rpc->p_kcall_cycles = 0; rpc->p_kipc_cycles = 0; - rpc->p_signal_received = 0; /* If the parent is a privileged process, take away the privileges from the * child process and inhibit it from running by setting the NO_PRIV flag. diff --git a/minix/kernel/system/do_getinfo.c b/minix/kernel/system/do_getinfo.c index e47b28c1e..85e81d062 100644 --- a/minix/kernel/system/do_getinfo.c +++ b/minix/kernel/system/do_getinfo.c @@ -211,7 +211,6 @@ int do_getinfo(struct proc * caller, message * m_ptr) usec = target->p_sys_time * 1000000 / system_hz; r_usage.ru_stime.tv_sec = usec / 1000000; r_usage.ru_stime.tv_usec = usec % 1000000; - r_usage.ru_nsignals = target->p_signal_received; src_vir = (vir_bytes) &r_usage; break; } diff --git a/minix/usr.bin/trace/service/pm.c b/minix/usr.bin/trace/service/pm.c index 0656bdb94..176955dce 100644 --- a/minix/usr.bin/trace/service/pm.c +++ b/minix/usr.bin/trace/service/pm.c @@ -1240,8 +1240,6 @@ pm_getrusage_in(struct trace_proc * proc, const message * m_out, put_struct_timeval(proc, "ru_stime", PF_LOCADDR, (vir_bytes)&buf.ru_stime); - if (verbose > 0) - put_value(proc, "ru_nsignals", "%ld", buf.ru_nsignals); put_close_struct(proc, verbose > 0); } put_equals(proc);