зеркало из https://github.com/github/ruby.git
* ext/pty/pty.c (establishShell): parent pid is not used.
* ext/pty/pty.c (freeDevice): not used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
006f77a2f1
Коммит
b1ad30b2f7
|
@ -1,4 +1,4 @@
|
||||||
Sat Sep 16 16:14:40 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Jan 16 16:20:35 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* Makefile.in, common.in, instruby.rb, ext/extmk.rb, lib/mkmf.rb:
|
* Makefile.in, common.in, instruby.rb, ext/extmk.rb, lib/mkmf.rb:
|
||||||
use instruby.rb to install extensions instead of ext/extmk.rb.
|
use instruby.rb to install extensions instead of ext/extmk.rb.
|
||||||
|
@ -9,6 +9,10 @@ Sat Sep 16 16:14:40 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/io/wait/extconf.rb: suspicious checking_for.
|
* ext/io/wait/extconf.rb: suspicious checking_for.
|
||||||
|
|
||||||
|
* ext/pty/pty.c (establishShell): parent pid is not used.
|
||||||
|
|
||||||
|
* ext/pty/pty.c (freeDevice): not used.
|
||||||
|
|
||||||
Sat Sep 16 11:03:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Sat Sep 16 11:03:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* array.c (ary_shared_first): should create embedded copies
|
* array.c (ary_shared_first): should create embedded copies
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#ifdef RUBY_EXTCONF_H
|
||||||
|
#include RUBY_EXTCONF_H
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -62,7 +65,7 @@ char *MasterDevice = "/dev/ptym/pty%s",
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
#elif defined(_IBMESA) /* AIX/ESA */
|
#elif defined(_IBMESA) /* AIX/ESA */
|
||||||
static
|
static
|
||||||
char *MasterDevice = "/dev/ptyp%s",
|
char *MasterDevice = "/dev/ptyp%s",
|
||||||
*SlaveDevice = "/dev/ttyp%s",
|
*SlaveDevice = "/dev/ttyp%s",
|
||||||
*deviceNo[] = {
|
*deviceNo[] = {
|
||||||
|
@ -84,7 +87,7 @@ char *MasterDevice = "/dev/ptyp%s",
|
||||||
"f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff",
|
"f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff",
|
||||||
};
|
};
|
||||||
#elif !defined(HAVE_PTSNAME)
|
#elif !defined(HAVE_PTSNAME)
|
||||||
static
|
static
|
||||||
char *MasterDevice = "/dev/pty%s",
|
char *MasterDevice = "/dev/pty%s",
|
||||||
*SlaveDevice = "/dev/tty%s",
|
*SlaveDevice = "/dev/tty%s",
|
||||||
*deviceNo[] = {
|
*deviceNo[] = {
|
||||||
|
@ -136,7 +139,7 @@ raise_from_wait(char *state, struct pty_info *info)
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
VALUE exc;
|
VALUE exc;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "pty - %s: %d", state, info->child_pid);
|
snprintf(buf, sizeof(buf), "pty - %s: %ld", state, (long)info->child_pid);
|
||||||
exc = rb_exc_new2(eChildExited, buf);
|
exc = rb_exc_new2(eChildExited, buf);
|
||||||
rb_iv_set(exc, "status", rb_last_status);
|
rb_iv_set(exc, "status", rb_last_status);
|
||||||
rb_funcall(info->thread, rb_intern("raise"), 1, exc);
|
rb_funcall(info->thread, rb_intern("raise"), 1, exc);
|
||||||
|
@ -172,7 +175,7 @@ pty_syswait(struct pty_info *info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getDevice _((int*, int*));
|
static void getDevice(int*, int*);
|
||||||
|
|
||||||
struct exec_info {
|
struct exec_info {
|
||||||
int argc;
|
int argc;
|
||||||
|
@ -180,15 +183,16 @@ struct exec_info {
|
||||||
};
|
};
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
pty_exec(struct exec_info *arg)
|
pty_exec(VALUE v)
|
||||||
{
|
{
|
||||||
|
struct exec_info *arg = (struct exec_info *)v;
|
||||||
return rb_f_exec(arg->argc, arg->argv);
|
return rb_f_exec(arg->argc, arg->argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
establishShell(int argc, VALUE *argv, struct pty_info *info)
|
establishShell(int argc, VALUE *argv, struct pty_info *info)
|
||||||
{
|
{
|
||||||
static int i,master,slave,currentPid;
|
int i,master,slave;
|
||||||
char *p,*getenv();
|
char *p,*getenv();
|
||||||
struct passwd *pwent;
|
struct passwd *pwent;
|
||||||
VALUE v;
|
VALUE v;
|
||||||
|
@ -215,7 +219,6 @@ establishShell(int argc, VALUE *argv, struct pty_info *info)
|
||||||
getDevice(&master,&slave);
|
getDevice(&master,&slave);
|
||||||
|
|
||||||
info->thread = rb_thread_current();
|
info->thread = rb_thread_current();
|
||||||
currentPid = getpid();
|
|
||||||
if((i = fork()) < 0) {
|
if((i = fork()) < 0) {
|
||||||
close(master);
|
close(master);
|
||||||
close(slave);
|
close(slave);
|
||||||
|
@ -223,8 +226,6 @@ establishShell(int argc, VALUE *argv, struct pty_info *info)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i == 0) { /* child */
|
if(i == 0) { /* child */
|
||||||
currentPid = getpid();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set free from process group and controlling terminal
|
* Set free from process group and controlling terminal
|
||||||
*/
|
*/
|
||||||
|
@ -236,7 +237,7 @@ establishShell(int argc, VALUE *argv, struct pty_info *info)
|
||||||
if (setpgrp() == -1)
|
if (setpgrp() == -1)
|
||||||
perror("setpgrp()");
|
perror("setpgrp()");
|
||||||
# else /* SETGRP_VOID */
|
# else /* SETGRP_VOID */
|
||||||
if (setpgrp(0, currentPid) == -1)
|
if (setpgrp(0, getpid()) == -1)
|
||||||
rb_sys_fail("setpgrp()");
|
rb_sys_fail("setpgrp()");
|
||||||
if ((i = open("/dev/tty", O_RDONLY)) < 0)
|
if ((i = open("/dev/tty", O_RDONLY)) < 0)
|
||||||
rb_sys_fail("/dev/tty");
|
rb_sys_fail("/dev/tty");
|
||||||
|
@ -393,13 +394,6 @@ getDevice(int *master, int *slave)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
freeDevice()
|
|
||||||
{
|
|
||||||
chmod(SlaveName, 0666);
|
|
||||||
chown(SlaveName, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ruby function: getpty */
|
/* ruby function: getpty */
|
||||||
static VALUE
|
static VALUE
|
||||||
pty_getpty(int argc, VALUE *argv, VALUE self)
|
pty_getpty(int argc, VALUE *argv, VALUE self)
|
||||||
|
@ -410,7 +404,7 @@ pty_getpty(int argc, VALUE *argv, VALUE self)
|
||||||
OpenFile *wfptr,*rfptr;
|
OpenFile *wfptr,*rfptr;
|
||||||
VALUE rport = rb_obj_alloc(rb_cFile);
|
VALUE rport = rb_obj_alloc(rb_cFile);
|
||||||
VALUE wport = rb_obj_alloc(rb_cFile);
|
VALUE wport = rb_obj_alloc(rb_cFile);
|
||||||
|
|
||||||
MakeOpenFile(rport, rfptr);
|
MakeOpenFile(rport, rfptr);
|
||||||
MakeOpenFile(wport, wfptr);
|
MakeOpenFile(wport, wfptr);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче