From nobody Mon Oct 14 18:59:00 2024 X-Original-To: bugs@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 4XS62s2gQvz5Z0fW for ; Mon, 14 Oct 2024 18:59:01 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XS62s1Z8Vz4pnp for ; Mon, 14 Oct 2024 18:59:01 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728932341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Hgjmqcb2bWNJtyvrr0TYqWuWf614JwbXADaBY7GeZJI=; b=BLadO5sD6dhk7MqCcTb5PxxO6Xi62sxwHN6eBLDNH0nW9k8CZCRRqTmEi1LwtgyXf3nBOb OpGZV1OdDsZdfCaX2Qkjs4TPF2iGZTkyVYLlL/qudTze6ASXCceZsfbgVqYZALNgrxaV3o KiK54jBu2Stu/jIEIam9PpPgYjKin7BU5OB/WcUVUGjtfqcrQeQMUC1D+AVQZlWLzHbRAw QqJ/1zisxL8lPtXFbY99lf1iQrqWeNVi1Ov4/PxzPqbX6fEI+b4C65THy3QpjLBnZJTiDw hepBkDroCMhB2hs9/K9Wy07NJUODyngFCry2cKa7ZUMVe06eqn1tCiTGhdTzWg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728932341; a=rsa-sha256; cv=none; b=PJ5MQ9AslsQzRz2ViazuMMIq2vzpzWaHT30abDMNe3Bvhh5xqN7vYnKoK7jxeTn5EIIm48 HnhR3rMPSlSviHSCO/Ha3hVWY4tnKK6vjYJ75nNCQshRDabr9ABJGCYXzR6t/hDQ06sfDa 6eYipR5bbWYBh6ncKNVKskHZWDCIivVlw0VYMCgppI2nCTZeFRnAwqmDJSpEhlO3GixT0N Wt7xWuorVAo4xuKG4UsJV4IMiTW2E8ODtCk2F9N2K0L3z4E947Mi3hG1RWzm1srD8nppBl OZ63ZK4apezu3OV87IToe/c6aM6TJRz+Oe91boFHHV90tQNkQitdA55FzAXmag== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XS62s12n9zpmk for ; Mon, 14 Oct 2024 18:59:01 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 49EIx1ws041368 for ; Mon, 14 Oct 2024 18:59:01 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 49EIx10b041366 for bugs@FreeBSD.org; Mon, 14 Oct 2024 18:59:01 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 243177] open(2): Add O_CREATFIFO flag Date: Mon, 14 Oct 2024 18:59:00 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: feature, needs-patch X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: brooks@FreeBSD.org X-Bugzilla-Status: Closed X-Bugzilla-Resolution: Not A Bug X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D243177 --- Comment #4 from Brooks Davis --- I've thought about this some more (and returned from last week's travel). Consider the following code: ------ char path[] =3D "/some/path"; int fd; mode_t =3D 0600; struct stat sb; assert(mkfifo(path, mode) =3D=3D 0); /* (1) A fifo was created at "/some/path". */ assert((fd =3D open(path, O_RDWR)) !=3D -1); /* * (2) Some file existed at "/some/path" and was opened. * It might or might not be a fifo. */ assert(fstat(fd, &sb) =3D=3D 0 && (sb.st_mode & S_IFMT) =3D=3D S_IFIFO); /* * (3) The file we opened in (2) was a fifo. * "/some/path" might still exist. * "/some/path" might be a fifo. * "/some/path" might even be the fifo we created. */ ------ With the proposed O_CREATFIFO flag, this would be equivalent to: ------ char path[] =3D "/some/path"; int fd; mode_t =3D 0600; assert((fd =3D open(path, O_RDWR|O_CREATFIFO|O_EXCL, mode)) !=3D -1); /* * A fifo was created at "/some/path" and we opened it. * "/some/path" might still exist. * "/some/path" might be a fifo. * "/some/path" might even be the fifo we created. */ ------ Closing the race between mkfifo(2) and open(2) saves one or two syscalls in= an uncommon path, but nothing more. At the end of either snippet, there's no assurance that some client who opens "/some/path" will open the other end of the file referred by `fd` because AFACT we can do nothing to guarantee that= . I can see a symmetry argument for the flag (or a dedicated syscall), but it w= ould take a real world example or three to convince me there's an interesting ra= ce to close. --=20 You are receiving this mail because: You are the assignee for the bug.=