From patchwork Sun Jun 4 20:42:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 70573 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 BBF503857707 for ; Sun, 4 Jun 2023 20:43:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BBF503857707 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1685911405; bh=OOjTlmMDra6Vug4BsR/fyicDyoHtBJqtWn+qXyzW5Fg=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=fGWevPCfFMKBGq5moQHpbJVgGbox+DpxL7uqk5WrzYt65SPIf4Yum4DTiKsFLr9Rv pZ9sZZvtvpYHNyvNSMNo+YDcd9zSTSdyK41rv1odJsxxuJcKy6tY9N1gb06eTtBV7A kYYKS/KEm66BNs6f75ID/4d3HjRwgxiNbvpnv5js= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id 573723858D39 for ; Sun, 4 Jun 2023 20:43:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 573723858D39 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2b1b66a8fd5so24463631fa.0 for ; Sun, 04 Jun 2023 13:43:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685911381; x=1688503381; 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=OOjTlmMDra6Vug4BsR/fyicDyoHtBJqtWn+qXyzW5Fg=; b=ENfRUphHFrEIgC4/mRhAn27UfgjwCuwNMe4soP+mfeuTrkWbrqAdaJ8jZBpeF4ds0d JGwFCce/i2jZ1QKhIdGfvSPQGI2oZnGh3aaqailLoBaaVO6CsQCapNoaQ9KhLXUm40IS hs/5wDOnFrsYQpoUQNKSeaH3oUeXVTekc5X2Mhl9BKDZlS3ykq2IEemCCxcQASpVIuKh NxGr5q1FHEGfYg5zjvLws/26Uj32Z5Uw/+cJrqkKJTwafHnpfVD14pihSiQ39Lf2jsHA cFzMGlTZKt8MF188rFtkYC/sjfDQoGNo57mIE33hWYnV8tKuVLv1lW1+xpvWmd35PDhs IjjQ== X-Gm-Message-State: AC+VfDxg0bC+nR4zu2WdoPe4TOkP9PbdNoCe6w6rtfFjHkWW+U6AULR7 047yt5Wjglv7hoFIhxCfeef+Q1RNWgI= X-Google-Smtp-Source: ACHHUZ7tID5WpuybTLNN9CA8D++6X5Rc47pN73Ydd+PYAGODIA6FwqU0lNCked0QmE79R/oSD9/Vfg== X-Received: by 2002:a2e:3318:0:b0:2b1:b68d:b10c with SMTP id d24-20020a2e3318000000b002b1b68db10cmr2878736ljc.32.1685911381367; Sun, 04 Jun 2023 13:43:01 -0700 (PDT) Received: from surface-pro-6.. ([2a00:1370:818c:4a57:be3:dad4:cf62:50cd]) by smtp.gmail.com with ESMTPSA id h1-20020a2e9001000000b002a929484fa0sm1114587ljg.68.2023.06.04.13.43.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jun 2023 13:43:01 -0700 (PDT) To: libc-alpha@sourceware.org, bug-hurd@gnu.org Cc: Samuel Thibault Subject: [PATCH v3 1/2] include/fcntl.h: Define O_IGNORE_CTTY Date: Sun, 4 Jun 2023 23:42:57 +0300 Message-Id: <20230604204258.2026816-2-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230604204258.2026816-1-bugaevc@gmail.com> References: <20230604204258.2026816-1-bugaevc@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Sergey Bugaev via Libc-alpha From: Sergey Bugaev Reply-To: Sergey Bugaev Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/fcntl.h b/include/fcntl.h index be435047..d788db2e 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -33,6 +33,21 @@ 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 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