31 #if defined (HAVE_CONFIG_H)
37 #include <sys/types.h>
40 #if defined (__WIN32__) && ! defined (__CYGWIN__)
44 #if defined (OCTAVE_USE_WINDOWS_API)
49 #if defined (__WIN32__) && ! defined (__CYGWIN__)
50 # include "windows-spawn.h"
83 return access (nm, mode);
89 #if defined (OCTAVE_USE_WINDOWS_API)
91 int status = _wchdir (wnm);
108 #if defined (HAVE_CTERMID)
118 return dup2 (fd1, fd2);
124 #if defined (__WIN32__) && ! defined (__CYGWIN__)
126 char *argv_mem_to_free;
127 const char **sanitized_argv = prepare_spawn ((
const char *
const *) argv,
130 # if defined (OCTAVE_USE_WINDOWS_API) && defined (_UNICODE)
134 for (argc = 0; sanitized_argv[argc] != NULL; argc++)
138 const wchar_t **wargv =
malloc ((argc + 1) *
sizeof (
wchar_t *));
141 for (
size_t i_arg = 0; i_arg < argc; i_arg++)
142 wargv[i_arg] =
u8_to_wchar (sanitized_argv[i_arg]);
146 free (sanitized_argv);
147 free (argv_mem_to_free);
149 int status = _wspawnv (P_WAIT, wfile, wargv+1);
155 if (status == -1 && errno == ENOEXEC)
161 status = _wspawnv (P_WAIT, wargv[0], wargv);
168 const wchar_t **wp = wargv;
171 free ((
wchar_t *) *wp++);
176 int status = spawnv (P_OVERLAY, file, sanitized_argv);
180 free (sanitized_argv);
181 free (argv_mem_to_free);
189 return execv (file, argv);
197 return execvp (file, argv);
203 #if defined (HAVE_FORK)
213 return ftruncate (fd, sz);
219 #if defined (OCTAVE_USE_WINDOWS_API)
220 wchar_t *tmp = _wgetcwd (NULL, 0);
234 memcpy (nm, retval,
len);
246 #if defined (HAVE_GETEGID)
256 #if defined (HAVE_GETEUID)
266 #if defined (HAVE_GETGID)
276 return gethostname (nm,
len);
282 #if defined (HAVE_GETPGRP)
292 #if defined (HAVE_GETPID)
302 #if defined (HAVE_GETPPID)
312 #if defined (HAVE_GETUID)
328 return link (nm1, nm2);
340 #if defined (OCTAVE_USE_WINDOWS_API)
342 int status = _wrmdir (wnm);
353 #if defined (HAVE_SETSID)
369 return STDOUT_FILENO;
381 #if defined (OCTAVE_USE_WINDOWS_API)
385 DWORD file_attributes = GetFileAttributesW (wnm);
386 if (file_attributes != INVALID_FILE_ATTRIBUTES
387 && file_attributes & FILE_ATTRIBUTE_READONLY)
388 SetFileAttributesW (wnm, file_attributes & ~FILE_ATTRIBUTE_READONLY);
390 int status = _wunlink (wnm);
402 #if defined (HAVE_VFORK)
412 #if defined (HAVE_FORK)
422 #if defined (HAVE_VFORK)
int unlink(const std::string &name)
int symlink(const std::string &old_name, const std::string &new_name)
int rmdir(const std::string &name)
int link(const std::string &old_name, const std::string &new_name)
int chdir(const std::string &path_arg)
T::size_type strlen(const typename T::value_type *str)
pid_t fork(std::string &msg)
int execvp(const std::string &file, const string_vector &argv)
pid_t getpgrp(std::string &msg)
pid_t vfork(std::string &msg)
int dup2(int old_fd, int new_fd)
wchar_t * u8_to_wchar(const char *u8)
char * u8_from_wchar(const wchar_t *wc)
int octave_access_f_ok(void)
pid_t octave_setsid_wrapper(void)
gid_t octave_getgid_wrapper(void)
uid_t octave_geteuid_wrapper(void)
int octave_ftruncate_wrapper(int fd, off_t sz)
int octave_gethostname_wrapper(char *nm, size_t len)
int octave_rmdir_wrapper(const char *nm)
pid_t octave_fork_wrapper(void)
pid_t octave_getpgrp_wrapper(void)
pid_t octave_getppid_wrapper(void)
int octave_access_r_ok(void)
bool octave_have_vfork(void)
int octave_execvp_wrapper(const char *file, char *const *argv)
gid_t octave_getegid_wrapper(void)
int octave_execv_wrapper(const char *file, char *const *argv)
pid_t octave_getpid_wrapper(void)
int octave_close_wrapper(int fd)
int octave_access_wrapper(const char *nm, int mode)
int octave_unlink_wrapper(const char *nm)
int octave_chdir_wrapper(const char *nm)
int octave_symlink_wrapper(const char *nm1, const char *nm2)
uid_t octave_getuid_wrapper(void)
int octave_access_x_ok(void)
int octave_link_wrapper(const char *nm1, const char *nm2)
int octave_access_w_ok(void)
const char * octave_ctermid_wrapper(void)
int octave_stdout_fileno(void)
char * octave_getcwd_wrapper(char *nm, size_t len)
pid_t octave_vfork_wrapper(void)
int octave_isatty_wrapper(int fd)
bool octave_have_fork(void)
int octave_dup2_wrapper(int fd1, int fd2)
int octave_stdin_fileno(void)
int octave_pipe_wrapper(int *fd)