Mercurial > hg > octave-lojdl > gnulib-hg
annotate lib/wait-process.h @ 17426:90f3d53e01f5
sig2str: port to C++
* lib/sig2str.h (sig2str, str2sig): Declare as extern "C".
Reported by Daniel J Sebald in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-06/msg00000.html>.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sun, 02 Jun 2013 11:52:41 -0700 |
parents | e542fd46ad6f |
children |
rev | line source |
---|---|
4802 | 1 /* Waiting for a subprocess to finish. |
17249
e542fd46ad6f
maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents:
16201
diff
changeset
|
2 Copyright (C) 2001-2003, 2006, 2008-2013 Free Software Foundation, Inc. |
4802 | 3 Written by Bruno Haible <haible@clisp.cons.org>, 2001. |
4 | |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
6761
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify |
4802 | 6 it under the terms of the GNU General Public License as published by |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
6761
diff
changeset
|
7 the Free Software Foundation; either version 3 of the License, or |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
6761
diff
changeset
|
8 (at your option) any later version. |
4802 | 9 |
10 This program is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 GNU General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU General Public License | |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
6761
diff
changeset
|
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
4802 | 17 |
18 #ifndef _WAIT_PROCESS_H | |
19 #define _WAIT_PROCESS_H | |
20 | |
21 /* Get pid_t. */ | |
22 #include <stdlib.h> | |
23 #include <unistd.h> | |
24 #include <sys/types.h> | |
25 | |
26 #include <stdbool.h> | |
27 | |
28 | |
29 #ifdef __cplusplus | |
30 extern "C" { | |
31 #endif | |
32 | |
33 | |
34 /* Wait for a subprocess to finish. Return its exit code. | |
35 If it didn't terminate correctly, exit if exit_on_error is true, otherwise | |
6761
14eb5491c867
* lib/wait-process.c, lib/wait-process.h, lib/csharpcomp.c,
Derek R. Price <derek@ximbiot.com>
parents:
6759
diff
changeset
|
36 return 127. |
4927 | 37 Arguments: |
38 - child is the pid of the subprocess. | |
39 - progname is the name of the program executed by the subprocess, used for | |
40 error messages. | |
41 - If ignore_sigpipe is true, consider a subprocess termination due to | |
42 SIGPIPE as equivalent to a success. This is suitable for processes whose | |
43 only purpose is to write to standard output. This flag can be safely set | |
44 to false when the process' standard output is known to go to DEV_NULL. | |
45 - If null_stderr is true, the usual error message to stderr will be omitted. | |
46 This is suitable when the subprocess does not fulfill an important task. | |
47 - slave_process should be set to true if the process has been launched as a | |
48 slave process. | |
49 - If exit_on_error is true, any error will cause the main process to exit | |
10197
d079dd7b69bc
Add termsigp argument to execute() and wait_process().
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
50 with an error status. |
11248
04d6b677b5e4
Omit an error message that the caller can do better.
Bruno Haible <bruno@clisp.org>
parents:
11235
diff
changeset
|
51 - If termsigp is not NULL: *termsig will be set to the signal that |
10197
d079dd7b69bc
Add termsigp argument to execute() and wait_process().
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
52 terminated the subprocess (if supported by the platform: not on native |
11248
04d6b677b5e4
Omit an error message that the caller can do better.
Bruno Haible <bruno@clisp.org>
parents:
11235
diff
changeset
|
53 Windows platforms), otherwise 0, and the error message about the signal |
04d6b677b5e4
Omit an error message that the caller can do better.
Bruno Haible <bruno@clisp.org>
parents:
11235
diff
changeset
|
54 that terminated the subprocess will be omitted. |
11235
6d6cc28a5313
Clarify specification of wait_subprocess.
Bruno Haible <bruno@clisp.org>
parents:
10197
diff
changeset
|
55 Prerequisites: The signal handler for SIGCHLD should not be set to SIG_IGN, |
6d6cc28a5313
Clarify specification of wait_subprocess.
Bruno Haible <bruno@clisp.org>
parents:
10197
diff
changeset
|
56 otherwise this function will not work. */ |
4802 | 57 extern int wait_subprocess (pid_t child, const char *progname, |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11248
diff
changeset
|
58 bool ignore_sigpipe, bool null_stderr, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11248
diff
changeset
|
59 bool slave_process, bool exit_on_error, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11248
diff
changeset
|
60 int *termsigp); |
4802 | 61 |
62 /* Register a subprocess as being a slave process. This means that the | |
63 subprocess will be terminated when its creator receives a catchable fatal | |
64 signal or exits normally. Registration ends when wait_subprocess() | |
65 notices that the subprocess has exited. */ | |
66 extern void register_slave_subprocess (pid_t child); | |
67 | |
68 | |
69 #ifdef __cplusplus | |
70 } | |
71 #endif | |
72 | |
73 | |
74 #endif /* _WAIT_PROCESS_H */ |