Received: (from majordom@localhost) by hyperreal.com (8.8.5/8.8.5) id MAA04394; Wed, 7 May 1997 12:19:19 -0700 (PDT) Received: from twinlark.arctic.org (twinlark.arctic.org [204.62.130.91]) by hyperreal.com (8.8.5/8.8.5) with SMTP id MAA04323 for ; Wed, 7 May 1997 12:19:09 -0700 (PDT) Received: (qmail 13789 invoked by uid 500); 7 May 1997 19:19:03 -0000 Date: Wed, 7 May 1997 12:19:03 -0700 (PDT) From: Dean Gaudet To: Igor Brezac cc: new-httpd@apache.org Subject: solaris 256 FILE * problem In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org Igor, can you give this patch below a try instead of yours? It should cover more cases giving more descriptors. Thanks. If this works we should put a note about it in the FAQ. Dean Index: alloc.c =================================================================== RCS file: /export/home/cvs/apache/src/alloc.c,v retrieving revision 1.27 diff -c -3 -r1.27 alloc.c *** alloc.c 1997/04/24 23:35:18 1.27 --- alloc.c 1997/05/07 19:16:38 *************** *** 796,802 **** block_alarms(); fd = open(name, flg, mode); save_errno = errno; ! if (fd >= 0) note_cleanups_for_fd (a, fd); unblock_alarms(); errno = save_errno; return fd; --- 796,805 ---- block_alarms(); fd = open(name, flg, mode); save_errno = errno; ! if (fd >= 0) { ! fd = dup_fd_high(fd); ! note_cleanups_for_fd (a, fd); ! } unblock_alarms(); errno = save_errno; return fd; Index: http_main.c =================================================================== RCS file: /export/home/cvs/apache/src/http_main.c,v retrieving revision 1.142 diff -c -3 -r1.142 http_main.c *** http_main.c 1997/04/29 02:39:01 1.142 --- http_main.c 1997/05/07 19:16:39 *************** *** 694,699 **** --- 694,700 ---- fprintf(stderr, "httpd: Could not open /dev/zero\n"); exit(1); } + fd = dup_fd_high(fd); m = mmap((caddr_t)0, SCOREBOARD_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (m == (caddr_t)-1) *************** *** 1811,1816 **** --- 1812,1818 ---- */ signal (SIGUSR1, SIG_IGN); + csd = dup_fd_high(csd); note_cleanups_for_fd(ptrans,csd); /* *************** *** 1979,1984 **** --- 1981,1988 ---- server_conf); exit(1); } + + s = dup_fd_high (s); note_cleanups_for_fd(pconf, s); /* arrange to close on exec or restart */ Index: httpd.h =================================================================== RCS file: /export/home/cvs/apache/src/httpd.h,v retrieving revision 1.102 diff -c -3 -r1.102 httpd.h *** httpd.h 1997/04/29 05:18:53 1.102 --- httpd.h 1997/05/07 19:16:39 *************** *** 710,712 **** --- 710,714 ---- unsigned long get_virthost_addr (const char *hostname, unsigned short *port); extern time_t restart_time; + + int dup_fd_high(int); Index: util.c =================================================================== RCS file: /export/home/cvs/apache/src/util.c,v retrieving revision 1.52 diff -c -3 -r1.52 util.c *** util.c 1997/04/12 04:24:59 1.52 --- util.c 1997/05/07 19:16:39 *************** *** 1326,1328 **** --- 1326,1350 ---- return (p); } #endif + + + /* Solaris 2.x has this wonderful problem where you can have 1024 descriptors + * but FILE * only supports 256. So for the various descriptors which we + * don't use FILE * for, try to get them above number 256 to save space for + * FILE *. + */ + int dup_fd_high (int fd) + { + #ifdef SOLARIS2 + int new_fd; + + new_fd = fcntl (fd, F_DUPFD, 256); + if (new_fd == -1) { + return fd; + } + close (fd); + return new_fd; + #else + return fd; + #endif + }