From owner-freebsd-questions@freebsd.org Tue Sep 8 21:50:47 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC9D99CD1BC for ; Tue, 8 Sep 2015 21:50:47 +0000 (UTC) (envelope-from karly@kipshouse.net) Received: from mgmt.ironboy.kipshouse.net (ironboy.kipshouse.net [IPv6:2001:470:835a:4242::42]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "mx.kipshouse.net", Issuer "Starfield Secure Certificate Authority - G2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 707301F23 for ; Tue, 8 Sep 2015 21:50:47 +0000 (UTC) (envelope-from karly@kipshouse.net) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=kipshouse.org; i=@kipshouse.org; q=dns/txt; s=kh-ss; t=1441749048; x=1473285048; h=date:from:to:subject:message-id:mime-version; z=Date:=20Tue,=208=20Sep=202015=2014:41:55=20-0700|From: =20Karl=20Young=20|To:=20freebsd-que stions@freebsd.org|Subject:=20Alternatives=20to=20popen() ?|Message-ID:=20<20150908214155.GA11226@mailboy.kipshouse .net>|MIME-Version:=201.0; bh=As8YaXuAkmqq7d5loyB7hcnFqpOvM8d9DiuR4jTj9eU=; b=p7KIUyI/E++ZvcZNVS2/euKwKeqQJV6P0vEBjRclWOzlCRo3FL1BZ1lK cPU7ddpwLPE+azi9xhS5rGRNq/DvvvzWw5nHOrRbWOSfCNDfxeUT2k6Lm hB0MUq2hsc9PNnIparIcRHYaAFRi1PdwT68AmvjA+KLeQyjUGr3YtNLXE yaxwWzPcLl7ruyeu3/s2pJCeLpSYOE0OWoAQMNOUj1e4nFmaq0Kwa/oKc qMnwvYOgS6B9XWVOTjLepqtKhi4rBPVp6oilvKjL3mc87EEy2Z4/Z2V9t iyDRurQmZe6k+P0XAB5ZirVxz7uGWW4eGkExWNdKC9GKQiOVXexpS/zBz g==; Authentication-Results: d2.ironport.kipshouse.net; dkim=neutral (message not signed) header.i=none Received-SPF: None (d2.ironport.kipshouse.net: no sender authenticity information available from domain of karly@kipshouse.org) identity=pra; client-ip=2001:470:835a:1010::26; receiver=d2.ironport.kipshouse.net; envelope-from="karly@kipshouse.net"; x-sender="karly@kipshouse.org"; x-conformance=sidf_compatible Received-SPF: None (d2.ironport.kipshouse.net: no sender authenticity information available from domain of karly@kipshouse.net) identity=mailfrom; client-ip=2001:470:835a:1010::26; receiver=d2.ironport.kipshouse.net; envelope-from="karly@kipshouse.net"; x-sender="karly@kipshouse.net"; x-conformance=sidf_compatible Received-SPF: None (d2.ironport.kipshouse.net: no sender authenticity information available from domain of postmaster@mailboy.kipshouse.net) identity=helo; client-ip=2001:470:835a:1010::26; receiver=d2.ironport.kipshouse.net; envelope-from="karly@kipshouse.net"; x-sender="postmaster@mailboy.kipshouse.net"; x-conformance=sidf_compatible X-SBRS: None X-MID: 173982 X-RemoteIP: 2001:470:835a:1010::26 X-RemoteHost: 2001:470:835a:1010::26, mailboypriv.kipshouse.net X-IronPort-AV: E=McAfee;i="5700,7163,7918"; a="173982" Received: from mailboypriv.kipshouse.net (HELO mailboy.kipshouse.net) ([IPv6:2001:470:835a:1010::26]) by d2.ironport.kipshouse.net with ESMTP; 08 Sep 2015 14:50:46 -0700 Received: by mailboy.kipshouse.net (Postfix, from userid 500) id EA3624367A; Tue, 8 Sep 2015 14:41:55 -0700 (PDT) Date: Tue, 8 Sep 2015 14:41:55 -0700 From: Karl Young To: freebsd-questions@freebsd.org Subject: Alternatives to popen()? Message-ID: <20150908214155.GA11226@mailboy.kipshouse.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Arbitrary-Number-Of-The-Day: 42 X-URL: http://www.kipshouse.org/karly X-Work-URL: http://www.cisco.com/ X-Disclaimer: My opinions do not necessarily represent those of my employer. User-Agent: Mutt/1.5.20 (2009-12-10) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 21:50:48 -0000 We've run into ths bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=148581 [libc] fopen(3) fails with EMFILE if there are more than SHORT_MAX fds open Since popen returns FILE* it hits the same issue. The program we use will typically have many thousands of sockets open, and if it happens to have over 32K open when we call popen it fails. So I guess we can cobble together our own popen with fork and pipe. Are there any other alternatives? Thanks -karl