summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog59
-rw-r--r--eval.c32
-rw-r--r--ext/socket/socket.c1
-rw-r--r--rubysig.h8
-rw-r--r--sample/svr.rb2
-rw-r--r--sample/tsvr.rb2
-rw-r--r--version.h4
-rw-r--r--win32/win32.c36
-rw-r--r--win32/win32.h7
9 files changed, 100 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index d97eef3..a200fdc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+Thu Nov 16 14:58:00 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/socket/socket.c (sock_new): duplicates file descriptor
+ with myfddup() on mswin32/mingw32.
+
+ * win32/win32.h: uses system original fdopen().
+
+ * win32/win32.c (myfddup): newly added instead of myfdopen().
+
+ * win32/win32.c (mybind, myconnect, mygetsockname, mygetsockopt,
+ mylisten, mysetsockopt): now accept file descriptor only, not
+ SOCKET.
+
+ * win32/win32.c (myaccept, mysocket): return file descriptor,
+ instead of SOCKET.
+
+Thu Nov 16 10:23:24 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (massign): too strict check for nameless rest argument.
+
+ * eval.c (method_arity): mere * should return -1.
+
+ * eval.c (intersect_fds): should check all FDs in the fd_set.
+
+Wed Nov 15 19:33:20 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_attr): should clear method cache before calling hook.
+
+ * eval.c (rb_eval): ditto.
+
+ * eval.c (rb_mod_modfunc): ditto.
+
Mon Nov 13 22:44:52 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* error.c (rb_bug): print version to stderr.
@@ -10,13 +42,38 @@ Mon Nov 13 19:02:08 2000 WATANABE Hirofumi <eban@ruby-lang.org>
Sat Nov 11 22:57:38 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (arg): uniformed treatment of -a**b, where a is a
- number literal; hacky but behavior appears uniformed.
+ number literal; hacky but behavior appears more consistent.
* parse.y (newline_node): reduce newline node (one per line).
* random.c (rb_f_srand): should be prohibited in safe level
greater than 4.
+Sat Nov 11 22:37:36 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * rubysig.h: do not use rb_trap_immediate on win32.
+
+ * rubysig.h: new macros, ATOMIC_TEST, ATOMIC_SET, ATOMIC_INC,
+ ATOMIC_DEC, RUBY_CRITICAL and new definition of TRAP_BEG,
+ TRAP_END.
+
+ * gc.c (ruby_xmalloc): should wrap malloc() by RUBY_CRITICAL.
+
+ * signal.c (sighandle): better win32 sig handling.
+
+ * win32/win32.c (flock): better implementation.
+
+ * win32/win32.c (myselect): ditto.
+
+ * win32/win32.c (myaccept): ditto.
+
+ * win32/win32.c (waitpid): ditto.
+
+ * win32/win32.c (myrename): ditto.
+
+ * win32/win32.c (wait_events): support function for win32 signal
+ handling.
+
Sat Nov 11 08:34:18 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.31.
diff --git a/eval.c b/eval.c
index 2320903..2a2423e 100644
--- a/eval.c
+++ b/eval.c
@@ -477,15 +477,15 @@ rb_attr(klass, id, read, write, ex)
attriv = rb_intern(buf);
if (read) {
rb_add_method(klass, id, NEW_IVAR(attriv), noex);
- rb_funcall(klass, added, 1, ID2SYM(id));
rb_clear_cache_by_id(id);
+ rb_funcall(klass, added, 1, ID2SYM(id));
}
sprintf(buf, "%s=", name);
id = rb_intern(buf);
if (write) {
rb_add_method(klass, id, NEW_ATTRSET(attriv), noex);
- rb_funcall(klass, added, 1, ID2SYM(id));
rb_clear_cache_by_id(id);
+ rb_funcall(klass, added, 1, ID2SYM(id));
}
}
@@ -2855,12 +2855,12 @@ rb_eval(self, n)
noex |= NOEX_UNDEF;
}
rb_add_method(ruby_class, node->nd_mid, node->nd_defn, noex);
+ rb_clear_cache_by_id(node->nd_mid);
if (scope_vmode == SCOPE_MODFUNC) {
rb_add_method(rb_singleton_class(ruby_class),
node->nd_mid, node->nd_defn, NOEX_PUBLIC);
rb_funcall(ruby_class, singleton_added, 1, ID2SYM(node->nd_mid));
}
- rb_clear_cache_by_id(node->nd_mid);
if (FL_TEST(ruby_class, FL_SINGLETON)) {
rb_funcall(rb_iv_get(ruby_class, "__attached__"),
singleton_added, 1, ID2SYM(node->nd_mid));
@@ -2900,8 +2900,8 @@ rb_eval(self, n)
}
rb_add_method(klass, node->nd_mid, node->nd_defn,
NOEX_PUBLIC|(body?body->nd_noex&NOEX_UNDEF:0));
- rb_funcall(recv, singleton_added, 1, ID2SYM(node->nd_mid));
rb_clear_cache_by_id(node->nd_mid);
+ rb_funcall(recv, singleton_added, 1, ID2SYM(node->nd_mid));
result = Qnil;
}
break;
@@ -3564,9 +3564,7 @@ massign(self, node, val, check)
if (check && list) goto arg_error;
if (node->nd_args) {
if (node->nd_args == (NODE*)-1) {
- if (check) {
- goto arg_error;
- }
+ /* no check for mere `*' */
}
else if (!list && i<len) {
assign(self, node->nd_args, rb_ary_new4(len-i, RARRAY(val)->ptr+i), check);
@@ -5374,8 +5372,8 @@ rb_mod_modfunc(argc, argv, module)
rb_bug("undefined method `%s'; can't happen", rb_id2name(id));
}
rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC);
- rb_funcall(module, singleton_added, 1, ID2SYM(id));
rb_clear_cache_by_id(id);
+ rb_funcall(module, singleton_added, 1, ID2SYM(id));
}
return module;
}
@@ -6428,7 +6426,7 @@ method_arity(method)
body = body->nd_head;
if (!body) return INT2FIX(0);
n = body->nd_cnt;
- if (body->nd_opt || body->nd_rest >= 0)
+ if (body->nd_opt || body->nd_rest != -1)
n = -n-1;
return INT2FIX(n);
}
@@ -6980,26 +6978,24 @@ match_fds(dst, src, max)
return Qfalse;
}
-static int
-intersect_fds(dst, src, max)
- fd_set *dst, *src;
+static void
+intersect_fds(src, dst, max)
+ fd_set *src, *dst;
int max;
{
int i;
for (i=0; i<=max; i++) {
- if (FD_ISSET(i, src)) {
- if (FD_ISSET(i, dst)) {
+ if (FD_ISSET(i, dst)) {
+ if (FD_ISSET(i, src)) {
/* Wake up only one thread per fd. */
- FD_CLR(i, dst);
+ FD_CLR(i, src);
}
else {
- FD_CLR(i, src);
+ FD_CLR(i, dst);
}
- return Qtrue;
}
}
- return Qfalse;
}
static int
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index b815c3f..e77e3d6 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -182,6 +182,7 @@ sock_new(class, fd)
fp->f = rb_fdopen(fd, "r");
#ifdef NT
fp->finalize = sock_finalize;
+ fd = myfddup(fd);
#else
fd = dup(fd);
#endif
diff --git a/rubysig.h b/rubysig.h
index 88b3083..1975215 100644
--- a/rubysig.h
+++ b/rubysig.h
@@ -37,8 +37,12 @@ typedef int rb_atomic_t;
# define ATOMIC_INC(var) (++(var))
# define ATOMIC_DEC(var) (--(var))
-# define TRAP_BEG (rb_trap_immediate=1)
-# define TRAP_END (rb_trap_immediate=0)
+# define TRAP_BEG do {\
+ int trap_immediate = rb_trap_immediate;\
+ rb_trap_immediate = 1;
+# define TRAP_END rb_trap_immediate = trap_immediate;\
+} while (0)
+
# define RUBY_CRITICAL(statements) do {\
int trap_immediate = rb_trap_immediate;\
rb_trap_immediate = 0;\
diff --git a/sample/svr.rb b/sample/svr.rb
index c866407..af56605 100644
--- a/sample/svr.rb
+++ b/sample/svr.rb
@@ -6,7 +6,7 @@ require "socket"
gs = TCPserver.open(0)
addr = gs.addr
addr.shift
-printf("server is on %d\n", addr.join(":"))
+printf("server is on %s\n", addr.join(":"))
socks = [gs]
while TRUE
diff --git a/sample/tsvr.rb b/sample/tsvr.rb
index ebfad4b..8b019bd 100644
--- a/sample/tsvr.rb
+++ b/sample/tsvr.rb
@@ -6,7 +6,7 @@ require "socket"
gs = TCPserver.open(0)
addr = gs.addr
addr.shift
-printf("server is on %d\n", addr.join(":"))
+printf("server is on %s\n", addr.join(":"))
while TRUE
Thread.start(gs.accept) do |s|
diff --git a/version.h b/version.h
index d731091..acb980b 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.6.2"
-#define RUBY_RELEASE_DATE "2000-11-14"
+#define RUBY_RELEASE_DATE "2000-11-16"
#define RUBY_VERSION_CODE 162
-#define RUBY_RELEASE_CODE 20001114
+#define RUBY_RELEASE_CODE 20001116
diff --git a/win32/win32.c b/win32/win32.c
index 74c18aa..9e2eb2f 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1726,6 +1726,8 @@ my_open_osfhandle(long osfhandle, int flags)
return fh; /* return handle */
}
+#undef getsockopt
+
static int
is_socket(SOCKET fd)
{
@@ -1750,18 +1752,15 @@ is_socket(SOCKET fd)
return TRUE;
}
-FILE *
-myfdopen (int fd, const char *mode)
+int
+myfddup (int fd)
{
- if (is_socket((SOCKET)fd)) {
- int fh;
+ SOCKET s = TO_SOCKET(fd);
- fh = my_open_osfhandle((SOCKET)fd, O_RDWR|O_BINARY);
- return _fdopen(fh, mode); // return file pointer
- }
- else {
- return (_fdopen(fd, mode));
- }
+ if (s == -1)
+ return -1;
+
+ return my_open_osfhandle(s, O_RDWR|O_BINARY);
}
@@ -2056,14 +2055,13 @@ SOCKET
myaccept (SOCKET s, struct sockaddr *addr, int *addrlen)
{
SOCKET r;
- int trap_immediate = rb_trap_immediate;
if (!NtSocketsInitialized++) {
StartSockets();
}
if ((r = accept (TO_SOCKET(s), addr, addrlen)) == INVALID_SOCKET)
errno = WSAGetLastError();
- return r;
+ return my_open_osfhandle(r, O_RDWR|O_BINARY);
}
#undef bind
@@ -2076,7 +2074,7 @@ mybind (SOCKET s, struct sockaddr *addr, int addrlen)
if (!NtSocketsInitialized++) {
StartSockets();
}
- if ((r = bind (s, addr, addrlen)) == SOCKET_ERROR)
+ if ((r = bind (TO_SOCKET(s), addr, addrlen)) == SOCKET_ERROR)
errno = WSAGetLastError();
return r;
}
@@ -2090,7 +2088,7 @@ myconnect (SOCKET s, struct sockaddr *addr, int addrlen)
if (!NtSocketsInitialized++) {
StartSockets();
}
- if ((r = connect (s, addr, addrlen)) == SOCKET_ERROR)
+ if ((r = connect (TO_SOCKET(s), addr, addrlen)) == SOCKET_ERROR)
errno = WSAGetLastError();
return r;
}
@@ -2124,8 +2122,6 @@ mygetsockname (SOCKET s, struct sockaddr *addr, int *addrlen)
return r;
}
-#undef getsockopt
-
int
mygetsockopt (SOCKET s, int level, int optname, char *optval, int *optlen)
{
@@ -2133,7 +2129,7 @@ mygetsockopt (SOCKET s, int level, int optname, char *optval, int *optlen)
if (!NtSocketsInitialized++) {
StartSockets();
}
- if ((r = getsockopt (s, level, optname, optval, optlen)) == SOCKET_ERROR)
+ if ((r = getsockopt (TO_SOCKET(s), level, optname, optval, optlen)) == SOCKET_ERROR)
errno = WSAGetLastError();
return r;
}
@@ -2161,7 +2157,7 @@ mylisten (SOCKET s, int backlog)
if (!NtSocketsInitialized++) {
StartSockets();
}
- if ((r = listen (s, backlog)) == SOCKET_ERROR)
+ if ((r = listen (TO_SOCKET(s), backlog)) == SOCKET_ERROR)
errno = WSAGetLastError();
return r;
}
@@ -2233,7 +2229,7 @@ mysetsockopt (SOCKET s, int level, int optname, char *optval, int optlen)
if (!NtSocketsInitialized++) {
StartSockets();
}
- if ((r = setsockopt (s, level, optname, optval, optlen))
+ if ((r = setsockopt (TO_SOCKET(s), level, optname, optval, optlen))
== SOCKET_ERROR)
errno = WSAGetLastError();
return r;
@@ -2266,7 +2262,7 @@ mysocket (int af, int type, int protocol)
errno = WSAGetLastError();
//fprintf(stderr, "socket fail (%d)", WSAGetLastError());
}
- return s;
+ return my_open_osfhandle(s, O_RDWR|O_BINARY);
}
#undef gethostbyaddr
diff --git a/win32/win32.h b/win32/win32.h
index 2976781..ebffc5c 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -177,7 +177,7 @@ extern char *NtGetBin(void);
extern FILE *mypopen(char *, char *);
extern int mypclose(FILE *);
extern int flock(int fd, int oper);
-extern FILE * myfdopen(int, const char *);
+extern int myfddup(int);
extern void myfdclose(FILE *);
extern SOCKET myaccept(SOCKET, struct sockaddr *, int *);
extern int mybind(SOCKET, struct sockaddr *, int);
@@ -267,11 +267,6 @@ extern char *mystrerror(int);
/* #undef va_start */
/* #undef va_end */
-#ifdef fdopen
-#undef fdopen
-#endif
-#define fdopen myfdopen
-
#ifdef accept
#undef accept
#endif