Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Fri, 14 Dec 2001 04:54:22 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Fri, 14 Dec 2001 04:54:03 -0500 Received: from uucp.cistron.nl ([195.64.68.38]:15890 "EHLO ncc1701.cistron.net") by vger.kernel.org with ESMTP id ; Fri, 14 Dec 2001 04:53:55 -0500 From: Miquel van Smoorenburg Subject: Re: fd_setsize Date: Fri, 14 Dec 2001 09:53:54 +0000 (UTC) Organization: Cistron Internet Services B.V. Lines: 35 Message-ID: <9vci7i$8eh$2@ncc1701.cistron.net> In-Reply-To: X-Trace: ncc1701.cistron.net 1008323634 8657 195.64.65.67 (14 Dec 2001 09:53:54 GMT) X-Complaints-To: abuse@cistron.nl X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Originator: miquels@cistron.nl (Miquel van Smoorenburg) To: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org In article , wrote: >I am using 2.4 kernel. How can I increase the fd_setsize so that I can use >select to check more than 1024 file descriptors? That's more a glibc question. On many systems, you can set FD_SETSIZE before including and the libs will use that FD_SETSIZE from that point on. With glibc, you can't do that. Well that's not entirely true, the following works but is not portable and an unbelievable hack. BTW, why not use poll() - it has no fd_set imposed limit. BTW2 don't forget to increase the ulimit filedescriptor max, and perhaps /proc/sys/fs/{file-max,inode-max} /* * Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE * with glibc 2.2 (or later? remains to be seen). We do this by including * bits/types.h which defines __FD_SETSIZE first, then we redefine * __FD_SETSIZE. Ofcourse a user program may NEVER include bits/whatever.h * directly, so this is a dirty hack! */ #include #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) # include # undef __FD_SETSIZE # define __FD_SETSIZE 8192 #endif Mike. -- Deadlock, n.: Deceased rastaman. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/