From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by sourceware.org (Postfix) with ESMTPS id D213F3858D37 for ; Wed, 19 Apr 2023 16:02:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D213F3858D37 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-x22e.google.com with SMTP id c3so11533141ljf.7 for ; Wed, 19 Apr 2023 09:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681920159; x=1684512159; 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=fKu1O1gb3BY0YNtbppFYnTWdd2zvLegunxgN5Xsxm/I=; b=ftO3VREZ5ieC1YLOn1mARx+QwXs3C7/V4JATqBz/iCigEwapg6XI5iz51Rbq2UhTDH LdNzUWEhYa4P9C64fCFAlF1rOTzDyWTCum8mOIUesa7jfAVsQlgvckajP0/n/SN8Li70 /02yQc5dj2UJr5wVZRD0VA36l2HUOkGAyJ+4rCerBcgIqzX+jQTaq5u+fChkUfemxNu/ oOowh4UW6TFJK9LUNDupN6h0Gy7axOCKGps8YUSpdXtsga3lpi3Os9jgbTDzl0Rt3obS 6atQGrWfFjxyzpy5OGmvnWVe4Wiy5BAqgZSknZkaru9cuOuctokC2vkW4gH7l1u5U+B1 HafA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681920159; x=1684512159; 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=fKu1O1gb3BY0YNtbppFYnTWdd2zvLegunxgN5Xsxm/I=; b=QBT028oNDNFCxjitlSn0lItJCXFxYqCDsk5Y3okNJ7IiIWwFGYkqmcmUXvjs3gEbVG p2ly/JwdXrgYQk0cxMWIAn1RtUoMSaEBq/hYB2OZns5EY7JPjANy2qxqNnwjvjo1Rsu+ L4PJfOOvPT6BUpuM+wMNrsSdgIiQCX2uK5DmAgXIRa8wR5QCyxILsoOjZ4BTVtFklOXw 8NrAecSBEOHMykUcj6ohUJecV1ikkmydJaOzBswmnlB3PkzQjDUsnsQ4EqRsFQHxJlRu o2kZOcQ95Gb5PMjfanyJPocieULv1R3gC4NoYo5DRbwf4t38dYULcMeug6bRk/a8+bfu 1w1g== X-Gm-Message-State: AAQBX9eRrx/XnfxZvlMkfo9Ln79xuWw1FcGj77fKCClrOBmjKB4k9U43 tPC6NCq6YAch6qyJjLpSeNQSerqOnw0= X-Google-Smtp-Source: AKy350Y5PLtRZb8bsw6tBF8aT4mO56wvGXSeanBfH3xpcg/2y6mqTlifMXwfNIx4SA5I6C/On5/5og== X-Received: by 2002:a2e:b17b:0:b0:2a7:6d19:b569 with SMTP id a27-20020a2eb17b000000b002a76d19b569mr2268197ljm.53.1681920158701; Wed, 19 Apr 2023 09:02:38 -0700 (PDT) Received: from surface-pro-6.. ([194.190.106.50]) by smtp.gmail.com with ESMTPSA id l1-20020a2e7001000000b002a6007383a0sm2959663ljc.135.2023.04.19.09.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 09:02:37 -0700 (PDT) From: Sergey Bugaev To: libc-alpha@sourceware.org Cc: bug-hurd@gnu.org, Samuel Thibault , Adhemerval Zanella Netto , =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= , Sergey Bugaev Subject: [RFC PATCH v2 6/7] include/fcntl.h: Define O_IGNORE_CTTY Date: Wed, 19 Apr 2023 19:02:06 +0300 Message-Id: <20230419160207.65988-7-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230419160207.65988-1-bugaevc@gmail.com> References: <20230419160207.65988-1-bugaevc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.1 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 | 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 -- 2.40.0