From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id 516C83857038 for ; Wed, 19 Apr 2023 12:43:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 516C83857038 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-38bc978ac3eso690403b6e.1 for ; Wed, 19 Apr 2023 05:43:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681908184; x=1684500184; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=mdFMA3rMkfTxiYwmxSYPtiIQCtdkUwJKiLlmRFVKueU=; b=b/IqT6AjOR9doZg8LdbITqc0h/q56+lm6ibvzcjh6OE1UjYgVhQfbdYfQ4N143PDdr R/kqjK0rcCzA6T2GRTDThvYKX+dW5dTF29x/rAkcTSBYX6dFDW9vzJ9GgIIAh0sJSHj4 DNB5G7esFafa0HllI09/2LqrmnQJyYZUNemID7zWq879aXB+egCZsD72Co7z3RU1VWOX tFGVROkJBtaA4F9ps+0xbfWI0m1vBnIvUOZj1bNBU+JiyYJ35AyXHQIABV4TczeIOhRM wI3ot+uoL0vTxLR1sgZH62qf3keurJNCMavAGIRik7wlnVUd0vnGOTu/Gyc4FE0EY+hc 6toQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681908184; x=1684500184; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mdFMA3rMkfTxiYwmxSYPtiIQCtdkUwJKiLlmRFVKueU=; b=b/m96er25VfBrFDrDtuFN25Us2A7uckmPgKPmZk6fOotwIFAuWf4tRuY9muWJd27D3 EJE9+trxZvl7Km/36RYX1UGvGYsn5Xu9crUBiRAT3RsbLE40gWaeMwBLGEfNE+MyipqJ t4I9JUC/28o1Fp0NoUSUFpcOTgZGZlAB2nK/qUCcqBbrXfm/pnkXelOBLuEpbGlr8gEL a3rLClN63pVJn5MU8wwBJ4nQxu9DIcOIQWNwPV4ShHk/RT3BVgI3e/1bXwF6LXUUQ+N+ 7ojXFQESvJZZfng0wZGgFi8OQUQtBol/Oei9YNpDoXVQVyR88AibkRyx8oVKOr8yNbxz SeaQ== X-Gm-Message-State: AAQBX9dPY9mZZ88uNj/Q0qRrMS5dsxPHMVgP6/KS1g4gZ9JQQtqxS4TE Xec5OHnT471z1p46w7qph48rLXv/dpWWLQwdhp9I/w== X-Google-Smtp-Source: AKy350YXqp1N9DGOw71+8mcc268ILJ46isFwrnz8u030XKYdnnZHhExp4l9E9dSfvtkw3UA1OvwI1A== X-Received: by 2002:a05:6808:1b11:b0:38b:f3ab:aa71 with SMTP id bx17-20020a0568081b1100b0038bf3abaa71mr3330079oib.16.1681908184265; Wed, 19 Apr 2023 05:43:04 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c3:333:688f:9c89:b48e:ce61? ([2804:1b3:a7c3:333:688f:9c89:b48e:ce61]) by smtp.gmail.com with ESMTPSA id bp13-20020a056808238d00b0038413a012dasm6972430oib.4.2023.04.19.05.43.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Apr 2023 05:43:03 -0700 (PDT) Message-ID: <7f02fefd-374c-595b-e5f8-612f81c41bff@linaro.org> Date: Wed, 19 Apr 2023 09:43:01 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 1/1] document posix_openpt Content-Language: en-US To: Gavin Smith , libc-alpha@sourceware.org References: From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,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: On 12/04/23 09:45, Gavin Smith via Libc-alpha wrote: > 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 LGTM, I am just no sure which standard to use. > > 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} Shouldn't it be POSIX.2, since it is define for _XOPEN_SOURCE >= 600? > +@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; > > Ok.