From nobody Tue May 7 20:02:40 2024 X-Original-To: doc@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 4VYq2D3slCz5JZ9L for ; Tue, 07 May 2024 20:02:44 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VYq2D1yzgz50w5 for ; Tue, 7 May 2024 20:02:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715112164; a=rsa-sha256; cv=none; b=U/kZnbVdEVpGI8vlrZDcgvldPQ+3BXSYrHDgLpn9CqtQ+0qnSRJvlSJB+6IfC1KcnP08Rh KreVrLV31Bz1Ppsy4dPz3mSf8wzSX+F+Y/TQl2FrS0vtmLU0Fg5PExXvcjsQKhCRoNKjaH mSIScLH1sqMWjyG7H40Fbc3r6yIVvK+OvIooiUyYpF19AcEMjzCG8bZbPJvoQj5U1PeVAV Sxj9FfS6tX4FQitfckBa01+iNAEOPQA2PNlaegubtItHXy5y4QdxGMlcosHV7gaxcrdLhK WHy+MrHawvBPjINcXrKl5uJ5yRLklL3FbKhs81EKgv2Pl37T+9WNgZhN99Gc/Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715112164; 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; bh=v7lEc4l0j+Isir14srlSq5baMT4orLQeMeF6m59hUC0=; b=gJ+ng5uXaalxC+A/wdA4G1EJvXJrODP8SaWwi+GQyuPlIU4XWahEA9ALDzbSgLeh6VXkTM mYtaPnDPhF8XYsgx/WCFEfbRR4BCZLkOE/PORUWQOTtEG2hRRlKfg/4j4/XZy3i6y2WdVZ rTedOwue6e9qFoNtN81+u1SIUrmTN8MU/WQvnpgYHVEwrAqVgMUIdM7SGfErgtnrWvifxG ZdvN1jyIqqf9I1sjE40+p2sAhxq3ZwfCWC38X00LkMxmatD2XcTXcRNfbj5z4kdK6Jj1kJ N8QSTSiZ09mUYmfTgpRiOvswy/V8tpim+Ht0rQq3bMsB1uFQb6kKmUV/PQR1KA== 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 4VYq2D1JMczvsR for ; Tue, 7 May 2024 20:02:44 +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 447K2iWF068878 for ; Tue, 7 May 2024 20:02:44 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 447K2i8S068853 for doc@FreeBSD.org; Tue, 7 May 2024 20:02:44 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: doc@FreeBSD.org Subject: [Bug 278841] rfork(2) bad documentation Date: Tue, 07 May 2024 20:02:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Documentation X-Bugzilla-Component: Manual Pages X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: i+freebsd@1a-insec.net X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc Message-ID: 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: Documentation project List-Archive: https://lists.freebsd.org/archives/freebsd-doc List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-doc@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D278841 Bug ID: 278841 Summary: rfork(2) bad documentation Product: Documentation Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: Manual Pages Assignee: bugs@FreeBSD.org Reporter: i+freebsd@1a-insec.net CC: doc@FreeBSD.org # problems about rfork(2) rfork(RFTHREAD) returns 0 (but it doesn't do anything). This is not documen= ted explicitly. RETURN VALUES section bad >>> start (this part should be in RETURN VALUES) If RFPROC is set, the value returned in the parent process is the proc= ess id of the child process; the value returned in the child is zero. Without RFPROC, the return value is zero. Process id's range from 1 to the maximum integer (int) value. The rfork() system call will sleep, = if necessary, until required process resources are available. >>> end The fork() system call can be implemented as a call to rfork(RFFDG | RFPROC) but is not for backwards compatibility. RETURN VALUES Upon successful completion, rfork() returns a value of 0 to the child process and returns the process ID of the child process to the parent process. Otherwise, a value of -1 is returned to the parent process, = no child process is created, and the global variable errno is set to indicate the error. I don't understand this wording: > RFTHREAD If set, the new process shares file descriptor to process le= aders table with its parent=20 Since `man -K 'process leader'` gives no result, I've read the FreeBSD sour= ce code and wrote about p_leader myself: https://www.1a-insec.net/frag/35-freebsd-fd-race/. I hope I understand this correctly. For some reason, there are both `proc->p_fdtol->fdl_leader` and `proc->p_leader`. In sys/kern/kern_descrip.c, I see: error =3D VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_S= ETLK, flp, flg); (void) VOP_ADVLOCK(vp, (caddr_t)fdtol->fdl_leader, F_UNLCK, &l= f, F_POSIX); What is happening here? --=20 You are receiving this mail because: You are on the CC list for the bug.=