From nobody Thu Sep 28 16:10:38 2023 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 4RxJNy0FPcz4v0W1; Thu, 28 Sep 2023 16:10:42 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RxJNx6y0Hz4VLM; Thu, 28 Sep 2023 16:10:41 +0000 (UTC) (envelope-from bapt@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695917442; 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: in-reply-to:in-reply-to:references:references; bh=J7X5Lp5RGK8Ywx4lyeUchZghp7CviSSRjo10kbv9/+A=; b=Qi61RcRjlDCaihfFOgSDSaEOhqf6zW/3Dg3lkSUvB11JjBKtE/qRQTG4GMZT1cxkeqj9im 0S96T4iz3WTqw2K4/kyWzphkZlH/rFVWt2RZbsBSSsjjIXXr347stiaOitNTCmAnixrKCR IyKg7KniHmgE+eUgp735rgUoczKk0G6Id/0hz4cjjLOMD9F7R11bajfoIGu/xciVHtusy1 7Oi7qU0gz6iwTWFyaOmiTq6/8IFH6PL02YojwvtPRRr8mJVZbSRNwZoBJ0v1BkCn+9SAys w06YcCUx1POJTu8UQvE/OIhLIUnyCMBvXA2txwM/fvljjwGvZxCnkRFi9RdHWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695917442; a=rsa-sha256; cv=none; b=N1apoNQIadyIdNh8v7O1/dMiiruNUpwhCOOjRd3/x1bTP/LHRU386bdj5Cnl/Ex8wOsfBh VNXQSXx66W1opyRxiwfHwGebda3ST9NDgChA+ZamXHXQ92kVfYGn8JObg4EMrwmJoqEy/d UORk0dvMpKukonm8b9relXO5PoO4wfgirOh6m9KJ4HXKewPOiEpP2Na569Gew8JOaHupd0 d2ctPLY2yJdviLmab3b45j46lj5C7lvfbMT2yCYWK6kbguFdVC4JqIOQnH2jFfOt2ziadJ 8brkO8mKSCYO6LwkUVEJaGDAyMwQeCV6VCYUKvo7+3U3kw6bYrlFrzR0g4KVww== 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=1695917442; 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: in-reply-to:in-reply-to:references:references; bh=J7X5Lp5RGK8Ywx4lyeUchZghp7CviSSRjo10kbv9/+A=; b=TnNwrmR33fWWqVhB8d9yBQI/Lnn8Q+PMj/QwwQwGcwb6yhzWq5u7r55Z7rLyHo7P2LG33o RRID/xL2K3AUiDrVnqBSg/68cSHzDJqIJQCiR7j+yyQqPh8LHdvqTfk91Ku5vZ9ODzcoLe LqMWPDxqqafoC8qiGrVSNU2Wd49eBKoSHLeiKbs9mXic1h+peYnGKZ0i46xrCk8WFK8QH5 JKpsxOL77WwCC6cyQns0vJQ/giLfKsABzACcUygF3HhnGWlON+tkG7Q568UZl7llPNQRqp IWnAIfjUAQqZC0ynKMrBmj5YeFJg2Q+dvunodsuVviAQQ5ChmtfAoUpYdTdI3w== Received: from aniel.nours.eu (nours.eu [176.31.115.77]) (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: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id 4RxJNx5MQrzB3w; Thu, 28 Sep 2023 16:10:41 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: by aniel.nours.eu (Postfix, from userid 1001) id D6CB11711E; Thu, 28 Sep 2023 18:10:38 +0200 (CEST) Date: Thu, 28 Sep 2023 18:10:38 +0200 From: Baptiste Daroussin To: Mark Johnston 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: <6enez4khdaqrwbkm4zointeoyt6p4tyf5vd3gwkattahmsehst@nbpu4vwnqkas> References: <202309271400.38RE0s2R037013@gitrepo.freebsd.org> 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 Content-Disposition: inline In-Reply-To: On Thu, Sep 28, 2023 at 11:41:23AM -0400, Mark Johnston wrote: > 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 not indentical this fbsd.exec will fork/exec while posix.unistd.exec, will just exec. yes if add to lposix.c fork() and exec() then we can replace fbsd.exec by a pure lua version calling unistd.fork() and unistd.exec() is that is what you meant by almost identical. > > 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 am fine if we extend lposix with fork and exec and remove my fbsd.exec. I am happy to work on it as well. > > > > 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. I do like this proposal and it is better with that my ugly fbsd.* :) > > 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. Best regards, Bapt