From owner-freebsd-standards@FreeBSD.ORG Fri Jan 27 12:51:28 2006 Return-Path: X-Original-To: standards@FreeBSD.org Delivered-To: freebsd-standards@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D7CCB16A420 for ; Fri, 27 Jan 2006 12:51:28 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id BE2F943D48 for ; Fri, 27 Jan 2006 12:51:27 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.13.3/8.13.3) with ESMTP id k0RCpPXH052686 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 27 Jan 2006 15:51:25 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.sick.ru (8.13.3/8.13.1/Submit) id k0RCpPxh052685 for standards@FreeBSD.org; Fri, 27 Jan 2006 15:51:25 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@FreeBSD.org using -f Resent-From: glebius@FreeBSD.org Resent-Date: Fri, 27 Jan 2006 15:51:24 +0300 Resent-Message-ID: <20060127125124.GT83922@FreeBSD.org> Resent-To: standards@FreeBSD.org Received: from relay.bestcom.ru (relay.bestcom.ru [217.72.144.5]) by cell.sick.ru (8.13.3/8.13.3) with ESMTP id k0R9fZ0A049801 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 27 Jan 2006 12:41:36 +0300 (MSK) (envelope-from owner-freebsd-arch@freebsd.org) Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by relay.bestcom.ru (8.13.1/8.12.9) with ESMTP id k0R9fSUS030880 for ; Fri, 27 Jan 2006 12:41:34 +0300 (MSK) (envelope-from owner-freebsd-arch@freebsd.org) Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id 3E0D514BA35 for ; Fri, 27 Jan 2006 09:36:49 +0000 (GMT) (envelope-from owner-freebsd-arch@freebsd.org) Received: by hub.freebsd.org (Postfix) id 91FF916A42B; Fri, 27 Jan 2006 09:36:48 +0000 (GMT) Delivered-To: glebius@freebsd.org Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 7813A16A42A; Fri, 27 Jan 2006 09:36:48 +0000 (GMT) (envelope-from owner-freebsd-arch@freebsd.org) X-Original-To: arch@FreeBSD.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 13E7916A422; Fri, 27 Jan 2006 09:36:05 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4A3DB43D46; Fri, 27 Jan 2006 09:36:04 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.13.3/8.13.3) with ESMTP id k0R9a2CW049685 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 27 Jan 2006 12:36:03 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.sick.ru (8.13.3/8.13.1/Submit) id k0R9a2DS049684; Fri, 27 Jan 2006 12:36:02 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 27 Jan 2006 12:36:02 +0300 From: Gleb Smirnoff To: arch@FreeBSD.org Message-ID: <20060127093602.GO83922@cell.sick.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="O8/n5iBOhiUtMkxf" Content-Disposition: inline User-Agent: Mutt/1.5.6i X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Sender: owner-freebsd-arch@FreeBSD.org Errors-To: owner-freebsd-arch@FreeBSD.org X-Virus-Scanned: ClamAV 0.88/1252/Thu Jan 26 14:03:25 2006 on relay.bestcom.ru X-Virus-Status: Clean X-Spam-Status: hits=0.1 autolearn=ham X-Spam-Checker-Version: RBSpam 1.2.1 (relay.bestcom.ru) Cc: alfred@FreeBSD.org Subject: fix return code for pipe(2) syscall X-BeenThere: freebsd-standards@freebsd.org List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2006 12:51:29 -0000 --O8/n5iBOhiUtMkxf Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Colleagues, sometimes pipe(2) can return ENFILE, which has nothing to do with number of open files. It happens when we run out of kva. However, pipe(2) can also return correct ENFILE, when falloc() fails. The only way to distinguish between latter error and the former one is looking into the 'dmesg' output, right after failure. If your dmesg is later overwritten with some other logging, then you will loose this information, and you won't be able to tell why pipe(2) syscall yesterday returned ENFILE - did it hit descriptor limit or kva? Recently I've got some communication with people, who have problems with mpd port. They have experienced ENFILE from pipe(2). They have spent some time tuning descriptor limits and I spent some time trying to help them, until we looked into dmesg, and then into source, to discover alternative meaning of ENFILES. Any objection for the attached change? It should make return ENOMEM in case of kva outage? Yes, according to SUSv3 the only errors from pipe(2) are ENFILE and EMFILE. I think that blindly following standard in this case will lead to confusion (see above). And we already return EFAULT from pipe(2), which is not described in standard. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE --O8/n5iBOhiUtMkxf Content-Type: text/plain; charset=koi8-r Content-Disposition: attachment; filename="sys_pipe.c.diff" Index: sys_pipe.c =================================================================== RCS file: /home/ncvs/src/sys/kern/sys_pipe.c,v retrieving revision 1.185 diff -u -r1.185 sys_pipe.c --- sys_pipe.c 16 Dec 2005 18:32:39 -0000 1.185 +++ sys_pipe.c 27 Jan 2006 09:15:56 -0000 @@ -357,10 +357,11 @@ NULL); /* Only the forward direction pipe is backed by default */ - if (pipe_create(rpipe, 1) || pipe_create(wpipe, 0)) { + if ((error = pipe_create(rpipe, 1)) != 0 || + (error = pipe_create(wpipe, 0)) != 0) { pipeclose(rpipe); pipeclose(wpipe); - return (ENFILE); + return (error); } rpipe->pipe_state |= PIPE_DIRECTOK; --O8/n5iBOhiUtMkxf Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ freebsd-arch@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-arch To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" --O8/n5iBOhiUtMkxf--