GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
wait-wrappers.c
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2016-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 // These functions may be provided by gnulib. We don't include gnulib
24 // headers directly in Octave's C++ source files to avoid problems that
25 // may be caused by the way that gnulib overrides standard library
26 // functions.
27 
28 #if defined (HAVE_CONFIG_H)
29 # include "config.h"
30 #endif
31 
32 #include <sys/types.h>
33 #include <sys/wait.h>
34 
35 #include "wait-wrappers.h"
36 
37 #if ! defined (WCONTINUE)
38 # define WCONTINUE 0
39 #endif
40 
41 #if ! defined (WNOHANG)
42 # define WNOHANG 0
43 #endif
44 
45 #if ! defined (WUNTRACED)
46 # define WUNTRACED 0
47 #endif
48 
49 pid_t
50 octave_waitpid_wrapper (pid_t pid, int *statusp, int options)
51 {
52 #if defined (__WIN32__) && ! defined (__CYGWIN__)
53  // gnulib's waitpid replacement currently uses _cwait, which
54  // apparently only works with console applications.
55  *statusp = 0;
56  return -1;
57 #else
58  return waitpid (pid, statusp, options);
59 #endif
60 }
61 
62 int
64 {
65  return WCONTINUE;
66 }
67 
68 int
70 {
71  return WCOREDUMP (status);
72 }
73 
74 #if ! defined (WIFCONTINUED)
75 # define WIFCONTINUED(x) false
76 #endif
77 
78 bool
80 {
81  return WIFCONTINUED (status);
82 }
83 
84 bool
86 {
87  return WIFEXITED (status);
88 }
89 
90 bool
92 {
93  return WIFSIGNALED (status);
94 }
95 
96 bool
98 {
99  return WIFSTOPPED (status);
100 }
101 
102 int
104 {
105  return WEXITSTATUS (status);
106 }
107 
108 int
110 {
111  return WNOHANG;
112 }
113 
114 int
116 {
117  return WSTOPSIG (status);
118 }
119 
120 int
122 {
123  return WTERMSIG (status);
124 }
125 
126 int
128 {
129  return WUNTRACED;
130 }
bool octave_wifsignaled_wrapper(int status)
Definition: wait-wrappers.c:91
bool octave_wifexited_wrapper(int status)
Definition: wait-wrappers.c:85
waitpid(pid)
int octave_wcontinue_wrapper(void)
Definition: wait-wrappers.c:63
#define WNOHANG
Definition: wait-wrappers.c:42
bool octave_wifcontinued_wrapper(int status)
Definition: wait-wrappers.c:79
int octave_wtermsig_wrapper(int status)
int octave_wstopsig_wrapper(int status)
int octave_wexitstatus_wrapper(int status)
OCTAVE_EXPORT octave_value_list only variables visible in the local scope are displayed The following are valid options
Definition: variables.cc:1859
pid_t octave_waitpid_wrapper(pid_t pid, int *statusp, int options)
Definition: wait-wrappers.c:50
#define WCONTINUE
Definition: wait-wrappers.c:38
int octave_wcoredump_wrapper(int status)
Definition: wait-wrappers.c:69
#define WIFCONTINUED(x)
Definition: wait-wrappers.c:75
#define WUNTRACED
Definition: wait-wrappers.c:46
int octave_wuntraced_wrapper(void)
int octave_wnohang_wrapper(void)
bool octave_wifstopped_wrapper(int status)
Definition: wait-wrappers.c:97