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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 082953853C02 for ; Wed, 28 Jul 2021 09:11:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 082953853C02 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=1627463470; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=BvvZzy3E3zvMLqbMOGUGyalcXpN6xoYDTKoa8+QuJnY=; b=Ec+l8h/qAW0XDv/m1pYVGHLMyiRaHDW4JuMegpuSe82pSgHRKR+PghKHPqQDbJgM53OkAj RBG1/kSUFx3xTKGBiqFUr/eyNOt8jlygRc2P66mXacFe2Jxj6OAkGJbjfm1XL6JXzNAFJk wn6lkmngxP8qEGqmWT3yFP5fbR6H73I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-83-vuWCnKYLNzy1F23UMIBdYA-1; Wed, 28 Jul 2021 05:11:07 -0400 X-MC-Unique: vuWCnKYLNzy1F23UMIBdYA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6391CC73A0; Wed, 28 Jul 2021 09:11:06 +0000 (UTC) Received: from calimero.vinschen.de (ovpn-112-26.ams2.redhat.com [10.36.112.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27892179B3; Wed, 28 Jul 2021 09:11:06 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id B21A1A80DD9; Wed, 28 Jul 2021 11:11:04 +0200 (CEST) Date: Wed, 28 Jul 2021 11:11:04 +0200 From: Corinna Vinschen To: Matt Joyce Cc: newlib@sourceware.org Subject: Re: [PATCH 1/1] libc: Added implementations and prototypes for Message-ID: Reply-To: newlib@sourceware.org Mail-Followup-To: Matt Joyce , newlib@sourceware.org References: <20210724083730.16959-1-mfjoyce2004@gmail.com> <20210724083730.16959-2-mfjoyce2004@gmail.com> MIME-Version: 1.0 In-Reply-To: <20210724083730.16959-2-mfjoyce2004@gmail.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=vinschen@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2021 09:11:12 -0000 Hi Matt, thanks for this v2. On Jul 24 10:37, Matt Joyce wrote: > Added implementations for sig2str() and str2sig() in libc/signal in order > to improve POSIX compliance. Added function prototypes to sys/signal.h. > Added Makefile.am entries to build the new file. > --- > [...] > +#if __GNU_VISIBLE I think this needs discussion. The sig2str/str2sig API has not been provided yet by GLibC. Using __GNU_VISIBLE in this context looks wrong. What we need, in fact, is a __POSIX_VISIBLE guard, but here's the problem: As far as I can see, the Issue 8 draft does not yet define a version number. If anybody has better information or a good idea how to guard this new API in the meantime, I'm all ears. > > include $(srcdir)/../../Makefile.shared > > -CHEWOUT_FILES = psignal.def raise.def signal.def > +CHEWOUT_FILES = psignal.def raise.def signal.def sig2str.def If you add this, you also have to provide a header allowing to create a man page. See, for instance, newlib/signal/raise.c. > +int > +sig2str(int signum, char *str) > [...] > + /* If signum is not a recognized signal number, store this message in str. */ > + sprintf(str, "Unknown signal"); Just drop this sprintf, as I just wrote in my other mail. There's no expectation that the incoming buffer gets changed if the function returns with error. > + return -1; > +} > + > +int > +str2sig(const char *restrict str, int *restrict pnum) > +{ > + unsigned long j = 0; > + char *endp; > + const sig_name_and_num *sptr; > + int is_valid_decimal; > + is_valid_decimal = atoi(str); What if the input is "12xyz"? This, too, needs checking with strtoul. The rest looks good to me. Thanks, Corinna