From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 81CFD3858D39 for ; Mon, 27 Mar 2023 12:44:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 81CFD3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679921077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=COBFb3zIGuRWvK/cLWI+YbphMJEgO6Y4v0IdZu8jh5o=; b=HXAuIFduzuGvyncMIdWRnNM4uBCVPIRtvE5Nmwf/RlkTe/o7mNLOS4jGZXWPs7vQB5BiTk oOxHNPwijIDV0SiPoTE7SXICbPQb6AONGo5nX3dKeE3Q1IzJ4/c1je7AkHKCLvDEQkqRVd 3iyb7Lta2duluSQlAe+DeXxgeXyRwsQ= Received: from mail-yw1-f199.google.com (mail-yw1-f199.google.com [209.85.128.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-354-XSXAA6VyODmtjo8EORvWmg-1; Mon, 27 Mar 2023 08:44:36 -0400 X-MC-Unique: XSXAA6VyODmtjo8EORvWmg-1 Received: by mail-yw1-f199.google.com with SMTP id 00721157ae682-545d027103eso44000887b3.5 for ; Mon, 27 Mar 2023 05:44:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679921075; 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=hKHHGjx80AXZd5eN5Hi3th+kRneIDaYE8vy550nI6XM=; b=WoZ1f4l29gnHKxj1xvlRyLnBSZFLDCFGwJGeUer7T/CoEjnx9a7skzefx4Y/QcEH7p G/9KOnRtAGG7bx3ZA0+30sOYN2/mKobjI3nLZwU5Q/JB+4ebjIZ9ymwveN+Thut/QvIF sQiMEkBA8A6YE4efwAvTh8/Azigm7/4jhHkcIVwvRcdaUxg6hpf3e7QusjxJV9L0Cs1C FYkKOFL1bqcjqyxh8TZ8o9cx6MrbLPmB3G9UT5IjKNMpBiN11r8rMJcqnQrs7WF1XyIK vl7vCYNuiKJt+dEadHEzWp0FYszk0Hb4lwZFB0gmFXMW6jVlqqlv0dXQotQAAgwqpYH8 blSA== X-Gm-Message-State: AAQBX9fqJ6Arp2EBHQMnrmusBH/FnlQhoTPUA3r13ta7O4c4u+LJfs2M 3PVhYpRGhDGL5hoUW6OU4IOxfIC46qdy3rmSNEopQgk2f8Lt9iQxEnZA/NFF4O4gY25Pes9RBNi fg3cILPvyPpPq5m4dqDQSUJhpfRB/ X-Received: by 2002:a81:47c2:0:b0:536:e8d8:c164 with SMTP id u185-20020a8147c2000000b00536e8d8c164mr12024934ywa.52.1679921075239; Mon, 27 Mar 2023 05:44:35 -0700 (PDT) X-Google-Smtp-Source: AKy350ZwM3DDNhdqoOigmj6Jc+2ZwWFMKYShtn4GRoTOXKFUMpUN+HlO2i7JSUtWoa3s+r0ABdv6Aw== X-Received: by 2002:a81:47c2:0:b0:536:e8d8:c164 with SMTP id u185-20020a8147c2000000b00536e8d8c164mr12024919ywa.52.1679921074917; Mon, 27 Mar 2023 05:44:34 -0700 (PDT) Received: from [192.168.0.241] ([198.48.244.52]) by smtp.gmail.com with ESMTPSA id cn11-20020a05690c0d0b00b0054601ee157fsm73737ywb.114.2023.03.27.05.44.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Mar 2023 05:44:34 -0700 (PDT) Message-ID: Date: Mon, 27 Mar 2023 08:44:33 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v5 2/5] libio: Do not autogenerate stdio_lim.h To: Adhemerval Zanella , libc-alpha@sourceware.org, Florian Weimer References: <20230306191642.347001-1-adhemerval.zanella@linaro.org> <20230306191642.347001-3-adhemerval.zanella@linaro.org> From: Carlos O'Donell Organization: Red Hat In-Reply-To: <20230306191642.347001-3-adhemerval.zanella@linaro.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-22.9 required=5.0 tests=BAYES_00,DKIM_INVALID,DKIM_SIGNED,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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: On 3/6/23 14:16, Adhemerval Zanella wrote: > From: Adhemerval Zanella Netto > > Instead define the required fields in system dependend files. Thee only s/Thee/The/g > system dependent definition is FILENAME_MAX, which should match POSIX > PATH_MAX, and it is obtained from either kernel UAPI or mach headers. > Currently set pre-defined value from current kernels. Agreed. > > It avoid a circular dependendy when including stdio.h in s/avoid/avoids/g > gen-as-const-headers files. All the better! > > Checked on x86_64-linux-gnu and i686-linux-gnu LGTM. All 6 values defined. Reviewed-by: Carlos O'Donell > --- > Makerules | 40 ------------------- > Rules | 3 -- > libio/stdio.h | 19 +++++---- > .../mach/hurd/bits/stdio_lim.h | 17 ++------ > sysdeps/posix/Makefile | 5 --- > sysdeps/unix/sysv/linux/bits/stdio_lim.h | 28 +++++++++++++ > 6 files changed, 43 insertions(+), 69 deletions(-) > rename stdio-common/stdio_lim.h.in => sysdeps/mach/hurd/bits/stdio_lim.h (72%) > delete mode 100644 sysdeps/posix/Makefile > create mode 100644 sysdeps/unix/sysv/linux/bits/stdio_lim.h > > diff --git a/Makerules b/Makerules > index f6071eab50..57b3f093c4 100644 > --- a/Makerules > +++ b/Makerules > @@ -1351,46 +1351,6 @@ endif > > endif > > -# These will have been set by sysdeps/posix/Makefile. > -L_tmpnam ?= 1 > -TMP_MAX ?= 0 > -L_ctermid ?= 1 > -L_cuserid ?= 1 > - > -stdio_lim = $(common-objpfx)bits/stdio_lim.h > - > -$(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @: > -$(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \ > - $(common-objpfx)config.make > - $(make-target-directory) > - { echo '#include "$(..)posix/bits/posix1_lim.h"'; \ > - } | \ > - $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)' \ > - $(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT) > - sed $(sed-remove-objpfx) $(sed-remove-dotdot) \ > - $(@:st=dT) > $(@:st=dt) > - mv -f $(@:st=dt) $(@:st=d) > - fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; \ > - filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`; \ > - fopen_max=$${fopen_max:-16}; \ > - filename_max=$${filename_max:-1024}; \ > - sed -e "s/@FOPEN_MAX@/$$fopen_max/" \ > - -e "s/@FILENAME_MAX@/$$filename_max/" \ > - -e "s/@L_tmpnam@/$(L_tmpnam)/" \ > - -e "s/@TMP_MAX@/$(TMP_MAX)/" \ > - -e "s/@L_ctermid@/$(L_ctermid)/" \ > - -e "s/@L_cuserid@/$(L_cuserid)/" \ > - $< > $(@:st=h.new) > - $(move-if-change) $(@:st=h.new) $(@:st=h) > -# Remove these last so that they can be examined if something went wrong. > - rm -f $(@:st=hT) $(@:st=dT) $(@:st=dt) > - touch $@ > -# Get dependencies. > -ifndef no_deps > --include $(stdio_lim:h=d) > -endif > -common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st > - > FORCE: > > .PHONY: echo-headers > diff --git a/Rules b/Rules > index fdff415fdc..5e945d7347 100644 > --- a/Rules > +++ b/Rules > @@ -60,9 +60,6 @@ ifneq "$(findstring env,$(origin common-generated))" "" > common-generated := > endif > > -# See below. This must be set before Makerules processes it. > -before-compile += $(common-objpfx)bits/stdio_lim.h > - > include $(..)Makerules > > .PHONY: subdir_lib > diff --git a/libio/stdio.h b/libio/stdio.h > index 857f02888d..686c40f28d 100644 > --- a/libio/stdio.h > +++ b/libio/stdio.h > @@ -120,18 +120,23 @@ typedef __fpos64_t fpos64_t; > # define P_tmpdir "/tmp" > #endif > > +#define L_tmpnam 20 > +#define TMP_MAX 238328 OK. Define 1/6, 2/6. > > /* Get the values: > - L_tmpnam How long an array of chars must be to be passed to `tmpnam'. > - TMP_MAX The minimum number of unique filenames generated by tmpnam > - (and tempnam when it uses tmpnam's name space), > - or tempnam (the two are separate). > - L_ctermid How long an array to pass to `ctermid'. > - L_cuserid How long an array to pass to `cuserid'. > - FOPEN_MAX Minimum number of files that can be open at once. > FILENAME_MAX Maximum length of a filename. */ > #include > > +#ifdef __USE_POSIX > +# define L_ctermid 9 OK. Define 3/6. > +# if !defined __USE_XOPEN2K || defined __USE_GNU > +# define L_cuserid 9 OK. Define 4/6. > +# endif > +#endif > + > +#undef FOPEN_MAX > +#define FOPEN_MAX 16 OK. Define 5/6. > + > > #if __GLIBC_USE (ISOC2X) > /* Maximum length of printf output for a NaN. */ > diff --git a/stdio-common/stdio_lim.h.in b/sysdeps/mach/hurd/bits/stdio_lim.h > similarity index 72% > rename from stdio-common/stdio_lim.h.in > rename to sysdeps/mach/hurd/bits/stdio_lim.h > index bc7aacc35e..f3ef0be96e 100644 > --- a/stdio-common/stdio_lim.h.in > +++ b/sysdeps/mach/hurd/bits/stdio_lim.h > @@ -1,4 +1,5 @@ > -/* Copyright (C) 1994-2023 Free Software Foundation, Inc. > +/* System specific stdio.h definitions. Hurd version. > + Copyright (C) 2023 Free Software Foundation, Inc. > This file is part of the GNU C Library. > > The GNU C Library is free software; you can redistribute it and/or > @@ -22,18 +23,6 @@ > # error "Never include directly; use instead." > #endif > > -#define L_tmpnam @L_tmpnam@ > -#define TMP_MAX @TMP_MAX@ > -#define FILENAME_MAX @FILENAME_MAX@ > - > -#ifdef __USE_POSIX > -# define L_ctermid @L_ctermid@ > -# if !defined __USE_XOPEN2K || defined __USE_GNU > -# define L_cuserid @L_cuserid@ > -# endif > -#endif > - > -#undef FOPEN_MAX > -#define FOPEN_MAX @FOPEN_MAX@ > +#define FILENAME_MAX 1024 > > #endif /* bits/stdio_lim.h */ > diff --git a/sysdeps/posix/Makefile b/sysdeps/posix/Makefile > deleted file mode 100644 > index b58aa6aadb..0000000000 > --- a/sysdeps/posix/Makefile > +++ /dev/null > @@ -1,5 +0,0 @@ > -# These affect the generated bits/stdio_lim.h file. > -L_tmpnam = 20 > -TMP_MAX = 238328 > -L_ctermid = 9 > -L_cuserid = 9 > diff --git a/sysdeps/unix/sysv/linux/bits/stdio_lim.h b/sysdeps/unix/sysv/linux/bits/stdio_lim.h > new file mode 100644 > index 0000000000..4c3f36d7ce > --- /dev/null > +++ b/sysdeps/unix/sysv/linux/bits/stdio_lim.h > @@ -0,0 +1,28 @@ > +/* System specific stdio.h definitions. Linux version. > + Copyright (C) 2023 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#ifndef _BITS_STDIO_LIM_H > +#define _BITS_STDIO_LIM_H 1 > + > +#ifndef _STDIO_H > +# error "Never include directly; use instead." > +#endif > + > +#define FILENAME_MAX 4096 OK. Define 6/6. > + > +#endif /* bits/stdio_lim.h */ -- Cheers, Carlos.