From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 37A851F44D for ; Sat, 23 Mar 2024 17:37:21 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=k2BXiZNZ; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 851A23858D33 for ; Sat, 23 Mar 2024 17:37:20 +0000 (GMT) Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by sourceware.org (Postfix) with ESMTPS id 50695385843A for ; Sat, 23 Mar 2024 17:35:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 50695385843A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 50695385843A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::136 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711215328; cv=none; b=VOyfLy2rvzd0g3fhT+MYFXXvnDo1IEwWSrJ3KKm2CVPbQz1Y2Ft19+1AXJEkOYPfVnfkGv8OpzfzgQ9Vy5dE+331Anh7GHEU2bIVwKUIGtaHn32Wai5Yasj+VVUyoS50TmoFkc/7fsCSVSro/UQHEnYah1u4+uwogQZkALaifco= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711215328; c=relaxed/simple; bh=fYNNHETKDZINdV2DOxbb0ZFSLn0UrR+Q4Ngs7C4fC/M=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=FPnLBC2g3yQvXYpH6seyw+AX67zXRd6hYlMjpYwrehbFAhVCejwZoiID2D8asTJdnACMYl2wjoZa/IM6LGb6vFfqBOrA1o9/B282+r5yyrv6heOS9hAzCKhW5UTQQ5yvm4RTP2ao2lHEBwHKjczHjWiEVcJ9SC4SI3eHi3ks+cM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-513d23be0b6so3743451e87.0 for ; Sat, 23 Mar 2024 10:35:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711215323; x=1711820123; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m703ExJuiZxvfZQVvWll8KQfNXW33WwwGGxxZCezCd4=; b=k2BXiZNZ0HTSrDeTT49e2shjA0JT4M9voAHuJKLZsar5Q+5q7rBK5FAvPFF/7TBvVK GE7s07vLmX6caekNObVTkVj+vYfLcGHvR1HrpRyDsKsF7iOq0JjvJIYbMpkFgoLaO3JY m8/Utx1RyFdD8CFiiqdYlQoZGREjVsCA09Tz4Q039HjajHlASEyYF2wPFd80g87bvv7x 8t8LuweMjTl61kxkCbb8KizUODf0rgmWOA7FMFgB0QCpn9vE6noRituSV+FQeu55RTTj m0F0Dh70Amwu4qL1C6IX5YbINOBMCGbIFLErBgF1V9XgsPxUOXtJbjhIrqtDlfeczL4W I4gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711215323; x=1711820123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m703ExJuiZxvfZQVvWll8KQfNXW33WwwGGxxZCezCd4=; b=rG50e0o0tYcAHgoQNxClP+j7SuA/n/zTZBAz66rbmmG3cG3fY++ZuHQbH7Fus6aiZY HoX0gaytSPyDNQF+bmpyznC6/kobGdlTFO3T04CgoxRP4K6y6XFY+hjrfr1HXIgRIPwn kUbD1rbhpQpj0x2RXeoSv69ZgsEgK3oIpt+EfCVogV259yX0rMK+tguDzdIVoO4dLOhw nzHJLJ3UqfrekTrCFhf3++lAngqMsUdp+wA/PhA9O1+2/aUICPrRUi2fzRrNkJeQ8MBO yRANiDE5xaofbVZ/U//TLcTztHpICN6DQbimcvZj1aXtTksbmx9eKyzQrxLZ+jim1bsh cJHw== X-Gm-Message-State: AOJu0YwAUElUev36qjl6ZRvvHCew3wrhhpz3DIrn139TbX23kgD8s2Al wVmJoz40VrFpgXrxq+c7VeoK4pnSKb5eNC4IyAElQyjw43TjnJd19SidnaRv X-Google-Smtp-Source: AGHT+IEz2CQEDhwPlA7ArYfiIwesaVzsW1AxmIuDI3OxUcoMAQ68nA3rBCxr2BClLO3cH+hOlte8Sg== X-Received: by 2002:ac2:4421:0:b0:513:76ec:2d21 with SMTP id w1-20020ac24421000000b0051376ec2d21mr1867047lfl.10.1711215323453; Sat, 23 Mar 2024 10:35:23 -0700 (PDT) Received: from surface-pro-6.. (79-139-171-253.dynamic.spd-mgts.ru. [79.139.171.253]) by smtp.gmail.com with ESMTPSA id g20-20020ac25394000000b00513973dee6fsm361290lfh.150.2024.03.23.10.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Mar 2024 10:35:23 -0700 (PDT) From: Sergey Bugaev To: libc-alpha@sourceware.org, bug-hurd@gnu.org Cc: Maxim Kuvyrkov , Luca Subject: [PATCH v2 12/20] mach: Declare the new thread_set_self_state () trap Date: Sat, 23 Mar 2024 20:32:53 +0300 Message-ID: <20240323173301.151066-13-bugaevc@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240323173301.151066-1-bugaevc@gmail.com> References: <20240323173301.151066-1-bugaevc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org This is a new Mach trap for setting the state of the current thread, as if with thread_set_state () RPC. The trap has been added to GNU Mach as a part of the AArch64 port, to make it possible to implement sigreturn in glibc; however, the trap itself is fully arch-independent. There does not seem to be an easy way to feature-test, in a header, for existence of traps in the Mach version being built against. Instead, just declare the trap prototype unconditionally, and don't add an exported version for now. Signed-off-by: Sergey Bugaev --- sysdeps/mach/include/mach/mach_traps.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sysdeps/mach/include/mach/mach_traps.h b/sysdeps/mach/include/mach/mach_traps.h index c4334952..a942212c 100644 --- a/sysdeps/mach/include/mach/mach_traps.h +++ b/sysdeps/mach/include/mach/mach_traps.h @@ -19,5 +19,12 @@ kern_return_t __thread_switch (mach_port_t new_thread, libc_hidden_proto (__thread_switch) kern_return_t __evc_wait (unsigned int event); libc_hidden_proto (__evc_wait) + +/* Set current thread's state, as if with thread_set_state() RPC. + This syscall is only really available in recent enough GNU Mach. */ +extern kern_return_t __thread_set_self_state (int flavor, + natural_t *new_state, + natural_t new_state_count); +libc_hidden_proto (__thread_set_self_state) #endif #endif -- 2.44.0