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
oct-syscalls.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-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 #if ! defined (octave_oct_syscalls_h)
24 #define octave_oct_syscalls_h 1
25 
26 #include "octave-config.h"
27 
28 #include <string>
29 
30 class string_vector;
31 
32 #include <sys/types.h>
33 
34 namespace octave
35 {
36  namespace sys
37  {
38  extern OCTAVE_API int dup2 (int, int);
39  extern OCTAVE_API int dup2 (int, int, std::string&);
40 
41  extern OCTAVE_API int execvp (const std::string&, const string_vector&);
42  extern OCTAVE_API int execvp (const std::string&, const string_vector&,
43  std::string&);
44 
45  extern OCTAVE_API pid_t fork (std::string&);
46 
47  extern OCTAVE_API pid_t vfork (std::string&);
48 
49  extern OCTAVE_API pid_t getpgrp (std::string&);
50 
51  extern OCTAVE_API pid_t getpid (void);
52 
53  extern OCTAVE_API pid_t getppid (void);
54 
55  extern OCTAVE_API gid_t getgid (void);
56 
57  extern OCTAVE_API gid_t getegid (void);
58 
59  extern OCTAVE_API uid_t getuid (void);
60 
61  extern OCTAVE_API uid_t geteuid (void);
62 
63  extern OCTAVE_API int pipe (int *);
64  extern OCTAVE_API int pipe (int *, std::string&);
65 
66  extern OCTAVE_API pid_t waitpid (pid_t, int *status, int);
67  extern OCTAVE_API pid_t waitpid (pid_t, int *status, int, std::string&);
68 
69  extern OCTAVE_API int wcontinue (void);
70 
71  extern OCTAVE_API int wcoredump (int status);
72 
73  extern OCTAVE_API bool wifcontinued (int status);
74 
75  extern OCTAVE_API bool wifexited (int status);
76 
77  extern OCTAVE_API bool wifsignaled (int status);
78 
79  extern OCTAVE_API bool wifstopped (int status);
80 
81  extern OCTAVE_API int wexitstatus (int status);
82 
83  extern OCTAVE_API int wnohang (void);
84 
85  extern OCTAVE_API int wstopsig (int status);
86 
87  extern OCTAVE_API int wtermsig (int status);
88 
89  extern OCTAVE_API int wuntraced (void);
90 
91  extern OCTAVE_API int kill (pid_t, int);
92  extern OCTAVE_API int kill (pid_t, int, std::string&);
93 
94  extern OCTAVE_API pid_t
95  popen2 (const std::string&, const string_vector&, bool, int *);
96 
97  extern OCTAVE_API pid_t
98  popen2 (const std::string&, const string_vector&, bool, int *,
99  std::string&);
100 
101  extern OCTAVE_API int fcntl (int, int, long);
102  extern OCTAVE_API int fcntl (int, int, long, std::string&);
103  }
104 }
105 
106 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
107 
108 OCTAVE_DEPRECATED ("use 'octave::sys::popen2' instead")
109 inline pid_t
110 octave_popen2 (const std::string& cmd, const string_vector& args,
111  bool sync_mode, int *filedes)
112 {
113  return octave::sys::popen2 (cmd, args, sync_mode, filedes);
114 }
115 
116 OCTAVE_DEPRECATED ("use 'octave::sys::popen2' instead")
117 inline pid_t
118 popen2 (const std::string& cmd, const string_vector& args,
119  bool sync_mode, int *filedes, std::string& msg)
120 {
121  return octave::sys::popen2 (cmd, args, sync_mode, filedes, msg);
122 }
123 
124 OCTAVE_DEPRECATED ("use 'octave::sys::popen2' instead")
125 inline pid_t
126 popen2 (const std::string& cmd, const string_vector& args,
127  bool sync_mode, int *filedes, std::string& msg,
128  bool &/*interactive*/)
129 {
130  return octave::sys::popen2 (cmd, args, sync_mode, filedes, msg);
131 }
132 
133 #endif
134 
135 #endif
int dup2(int old_fd, int new_fd)
Definition: oct-syscalls.cc:50
Octave interface to the compression and uncompression libraries.
Definition: aepbalance.cc:47
int fcntl(int fd, int cmd, long arg)
int kill(pid_t pid, int sig)
int wcontinue(void)
pid_t getpid(void)
STL namespace.
gid_t getgid(void)
pid_t getppid(void)
bool wifstopped(int status)
JNIEnv void * args
Definition: ov-java.cc:67
pid_t octave_popen2(const char *cmd, char *const *args, bool sync_mode, int *fildes, const char **errmsg)
bool wifsignaled(int status)
pid_t waitpid(pid_t pid, int *status, int options)
int wexitstatus(int status)
int wcoredump(int status)
int wuntraced(void)
uid_t geteuid(void)
bool wifexited(int status)
int wnohang(void)
bool wifcontinued(int status)
int execvp(const std::string &file, const string_vector &argv)
Definition: oct-syscalls.cc:72
int wtermsig(int status)
gid_t getegid(void)
int wstopsig(int status)
pid_t fork(std::string &msg)
Definition: oct-syscalls.cc:97
uid_t getuid(void)
int pipe(int *fildes)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
pid_t getpgrp(std::string &msg)
pid_t vfork(std::string &msg)
pid_t popen2(const std::string &cmd, const string_vector &args, bool sync_mode, int *fildes)