From patchwork Mon Mar 25 08:59:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?xaB0xJtww6FuIE7Em21lYw==?= X-Patchwork-Id: 87613 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 43A863858410 for ; Mon, 25 Mar 2024 09:00:04 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail.smrk.net (mail.smrk.net [45.76.87.244]) by sourceware.org (Postfix) with ESMTPS id 427E63858408 for ; Mon, 25 Mar 2024 08:59:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 427E63858408 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=smrk.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=smrk.net ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 427E63858408 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=45.76.87.244 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711357175; cv=none; b=Yiyl38uzfY1GLtLnUWVo41glj0r/u6U7LzwaUD/0VL3eAaNxnc/J4+db4dGATUcYUs5fNahIPSkNC8smKqe06n4toCcralZHw6hyQ9FjAP+Qdo7fcmLS+icq0JKSL+x3pYOpFPjMm0uoNos9EUokdg9UkDo772Giw4UscnbzG3U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711357175; c=relaxed/simple; bh=6zSuGvFYH6iAZTIVfJSeh+JSM67ErTBWqXNDdUwmuqM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vh/kbe3uT7CMVEvc8EYhPaXi7l/W4py5T2lQxoRintjlSpIANGGShDConod6eR5Z0LhwSq0ujfIBOR909XRQiIHzpgB9slagPoJo2S9/853nvlmdB2ajn7HFNAi1unICC7MZaZHQZMg+gejQiC+lHChNWWGss8TPhy+uPVV3BHA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smrk.net; s=20221002; t=1711357169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FLjF4hC/RUWxbtZmlMOxTY3PDDSmxbqO+0ej4h8XsY0=; b=SEfSmVKDXhNr4A67YIBIQQOKCnurI/rTn4V6W5cdNVETsTVT2Z2/u+nrrbj8UnVcD+aIXy 0QXgAD0JIZgAJM/8ertKUAHM51zPJFR8MzW8p4LQMculkPm92EjDbX7Q0lH4DhNOypoo8i a6VbLKZzlU0PSohEIPZ4epiBCYtFcSMkd1/uQr5KkLJi8ycQW0otbNN/fkPQ0M6yhhpqBu 4GjrfqR593923v1A/ztd3YCyrIXm17kN/BcyxvsNropwvgShRjJ6DCM9WHGoAPF/iqd7Cp YgWksVjj2GA0GT4M7UNt/llkQeZS3tVUdUyNS3agXhNoS1DgDb1v7671pHeBiw== Received: from localhost ( [192.168.5.2]) by smrk (OpenSMTPD) with ESMTPSA id 26683069 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 25 Mar 2024 09:59:29 +0100 (CET) From: =?utf-8?b?xaB0xJtww6FuIE7Em21lYw==?= To: libc-alpha@sourceware.org Subject: [PATCH] manual: Drop incorrect statement on PIPE_BUF and blocking writes Date: Mon, 25 Mar 2024 09:59:27 +0100 Message-ID: <20240325085927.2041034-1-stepnem@smrk.net> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Typical Linux defaults are 4096 bytes of PIPE_BUF and 65536 bytes of kernel pipe buffer; the latter, not the former, limits the amount of data writable without blocking. E.g., observe the different behavior of the following two command lines (assuming the above defaults): { dd if=/dev/zero bs=65536 count=1 2>/dev/null; echo 'all written' >&2; } | { sleep 1; wc -c; } { dd if=/dev/zero bs=65537 count=1 2>/dev/null; echo 'all written' >&2; } | { sleep 1; wc -c; } Only the latter waits 1s before printing 'all written', due to the number of bytes being written exceeding the kernel pipe buffer. PIPE_BUF (still only 4096 bytes) is irrelevant here. From pipe(7): Before Linux 2.6.11, the capacity of a pipe was the same as the system page size (e.g., 4096 bytes on i386). Since Linux 2.6.11, the pipe ca‐ pacity is 16 pages (i.e., 65,536 bytes in a system with a page size of 4096 bytes). Since Linux 2.6.35, the default pipe capacity is 16 pages, but the capacity can be queried and set using the fcntl(2) F_GETPIPE_SZ and F_SETPIPE_SZ operations. See fcntl(2) for more infor‐ mation. --- manual/pipe.texi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) base-commit: dc1a77269c971652a8a5167ec366792eae052e65 diff --git a/manual/pipe.texi b/manual/pipe.texi index 483c40c5c3dd..8a9a275cafe7 100644 --- a/manual/pipe.texi +++ b/manual/pipe.texi @@ -312,8 +312,7 @@ Reading or writing a larger amount of data may not be atomic; for example, output data from other processes sharing the descriptor may be -interspersed. Also, once @code{PIPE_BUF} characters have been written, -further writes will block until some characters are read. +interspersed. @xref{Limits for Files}, for information about the @code{PIPE_BUF} parameter.