1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING.  If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_oct_syscalls_h)
27 #define octave_oct_syscalls_h 1
28 
29 #include "octave-config.h"
30 
31 #include <string>
32 
33 class string_vector;
34 
35 #include <sys/types.h>
36 
37 namespace octave
38 {
39   namespace sys
40   {
41     extern OCTAVE_API int dup2 (int, int);
42     extern OCTAVE_API int dup2 (int, int, std::string&);
43 
44     extern OCTAVE_API int execvp (const std::string&, const string_vector&);
45     extern OCTAVE_API int execvp (const std::string&, const string_vector&,
46                                   std::string&);
47 
48     extern OCTAVE_API pid_t fork (std::string&);
49 
50     extern OCTAVE_API pid_t vfork (std::string&);
51 
52     extern OCTAVE_API pid_t getpgrp (std::string&);
53 
54     extern OCTAVE_API pid_t getpid (void);
55 
56     extern OCTAVE_API pid_t getppid (void);
57 
58     extern OCTAVE_API gid_t getgid (void);
59 
60     extern OCTAVE_API gid_t getegid (void);
61 
62     extern OCTAVE_API uid_t getuid (void);
63 
64     extern OCTAVE_API uid_t geteuid (void);
65 
66     extern OCTAVE_API int pipe (int *);
67     extern OCTAVE_API int pipe (int *, std::string&);
68 
69     extern OCTAVE_API pid_t waitpid (pid_t, int *status, int);
70     extern OCTAVE_API pid_t waitpid (pid_t, int *status, int, std::string&);
71 
72     extern OCTAVE_API int wcontinue (void);
73 
74     extern OCTAVE_API int wcoredump (int status);
75 
76     extern OCTAVE_API bool wifcontinued (int status);
77 
78     extern OCTAVE_API bool wifexited (int status);
79 
80     extern OCTAVE_API bool wifsignaled (int status);
81 
82     extern OCTAVE_API bool wifstopped (int status);
83 
84     extern OCTAVE_API int wexitstatus (int status);
85 
86     extern OCTAVE_API int wnohang (void);
87 
88     extern OCTAVE_API int wstopsig (int status);
89 
90     extern OCTAVE_API int wtermsig (int status);
91 
92     extern OCTAVE_API int wuntraced (void);
93 
94     extern OCTAVE_API int kill (pid_t, int);
95     extern OCTAVE_API int kill (pid_t, int, std::string&);
96 
97     extern OCTAVE_API pid_t
98     popen2 (const std::string&, const string_vector&, bool, int *);
99 
100     extern OCTAVE_API pid_t
101     popen2 (const std::string&, const string_vector&, bool, int *,
102             std::string&);
103 
104     extern OCTAVE_API int fcntl (int, int, long);
105     extern OCTAVE_API int fcntl (int, int, long, std::string&);
106   }
107 }
108 
109 #endif
110