mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* process.c (rb_exec_async_signal_safe): exported.
* ext/pty/extconf.rb: modify $INCFLAGS to include internal.h * ext/pty/pty.c: include internal.h. (chfunc): don't call rb_thread_atfork_before_exec. use rb_exec_async_signal_safe instead of rb_f_exec. (establishShell): set up earg. use rb_fork_async_signal_safe instead of rb_fork_err. * internal.h (rb_exec_async_signal_safe): declared. (rb_fork_async_signal_safe): declared. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									5bd7899b98
								
							
						
					
					
						commit
						18088467e7
					
				
					 5 changed files with 29 additions and 12 deletions
				
			
		
							
								
								
									
										15
									
								
								ChangeLog
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								ChangeLog
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,3 +1,18 @@
 | 
			
		|||
Sun Jun 10 10:24:51 2012  Tanaka Akira  <akr@fsij.org>
 | 
			
		||||
 | 
			
		||||
	* process.c (rb_exec_async_signal_safe): exported.
 | 
			
		||||
 | 
			
		||||
	* ext/pty/extconf.rb: modify $INCFLAGS to include internal.h
 | 
			
		||||
 | 
			
		||||
	* ext/pty/pty.c: include internal.h.
 | 
			
		||||
	  (chfunc): don't call rb_thread_atfork_before_exec.  use
 | 
			
		||||
	  rb_exec_async_signal_safe instead of rb_f_exec.
 | 
			
		||||
	  (establishShell): set up earg.  use rb_fork_async_signal_safe
 | 
			
		||||
	  instead of rb_fork_err.
 | 
			
		||||
 | 
			
		||||
	* internal.h (rb_exec_async_signal_safe): declared.
 | 
			
		||||
	  (rb_fork_async_signal_safe): declared.
 | 
			
		||||
 | 
			
		||||
Sun Jun 10 10:21:37 2012  Martin Bosslet  <Martin.Bosslet@googlemail.com>
 | 
			
		||||
 | 
			
		||||
	* ext/openssl/ossl.c
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,7 @@
 | 
			
		|||
require 'mkmf'
 | 
			
		||||
 | 
			
		||||
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
 | 
			
		||||
 | 
			
		||||
if /mswin|mingw|bccwin|nacl/ !~ RUBY_PLATFORM
 | 
			
		||||
  have_header("sys/stropts.h")
 | 
			
		||||
  have_func("setresuid")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,6 +32,7 @@
 | 
			
		|||
#include "ruby/ruby.h"
 | 
			
		||||
#include "ruby/io.h"
 | 
			
		||||
#include "ruby/util.h"
 | 
			
		||||
#include "internal.h"
 | 
			
		||||
 | 
			
		||||
#include <signal.h>
 | 
			
		||||
#ifdef HAVE_SYS_STROPTS_H
 | 
			
		||||
| 
						 | 
				
			
			@ -77,8 +78,7 @@ static void getDevice(int*, int*, char [DEVICELEN], int);
 | 
			
		|||
struct child_info {
 | 
			
		||||
    int master, slave;
 | 
			
		||||
    char *slavename;
 | 
			
		||||
    int argc;
 | 
			
		||||
    VALUE *argv;
 | 
			
		||||
    struct rb_exec_arg earg;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
| 
						 | 
				
			
			@ -87,16 +87,12 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
 | 
			
		|||
    struct child_info *carg = data;
 | 
			
		||||
    int master = carg->master;
 | 
			
		||||
    int slave = carg->slave;
 | 
			
		||||
    int argc = carg->argc;
 | 
			
		||||
    VALUE *argv = carg->argv;
 | 
			
		||||
 | 
			
		||||
#define ERROR_EXIT(str) do { \
 | 
			
		||||
	strlcpy(errbuf, (str), errbuf_len); \
 | 
			
		||||
	return -1; \
 | 
			
		||||
    } while (0)
 | 
			
		||||
 | 
			
		||||
    rb_thread_atfork_before_exec();
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Set free from process group and controlling terminal
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -146,8 +142,7 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
 | 
			
		|||
    seteuid(getuid());
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    rb_f_exec(argc, argv);
 | 
			
		||||
    return 0;
 | 
			
		||||
    return rb_exec_async_signal_safe(&carg->earg, errbuf, sizeof(errbuf_len));
 | 
			
		||||
#undef ERROR_EXIT
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -181,15 +176,16 @@ establishShell(int argc, VALUE *argv, struct pty_info *info,
 | 
			
		|||
	argv = &v;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    rb_exec_arg_init(argc, argv, 1, &carg.earg);
 | 
			
		||||
    rb_exec_arg_fixup(&carg.earg);
 | 
			
		||||
 | 
			
		||||
    getDevice(&master, &slave, SlaveName, 0);
 | 
			
		||||
 | 
			
		||||
    carg.master = master;
 | 
			
		||||
    carg.slave = slave;
 | 
			
		||||
    carg.slavename = SlaveName;
 | 
			
		||||
    carg.argc = argc;
 | 
			
		||||
    carg.argv = argv;
 | 
			
		||||
    errbuf[0] = '\0';
 | 
			
		||||
    pid = rb_fork_err(&status, chfunc, &carg, Qnil, errbuf, sizeof(errbuf));
 | 
			
		||||
    pid = rb_fork_async_signal_safe(&status, chfunc, &carg, Qnil, errbuf, sizeof(errbuf));
 | 
			
		||||
 | 
			
		||||
    if (pid < 0) {
 | 
			
		||||
	int e = errno;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -261,6 +261,10 @@ VALUE rb_thread_call_without_gvl(
 | 
			
		|||
/* io.c */
 | 
			
		||||
void rb_maygvl_fd_fix_cloexec(int fd);
 | 
			
		||||
 | 
			
		||||
/* process.c */
 | 
			
		||||
int rb_exec_async_signal_safe(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen);
 | 
			
		||||
rb_pid_t rb_fork_async_signal_safe(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds, char *errmsg, size_t errmsg_buflen);
 | 
			
		||||
 | 
			
		||||
#if defined __GNUC__ && __GNUC__ >= 4
 | 
			
		||||
#pragma GCC visibility pop
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2610,7 +2610,7 @@ rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/* This function should be async-signal-safe.  Hopefully it is. */
 | 
			
		||||
static int
 | 
			
		||||
int
 | 
			
		||||
rb_exec_async_signal_safe(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
 | 
			
		||||
{
 | 
			
		||||
#if !defined(HAVE_FORK)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue