From nobody Tue Mar 25 16:09:59 2025 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZMZfL5T4Yz5rShd for ; Tue, 25 Mar 2025 16:11:06 +0000 (UTC) (envelope-from vini.ipsmaker@gmail.com) Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZMZfL3Mw2z3WxT; Tue, 25 Mar 2025 16:11:06 +0000 (UTC) (envelope-from vini.ipsmaker@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-30c461a45f8so57487881fa.1; Tue, 25 Mar 2025 09:11:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742919063; x=1743523863; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=iO8S+/lr3SJXbVNONnjAEw/WDGkhoTMi1qmchjtijzI=; b=Xlw5TKnOdbQgEsWbUp5kqbsJq0Tu5W6Q6qKGDLnqDU5et+XEVnNq7kTOq7WwwRXIW9 INNEHB8iqDCXGJ2Eikwk5YanFcNVt/Nr1C3DFXph4kg6rNbXLRslxsih2L6EfIcwxC41 PMW47sjf6406MsdzkLE2SLPVvquRQkQlCxR7i3/c8UFiPE2V197tdI5f27SyY9YTtmB/ yUawNx8Td19CQJ5f4mQLH/P5uFRhOuvom4HMmlEVHipJaYa7RgQRMTY2YxZUFDU+QXaT m1DfIkkimAZCOtUFn01MQlI8IYdbaUItbbBLalSrXWFHWDs4Q+djyiy0mGP6zrHlf5e7 crdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742919063; x=1743523863; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iO8S+/lr3SJXbVNONnjAEw/WDGkhoTMi1qmchjtijzI=; b=omwsJ463Sc9FjRqNgC7M4OjLYJweIsoxrINZ6LW5+a3nPd9YQNLXdX0MsFlLKY7XFE 0IXBUmm8rjC6BUoZZQWrN27FXE5/2RGW3/yY8AVAr9kaKH+HuAUT9Y9OV89kp1ub4gRU Qwx9wCe1c1ukU4oiP3Zz/jTrGwYNI9YlnehHa3UzNPFQhuNbvN5HRJdJEfXpfaCy0ayr tREQ+UIYxoa0V2osCvW/MMrjO1jbwuHi3m68lV05ynk8FMZ4TTsvo45BGtKh8dO2QMwH BEGUxQOANaCYAVBnugvD2ogv5X9XAMCTIxZeq7oERTuGH6CzMx7XlDJF8UY3MFW52MV6 c2pw== X-Forwarded-Encrypted: i=1; AJvYcCUAnfrZ55PAbISP/omSYJhndLfy2URNqXgy4glcPP/BBgrMEdSI13iCtEKkko2c7U8XkvPEfMHKIozH8HcEI0E=@freebsd.org X-Gm-Message-State: AOJu0YwLEuVyZ0N+S/sLgmf9rnCIyWxDyXBAAccftcVNU8n3lh4laMfL oN8P8tY5UWye3wc1jOnt3gtuP2h+Taa/ntFaE/XZwZjurLsw6HrKBGhGRbwoq9Qr9zGNVUYfiGC UXjvH+Lg7+okmj1Dydf1vXPx8+MCTWw/Q X-Gm-Gg: ASbGncudGBOh6YEiwcDRY2UZqFDFtLUu2M7aGpvpvVBa76qZwKzLkdAusFXUwx0l+NO jTHBnkZmBAeuJTBRMkMuhBI5PceQSGz7z+baZ4ylQQXCwvChsF6IB379R4obfZW5HU5UHob4p8x yRptYzQevinwJ7GMR32vzK5dSUbGvhKZw0II7JmyN2KuhFSKywrwZvFlTswRxJ X-Google-Smtp-Source: AGHT+IFQQlQpu6jCxb747S6Ji3ggNPOtOyM15YF+285oeT9KuphzuSGBzj8haS2dseVPpvyj78cQpJi8UfUx0F8Ithg= X-Received: by 2002:a2e:8ecd:0:b0:30b:ee67:2ba5 with SMTP id 38308e7fff4ca-30d7e2278e4mr50039131fa.13.1742919062896; Tue, 25 Mar 2025 09:11:02 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?Q?Vin=C3=ADcius_dos_Santos_Oliveira?= Date: Tue, 25 Mar 2025 13:09:59 -0300 X-Gm-Features: AQ5f1JpqCTCJNpgehmwh7jNwm23DbjxLCRnIqKZC5WhReQammOGC2LwlbQsbh94 Message-ID: Subject: Re: Would we want pidfd_open(2) & SO_PEERPIDFD? To: David Chisnall Cc: Gleb Popov , Konstantin Belousov , freebsd-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4ZMZfL3Mw2z3WxT X-Spamd-Bar: ---- Em ter., 25 de mar. de 2025 =C3=A0s 06:50, David Chisnall escreveu: > It would probably be good to collect the desired behaviours for process d= escriptors and do a proper implementation of the desired feature set. It looks like a step into the right direction. > Currently, process descriptors serve precisely one need: Capsicum process= es can use them to wait for process termination without needing access to t= he global PID namespace. I have a multithreaded application that needs to create processes that don't call exec() after fork(). For this application, I fork() near main() (while the process is single-threaded) and use this extra helper child single-threaded process to do the next fork() calls. The child uses pdfork() and passes the file descriptor to the parent. This is not a capsicum need, and solves my problem. I do something similar with Linux, but it's a mess (I lose the ability to wait() on the pidfd given it's not a direct child). I wish Linux had just copied FreeBSD's procdesc semantics. Linux pidfd is such a mess to work with. Linux userspace isn't much better, using pidfd to take a pid to read /proc. --=20 Vin=C3=ADcius dos Santos Oliveira