diff libinterp/corefcn/syscalls.cc @ 21921:ecfcc8527661

hide sys/wait.h header and provide wrappers for waitpid macros * bootstrap.conf: Use sys_wait and waitpid gnulib modules. * liboctave/wrappers/wait-wrappers.c, added liboctave/wrappers/wait-wrappers.h: New files. * changed liboctave/wrappers/module.mk: Update. * liboctave/system/syswait.h: Delete. * liboctave/system/module.mk: Update. * oct-syscalls.cc, oct-syscalls.h (wcontinue, wcoredump, wifcontinued, wifexited, wifsignaled, wifstopped, wexitstatus, wnohang, wstopsig, wtermsig, wuntraced): New functions. (waitpid): Use octave_waitpid_wrapper. * lo-cutils.c, lo-cutils.h (octave_waitpid, octave_wifexited, octave_wexitstatus, octave_wifsignaled, octave_wtermsig, octave_wcoredump, octave_wifstopped, octave_wstopsig, octave_wifcontinued): Delete. * lo-utils.h (class octave_wait): Delete. * octave-gui.cc, help.cc: Don't include sys/wait.h. * pager.cc, sighandlers.cc, syscalls.cc, toplev.cc: Use wait functions from octave::sys namespace. * main.in.cc: Use wait-wrappers.h. * src/module.mk: Update.
author John W. Eaton <jwe@octave.org>
date Thu, 16 Jun 2016 01:00:20 -0400
parents c66c156e1d1d
children 2f33052c68ff
line wrap: on
line diff
--- a/libinterp/corefcn/syscalls.cc	Wed Jun 15 16:41:02 2016 -0400
+++ b/libinterp/corefcn/syscalls.cc	Thu Jun 16 01:00:20 2016 -0400
@@ -1146,7 +1146,7 @@
 
   int status = args(0).xint_value ("WIFEXITED: STATUS must be an integer");
 
-  return ovl (octave_wait::ifexited (status));
+  return ovl (octave::sys::wifexited (status));
 }
 
 DEFUNX ("WEXITSTATUS", FWEXITSTATUS, args, ,
@@ -1164,7 +1164,7 @@
 
   int status = args(0).xint_value ("WEXITSTATUS: STATUS must be an integer");
 
-  return ovl (octave_wait::exitstatus (status));
+  return ovl (octave::sys::wexitstatus (status));
 }
 
 DEFUNX ("WIFSIGNALED", FWIFSIGNALED, args, ,
@@ -1180,7 +1180,7 @@
 
   int status = args(0).xint_value ("WIFSIGNALED: STATUS must be an integer");
 
-  return ovl (octave_wait::ifsignaled (status));
+  return ovl (octave::sys::wifsignaled (status));
 }
 
 DEFUNX ("WTERMSIG", FWTERMSIG, args, ,
@@ -1198,7 +1198,7 @@
 
   int status = args(0).xint_value ("WTERMSIG: STATUS must be an integer");
 
-  return ovl (octave_wait::termsig (status));
+  return ovl (octave::sys::wtermsig (status));
 }
 
 DEFUNX ("WCOREDUMP", FWCOREDUMP, args, ,
@@ -1218,7 +1218,7 @@
 
   int status = args(0).xint_value ("WCOREDUMP: STATUS must be an integer");
 
-  return ovl (octave_wait::coredump (status));
+  return ovl (octave::sys::wcoredump (status));
 }
 
 DEFUNX ("WIFSTOPPED", FWIFSTOPPED, args, ,
@@ -1237,7 +1237,7 @@
 
   int status = args(0).xint_value ("WIFSTOPPED: STATUS must be an integer");
 
-  return ovl (octave_wait::ifstopped (status));
+  return ovl (octave::sys::wifstopped (status));
 }
 
 DEFUNX ("WSTOPSIG", FWSTOPSIG, args, ,
@@ -1255,7 +1255,7 @@
 
   int status = args(0).xint_value ("WSTOPSIG: STATUS must be an integer");
 
-  return ovl (octave_wait::stopsig (status));
+  return ovl (octave::sys::wstopsig (status));
 }
 
 DEFUNX ("WIFCONTINUED", FWIFCONTINUED, args, ,
@@ -1271,7 +1271,7 @@
 
   int status = args(0).xint_value ("WIFCONTINUED: STATUS must be an integer");
 
-  return ovl (octave_wait::ifcontinued (status));
+  return ovl (octave::sys::wifcontinued (status));
 }
 
 DEFUNX ("canonicalize_file_name", Fcanonicalize_file_name, args, ,
@@ -1304,7 +1304,7 @@
   return octave_value (val);
 }
 
-DEFUN (F_DUPFD, args, ,
+DEFUNX ("F_DUPFD", FF_DUPFD, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} F_DUPFD ()\n\
 Return the numerical value to pass to @code{fcntl} to return\n\
@@ -1320,7 +1320,7 @@
   return const_value (args, val);
 }
 
-DEFUN (F_GETFD, args, ,
+DEFUNX ("F_GETFD", FF_GETFD, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} F_GETFD ()\n\
 Return the numerical value to pass to @code{fcntl} to return\n\
@@ -1336,7 +1336,7 @@
   return const_value (args, val);
 }
 
-DEFUN (F_GETFL, args, ,
+DEFUNX ("F_GETFL", FF_GETFL, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} F_GETFL ()\n\
 Return the numerical value to pass to @code{fcntl} to return\n\
@@ -1352,7 +1352,7 @@
   return const_value (args, val);
 }
 
-DEFUN (F_SETFD, args, ,
+DEFUNX ("F_SETFD", FF_SETFD, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} F_SETFD ()\n\
 Return the numerical value to pass to @code{fcntl} to set the file\n\
@@ -1368,7 +1368,7 @@
   return const_value (args, val);
 }
 
-DEFUN (F_SETFL, args, ,
+DEFUNX ("F_SETFL", FF_SETFL, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} F_SETFL ()\n\
 Return the numerical value to pass to @code{fcntl} to set the file\n\
@@ -1384,7 +1384,7 @@
   return const_value (args, val);
 }
 
-DEFUN (O_APPEND, args, ,
+DEFUNX ("O_APPEND", FO_APPEND, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} O_APPEND ()\n\
 Return the numerical value of the file status flag that may be\n\
@@ -1401,7 +1401,7 @@
   return const_value (args, val);
 }
 
-DEFUN (O_ASYNC, args, ,
+DEFUNX ("O_ASYNC", FO_ASYNC, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} O_ASYNC ()\n\
 Return the numerical value of the file status flag that may be\n\
@@ -1417,7 +1417,7 @@
   return const_value (args, val);
 }
 
-DEFUN (O_CREAT, args, ,
+DEFUNX ("O_CREAT", FO_CREAT, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} O_CREAT ()\n\
 Return the numerical value of the file status flag that may be\n\
@@ -1434,7 +1434,7 @@
   return const_value (args, val);
 }
 
-DEFUN (O_EXCL, args, ,
+DEFUNX ("O_EXCL", FO_EXCL, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} O_EXCL ()\n\
 Return the numerical value of the file status flag that may be\n\
@@ -1450,7 +1450,7 @@
   return const_value (args, val);
 }
 
-DEFUN (O_NONBLOCK, args, ,
+DEFUNX ("O_NONBLOCK", FO_NONBLOCK, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} O_NONBLOCK ()\n\
 Return the numerical value of the file status flag that may be\n\
@@ -1467,7 +1467,7 @@
   return const_value (args, val);
 }
 
-DEFUN (O_RDONLY, args, ,
+DEFUNX ("O_RDONLY", FO_RDONLY, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} O_RDONLY ()\n\
 Return the numerical value of the file status flag that may be\n\
@@ -1483,7 +1483,7 @@
   return const_value (args, val);
 }
 
-DEFUN (O_RDWR, args, ,
+DEFUNX ("O_RDWR", FO_RDWR, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} O_RDWR ()\n\
 Return the numerical value of the file status flag that may be\n\
@@ -1500,7 +1500,7 @@
   return const_value (args, val);
 }
 
-DEFUN (O_SYNC, args, ,
+DEFUNX ("O_SYNC", FO_SYNC, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} O_SYNC ()\n\
 Return the numerical value of the file status flag that may be\n\
@@ -1517,7 +1517,7 @@
   return const_value (args, val);
 }
 
-DEFUN (O_TRUNC, args, ,
+DEFUNX ("O_TRUNC", FO_TRUNC, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} O_TRUNC ()\n\
 Return the numerical value of the file status flag that may be\n\
@@ -1534,7 +1534,7 @@
   return const_value (args, val);
 }
 
-DEFUN (O_WRONLY, args, ,
+DEFUNX ("O_WRONLY", FO_WRONLY, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} O_WRONLY ()\n\
 Return the numerical value of the file status flag that may be\n\
@@ -1550,10 +1550,6 @@
   return const_value (args, val);
 }
 
-#if ! defined (WNOHANG)
-#define WNOHANG 0
-#endif
-
 DEFUNX ("WNOHANG", FWNOHANG, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} WNOHANG ()\n\
@@ -1563,13 +1559,9 @@
 @seealso{waitpid, WUNTRACED, WCONTINUE}\n\
 @end deftypefn")
 {
-  return const_value (args, WNOHANG);
+  return const_value (args, octave::sys::wnohang ());
 }
 
-#if ! defined (WUNTRACED)
-#define WUNTRACED 0
-#endif
-
 DEFUNX ("WUNTRACED", FWUNTRACED, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} WUNTRACED ()\n\
@@ -1579,13 +1571,9 @@
 @seealso{waitpid, WNOHANG, WCONTINUE}\n\
 @end deftypefn")
 {
-  return const_value (args, WUNTRACED);
+  return const_value (args, octave::sys::wuntraced ());
 }
 
-#if ! defined (WCONTINUE)
-#define WCONTINUE 0
-#endif
-
 DEFUNX ("WCONTINUE", FWCONTINUE, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {} {} WCONTINUE ()\n\
@@ -1595,5 +1583,5 @@
 @seealso{waitpid, WNOHANG, WUNTRACED}\n\
 @end deftypefn")
 {
-  return const_value (args, WCONTINUE);
+  return const_value (args, octave::sys::wcontinue ());
 }