From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id ED3023858C2F for ; Mon, 17 Apr 2023 22:59:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED3023858C2F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x229.google.com with SMTP id by8so28054642ljb.13 for ; Mon, 17 Apr 2023 15:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681772349; x=1684364349; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FvAZr72cbt13yNzoAGdXF+/5UCvJ/fObaq0qJ2h09dA=; b=V7vRiqnW9tqL9pG8BsRz6QWq5FsNrLVRQiIafpJ8kA+ToJwfvDfb2VH19cbHLMIv+c B9025cHKm8ETw51k/xJHvXcZtxkMyQincvkQLXeIf0Wk7B+0cAWpe0zJjyEvk7eV/5Mj c86k057u+kSawuJr+0Q0Yt7P67T844RuB06TpiKxtwKzHEszVItMbcyz3DXXHOJvvdeG eQNoGOhATF/8m7SrjN4VLPT7t7Sge2fw67wSWqTpv6HHKp3sJt4mVW4xEZPmbtgl/MDK OQT3yzDt/DzpvTlk3ofyVnlYDBwOtgQWpJLZlyPb8jalZMARoPOmaZiK5Tx/BM1bE7mt A7NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681772349; x=1684364349; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FvAZr72cbt13yNzoAGdXF+/5UCvJ/fObaq0qJ2h09dA=; b=GgenqiKC9nynYeH/XQ7MQBhZ6SP/3pHYpw/9eLmMhwIKMoOiq1F/D/MCzUXMVDbHh9 T+z0xzZulpQXBXUQp4yG9oZ2gQc6ROER75oW5nU2zerQqhxnHDnl/HlI7jPw1X1AbRBS kp3z8tQEN+p1FLyZw01lFI+1jueI5xR/aQKt14t2eA2u0HhLXMLqwrVN7coi5oAoejLr V1tYa3KGeFR7eNZSIr17ZoN2qSw/Ujx9NhSbWXj18mvrcAfXyYiDix4cGRIg+As/YFKw fM5aTk4ndDBKYkZFEQCQWxS8A2xzKs3yz9gCD2TnnVTfw7DMLZE/K1thW6G0zoqUnDRk tIOg== X-Gm-Message-State: AAQBX9fuhJyNRaA+tqpdvBlP2yTaO2W7hVMmca/4Xq0bYwsv4LOtaXZC E0eko0Ur0ch7t/rFxTqb7EFb905ltkYJ2w== X-Google-Smtp-Source: AKy350Y31LS9JPbcxhPPtzLK7GGQ3KivXI+MfnhwUXMnJAF5jyY1ET11EqCDLI+1lTdCkM+ADTKPvQ== X-Received: by 2002:a2e:9bd6:0:b0:2a8:a80f:dbbc with SMTP id w22-20020a2e9bd6000000b002a8a80fdbbcmr131750ljj.9.1681772349182; Mon, 17 Apr 2023 15:59:09 -0700 (PDT) Received: from surface-pro-6.. ([2a00:1370:818c:4a57:d907:80f6:db70:646a]) by smtp.gmail.com with ESMTPSA id f7-20020a2ea0c7000000b002a8b5310642sm1463539ljm.5.2023.04.17.15.59.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 15:59:08 -0700 (PDT) From: Sergey Bugaev To: libc-alpha@sourceware.org, bug-hurd@gnu.org Cc: Samuel Thibault , Sergey Bugaev Subject: [RFC PATCH 4/5] include/fcntl.h: Define O_IGNORE_CTTY Date: Tue, 18 Apr 2023 01:58:56 +0300 Message-Id: <20230417225857.2006561-5-bugaevc@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417225857.2006561-1-bugaevc@gmail.com> References: <20230417225857.2006561-1-bugaevc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This internal definition makes it possible to use O_IGNORE_CTTY in the glibc codebase unconditionally, no matter whether the current port provides it or not (i.e. both on Hurd and on Linux). Along with the definition, this adds a small guide on when O_IGNORE_CTTY is to be used. The following commit will actually make use of O_IGNORE_CTTY throughout the glibc codebase. Signed-off-by: Sergey Bugaev --- include/fcntl.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/fcntl.h b/include/fcntl.h index be435047..3de40827 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -33,6 +33,22 @@ extern int __openat_2 (int __fd, const char *__path, int __oflag); extern int __openat64_2 (int __fd, const char *__path, int __oflag); +/* Makes open () & friends slightly faster on the Hurd, but can only be used + (without altering user-visible behavior) when we're sure that the file + we're opening is not (at the moment) our controlling terminal. Use this + when: + - opening well-known files internally (utmp, nss db); + - opening files with user-specified names that can not reasonably be ttys + (sem_open, shm_open); + - opening new (previously unused) ttys (openpty). + Don't use this when: + - doing a general-purpose open () with a user-controlled path that could + well be "/dev/tty" (fopen). */ +#ifndef O_IGNORE_CTTY +# define O_IGNORE_CTTY 0 +#endif + + #if IS_IN (rtld) # include #endif -- 2.39.2