зеркало из https://github.com/github/ruby.git
* eval.c (ruby_stop): should not trace error handler.
* signal.c (install_sighandler): do not install sighandler unless the old value is SIG_DFL. * io.c (io_write): should not raise exception on O_NONBLOCK io. * dir.c (dir_set_pos): seek should return dir, pos= should not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0de16b913b
Коммит
b03bdcd64f
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Mon Jan 21 08:25:30 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (ruby_stop): should not trace error handler.
|
||||
|
||||
* signal.c (install_sighandler): do not install sighandler unless
|
||||
the old value is SIG_DFL.
|
||||
|
||||
* io.c (io_write): should not raise exception on O_NONBLOCK io.
|
||||
|
||||
* dir.c (dir_set_pos): seek should return dir, pos= should not.
|
||||
|
||||
Sat Jan 19 02:31:45 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_eval): need not to clar method cache for NODE_CLASS,
|
||||
|
|
12
dir.c
12
dir.c
|
@ -389,12 +389,20 @@ dir_seek(dir, pos)
|
|||
#ifdef HAVE_SEEKDIR
|
||||
GetDIR(dir, dirp);
|
||||
seekdir(dirp->dir, NUM2INT(pos));
|
||||
return pos;
|
||||
return dir;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
dir_set_pos(dir, pos)
|
||||
VALUE dir, pos;
|
||||
{
|
||||
dir_seek(dir, pos);
|
||||
return pos;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
dir_rewind(dir)
|
||||
VALUE dir;
|
||||
|
@ -1004,7 +1012,7 @@ Init_Dir()
|
|||
rb_define_method(rb_cDir,"tell", dir_tell, 0);
|
||||
rb_define_method(rb_cDir,"seek", dir_seek, 1);
|
||||
rb_define_method(rb_cDir,"pos", dir_tell, 0);
|
||||
rb_define_method(rb_cDir,"pos=", dir_seek, 1);
|
||||
rb_define_method(rb_cDir,"pos=", dir_set_pos, 1);
|
||||
rb_define_method(rb_cDir,"close", dir_close, 0);
|
||||
|
||||
rb_define_singleton_method(rb_cDir,"chdir", dir_s_chdir, -1);
|
||||
|
|
2
eval.c
2
eval.c
|
@ -1193,6 +1193,8 @@ ruby_stop(ex)
|
|||
POP_ITER();
|
||||
POP_TAG();
|
||||
|
||||
trace_func = 0;
|
||||
tracing = 0;
|
||||
ex = error_handle(ex);
|
||||
ruby_finalize();
|
||||
exit(ex);
|
||||
|
|
6
io.c
6
io.c
|
@ -255,14 +255,14 @@ io_write(io, str)
|
|||
n = (int)RSTRING(str)->len;
|
||||
while (--n >= 0)
|
||||
if (fputc(*ptr++, f) == EOF)
|
||||
rb_sys_fail(fptr->path);
|
||||
break;
|
||||
n = ptr - RSTRING(str)->ptr;
|
||||
}
|
||||
if (ferror(f))
|
||||
if (n == 0 && ferror(f))
|
||||
rb_sys_fail(fptr->path);
|
||||
#else
|
||||
n = fwrite(RSTRING(str)->ptr, 1, RSTRING(str)->len, f);
|
||||
if (ferror(f)) {
|
||||
if (n == 0 && ferror(f)) {
|
||||
rb_sys_fail(fptr->path);
|
||||
}
|
||||
#endif
|
||||
|
|
5
parse.y
5
parse.y
|
@ -4288,6 +4288,11 @@ gettable(id)
|
|||
if (dyna_in_block() && rb_dvar_defined(id)) return NEW_DVAR(id);
|
||||
if (local_id(id)) return NEW_LVAR(id);
|
||||
/* method call without arguments */
|
||||
#if 0
|
||||
/* Rite will warn this */
|
||||
rb_warn("ambiguous identifier; %s() or self.%s is better for method call",
|
||||
rb_id2name(id), rb_id2name(id));
|
||||
#endif
|
||||
return NEW_VCALL(id);
|
||||
}
|
||||
else if (is_global_id(id)) {
|
||||
|
|
67
signal.c
67
signal.c
|
@ -282,12 +282,14 @@ rb_gc_mark_trap_list()
|
|||
}
|
||||
|
||||
#ifdef POSIX_SIGNAL
|
||||
void
|
||||
posix_signal(signum, handler)
|
||||
typedef RETSIGTYPE (*sighandler_t)_((int));
|
||||
|
||||
static sighandler_t
|
||||
ruby_signal(signum, handler)
|
||||
int signum;
|
||||
RETSIGTYPE (*handler)_((int));
|
||||
sighandler_t handler;
|
||||
{
|
||||
struct sigaction sigact;
|
||||
struct sigaction sigact, old;
|
||||
|
||||
sigact.sa_handler = handler;
|
||||
sigemptyset(&sigact.sa_mask);
|
||||
|
@ -304,11 +306,19 @@ posix_signal(signum, handler)
|
|||
if (signum == SIGCHLD && handler == SIG_IGN)
|
||||
sigact.sa_flags |= SA_NOCLDWAIT;
|
||||
#endif
|
||||
sigaction(signum, &sigact, 0);
|
||||
sigaction(signum, &sigact, &old);
|
||||
return old.sa_handler;
|
||||
}
|
||||
|
||||
void
|
||||
posix_signal(signum, handler)
|
||||
int signum;
|
||||
sighandler_t handler;
|
||||
{
|
||||
ruby_signal(signum, handler);
|
||||
}
|
||||
#define ruby_signal(sig,handle) posix_signal((sig),(handle))
|
||||
#else
|
||||
#define ruby_signal(sig,handle) signal((sig),(handle))
|
||||
#define ruby_signal(sig,handler) signal((sig),(handler))
|
||||
#endif
|
||||
|
||||
static void signal_exec _((int sig));
|
||||
|
@ -345,9 +355,9 @@ signal_exec(sig)
|
|||
}
|
||||
}
|
||||
|
||||
static RETSIGTYPE sighandle _((int));
|
||||
static RETSIGTYPE sighandler _((int));
|
||||
static RETSIGTYPE
|
||||
sighandle(sig)
|
||||
sighandler(sig)
|
||||
int sig;
|
||||
{
|
||||
#ifdef NT
|
||||
|
@ -361,7 +371,7 @@ sighandle(sig)
|
|||
}
|
||||
|
||||
#if !defined(BSD_SIGNAL) && !defined(POSIX_SIGNAL)
|
||||
ruby_signal(sig, sighandle);
|
||||
ruby_signal(sig, sighandler);
|
||||
#endif
|
||||
|
||||
if (ATOMIC_TEST(rb_trap_immediate)) {
|
||||
|
@ -462,12 +472,12 @@ static VALUE
|
|||
trap(arg)
|
||||
struct trap_arg *arg;
|
||||
{
|
||||
RETSIGTYPE (*func)_((int));
|
||||
sighandler_t func;
|
||||
VALUE command, old;
|
||||
int sig;
|
||||
char *s;
|
||||
|
||||
func = sighandle;
|
||||
func = sighandler;
|
||||
command = arg->cmd;
|
||||
if (NIL_P(command)) {
|
||||
func = SIG_IGN;
|
||||
|
@ -550,7 +560,7 @@ trap(arg)
|
|||
#ifdef SIGUSR2
|
||||
case SIGUSR2:
|
||||
#endif
|
||||
func = sighandle;
|
||||
func = sighandler;
|
||||
break;
|
||||
#ifdef SIGBUS
|
||||
case SIGBUS:
|
||||
|
@ -663,6 +673,19 @@ sig_list()
|
|||
return h;
|
||||
}
|
||||
|
||||
static void
|
||||
install_sighandler(signum, handler)
|
||||
int signum;
|
||||
sighandler_t handler;
|
||||
{
|
||||
sighandler_t old;
|
||||
|
||||
old = ruby_signal(signum, handler);
|
||||
if (old != SIG_DFL) {
|
||||
ruby_signal(signum, old);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Init_signal()
|
||||
{
|
||||
|
@ -673,31 +696,31 @@ Init_signal()
|
|||
rb_define_module_function(mSignal, "trap", sig_trap, -1);
|
||||
rb_define_module_function(mSignal, "list", sig_list, 0);
|
||||
|
||||
ruby_signal(SIGINT, sighandle);
|
||||
install_sighandler(SIGINT, sighandler);
|
||||
#ifdef SIGHUP
|
||||
ruby_signal(SIGHUP, sighandle);
|
||||
install_sighandler(SIGHUP, sighandler);
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
ruby_signal(SIGQUIT, sighandle);
|
||||
install_sighandler(SIGQUIT, sighandler);
|
||||
#endif
|
||||
#ifdef SIGALRM
|
||||
ruby_signal(SIGALRM, sighandle);
|
||||
install_sighandler(SIGALRM, sighandler);
|
||||
#endif
|
||||
#ifdef SIGUSR1
|
||||
ruby_signal(SIGUSR1, sighandle);
|
||||
install_sighandler(SIGUSR1, sighandler);
|
||||
#endif
|
||||
#ifdef SIGUSR2
|
||||
ruby_signal(SIGUSR2, sighandle);
|
||||
install_sighandler(SIGUSR2, sighandler);
|
||||
#endif
|
||||
|
||||
#ifdef SIGBUS
|
||||
ruby_signal(SIGBUS, sigbus);
|
||||
install_sighandler(SIGBUS, sigbus);
|
||||
#endif
|
||||
#ifdef SIGSEGV
|
||||
ruby_signal(SIGSEGV, sigsegv);
|
||||
install_sighandler(SIGSEGV, sigsegv);
|
||||
#endif
|
||||
#ifdef SIGPIPE
|
||||
ruby_signal(SIGPIPE, sigpipe);
|
||||
install_sighandler(SIGPIPE, sigpipe);
|
||||
#endif
|
||||
#endif /* MACOS_UNUSE_SIGNAL */
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче