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 8DD403858431 for ; Thu, 11 May 2023 14:18:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8DD403858431 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=1683814705; h=from:from: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=GZljEX8e1DDnIbjZfJKor365XgjHsvAwzNDdS1RuHwE=; b=S9TW2a49v3CxRp0uP+qAxQl9e3VqlyBAr8g2qTUXdOVbbvr7kvH04HzrgxxDAZYfhIztAX STaAAe337JvRIzENkv9xSbV1wqEXy7lbQ/A+5ZIRA0CUODhKEk1dKx/7OxJkFzlWCWDWOu gIPmLBujXmMQ2JOv/6SJ87Qr2Fjua1M= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-194-dPYqdKJgOiWJlQC-b3CrAw-1; Thu, 11 May 2023 10:18:23 -0400 X-MC-Unique: dPYqdKJgOiWJlQC-b3CrAw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8D47A38173D7; Thu, 11 May 2023 14:18:23 +0000 (UTC) Received: from oak (unknown [10.22.35.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7295CC15BA0; Thu, 11 May 2023 14:18:23 +0000 (UTC) Date: Thu, 11 May 2023 10:18:22 -0400 From: Joe Simmons-Talbott To: Firas Cheaib Cc: "libc-help@sourceware.org" Subject: Re: Signal() Implementation Message-ID: <20230511141822.GP2106608@oak> References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 Thu, May 11, 2023 at 01:44:48PM +0000, Firas Cheaib wrote: > Under signal/signal.c the comment header states the following: > > /* Set the handler for the signal SIG to HANDLER, > returning the old handler, or SIG_ERR on error. */ > > Yet the function doesn't return the old handler at any point, it only returns SIG_ERR. > Is my understanding correct? If so, is the comment wrong and should be corrected? > I understand that using signal() is to be avoided and I should use sigaction instead. > > __sighandler_t > signal (int sig, __sighandler_t handler) > { > __set_errno (ENOSYS); > return SIG_ERR;} This is a stub function the actual implementation is elsewhere. It looks like it is __sysv_signal() in sysdeps/posix/sysv_signal.c. Both have the same comment which seems to be a clue as to the requirements in signal/signal.c Thanks, Joe