Received: from SOUTH-STATION-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA19769; Thu, 7 Dec 95 17:12:55 EST
Received: from george.lbl.gov by MIT.EDU with SMTP
	id AA20773; Thu, 7 Dec 95 17:02:34 EST
Received: (jin@localhost) by george.lbl.gov (8.6.10/8.6.5) id OAA05675; Thu, 7 Dec 1995 14:03:35 -0800
Date: Thu, 7 Dec 1995 14:03:35 -0800
From: "Jin Guojun[ITG]" <jin@george.lbl.gov>
Message-Id: <199512072203.OAA05675@george.lbl.gov>
To: proven@MIT.EDU
Subject: fd.c
Cc: pthreads@MIT.EDU
Content-Length: 1462

Here is the segment in pthreads/fd.c
----------------------------- Begin------------------------------------------
Line 55:
/*
 * These first functions really should not be called by the user.
 *
 * I really should dynamically figure out what the table size is.
 */
static pthread_mutex_t fd_table_mutex = PTHREAD_MUTEX_INITIALIZER;
static int dtablecount = 4096/sizeof(struct fd_table_entry);
int dtablesize;
  
/* ==========================================================================
 * Allocate dtablecount entries at once and populate the fd_table.
 * 
 * fd_init_entry()
 */   
int fd_init_entry(int entry)
{
        struct fd_table_entry *fd_entry;
        int i, round; 
 
        if (fd_table[entry] == NULL) {
+               dtablecount = dtablesize;	/* add on	*/
                round = entry - entry % dtablecount;
 
                if ((fd_entry = (struct fd_table_entry *)malloc(
                  sizeof(struct fd_table_entry) * dtablecount)) == NULL) {
                        return(NOTOK);
                }
 
                for (i = 0; i < dtablecount; i++) {

----------------------------- End ------------------------------------------

On line 62, the dtablecount is fixed to 41. It causes core dump when
useds try to use more than 41 file descriptors. I changed it
to be dynamically assigned to dtablesize (set by limit openfiles; see the
+ line, add on). It works well, and I believe it will not hurt the code. 
Am I right?

	-Jin

