pkg://FreeWnn-1.11-36.3.src.rpm:2903296/FreeWnn-1.1.1-a017-jserver-64bit-128387.patch
info downloads
diff -rU4 -p FreeWnn-1.1.1-a017/Xsi/Wnn/jserver/de.c FreeWnn-1.1.1-a017-selectfix/Xsi/Wnn/jserver/de.c
--- FreeWnn-1.1.1-a017/Xsi/Wnn/jserver/de.c 2004-06-08 18:54:21.000000000 -0400
+++ FreeWnn-1.1.1-a017-selectfix/Xsi/Wnn/jserver/de.c 2004-06-08 18:52:29.000000000 -0400
@@ -158,24 +158,21 @@ static char rcv_buf[S_BUF_SIZ];
int clientp; /** cblkの有効なデータの最後を差している **/
int cur_clp; /** 現在のクライアントの番号 **/
-static int *all_socks; /** ビットパターン
+static fd_set *all_socks; /** ビットパターン
which jserver to select を保持 **/
-static int *ready_socks; /** データのきているソケットの
+static fd_set *ready_socks; /** データのきているソケットの
ビットパターンを保持 **/
-static int *dummy1_socks, *dummy2_socks;
+static fd_set *dummy1_socks, *dummy2_socks;
static int no_of_ready_socks;
-static int sel_bwidth, /** bit width of all_socks **/
- sel_width; /** byte width of all_socks **/
static int nofile; /** No. of files **/
#define BINTSIZE (sizeof(int)*8)
#define sock_set(array,pos) (array[pos/BINTSIZE] |= (1<<(pos%BINTSIZE)))
#define sock_clr(array,pos) (array[pos/BINTSIZE] &= ~(1<<(pos%BINTSIZE)))
-#define sock_tst(array,pos) (array[pos/BINTSIZE] & (1<<(pos%BINTSIZE)))
struct msg_cat *wnn_msg_cat;
struct msg_cat *js_msg_cat;
@@ -350,27 +347,23 @@ demon_main ()
*/
void
socket_disc_init ()
{
- int sel_w; /* long word(==int) width of all_socks */
nofile = NOFILE;
- sel_w = (nofile - 1) / BINTSIZE + 1;
- all_socks = (int *) calloc (sel_w, (sizeof (int)));
- ready_socks = (int *) malloc (sel_w * (sizeof (int)));
- dummy1_socks = (int *) malloc (sel_w * (sizeof (int)));
- dummy2_socks = (int *) malloc (sel_w * (sizeof (int)));
- sel_width = sel_w * sizeof (int); /* byte width */
- sel_bwidth = sel_width * 8; /* bit width */
+ all_socks = (fd_set *) malloc (sizeof (fd_set));
+ ready_socks = (fd_set *) malloc (sizeof (fd_set));
+ dummy1_socks = (fd_set *) malloc (sizeof (fd_set));
+ dummy2_socks = (fd_set *) malloc (sizeof (fd_set));
}
/** 全てのソケットについて待つ **/
static void
sel_all ()
{
- bcopy (all_socks, ready_socks, sel_width);
- bzero (dummy1_socks, sel_width);
- bzero (dummy2_socks, sel_width);
+ memcpy (ready_socks, all_socks, sizeof(fd_set));
+ FD_ZERO(dummy1_socks);
+ FD_ZERO(dummy2_socks);
top:
errno = 0;
if ((no_of_ready_socks = select (nofile, ready_socks, dummy1_socks, dummy2_socks, 0)) == -1)
@@ -401,11 +394,11 @@ get_client ()
return -1;
i++;
if (i >= clientp)
i = 0;
- if (sock_tst (ready_socks, cblk[i].sd))
+ if (FD_ISSET(cblk[i].sd,ready_socks))
{
- sock_clr (ready_socks, cblk[i].sd);
+ FD_CLR(cblk[i].sd,ready_socks);
no_of_ready_socks--;
return cur_clp = i;
}
}
@@ -420,11 +413,11 @@ new_client () /* NewCl
register int full, i;
FILE *f[3];
char gomi[1024];
#ifdef AF_UNIX
- if ((serverNO == 0) && (sock_tst (ready_socks, accept_blk[UNIX_ACPT].sd)))
+ if ((serverNO == 0) && (FD_ISSET(accept_blk[UNIX_ACPT].sd, ready_socks)))
{
- sock_clr (ready_socks, accept_blk[UNIX_ACPT].sd);
+ FD_CLR(accept_blk[UNIX_ACPT].sd,ready_socks);
no_of_ready_socks--;
sd = socket_accept ();
}
else
@@ -473,9 +466,9 @@ new_client () /* NewCl
return;
}
cblk[clientp].sd = sd;
- sock_set (all_socks, sd);
+ FD_SET(sd, all_socks);
for (i = 0; i < WNN_MAX_ENV_OF_A_CLIENT; i++)
{
(client[clientp].env)[i] = -1;
}
@@ -487,9 +480,9 @@ new_client () /* NewCl
void
del_client ()
{
disconnect_all_env_of_client ();
- sock_clr (all_socks, cblk[cur_clp].sd);
+ FD_CLR(cblk[cur_clp].sd, all_socks);
#ifdef HAVE_CLOSESOCKET
closesocket (cblk[cur_clp].sd);
#else
close (cblk[cur_clp].sd);
@@ -616,9 +609,9 @@ demon_fin ()
#endif /* AF_UNIX */
#else
if ((fd != sock_d_un) &&
#endif
- sock_tst (all_socks, fd))
+ FD_ISSET(fd,all_socks))
{
shutdown (fd, 2);
#ifdef HAVE_CLOSESOCKET
closesocket (fd);
@@ -916,9 +909,9 @@ socket_init ()
#ifdef DEBUG
error1 ("sock_d_un = %d\n", sock_d_un);
#endif
accept_blk[UNIX_ACPT].sd = sock_d_un;
- sock_set (all_socks, sock_d_un);
+ FD_SET(sock_d_un, all_socks);
}
umask(oldUmask);
}
@@ -986,9 +979,9 @@ socket_init_in ()
#if DEBUG
error1 ("sock_d_in = %d\n", sock_d_in);
#endif
accept_blk[INET_ACPT].sd = sock_d_in;
- sock_set (all_socks, sock_d_in);
+ FD_SET(sock_d_in, all_socks);
}
/** accept new client socket **/
diff -rU4 -p FreeWnn-1.1.1-a017/Xsi/Wnn/jserver/error.c FreeWnn-1.1.1-a017-selectfix/Xsi/Wnn/jserver/error.c
--- FreeWnn-1.1.1-a017/Xsi/Wnn/jserver/error.c~ 2004-08-09 23:09:55.228860602 +0900
+++ FreeWnn-1.1.1-a017/Xsi/Wnn/jserver/error.c 2004-08-09 23:26:03.889907977 +0900
@@ -48,7 +48,7 @@
void
error_exit1 (x, y1, y2, y3, y4, y5)
char *x;
- int y1, y2, y3, y4, y5;
+ long y1, y2, y3, y4, y5;
{
char buf[512];
@@ -155,7 +155,7 @@
void
out (x, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12)
char *x;
- int y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12;
+ long y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12;
{
if (!noisy)
return;
--- FreeWnn-1.1.1-a017/Xsi/Wnn/jserver/renbn_kai.c 2000-02-23 10:31:38.000000000 -0500
+++ FreeWnn-1.1.1-a017-selectfix/Xsi/Wnn/jserver/renbn_kai.c 2004-06-29 03:45:35.000000000 -0400
@@ -330,9 +330,9 @@ tan_syo (yomi_sno, yomi_eno, beginvect,
rsbnptr = 0;
_status = 0;
if (chk_yomi_endvect (yomi_sno, yomi_eno, endvect, endvect1) < 0)
return (-1);
- if (sbn_kai (yomi_sno, yomi_eno, endvect, endvect1, &rsbnptr, 1, 0) < 0)
+ if (sbn_kai (yomi_sno, yomi_eno, endvect, endvect1, &rsbnptr, 1, NULL) < 0)
{
init_work_areas ();
return (-1); /* ERROR */
}