List for cgit developers and users
 help / color / mirror / Atom feed
From: Jason at zx2c4.com (Jason A. Donenfeld)
Subject: RFE: .so filters
Date: Sat, 11 Jan 2014 03:34:49 +0100	[thread overview]
Message-ID: <CAHmME9oYzRVHotaNk=AXX0YgdqOqhd1yfqCbGoHKJwfen8x2Jw@mail.gmail.com> (raw)
In-Reply-To: <52D0520C.1070609@xinu.at>

On Fri, Jan 10, 2014 at 9:03 PM, Florian Pritz <bluewind at xinu.at> wrote:
> How about using the current fork approach but instead of calling execvp
> use lua. I believe forks are pretty cheap on linux, it's the exec that's
> costly.
>
> If we do it like that we could reuse stdin/stdout, we could pass
> arguments via lua tables (like command line arguments now), but we
> should have little overhead for the script loading/executing.
>

This is a very interesting idea. But I think it defeats a lot of the
benefits of using lua in the first place. The pipe requires copying to
and from the kernel, whereas if we did it in the same process, it's
just a more or less transfer of memory in the same space. Further,
there's no need to fork(), since what we're doing is distinctly
synchronous -- the parent process in such a fork() would simply be
wait()ing on the child to complete. So it's really not even necessary.

I think the best solution is to hook the html_raw function, which
usually calls write, into calling the lua function (referred to as
filter_write(char *data, size_t len) above). This way, the same
approach would allow other types of plugin systems easy -- .so files
or whatever else.


      parent reply	other threads:[~2014-01-11  2:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09 21:34 Jason
2014-01-09 22:29 ` mailings
2014-01-09 22:58 ` john
2014-01-10  1:41   ` Jason
2014-01-10  2:11     ` Jason
2014-01-10  4:26       ` Jason
2014-01-10  9:06       ` john
2014-01-10 15:57         ` Jason
2014-01-10 17:12           ` bluewind
2014-01-10 17:20             ` john
2014-01-10 17:43               ` mricon
2014-01-10 18:00                 ` Jason
2014-01-10 18:00               ` Jason
2014-01-10 17:57             ` Jason
2014-01-10 20:03               ` bluewind
2014-01-10 20:11                 ` john
2014-01-10 20:25                   ` bluewind
2014-01-10 20:36                     ` john
2014-01-10 20:56                       ` bluewind
2014-01-11  2:37                         ` Jason
2014-01-11  2:34                 ` Jason [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHmME9oYzRVHotaNk=AXX0YgdqOqhd1yfqCbGoHKJwfen8x2Jw@mail.gmail.com' \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).