octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fork() for microsoft windows (native but not Cygwin).


From: address@hidden
Subject: Re: fork() for microsoft windows (native but not Cygwin).
Date: Mon, 2 May 2016 07:09:15 +0900 (JST)

--- tmacchant wrote:
> > From: Tatsuro MATSUOKA 
> > To: "octave-maintainers
> > Cc: 
> > Date: 2016/5/2, Mon 04:26
> > Subject: fork() for microsoft windows (native but not Cygwin).
> > 
> > In the discussion for parallel octave-forge package:
> > http://savannah.gnu.org/bugs/?41148
> > 
> > 
> > It should be checked the implementation of fork() on windows.
> > The native windows C compiler does not have a fork() function.
> > 
> > On octave prompt
> > 
> >>>  help fork
> > 
> > tells that fork() on octave implemented in libinterp/corefcn/syscalls.cc.
> > 
> > I looked into the code of syscalls.cc.
> > (http://octave.org/doxygen/4.1/d7/dba/syscalls_8cc_source.html)
> > 
> > Around line 555,
> > 
> > 555   DEFUNX ("fork", Ffork, args, ,
> > 556         "-*- texinfo -*-\n\
> > <snip>
> > {
> > 
> >   578   octave_value_list retval;
> >   579 
> >   580   retval(1) = std::string ();
> >   581   retval(0) = -1;
> >   582 
> >   583   int nargin = args.length ();
> >   584 
> >   585   if (nargin == 0)
> >   586     {
> >   587       std::string msg;
> >   588 
> >   589       pid_t pid = octave_syscalls::fork (msg);
> >   590 
> >   591       retval(1) = msg;
> >   592       retval(0) = pid;
> >   593     }
> >   594   else
> >   595     print_usage ();
> >   596 
> >   597   return retval;
> >   598 }
> > 
> > In oct-syscalls.cc
> > (http://octave.org/doxygen/4.0/d5/d5e/oct-syscalls_8cc_source.html)
> >   107 pid_t
> >   108 octave_syscalls::fork (std::string& msg)
> >   109 {
> >   110   pid_t status = -1;
> >   111 
> >   112 #if defined (HAVE_FORK)
> >   113   status = ::fork ();
> >   114 
> >   115   if (status < 0)
> >   116     msg = gnulib::strerror (errno);
> >   117 #else
> >   118   msg = NOT_SUPPORTED ("fork");
> >   119 #endif
> >   120 
> >   121   return status;
> >   122 }
> > 
> > To my knowledge, fork() is not implemented in native windows.
> > Cygwin implements fork() because cygwin offers almost all posix APIs.
> > 
> > The discussion resemble for pipe() on windows but native windows completely
> > lacks the fork.  If we want to use fork on windows we should implement
> > it using windows API that perhaps in done on the Cygwin
> > 
> > Am I wrong?
> > 
> > Tatsuro
> 
> 
> In the gnulib manual,"9.287 fork"
> https://www.gnu.org/software/gnulib/manual/html_node/fork.html
> 
> 
> On Windows platforms (excluding Cygwin), this function is not implemented; 
> use spawnvp instead.
> 
> 
> Can octave fork() be implemented by spawnvp but not by fork on windows?
> 
I don't see the octave manual and explanation of spawnvp.  The spawnvp is not 
able to use for the octave fork().

We have to write it using windows api like popen2 on octave for windows.

Tatsuro




reply via email to

[Prev in Thread] Current Thread [Next in Thread]