Mercurial > octave
changeset 21910:4d723ba06b4a
provide wrappers for some unistd.h functions
* liboctave/wrappers/unistd-wrappers.c,
liboctave/wrappers/unistd-wrappers.h: New files.
* liboctave/wrappers/module.mk: Update.
* gl2ps-print.cc, oct-hist.cc, oct-procbuf.cc, oct-tex-lexer.in.ll,
sysdep.cc, octave.cc, parse-tree/lex.ll, file-ops.cc, lo-sysdep.cc,
oct-env.cc, oct-syscalls.cc, cmd-edit.cc, kpse.cc:
Use wrappers instead of calling unistd.h functions directly.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 14 Jun 2016 18:10:04 -0400 |
parents | d7cac41df82a |
children | c66c156e1d1d |
files | libinterp/corefcn/gl2ps-print.cc libinterp/corefcn/oct-hist.cc libinterp/corefcn/oct-procbuf.cc libinterp/corefcn/oct-tex-lexer.in.ll libinterp/corefcn/sysdep.cc libinterp/octave.cc libinterp/parse-tree/lex.ll liboctave/system/file-ops.cc liboctave/system/lo-sysdep.cc liboctave/system/oct-env.cc liboctave/system/oct-syscalls.cc liboctave/util/cmd-edit.cc liboctave/util/kpse.cc liboctave/wrappers/module.mk liboctave/wrappers/unistd-wrappers.c liboctave/wrappers/unistd-wrappers.h |
diffstat | 16 files changed, 374 insertions(+), 138 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/gl2ps-print.cc Tue Jun 14 16:31:34 2016 -0400 +++ b/libinterp/corefcn/gl2ps-print.cc Tue Jun 14 18:10:04 2016 -0400 @@ -34,13 +34,11 @@ #include <limits> -#include <sys/types.h> -#include <unistd.h> - #include <gl2ps.h> #include "lo-mappers.h" #include "oct-locbuf.h" +#include "unistd-wrappers.h" #include "unwind-prot.h" #include "gl-render.h" @@ -212,7 +210,7 @@ buffer_overflow = false; buffsize *= 2; gnulib::fseek (tmpf, 0, SEEK_SET); - gnulib::ftruncate (fileno (tmpf), 0); + octave_ftruncate_wrapper (fileno (tmpf), 0); // For LaTeX output the fltk print process uses 2 drawnow() commands. // The first one is for the pdf/ps/eps graph to be included. The
--- a/libinterp/corefcn/oct-hist.cc Tue Jun 14 16:31:34 2016 -0400 +++ b/libinterp/corefcn/oct-hist.cc Tue Jun 14 18:10:04 2016 -0400 @@ -38,13 +38,9 @@ #include <cstdlib> #include <cstring> +#include <fstream> #include <string> -#include <fstream> - -#include <sys/types.h> -#include <unistd.h> - #include "cmd-hist.h" #include "file-ops.h" #include "lo-mappers.h" @@ -52,6 +48,7 @@ #include "oct-env.h" #include "oct-time.h" #include "str-vec.h" +#include "unistd-wrappers.h" #include <defaults.h> #include "defun.h" @@ -439,7 +436,7 @@ static void unlink_cleanup (const char *file) { - gnulib::unlink (file); + octave_unlink_wrapper (file); } static void
--- a/libinterp/corefcn/oct-procbuf.cc Tue Jun 14 16:31:34 2016 -0400 +++ b/libinterp/corefcn/oct-procbuf.cc Tue Jun 14 18:10:04 2016 -0400 @@ -33,6 +33,7 @@ #include "oct-procbuf.h" #include "oct-syscalls.h" #include "sysdep.h" +#include "unistd-wrappers.h" #include "variables.h" #include "defun.h" @@ -105,12 +106,12 @@ if (proc_pid == 0) { - gnulib::close (parent_end); + octave_close_wrapper (parent_end); if (child_end != child_std_end) { - gnulib::dup2 (child_end, child_std_end); - gnulib::close (child_end); + octave_dup2_wrapper (child_end, child_std_end); + octave_close_wrapper (child_end); } while (octave_procbuf_list) @@ -131,11 +132,11 @@ exit (127); } - gnulib::close (child_end); + octave_close_wrapper (child_end); if (proc_pid < 0) { - gnulib::close (parent_end); + octave_close_wrapper (parent_end); return 0; }
--- a/libinterp/corefcn/oct-tex-lexer.in.ll Tue Jun 14 16:31:34 2016 -0400 +++ b/libinterp/corefcn/oct-tex-lexer.in.ll Tue Jun 14 18:10:04 2016 -0400 @@ -58,12 +58,7 @@ %{ -// The generated code may include unistd.h. We need that to happen -// before defining isatty to be prefixed with the gnulib namespace -// identifier. - -#include <sys/types.h> -#include <unistd.h> +#include "unistd-wrappers.h" #include "txt-eng.h" #include "oct-tex-parser.h" @@ -79,6 +74,9 @@ # define YYSTYPE OCTAVE_TEX_STYPE #endif +#define YY_NO_UNISTD_H 1 +#define isatty octave_isatty_wrapper + #if defined (GNULIB_NAMESPACE) // Calls to the following functions appear in the generated output // from flex without the namespace tag. Redefine them so we will use @@ -87,7 +85,6 @@ # define fread GNULIB_NAMESPACE::fread # define fwrite GNULIB_NAMESPACE::fwrite # define getc GNULIB_NAMESPACE::getc -# define isatty GNULIB_NAMESPACE::isatty # define malloc GNULIB_NAMESPACE::malloc # define realloc GNULIB_NAMESPACE::realloc #endif
--- a/libinterp/corefcn/sysdep.cc Tue Jun 14 16:31:34 2016 -0400 +++ b/libinterp/corefcn/sysdep.cc Tue Jun 14 18:10:04 2016 -0400 @@ -33,9 +33,6 @@ #include <iostream> #include <string> -#include <sys/types.h> -#include <unistd.h> - #if defined (HAVE_TERMIOS_H) # include <termios.h> #elif defined (HAVE_TERMIO_H) @@ -71,6 +68,7 @@ #include "mach-info.h" #include "oct-env.h" #include "quit.h" +#include "unistd-wrappers.h" #include "unsetenv-wrapper.h" #include "Cell.h" @@ -354,7 +352,7 @@ static bool curr_on = false; int tty_fd = STDIN_FILENO; - if (! gnulib::isatty (tty_fd)) + if (! octave_isatty_wrapper (tty_fd)) { if (interactive && ! forced_interactive) error ("stdin is not a tty!");
--- a/libinterp/octave.cc Tue Jun 14 16:31:34 2016 -0400 +++ b/libinterp/octave.cc Tue Jun 14 18:10:04 2016 -0400 @@ -44,6 +44,7 @@ #include "lo-error.h" #include "oct-env.h" #include "str-vec.h" +#include "unistd-wrappers.h" #include "build-env.h" #include "builtins.h" @@ -849,10 +850,10 @@ // If stdin is not a tty, then we are reading commands from a pipe or // a redirected file. - bool stdin_is_tty = gnulib::isatty (fileno (stdin)); + bool stdin_is_tty = octave_isatty_wrapper (fileno (stdin)); interactive = (! embedded && ! an_octave_program && stdin_is_tty - && gnulib::isatty (fileno (stdout))); + && octave_isatty_wrapper (fileno (stdout))); // Check if the user forced an interactive session. If he // unnecessarily did so, reset forced_interactive to false. @@ -1039,7 +1040,7 @@ // (for example, starting from a desktop "launcher" with no terminal) and you // want to start the GUI, you may use the --force-gui option to start the GUI. - if (! gnulib::isatty (fileno (stdin))) + if (! octave_isatty_wrapper (fileno (stdin))) return false; // If we have code to eval or execute from a file, and we are going to exit
--- a/libinterp/parse-tree/lex.ll Tue Jun 14 16:31:34 2016 -0400 +++ b/libinterp/parse-tree/lex.ll Tue Jun 14 18:10:04 2016 -0400 @@ -89,12 +89,10 @@ #include <string> #include <stack> -#include <sys/types.h> -#include <unistd.h> - #include "cmd-edit.h" +#include "lo-mappers.h" #include "quit.h" -#include "lo-mappers.h" +#include "unistd-wrappers.h" // These would be alphabetical, but oct-parse.h must be included before // oct-gperf.h and oct-parse.h must be included after token.h and the tree @@ -131,13 +129,15 @@ # define YYSTYPE OCTAVE_STYPE #endif +#define YY_NO_UNISTD_H 1 +#define isatty octave_isatty_wrapper + #if defined (GNULIB_NAMESPACE) // Calls to the following functions appear in the generated output from // flex without the namespace tag. Redefine them so we will use them // via the gnulib namespace. # define fprintf GNULIB_NAMESPACE::fprintf # define fwrite GNULIB_NAMESPACE::fwrite -# define isatty GNULIB_NAMESPACE::isatty # define malloc GNULIB_NAMESPACE::malloc # define realloc GNULIB_NAMESPACE::realloc #endif
--- a/liboctave/system/file-ops.cc Tue Jun 14 16:31:34 2016 -0400 +++ b/liboctave/system/file-ops.cc Tue Jun 14 18:10:04 2016 -0400 @@ -36,9 +36,6 @@ #include <iostream> #include <vector> -#include <sys/types.h> -#include <unistd.h> - #include "areadlink-wrapper.h" #include "canonicalize-file-name-wrapper.h" #include "dir-ops.h" @@ -52,6 +49,7 @@ #include "singleton-cleanup.h" #include "stat-wrappers.h" #include "str-vec.h" +#include "unistd-wrappers.h" namespace octave { @@ -456,7 +454,7 @@ int status = -1; - status = gnulib::link (old_name.c_str (), new_name.c_str ()); + status = octave_link_wrapper (old_name.c_str (), new_name.c_str ()); if (status < 0) msg = gnulib::strerror (errno); @@ -479,7 +477,7 @@ int status = -1; - status = gnulib::symlink (old_name.c_str (), new_name.c_str ()); + status = octave_symlink_wrapper (old_name.c_str (), new_name.c_str ()); if (status < 0) msg = gnulib::strerror (errno); @@ -551,7 +549,7 @@ int status = -1; - status = gnulib::rmdir (name.c_str ()); + status = octave_rmdir_wrapper (name.c_str ()); if (status < 0) msg = gnulib::strerror (errno); @@ -656,7 +654,7 @@ int status = -1; - status = gnulib::unlink (name.c_str ()); + status = octave_unlink_wrapper (name.c_str ()); if (status < 0) msg = gnulib::strerror (errno);
--- a/liboctave/system/lo-sysdep.cc Tue Jun 14 16:31:34 2016 -0400 +++ b/liboctave/system/lo-sysdep.cc Tue Jun 14 18:10:04 2016 -0400 @@ -28,9 +28,6 @@ #include <string> #include <vector> -#include <sys/types.h> -#include <unistd.h> - #include <fcntl.h> #if defined (__WIN32__) && ! defined (__CYGWIN__) @@ -40,10 +37,11 @@ #include "file-ops.h" #include "lo-error.h" +#include "lo-sysdep.h" +#include "oct-locbuf.h" #include "pathlen.h" -#include "lo-sysdep.h" #include "str-vec.h" -#include "oct-locbuf.h" +#include "unistd-wrappers.h" namespace octave { @@ -54,11 +52,11 @@ { std::string retval; - // Using the gnulib getcwd module ensures that we have a getcwd that + // Using octave_getcwd_wrapper ensures that we have a getcwd that // will allocate a buffer as large as necessary if buf and size are // both 0. - char *tmp = gnulib::getcwd (0, 0); + char *tmp = octave_getcwd_wrapper (0, 0); if (! tmp) (*current_liboctave_error_handler) ("unable to find current directory"); @@ -79,7 +77,7 @@ path += "\\"; #endif - return gnulib::chdir (path.c_str ()); + return octave_chdir_wrapper (path.c_str ()); } #if defined (__WIN32__) && ! defined (__CYGWIN__)
--- a/liboctave/system/oct-env.cc Tue Jun 14 16:31:34 2016 -0400 +++ b/liboctave/system/oct-env.cc Tue Jun 14 18:10:04 2016 -0400 @@ -46,9 +46,6 @@ #include <string> -#include <sys/types.h> -#include <unistd.h> - #include "file-ops.h" #include "lo-error.h" #include "lo-sysdep.h" @@ -58,6 +55,7 @@ #include "oct-syscalls.h" #include "set-program-name-wrapper.h" #include "singleton-cleanup.h" +#include "unistd-wrappers.h" namespace octave { @@ -511,7 +509,7 @@ { char hostname[1024]; - int status = gnulib::gethostname (hostname, 1023); + int status = octave_gethostname_wrapper (hostname, 1023); host_name = (status < 0) ? "unknown" : hostname; }
--- a/liboctave/system/oct-syscalls.cc Tue Jun 14 16:31:34 2016 -0400 +++ b/liboctave/system/oct-syscalls.cc Tue Jun 14 18:10:04 2016 -0400 @@ -29,9 +29,6 @@ #include <string.h> -#include <sys/types.h> -#include <unistd.h> - #include <fcntl.h> // We can't use csignal as kill is not in the std namespace, and picky @@ -43,6 +40,7 @@ #include "lo-sysdep.h" #include "oct-syscalls.h" #include "str-vec.h" +#include "unistd-wrappers.h" #define NOT_SUPPORTED(nm) \ nm ": not supported on this system" @@ -65,14 +63,10 @@ int status = -1; -#if defined (HAVE_DUP2) - status = gnulib::dup2 (old_fd, new_fd); + status = octave_dup2_wrapper (old_fd, new_fd); if (status < 0) msg = gnulib::strerror (errno); -#else - msg = NOT_SUPPORTED ("dup2"); -#endif return status; } @@ -90,20 +84,14 @@ { msg = ""; - int status = -1; - -#if defined (HAVE_EXECVP) char **argv = args.c_str_vec (); - status = ::execvp (file.c_str (), argv); + int status = octave_execvp_wrapper (file.c_str (), argv); string_vector::delete_c_str_vec (argv); if (status < 0) msg = gnulib::strerror (errno); -#else - msg = NOT_SUPPORTED ("execvp"); -#endif return status; } @@ -114,12 +102,12 @@ pid_t status = -1; #if defined (HAVE_FORK) - status = ::fork (); + status = octave_fork_wrapper (); if (status < 0) msg = gnulib::strerror (errno); #else - msg = NOT_SUPPORTED ("fork"); + msg = NOT_SUPPORTED ("vfork"); #endif return status; @@ -132,9 +120,9 @@ #if defined (HAVE_VFORK) || defined (HAVE_FORK) # if defined (HAVE_VFORK) - status = ::vfork (); + status = octave_vfork_wrapper (); # else - status = ::fork (); + status = octave_fork_wrapper (); # endif if (status < 0) @@ -149,16 +137,10 @@ pid_t getpgrp (std::string& msg) { - pid_t status = -1; - -#if defined (HAVE_GETPGRP) - status = ::getpgrp (); + pid_t status = octave_getpgrp_wrapper (); if (status < 0) msg = gnulib::strerror (errno); -#else - msg = NOT_SUPPORTED ("getpgrp"); -#endif return status; } @@ -166,61 +148,37 @@ pid_t getpid (void) { -#if defined (HAVE_GETPID) - return ::getpid (); -#else - return 0; -#endif + return octave_getpid_wrapper (); } pid_t getppid (void) { -#if defined (HAVE_GETPPID) - return ::getppid (); -#else - return 0; -#endif + return octave_getppid_wrapper (); } gid_t getgid (void) { -#if defined (HAVE_GETGID) - return ::getgid (); -#else - return 0; -#endif + return octave_getgid_wrapper (); } gid_t getegid (void) { -#if defined (HAVE_GETEGID) - return ::getegid (); -#else - return 0; -#endif + return octave_getegid_wrapper (); } uid_t getuid (void) { -#if defined (HAVE_GETUID) - return ::getuid (); -#else - return 0; -#endif + return octave_getuid_wrapper (); } uid_t geteuid (void) { -#if defined (HAVE_GETEUID) - return ::geteuid (); -#else - return 0; -#endif + return octave_geteuid_wrapper (); } int @@ -237,7 +195,7 @@ int status = -1; - status = gnulib::pipe (fildes); + status = octave_pipe_wrapper (fildes); if (status < 0) msg = gnulib::strerror (errno); @@ -341,15 +299,15 @@ interactive = false; // Child process - gnulib::close (child_stdin[1]); - gnulib::close (child_stdout[0]); + octave_close_wrapper (child_stdin[1]); + octave_close_wrapper (child_stdout[0]); - if (dup2 (child_stdin[0], STDIN_FILENO) >= 0) + if (dup2 (child_stdin[0], octave_stdin_fileno ()) >= 0) { - gnulib::close (child_stdin[0]); - if (dup2 (child_stdout[1], STDOUT_FILENO) >= 0) + octave_close_wrapper (child_stdin[0]); + if (dup2 (child_stdout[1], octave_stdout_fileno ()) >= 0) { - gnulib::close (child_stdout[1]); + octave_close_wrapper (child_stdout[1]); if (execvp (cmd, args, child_msg) < 0) child_msg = "popen2 (child): unable to start process -- " + child_msg; } @@ -366,8 +324,8 @@ else { // Parent process - gnulib::close (child_stdin[0]); - gnulib::close (child_stdout[1]); + octave_close_wrapper (child_stdin[0]); + octave_close_wrapper (child_stdout[1]); #if defined (F_SETFL) && defined (O_NONBLOCK) if (! sync_mode @@ -382,14 +340,14 @@ return pid; } } - gnulib::close (child_stdout[0]); - gnulib::close (child_stdout[1]); + octave_close_wrapper (child_stdout[0]); + octave_close_wrapper (child_stdout[1]); } else msg = "popen2: pipe creation failed -- " + msg; - gnulib::close (child_stdin[0]); - gnulib::close (child_stdin[1]); + octave_close_wrapper (child_stdin[0]); + octave_close_wrapper (child_stdin[1]); } else msg = "popen2: pipe creation failed -- " + msg;
--- a/liboctave/util/cmd-edit.cc Tue Jun 14 16:31:34 2016 -0400 +++ b/liboctave/util/cmd-edit.cc Tue Jun 14 18:10:04 2016 -0400 @@ -29,11 +29,6 @@ #include <string> -#include <sys/types.h> -#include <unistd.h> - -#include "quit.h" - #include "cmd-edit.h" #include "cmd-hist.h" #include "file-ops.h" @@ -43,11 +38,12 @@ #include "oct-env.h" #include "oct-mutex.h" #include "oct-time.h" +#include "quit.h" #include "singleton-cleanup.h" +#include "unistd-wrappers.h" #if defined (USE_READLINE) #include <cstdio> -#include <cstdlib> #include "oct-rl-edit.h" #endif @@ -1819,12 +1815,7 @@ case '$': { -#if defined (HAVE_GETEUID) - tmpstr = (::geteuid () == 0 ? '#' : '$'); -#else - tmpstr = '$'; -#endif - + tmpstr = (octave_geteuid_wrapper () == 0 ? '#' : '$'); break; }
--- a/liboctave/util/kpse.cc Tue Jun 14 16:31:34 2016 -0400 +++ b/liboctave/util/kpse.cc Tue Jun 14 18:10:04 2016 -0400 @@ -40,9 +40,6 @@ #include <iostream> #include <string> -#include <sys/types.h> -#include <unistd.h> - // Needed for NAME_MAX. #include <dirent.h> @@ -52,6 +49,7 @@ #include "oct-env.h" #include "oct-passwd.h" #include "pathsearch.h" +#include "unistd-wrappers.h" #if defined (__WIN32__) && ! defined (__CYGWIN__) # define WIN32_LEAN_AND_MEAN 1 @@ -203,7 +201,7 @@ const char *t = fn.c_str (); - if (access (t, R_OK) == 0) + if (octave_access_wrapper (t, octave_access_r_ok ()) == 0) { octave::sys::file_stat fs (fn);
--- a/liboctave/wrappers/module.mk Tue Jun 14 16:31:34 2016 -0400 +++ b/liboctave/wrappers/module.mk Tue Jun 14 18:10:04 2016 -0400 @@ -15,6 +15,7 @@ liboctave/wrappers/strmode-wrapper.h \ liboctave/wrappers/strptime-wrapper.h \ liboctave/wrappers/uname-wrapper.h \ + liboctave/wrappers/unistd-wrappers.h \ liboctave/wrappers/unsetenv-wrapper.h \ liboctave/wrappers/vasprintf-wrapper.h \ liboctave/wrappers/wait-for-input.h @@ -36,6 +37,7 @@ liboctave/wrappers/strmode-wrapper.c \ liboctave/wrappers/strptime-wrapper.c \ liboctave/wrappers/uname-wrapper.c \ + liboctave/wrappers/unistd-wrappers.c \ liboctave/wrappers/unsetenv-wrapper.c \ liboctave/wrappers/vasprintf-wrapper.c \ liboctave/wrappers/wait-for-input.c \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/unistd-wrappers.c Tue Jun 14 18:10:04 2016 -0400 @@ -0,0 +1,209 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +// These functions may be provided by gnulib. We don't include gnulib +// headers directly in Octave's C++ source files to avoid problems that +// may be caused by the way that gnulib overrides standard library +// functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include <sys/types.h> +#include <unistd.h> + +#include "unistd-wrappers.h" + +int +octave_access_f_ok (void) +{ + return F_OK; +} + +int +octave_access_r_ok (void) +{ + return R_OK; +} + +int +octave_access_w_ok (void) +{ + return W_OK; +} + +int +octave_access_x_ok (void) +{ + return X_OK; +} + +int +octave_access_wrapper (const char *nm, int mode) +{ + return access (nm, mode); +} + +int +octave_chdir_wrapper (const char *nm) +{ + return chdir (nm); +} + +int +octave_close_wrapper (int fd) +{ + return close (fd); +} + +int +octave_dup2_wrapper (int fd1, int fd2) +{ + return dup2 (fd1, fd2); +} + +int +octave_execvp_wrapper (const char *file, char *const *argv) +{ + return execvp (file, argv); +} + +pid_t +octave_fork_wrapper (void) +{ + return fork (); +} + +int +octave_ftruncate_wrapper (int fd, off_t sz) +{ + return ftruncate (fd, sz); +} + +char * +octave_getcwd_wrapper (char *nm, size_t len) +{ + return getcwd (nm, len); +} + +gid_t +octave_getegid_wrapper (void) +{ + return getegid (); +} + +uid_t +octave_geteuid_wrapper (void) +{ + return geteuid (); +} + +gid_t +octave_getgid_wrapper (void) +{ + return getgid (); +} + +int +octave_gethostname_wrapper (char *nm, size_t len) +{ + return gethostname (nm, len); +} + +pid_t +octave_getpgrp_wrapper (void) +{ + return getpgrp (); +} + +pid_t +octave_getpid_wrapper (void) +{ + return getpid (); +} + +pid_t +octave_getppid_wrapper (void) +{ + return getppid (); +} + +uid_t +octave_getuid_wrapper (void) +{ + return getuid (); +} + +int +octave_isatty_wrapper (int fd) +{ + return isatty (fd); +} + +int +octave_link_wrapper (const char *nm1, const char *nm2) +{ + return link (nm1, nm2); +} + +int +octave_pipe_wrapper (int *fd) +{ + return pipe (fd); +} + +int +octave_rmdir_wrapper (const char *nm) +{ + return rmdir (nm); +} + +int +octave_stdin_fileno (void) +{ + return STDIN_FILENO; +} + +int +octave_stdout_fileno (void) +{ + return STDOUT_FILENO; +} + +int +octave_symlink_wrapper (const char *nm1, const char *nm2) +{ + return symlink (nm1, nm2); +} + +int +octave_unlink_wrapper (const char *nm) +{ + return unlink (nm); +} + +pid_t +octave_vfork_wrapper (void) +{ + return vfork (); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/unistd-wrappers.h Tue Jun 14 18:10:04 2016 -0400 @@ -0,0 +1,92 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_unistd_wrappers_h) +#define octave_unistd_wrappers_h 1 + +#if defined __cplusplus +extern "C" { +#endif + +extern int octave_access_f_ok (void); + +extern int octave_access_r_ok (void); + +extern int octave_access_w_ok (void); + +extern int octave_access_x_ok (void); + +extern int octave_access_wrapper (const char *nm, int mode); + +extern int octave_chdir_wrapper (const char *nm); + +extern int octave_close_wrapper (int fd); + +extern int octave_dup2_wrapper (int fd1, int fd2); + +extern int octave_execvp_wrapper (const char *file, char *const *argv); + +extern pid_t octave_fork_wrapper (void); + +extern int octave_ftruncate_wrapper (int fd, off_t sz); + +extern char *octave_getcwd_wrapper (char *nm, size_t len); + +extern gid_t octave_getegid_wrapper (void); + +extern uid_t octave_geteuid_wrapper (void); + +extern gid_t octave_getgid_wrapper (void); + +extern int octave_gethostname_wrapper (char *nm, size_t len); + +extern pid_t octave_getpgrp_wrapper (void); + +extern pid_t octave_getpid_wrapper (void); + +extern pid_t octave_getppid_wrapper (void); + +extern uid_t octave_getuid_wrapper (void); + +extern int octave_isatty_wrapper (int fd); + +extern int octave_link_wrapper (const char *nm1, const char *nm2); + +extern int octave_pipe_wrapper (int *fd); + +extern int octave_rmdir_wrapper (const char *nm); + +extern int octave_stdin_fileno (void); + +extern int octave_stdout_fileno (void); + +extern int octave_symlink_wrapper (const char *nm1, const char *nm2); + +extern int octave_unlink_wrapper (const char *nm); + +extern pid_t octave_vfork_wrapper (void); + +#if defined __cplusplus +} +#endif + +#endif