From nobody Thu Jan 08 02:34:40 2026 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 4dmpsC0pQ9z5YvkX for ; Thu, 08 Jan 2026 02:34:55 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 4dmpsB4nbzz4Fyb for ; Thu, 08 Jan 2026 02:34:54 +0000 (UTC) (envelope-from asomers@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-b7355f6ef12so505828566b.3 for ; Wed, 07 Jan 2026 18:34:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767839693; x=1768444493; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=s2GZXEwng+5L9kVTDr4QeD3DQc4jzSDrAXUfiFq1FII=; b=q/GGtPelaaKjQ959L6VEcb5B9+VC5M/RAVEefbulOzcn9olKZ8/9zJ/pbXB+UpbzNl apOW/Cv1ciQolJlbfEJCtTb/yBecUqRMyKFuXJbXSrehVJXdM8l/5gLL3lcZUiRQYwxX 5/vZqL9Sb+My3n/cWQBnTA4FrZQuRhNeue+2Otw7nxYlo9L9Kz0VfconbyfdZyDkT1Zh amPkaR7YBrqtIWgS4N0uRdz0wi+wr2SUutPv6dtoYjHLbPnXJb70nJpexdWSeflkZ4sL tNGNYfYa6oHjJ5MDFyxbbBkvlA7yqxD3jiYa1SRW+5wsUKA0BAaONEnjQ4BqMWA2qmot aVbA== X-Gm-Message-State: AOJu0YzcRQ3YMu02I35g/yMhYat3nUjsm0AHDigiMHoMDE0YFIC+/rug 4yUIaOgjrDZ9i0ACurePBRYeC8NbfgDkJuv0Wqh30gIMudNOT6/mO5Oi8DFPXs2n191q9KE309z dtb6q2qMgHaqWAFMkempx3EEUKlOuEN4= X-Gm-Gg: AY/fxX7B4TVlx0VxYn3guoz658ClQnceToph9uIa5fTTRnmCgXVMbqJ2+RyvDwZ7IAP a3EueQIWO9VRggmb3qSPTFtsWDbhhFS6DF5/ORhyzOXTWq/kgKodGajtSGkIR7r/VzFhK5T7piZ KoUGAsFWkppnr58M1lJ/15KIzPrZTtjQPlRGGZDNNTKS7o9Behofdn8vFsORVwK5b1w7sR+m8V1 ab69tG6ZAv0dzHnVneMSwBUegIMxjd9sfv3ozXOMsj8LCS4nyXj7IVhdsebl7eCn5OClz8= X-Google-Smtp-Source: AGHT+IEDGKusRT6WjplOf8M/YmmmnnSDeYIY1XlBG9r3f6yG3fZwoD9p+hN3IT+uep2QtmZ8CduHEKLqWqONrWcMNpU= X-Received: by 2002:a17:907:3f12:b0:b84:206f:c0e1 with SMTP id a640c23a62f3a-b84451de399mr479100166b.18.1767839692787; Wed, 07 Jan 2026 18:34:52 -0800 (PST) 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: <01AC8C85-DE8E-44F9-85FD-6E2514DDE96B@FreeBSD.org> In-Reply-To: From: Alan Somers Date: Wed, 7 Jan 2026 19:34:40 -0700 X-Gm-Features: AQt7F2pRylf1f60NJNzG0lpf9hwnEzQy3XR2o2d2fu9xhJ56jFPxYVDHjkOUXG8 Message-ID: Subject: Re: Is anybody working on extending procdesc support to rfork? To: Konstantin Belousov Cc: FreeBSD Hackers , arch@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4dmpsB4nbzz4Fyb On Wed, Jan 7, 2026 at 7:22=E2=80=AFPM Konstantin Belousov wrote: > > On Wed, Jan 07, 2026 at 08:06:59AM -0700, Alan Somers wrote: > > /* > > * pdrfork - a procdesc-enabled version of rfork, to support pd_spawn > > * fdp is return storage for the process descriptor > > * pdflags are as described in pdfork(2) > > * rflags are as described in rfork(2) > > */ > > int pdrfork(int *fdp, int pdflags, int rflags); > > I put together a naive (might be too naive) implementation for just that. > See https://reviews.freebsd.org/D54592, you are assigned as the reviewer. > > I made the operation without RFPROC flag requiring the current process. > > Would you wrote some tests to catch the expected behavior? Wow, that was fast! Yes, I will write some tests tomorrow. Unfortunately, I have made another discovery. While trying to implement the Rust feature today, I discovered that it isn't really possible to do correctly, because we don't have any race-free way to do wait4() on a process descriptor. The only way to wait on a process descriptor is to convert it into a pid. I didn't at first realize that this would be a problem, because there are multiple ways to watch for a process descriptor to exit (poll(), select(), and kevent()). However, none of those methods also reap the resulting zombie. There's an old bug to create a pdwait4() call (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D235871), but it's had no progress for 7 years.