From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 19 19:07:02 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ED0107EC for ; Wed, 19 Nov 2014 19:07:02 +0000 (UTC) Received: from mail-ie0-x244.google.com (mail-ie0-x244.google.com [IPv6:2607:f8b0:4001:c03::244]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B86C932F for ; Wed, 19 Nov 2014 19:07:02 +0000 (UTC) Received: by mail-ie0-f196.google.com with SMTP id rp18so176726iec.11 for ; Wed, 19 Nov 2014 11:07:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=3BocN1Zgh427yXk/yC5TrfsnfZbnrqqxhN/wdquHA9o=; b=uASI8LJoVuOTHSiLAMW8FoZIcSVbmlH/VH1Z3y74XSkdoJiv1KaR1opJ4dKyRt5gHe BtPADHSWSu9l9wgzhLjVHPOp1EBGlp/D9ye/YAtMHSuktUwfWfRVsJ8k4GTK8vMWWoBO jnaqM3YGG0XfxHbPCPF7yik9utpnB3pJbAOyDnTMHeSr5soV0uGAt5IiWolaCIfVoqaV Bhw+wh2eOp0pd6aHtDxHnu7agQax/jsVjhq/AG5d/xOr5erMi3j+scmG71gYc2TElU1z uHammjG5Yex7yxhDCz8LNKkq3T9UZ3f3558VpfXEj5uAxlu58XDQxWaC8uaPN/u3YvMK 4oPA== MIME-Version: 1.0 X-Received: by 10.50.164.226 with SMTP id yt2mr12102992igb.22.1416424022155; Wed, 19 Nov 2014 11:07:02 -0800 (PST) Received: by 10.64.147.164 with HTTP; Wed, 19 Nov 2014 11:07:02 -0800 (PST) Date: Wed, 19 Nov 2014 11:07:02 -0800 Message-ID: Subject: Re: Running 8 building 10 gives "Out of file descriptors" ? From: Dieter BSD To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2014 19:07:03 -0000 if (fd < 10) { fd2 = fcntl(fd, F_DUPFD_CLOEXEC, 10); close(fd); if (fd2 < 0) { int limit; limit = getdtablesize(); fprintf(stderr, "sh: setinputfile(): fcntl() returned %d ge\ tdtablesize() returned %d\n", fd2, limit); perror("sh: fcntl(F_DUPFD_CLOEXEC) failed:"); error("sh: Out of file descriptors?"); } fd = fd2; } Result: sh: setinputfile(): fcntl() returned -1 getdtablesize() returned 11095 sh: fcntl(F_DUPFD_CLOEXEC) failed:: Invalid argument sh: Out of file descriptors? find /usr/include/ | xargs grep F_DUPFD_CLOEXEC gives no hits in 8.2, but /usr/include/sys/fcntl.h: /new/freebsd/usr/include/fcntl.h: #define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ in 10.1 So, F_DUPFD_CLOEXEC was added after 8.2, and someone changed sh to use it, but couldn't be bothered to fix the error message. If someone would like to fix this, they don't need to build a toolchain, they can use a 2 line script: #!/bin/sh echo Hello, World! So Ian, how did you avoid running into this problem?