From 6dbfc28698697b8da36465c76b58be605910a4cf Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 17 Jun 2002 05:19:36 +0000 Subject: [PATCH] Implement server_channel_n_read, which is required by the runtime system to use server sockets. --- v7/src/microcode/ntapi.h | 9 ++++++--- v7/src/microcode/ntsock.c | 19 ++++++++++++++++--- v7/src/microcode/version.h | 8 ++++---- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/v7/src/microcode/ntapi.h b/v7/src/microcode/ntapi.h index 6fb0b6a83..ac79b0738 100644 --- a/v7/src/microcode/ntapi.h +++ b/v7/src/microcode/ntapi.h @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: ntapi.h,v 1.12 2000/05/20 18:59:11 cph Exp $ +$Id: ntapi.h,v 1.13 2002/06/17 05:19:06 cph Exp $ -Copyright (c) 1997, 1999 Massachusetts Institute of Technology +Copyright (c) 1997, 1999, 2002 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. */ /* This flag, defined by "syscall.h", means to define the syscall @@ -83,6 +84,7 @@ enum syscall_names apicall_ioctlsocket, apicall_listen, apicall_recv, + apicall_select, apicall_send, apicall_socket, @@ -942,6 +944,7 @@ static char * syscall_names_table [] = "listen", "recv", "send", + "select", "socket", /* C Library's unix-style procedures: */ diff --git a/v7/src/microcode/ntsock.c b/v7/src/microcode/ntsock.c index e589436ff..1ec009d9a 100644 --- a/v7/src/microcode/ntsock.c +++ b/v7/src/microcode/ntsock.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: ntsock.c,v 1.12 2002/04/23 13:47:30 cph Exp $ +$Id: ntsock.c,v 1.13 2002/06/17 05:18:29 cph Exp $ Copyright (c) 1997-2002 Massachusetts Institute of Technology @@ -311,11 +311,24 @@ server_channel_write (Tchannel channel, const void * buffer, return (0); } +/* The runtime system uses this procedure to decide whether an + accept() call will block. So test the socket with select() and + return a one-bit answer. */ + static long server_channel_n_read (Tchannel channel) { - error_external_return (); - return (0); + fd_set fds; + struct timeval tv; + int ret; + + FD_ZERO (&fds); + FD_SET ((CHANNEL_SOCKET (channel)), (&fds)); + (tv . tv_sec) = 0; + (tv . tv_usec) = 0; + VALUE_SOCKET_CALL (select, (1, (&fds), 0, 0, (&tv)), ret); + /* Zero bytes available means "accept would block", so return -1. */ + return ((ret == 0) ? (-1) : 1); } void diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index 8c74ae13c..f6eb6b194 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: version.h,v 11.183 2001/12/21 04:36:27 cph Exp $ +$Id: version.h,v 11.184 2002/06/17 05:19:36 cph Exp $ -Copyright (c) 1988-2001 Massachusetts Institute of Technology +Copyright (c) 1988-2002 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ USA. /* Scheme system release version */ #ifndef SCHEME_RELEASE -#define SCHEME_RELEASE "7.7.0" +#define SCHEME_RELEASE "7.7.1" #endif /* Microcode release version */ @@ -34,5 +34,5 @@ USA. #define SCHEME_VERSION 14 #endif #ifndef SCHEME_SUBVERSION -#define SCHEME_SUBVERSION 8 +#define SCHEME_SUBVERSION 9 #endif -- 2.25.1