From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 862633857703 for ; Wed, 12 Apr 2023 12:45:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 862633857703 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-wm1-x331.google.com with SMTP id gw11-20020a05600c850b00b003f07d305b32so7205734wmb.4 for ; Wed, 12 Apr 2023 05:45:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681303509; x=1683895509; h=content-disposition:mime-version:message-id:subject:to:date:from :from:to:cc:subject:date:message-id:reply-to; bh=tDVw5/zxstUCDinUK1sVKn0rLAsP/zhMQ6rDOXhHBAQ=; b=Z84prteyt75wW5OqjrJHMwxa9WIF6kSDlvSg+Vk20lgaCYAHq79qAjEF3nhyLtulrC 29EhKJUMTy1u+W3+0SMZNHHYiFqrxDwUmTldVQkTsgyNUbRFsZHD+V/vIF4mKn5OOdBq ztucT7L2YJF1loA8P93ZgHRRrWPhrxDJSMYsm5oOpjAmqnhmJjGgtO7H2WtXncjZnIqh JeAabwDMGK6J8PKP6YZUOx5QH6BMaHjg2bpapcCEV+5nG0Z+L+L7kOf7s95pBOQG73d8 9djwDdaG3HNkQ1uw14skY7Zg8wttbFFicjsb95/foy9YZfPRZobhGabjUlcqHH+WkYEd VMrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681303509; x=1683895509; h=content-disposition:mime-version:message-id:subject:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tDVw5/zxstUCDinUK1sVKn0rLAsP/zhMQ6rDOXhHBAQ=; b=Qrm9nV/X9QtOIiGPMBsCODNcQivsGIUZGuD3jgp8HQOH/Ck13resTzptxKdrQmdAZc YozhrX61vaayKuO/h/E8RZLrYP3z/Od5B56Q+uXRFyhgT5iHZcRjx+9uRJqNBcaM5AgJ mPV4+eHcgq1QifmqG3sC5AzmRAYnnCj7XsRmGtvJdCQxw2qGjm2ZllxZR49DgaIzofn5 9RGkrX3pW/Rf3o78YsHTtMdWaixLiVjLIi7wxNTPG9rsGOiSmBS+VK7qvc5hlUw9por2 Iu1TQ7TKdpYRIewPAb8WyB8objzCnZLdzHcSx+NTCP0Iq1NwSZFS52fB3XvxCdrFaRub +wdQ== X-Gm-Message-State: AAQBX9d57gzY2FepVJH74um8iAFHVyCjpTiYLBwUKLbPjMw2ikI0taHL OEi3yS1eTLYQTirGiuIR8GFkfhZruK0= X-Google-Smtp-Source: AKy350YPUW5mC8e62mdNMHZqLqAtFvQc4uY7eJW5cKsJ2YjgM3pimytxM8rjCqtF9T4/ScfhIJS1Aw== X-Received: by 2002:a05:600c:2158:b0:3eb:3945:d405 with SMTP id v24-20020a05600c215800b003eb3945d405mr4661295wml.38.1681303508902; Wed, 12 Apr 2023 05:45:08 -0700 (PDT) Received: from localhost (93.7.115.87.dyn.plus.net. [87.115.7.93]) by smtp.gmail.com with ESMTPSA id j1-20020a05600c488100b003ef5deb4188sm2234207wmp.17.2023.04.12.05.45.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 05:45:08 -0700 (PDT) From: Gavin Smith X-Google-Original-From: Gavin Smith Date: Wed, 12 Apr 2023 13:45:07 +0100 To: libc-alpha@sourceware.org Subject: [PATCH 1/1] document posix_openpt Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,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 List-Id: I copied the safety information from getpt, as I couldn't get this information in full from anywhere else. Your patch submission guide is contradictory as to whether to use Signed-off-by or not (https://sourceware.org/glibc/wiki/Contribution%20checklist): > ... you just add a line saying: > Signed-off-by: ... > The project does not support or use "Signed-off-by" lines commit be1468aa984d91e55db7719034ca9b8e53a7a136 Author: Gavin Smith Date: Wed Apr 12 13:36:47 2023 +0100 manual: document posix_openpt (bug 17010) * manual/terminal.texi (Allocation): Document posix_openpt. State that getpt is similar to posix_openpt. Use posix_openpt instead of getpt in example. Signed-off-by: Gavin Smith diff --git a/manual/terminal.texi b/manual/terminal.texi index 7293bfb393..bdaee56053 100644 --- a/manual/terminal.texi +++ b/manual/terminal.texi @@ -1947,6 +1947,33 @@ This subsection describes functions for allocating a pseudo-terminal, and for making this pseudo-terminal available for actual use. These functions are declared in the header file @file{stdlib.h}. +@deftypefun int posix_openpt (int @var{flags}) +@standards{POSIX.1, stdlib.h} +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{@acsfd{}}} + +@code{posix_openpt} returns a new file descriptor for the next +available master pseudo-terminal. In the case of an error, it returns +a value of @math{-1} instead, and sets @code{errno} to indicate +the error. @xref{Opening and Closing Files} for possible values +of @code{errno}. + +@var{flags} is a bit mask created from a bitwise OR of zero or more +of the following flags: + +@table @code +@item O_RDWR +Open the device for both reading and writing. It is usual to specify +this flag. +@item O_NOCTTY +Do not make the device the controlling terminal for the process. +@end table + +These flags are defined in @file{fcntl.h}. @xref{Access Modes}. + +For this function to be available, @code{_XOPEN_SOURCE} must be defined +to a value greater than @samp{600}. @xref{Feature Test Macros}. +@end deftypefun + @deftypefun int getpt (void) @standards{GNU, stdlib.h} @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{@acsfd{}}} @@ -1957,6 +1984,10 @@ functions are declared in the header file @file{stdlib.h}. @c a devfs, and returns the fd; static variables devpts_mounted and @c have_no_dev_ptmx are safely initialized so as to avoid repeated @c tests. + +@code{getpt} is similar to @code{posix_openpt}. This function is a +GNU extension and should not be used in portable programs. + The @code{getpt} function returns a new file descriptor for the next available master pseudo-terminal. The normal return value from @code{getpt} is a non-negative integer file descriptor. In the case of @@ -1967,8 +1998,6 @@ an error, a value of @math{-1} is returned instead. The following @item ENOENT There are no free master pseudo-terminals available. @end table - -This function is a GNU extension. @end deftypefun @deftypefun int grantpt (int @var{filedes}) @@ -2118,6 +2147,7 @@ This function is a GNU extension. @end deftypefun Typical usage of these functions is illustrated by the following example: + @smallexample int open_pty_pair (int *amaster, int *aslave) @@ -2125,7 +2155,7 @@ open_pty_pair (int *amaster, int *aslave) int master, slave; char *name; - master = getpt (); + master = posix_openpt (O_RDWR | O_NOCTTY); if (master < 0) return 0;