[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c
From: |
Bruno Haible |
Subject: |
Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c |
Date: |
Sat, 28 Feb 2009 17:44:01 +0100 |
User-agent: |
KMail/1.9.9 |
Jim Meyering wrote:
> > the change I could apply is to add a comment in the specification:
> > "This function assumes that the signal handler for SIGCHLD is not set to
> > SIG_IGN."
>
> Thanks. That's probably all that it can do.
Done, see below.
> Though isn't it better to say it assumes the handler *is* set to SIG_DFL?
Why? When the signal handler is set to a function, wait_subprocess should
work, according to the description of waitpid() in POSIX.
> wait-process.c could print
> a diagnostic about the potential portability problem when it
> sees the SIGCHLD handler is not SIG_DFL. Or return a value
> indicating the problem -- esp. if it already knows it's running
> on a system with the losing semantics.
Currently, when the problem occurs, it will print a diagnostic:
<subprogram> subprocess: No child processes
This should be enough, I think.
2009-02-28 Bruno Haible <address@hidden>
* lib/wait-process.h (wait_subprocess): Clarify restriction regarding
SIGCHLD.
Reported by Jim Meyering.
--- lib/wait-process.h.orig 2009-02-28 17:40:00.000000000 +0100
+++ lib/wait-process.h 2009-02-28 17:39:40.000000000 +0100
@@ -1,5 +1,5 @@
/* Waiting for a subprocess to finish.
- Copyright (C) 2001-2003, 2006, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2006, 2008-2009 Free Software Foundation, Inc.
Written by Bruno Haible <address@hidden>, 2001.
This program is free software: you can redistribute it and/or modify
@@ -50,7 +50,9 @@
with an error status.
- If termsigp is not NULL, *termsig will be set to the signal that
terminated the subprocess (if supported by the platform: not on native
- Windows platforms), otherwise 0. */
+ Windows platforms), otherwise 0.
+ Prerequisites: The signal handler for SIGCHLD should not be set to SIG_IGN,
+ otherwise this function will not work. */
extern int wait_subprocess (pid_t child, const char *progname,
bool ignore_sigpipe, bool null_stderr,
bool slave_process, bool exit_on_error,