lkml.org 
[lkml]   [2003]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: call_usermodehelper does not report exit status?
Omen Wild <Omen.Wild@Dartmouth.EDU> wrote:
>
> I found the call_usermodehelper function and
> call it with the wait flag set, but I cannot get a non-zero return
> status of the program to propagate into the kernel.

This might fix it.

25-akpm/kernel/exit.c | 21 +++++++++++++++++----
25-akpm/kernel/kmod.c | 2 +-
2 files changed, 18 insertions(+), 5 deletions(-)

diff -puN kernel/kmod.c~call_usermodehelper-retval-fix kernel/kmod.c
--- 25/kernel/kmod.c~call_usermodehelper-retval-fix Fri Sep 19 11:14:47 2003
+++ 25-akpm/kernel/kmod.c Fri Sep 19 11:20:14 2003
@@ -190,7 +190,7 @@ static int wait_for_helper(void *data)
/* We don't have a SIGCHLD signal handler, so this
* always returns -ECHILD, but the important thing is
* that it blocks. */
- sys_wait4(pid, NULL, 0, NULL);
+ sys_wait4(pid, &sub_info->retval, 0, NULL);

complete(sub_info->complete);
return 0;
diff -puN kernel/exit.c~call_usermodehelper-retval-fix kernel/exit.c
--- 25/kernel/exit.c~call_usermodehelper-retval-fix Fri Sep 19 11:16:59 2003
+++ 25-akpm/kernel/exit.c Fri Sep 19 11:20:10 2003
@@ -883,10 +883,17 @@ static int wait_task_zombie(task_t *p, u

retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
if (!retval && stat_addr) {
+ int stat;
+
if (p->signal->group_exit)
- retval = put_user(p->signal->group_exit_code, stat_addr);
+ stat = p->signal->group_exit_code;
+ else
+ stat = p->exit_code;
+
+ if (current->mm)
+ retval = put_user(stat, stat_addr);
else
- retval = put_user(p->exit_code, stat_addr);
+ retval = __put_user(stat, stat_addr);
}
if (retval) {
p->state = TASK_ZOMBIE;
@@ -987,8 +994,14 @@ static int wait_task_stopped(task_t *p,
write_unlock_irq(&tasklist_lock);

retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
- if (!retval && stat_addr)
- retval = put_user((exit_code << 8) | 0x7f, stat_addr);
+ if (!retval && stat_addr) {
+ int stat = (exit_code << 8) | 0x7f;
+
+ if (current->mm)
+ retval = put_user(stat, stat_addr);
+ else
+ retval = __put_user(stat, stat_addr);
+ }
if (!retval)
retval = p->pid;
put_task_struct(p);
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:48    [W:0.045 / U:2.984 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site