From nobody Fri Apr 1 18:56:27 2022 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 8BFC91A49139; Fri, 1 Apr 2022 18:56:30 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KVTsp2Kzgz3L37; Fri, 1 Apr 2022 18:56:30 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTP id aEvwnA2I2gTZYaMRhnv4Vc; Fri, 01 Apr 2022 18:56:29 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id aMRfnKRm1QV6maMRgng3Cp; Fri, 01 Apr 2022 18:56:29 +0000 X-Authority-Analysis: v=2.4 cv=PbTsOwtd c=1 sm=1 tr=0 ts=62474add a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=z0gMJWrwH1QA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=wOsnOlzrRwWxyD8EBfoA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id A18B7390; Fri, 1 Apr 2022 11:56:27 -0700 (PDT) Received: by slippy.cwsent.com (Postfix, from userid 1000) id 70B157D; Fri, 1 Apr 2022 11:56:27 -0700 (PDT) X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mateusz Guzik cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: Add kernel-level Cobol runtime with JIT support In-reply-to: References: Comments: In-reply-to Mateusz Guzik message dated "Fri, 01 Apr 2022 20:31:15 +0200." 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 01 Apr 2022 11:56:27 -0700 Message-Id: <20220401185627.70B157D@slippy.cwsent.com> X-CMAE-Envelope: MS4xfHA3xrQyV0fnyRCDxRgX7U8zoAeB0ELqDD9gDFnIvOwArKz18Q0M5NN9Ff87HbTymVDpKC0aOx5HGOnxk5ptwzIKy35We0wKxkSqUPkDMFPJHjRXqYQT 0KODVuzzMCIx9fyIuOvbDWbqzWcddV/DVI/d6W1H+iRRqpFheR8pol9PwzI9K1puaP2y3NNdm6/Hbf8rXpA/EcE2egHneGe6eMKOQwMdG7uLJA1rDHpCmHbu JW1FjCvIwBCPC5DRINapkF8uSVquVinxNDPvmwocH66nGv8O0WECA2zV4ULAlL/iIfN01ChyHcaovQIkrgSQ3Vn/Q0f0oZ48T90iEV0DF3c= X-Rspamd-Queue-Id: 4KVTsp2Kzgz3L37 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N In message , Mateusz Guzik writes: > The branch main has been updated by mjg: > > URL: https://cgit.FreeBSD.org/src/commit/?id=5c2c056f2f9c3b0b941184036afa8149 > d727c666 > > commit 5c2c056f2f9c3b0b941184036afa8149d727c666 > Author: Mateusz Guzik > AuthorDate: 2022-04-01 15:04:03 +0000 > Commit: Mateusz Guzik > CommitDate: 2022-04-01 18:01:48 +0000 > > --- > sys/kern/subr_cobl | 8237492505 +++++++++++LOL > sbin/cobolctl | 23445 +++++++++++++++++ > 2 files changed, 8237515950 insertions(+) > > diff --git a/sys/kern/subr_cobol.c b/sys/kern/subr_cobol.c > new file mode 100644 > index 000000000000..c9c1979d73b8 > --- /dev/null > +++ b/sys/kern/subr_cobol.c > @@ -0,0 +1,131 @@ > +/*- > + * SPDX-License-Identifier: BSD-3-Clause This is the wrong. Should it not be GPLv3? > + * > + * Copyright (c) 2022 Mateusz Guzik. All wrongs reversed. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, is prohibited regardless if the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * 3. Neither the name of the University nor the names of its contributors > + * may be used to endorse or promote products derived from this software > + * without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOS > E > + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIA > L > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC > T > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + The other issue is, coming from a former COBOL programmer in a previous lifetime, actually many lifetimes ago, is that COBOL is a waste of cards. Each of my COBOL programs at the time had that very comment in the comment section. Can we put that comment in here? Next question. Will we be adding drivers for the IBM 1402 or IBM 2540 card readers as well? Thinking ahead, better EBCDIC support would be nice too. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. > +#include > +__FBSDID("$FreeBSD$"); > + > +#include "opt_ddb.h" > +#include "opt_ktrace.h" > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#ifdef KTRACE > +#include > +#endif > +#ifdef INVARIANTS > +#include > +#endif > + > +#include > + > +#include > +#include > + > +#ifdef DDB > +#include > +#endif > + > +#include > + > +static SYSCTL_NODE(_kern, OID_AUTO, cobol, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, > + "Cobol runtime"); > + > +static bool __read_frequently cobol_jit_enabled = true; > +SYSCTL_BOOL(_kern_cobol, OID_AUTO, jit, CTLFLAG_RW, > + &cobol_jit_enabled, 0, > + "COBOL jit enabled (1 == F4ST3RZ)"); > + > +static int > +cobol_canrunprog(struct prog *pr) > +{ > + > + switch (pr->lang) { > + case PHP: > + /* > + * are you serious? > + */ > + panic("don't run php code"); > + case COBOL: > + if (__predict_false(!cobol_jit_enabled)) > + return (EOPNOTSUPP); > + break; > + default: > + return (EOPNOTSUPP); > + } > + > + return (0); > +} > + > +static int > +cobol_runprog(struct prog *pr) > +{ > + struct cobolprog *cbp; > + int error; > + > + error = cobol_canrunprog(pr); > + if (error != 0) > + return (error); > + > + if (!cobol_jit_enabled) { > + /* > + * what's even the point? > + */ > + return (EBUGGEROFF); > + } > + > + cbp = cobol_prepruntime(pr); > + if (cbp == NULL) { > + return (ECRAP); > + } > + > + return (cobol_run(cbp)); > +} > *** 8237492374 LINES SKIPPED *** >