From owner-freebsd-hackers Sat Jun 21 00:23:37 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id AAA17497 for hackers-outgoing; Sat, 21 Jun 1997 00:23:37 -0700 (PDT) Received: from scanner.worldgate.com (scanner.worldgate.com [198.161.84.3]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id AAA17481 for ; Sat, 21 Jun 1997 00:23:32 -0700 (PDT) Received: from znep.com (uucp@localhost) by scanner.worldgate.com (8.8.5/8.8.5) with UUCP id BAA27063 for hackers@freebsd.org; Sat, 21 Jun 1997 01:23:20 -0600 (MDT) Received: from localhost (marcs@localhost) by alive.znep.com (8.7.5/8.7.3) with SMTP id BAA22758 for ; Sat, 21 Jun 1997 01:22:50 -0600 (MDT) Date: Sat, 21 Jun 1997 01:22:50 -0600 (MDT) From: Marc Slemko To: hackers@freebsd.org Subject: gethostbyname() and fds >255 Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk If I run the following program: #define FD_SETSIZE 1024 #include #include #include #include #include #include #include int main () { char s[1024]; int i; struct hostent *h; for (i = 0; i < 400; i++) { sprintf(s, "test/%d", i); if (open(s, O_RDWR|O_CREAT, 0666) == -1) err(1, "open of %s failed", s); if (!(h = gethostbyname("www.worldgate.com"))) { herror("gethostbyname failed"); exit(1); } h = gethostbyname("www.worldgate.com"); printf("%d: host = %s (%s)\n", i, inet_ntoa(*(struct in_addr *)(u_int *)h->h_addr), h->h_name); } exit(0); } On 2.2-stable from a month or so ago with ulimit -n 2048 I get: 0: host = 198.161.84.2 (valis.worldgate.com) 1: host = 198.161.84.2 (valis.worldgate.com) 2: host = 198.161.84.2 (valis.worldgate.com) 3: host = 198.161.84.2 (valis.worldgate.com) [...] 249: host = 198.161.84.2 (valis.worldgate.com) 250: host = 198.161..84.2 (valis.worldgate.com) 251: host = 198.161.84.2 (valis.worldgate.com) gethostbyname failed: Unknown host For comparison, it works fine on BSD/OS 2.1. Does it work in -current? Ideas? If I remove the gethostbyname, I can open >255 fds without problem.