From nobody Thu Sep 28 15:41:23 2023 X-Original-To: dev-commits-src-all@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 4RxHlD42Hcz4tx9n; Thu, 28 Sep 2023 15:41:28 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RxHlD10kbz4HPk; Thu, 28 Sep 2023 15:41:28 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-418201cb9e9so43319641cf.0; Thu, 28 Sep 2023 08:41:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695915686; x=1696520486; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=5NJu7QAEHXpBxHR4KmywSCXWI6vI2Yvzw2k9/SuFdDs=; b=b4n8iELel/nPaLoWdTLPAIUXzf4LxyAybygJZizW0AUsuDHcfbWM5hEYEpdZFSJjCr d02HFA2qru6ovqN7TgthNbIWft8LNTAz/Hs5jRf03UpZ0CuEakGgYxCfZSnEbt/UmQVo a1boJ0p6mxMQlzN5AX6KsqNUrmZNE5EkRhNedqxBWY3TptlWMPJfVGQzX6e1I3T3ankd OF93RJwaJ0JCteEizphOPRpsthvT40SaH7mtHul/5jBg+fQsjApqp+att8V9FB48aRID nWPWuVF26eJfO8nyrl2zs4+B1typhfEyGwNiwjxP+K7+TMJCTh6lxSkAODRunN0X7pwu OEOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695915686; x=1696520486; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5NJu7QAEHXpBxHR4KmywSCXWI6vI2Yvzw2k9/SuFdDs=; b=vulO/P8tWxqYXN0/LKTx4vi78Sjlfo3Qvn3nM/ud/eoNCmrGSObkCUFqShfJZ0ASL8 lMkex5uBMV0MQ/6/T/6Bx5QY74G3grtq6+bdGf6AH1auJqvcmMQDK7bvuIqCfjF8doqv XY/R+yQ6xzkluCYY2pPUKJrEXUrmYKaB22MWr3kUK7BPcfejv0I5OxFYTkT7Y3BxtPli Fgwk6hOXx8kAHty30kHnHPKd5Nm7zsEKhqgQt6p9tw0xqpB/d9mQlHgl+vEubO0CNXX9 B66sAYdahon9Hoe9EZm7Fne9WnY82t2yymCRv5Q6esGuxKmIrT2PmAbJJGBJB1QKabe0 MZjA== X-Gm-Message-State: AOJu0YwZvtqwywGg47yLfOu5nDRvkpYY2YUT73qc37IzL3XCtHiWb0TD eNT104Mjh+BgizhWvuwc7Kfhwv6ayj4= X-Google-Smtp-Source: AGHT+IE94gPM0kuP86UxPiPzYPYAE0XffdVyBtW/76Q39dVwprtUxcw7WZYogYLnqC9Y6VTJpfLK7g== X-Received: by 2002:a05:622a:1109:b0:417:a514:72cd with SMTP id e9-20020a05622a110900b00417a51472cdmr1922705qty.19.1695915686496; Thu, 28 Sep 2023 08:41:26 -0700 (PDT) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id y17-20020ac87091000000b00419732075b4sm274775qto.84.2023.09.28.08.41.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 08:41:25 -0700 (PDT) Date: Thu, 28 Sep 2023 11:41:23 -0400 From: Mark Johnston To: Baptiste Daroussin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 1f31e00e19f9 - main - flua: add fbsd module Message-ID: References: <202309271400.38RE0s2R037013@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4RxHlD10kbz4HPk On Thu, Sep 28, 2023 at 05:27:52PM +0200, Baptiste Daroussin wrote: > On Thu, Sep 28, 2023 at 10:58:20AM -0400, Mark Johnston wrote: > > On Wed, Sep 27, 2023 at 02:00:54PM +0000, Baptiste Daroussin wrote: > > > The branch main has been updated by bapt: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=1f31e00e19f9e24d4c891a24973e08a027c4f71c > > > > > > commit 1f31e00e19f9e24d4c891a24973e08a027c4f71c > > > Author: Baptiste Daroussin > > > AuthorDate: 2023-09-13 07:43:33 +0000 > > > Commit: Baptiste Daroussin > > > CommitDate: 2023-09-27 14:00:00 +0000 > > > > > > flua: add fbsd module > > > > > > This module is bundled into flua, it only provides for now the exec > > > function. The point of the function is to be able to execute a program > > > without actually executing a shell. > > > > > > to use it: > > > fbsd.exec({"id", "bapt"}) > > > > Hi Baptiste, > > > > How is this different from posix.unistd.exec in the luaposix module? > > Wouldn't it be better to add this to the existing posix.unistd namespace > > in lposix.c? exec does not seem FreeBSD-specific. > > This is more like os.execure without the invocation of /bin/sh! Right, different from os.execute, but almost identical to posix.unistd.exec: https://luaposix.github.io/luaposix/modules/posix.unistd.html#exec We have a subset of luaposix already, in libexec/flua/modules/lposix.c. So my question is, how about we extend that to provide "exec"? "exec" is not FreeBSD-specific at all. I am happy to write the patch. > > I have a related question: this week I wrote some FreeBSD-specific lua > > modules wrapping some system calls like sysctl(2) and cap_enter(2). How > > do we want to organize the flua namespace for such things? Should we > > have a freebsd.sys namespace for system call wrappers? I would then put > > bindings for FreeBSD libraries under freebsd.* or freebsd.lib.*, so we > > could have freebsd.lib.procstat, for example. > > > I am fine with a module named freebsd.lib.* I plan to add kenv, rcctl, > procctl so, (I scratched sysctl and cap_enter has you have them ;) ) So my proposal is, raw system call wrappers should live under freebsd.sys.*; some higher-level interfaces can be built on top, hopefully written in lua as much as possible. Also, if we start adding more FreeBSD modules, I suspect it will be useful to maintain these modules of the tree. I have some plain lua (not flua) programs for which I wrote FreeBSD modules, and they could be useful to others. It'd also be useful to target multiple lua versions, at least 5.1 as well so that luajit can be used. But that's a topic for later.