From nobody Fri Sep 5 17:24:16 2025 X-Original-To: dev-commits-src-main@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 4cJNW53rY2z65sb9; Fri, 05 Sep 2025 17:24:17 +0000 (UTC) (envelope-from jamie@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cJNW538QPz4DS1; Fri, 05 Sep 2025 17:24:17 +0000 (UTC) (envelope-from jamie@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757093057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ckj7AHvv+gBKkx9lEXZdHPHle98lzwXc1Qt/5GNWQRg=; b=fs7lPRp6mtL7MnZEpEiZVI8ZxYvpBL9dT/iB8jE8IPfj3m/wT/FrsyuSuotYVgZLZfTNIN ZgdGkGCeJHPdDIwP6KZVK+e6gSHRkvpEKO/fvL2HbW61fpbyCb+BeyOygPc8WRO1+aq0se S/QNvHL1HAK5/3T6m7oIU276LAJtoR11VNTp16yYOohx4xNtUHcavOlYmDODxFpazEEMYj dqZuFGYG7O/dBqUXEi4z5MKGsY1jkjcee0sQYclB1b+2zfH/jrjRs4DvlItLeDWhk68xsH dR4ZVMdFzlUDlN1SY0G3A1jqoekxoGXzPyh2QVBGomRDrxDD+xwC7AYvSV33gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757093057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ckj7AHvv+gBKkx9lEXZdHPHle98lzwXc1Qt/5GNWQRg=; b=fQ22uexjMWBXo/vDbQWNSHOKcnevrSpmoALTlMGLSQib/YT6cOoSBJjQx+A00jrX0m2vRh R0xnxIvt8omPi9tLvct5NZcjBSP9ojPWQA8+2WSyeQLulrsWW/avRvnHnHfdrsgg9cuiIE 8dGRLENsdRMgFCCYsbvHoNPoIfjNhATrnzyEWEyCEFEGuVDmDXDW+25elGbyWYkb6l8epL 9fDFZWXXlpNMp5AsOjnQoy+jW2Pv6IphsR1H4+OWZoPZVZlYGIfVbbX5Qb3btzgRnouSgc JhVouasZA0Awk0qvw70xH4FOIFuJzDvE9rCZfnA4+HEHO11rL9AL8jExxUKoWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757093057; a=rsa-sha256; cv=none; b=W45B3I38bZgejpEnSRMIHAnVEktdoDUrmhUQbQyJaADUgcE0ML5DgU+IKFYu/v5WqxeEKQ 6FVSctw2Fd21QvwzEMTHLnjdhgC1TNqQFsMNed2N5G+i2rHEZ5uoloF4m3TcC3+ydhhyKd bCv28sikQ/EXXxm5iwerJm8wRbqdGFmNboTYibzy1qGnUkQa8bWDqTA88pzm4i6R+iHFv6 6OYVmlqtlbOxTjMJS+DMlC0i6rVZY50+2IPH4NDqLvPq/sbo50TV/CpkIi7p/afkhMTPSv jW97fdZFCpvQPUPkylCMthGG2MSdl1CB3eaJi4MPybMJANkErihqUgapiZ7FyQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from m2.gritton.org (gritton.org [67.43.236.212]) (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) (Authenticated sender: jamie) by smtp.freebsd.org (Postfix) with ESMTPSA id 4cJNW52CWHz141T; Fri, 05 Sep 2025 17:24:17 +0000 (UTC) (envelope-from jamie@freebsd.org) Received: from gritton.org (localgritton [127.0.0.212]) by m2.gritton.org (Postfix) with ESMTPSA id AE06479FE8; Fri, 5 Sep 2025 10:24:16 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Date: Fri, 05 Sep 2025 10:24:16 -0700 From: James Gritton To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 851dc7f859c2 - main - jail: add jail descriptors In-Reply-To: References: <202509042031.584KVpxY000408@gitrepo.freebsd.org> Message-ID: <282327ee69d5c26f379961c12e19dfbe@freebsd.org> X-Sender: jamie@freebsd.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit On 2025-09-04 22:14, Konstantin Belousov wrote: > On Thu, Sep 04, 2025 at 09:43:13PM -0700, James Gritton wrote: >> On 2025-09-04 16:43, Konstantin Belousov wrote: >> > jd = malloc(sizeof(*jd), M_JAILDESC, M_WAITOK | M_ZERO); >> > error = falloc_caps(td, &fp, fdp, 0, NULL); >> > finit(fp, priv_check_cred(fp->f_cred, PRIV_JAIL_SET) == 0 >> > ? FREAD | FWRITE : FREAD, DTYPE_JAILDESC, jd, &jaildesc_ops); >> > ^^^^^^^^^^^ '?' should be placed on the previous line >> >> I wasn't aware of this requirement; style(9) is silent on it. > In fact style(9) contains the explicit requirement: > If you have to wrap a long statement, put the operator at the end > of the > line. > There are a lot more of this pattern repeated in the commit. Ah, yes it says that. I was scanning examples looking for the "?", and missed the general statement. I don't think it's the best move for the ?: operator in particular, but I appreciate consistency in style. I can change that in kern_jaildesc.c, but it's a little trickier in kern_jail.c since it's already replete with me having done it wrong over the years. >> > Generated files should have been committed as a follow-up, not in the >> > same commit as written code. >> >> The FreeBSD Wiki explicitly allows it in the same commit. > I always objected against this practice. For instance, the commit > message > for this commit is even less useful because most of the limit was > filled > with the auto-generated stuff, instead of the code. Same for reading > the > commits with log. > > Could you please point me to the wiki page? https://wiki.freebsd.org/AddingSyscalls#Committing >> > jaildesc_find() returns EBADF when passed file type is not DTYPE_JAIL. >> > Normally EBADF means that the object underlying the file is invalidated, >> > like vnode is reclaimed, tty is revoked, etc. For the wrong type, EINVAL >> > should be returned. >> >> That's part of the code that I lifted from process descriptors, nearly >> identical to procdesc_find. A check of other c_type checks shows >> EBADF isn't uncommon. > So procdesc is wrong as well, I think. The existing code base is quite inconsistent. I some EINVAL, some EBADF (procdesc, kqueue, fcntl), also EPERM, ENODEV, ENOTSUPP, EPIPE, and ENOTSOCK. EINVAL is the most common, but there are enough EBADF that I feel I can keep it. - Jamie