~sircmpwn/himitsu-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
5 2

[PATCH himitsu 0/4] make work on OpenBSD

Details
Message ID
<cover.1706645313.git.humm@ljabl.com>
DKIM signature
pass
Download raw message
See https://lists.sr.ht/~sircmpwn/hare-dev/patches/49052 for the 
necessary changes to the hare standard library.

Lennart Jablonka (4):
  don't depend on keystore::key's underlying type
  Makefile: don't use $< in non-suffix-rules
  himitsud: use self-pipe instead of signalfd
  hipromt-tty: don't hardcode the value of TIOCSPGRP

 Makefile                 | 14 +++++++-------
 cmd/himitsud/main.ha     | 15 +++++++++++----
 cmd/himitsud/socket.ha   | 11 ++++++-----
 cmd/hiprompt-tty/main.ha |  2 +-
 secstore/secstore.ha     |  2 +-
 5 files changed, 26 insertions(+), 18 deletions(-)

-- 
2.43.0

[PATCH himitsu 1/4] don't depend on keystore::key's underlying type

Details
Message ID
<48b7560a6261b9aabf3f4fde104b86f39cb5f580.1706645313.git.humm@ljabl.com>
In-Reply-To
<cover.1706645313.git.humm@ljabl.com> (view parent)
DKIM signature
pass
Download raw message
Patch: +1 -1
On non-Linux, it's []u8, which renders assignments of arrays of u8 to
([]u8 | keystore::key) illegal.
---
 secstore/secstore.ha | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/secstore/secstore.ha b/secstore/secstore.ha
index b67054d..1612611 100644
--- a/secstore/secstore.ha
+++ b/secstore/secstore.ha
@@ -446,7 +446,7 @@ fn load_index(store: *secstore) (void | io::error | errors::invalid) = {
		const buf = memio::fixed(line);
		const dec = base64::newdecoder(&base64::std_encoding, &buf);

		const plaintext = secunbox(&dec, key)?;
		const plaintext = secunbox(&dec, key: []u8)?;

		const buf = memio::fixed(plaintext);
		const q = match (query::parse(&buf)) {
-- 
2.43.0

[PATCH himitsu 2/4] Makefile: don't use $< in non-suffix-rules

Details
Message ID
<f96e4cc06bf21e8d41bf9625c6db99394075002e.1706645313.git.humm@ljabl.com>
In-Reply-To
<cover.1706645313.git.humm@ljabl.com> (view parent)
DKIM signature
pass
Download raw message
Patch: +7 -7
It's a GNU-ism.
---
 Makefile | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index c861fef..fcaf6fe 100644
--- a/Makefile
+++ b/Makefile
@@ -41,25 +41,25 @@ DOCS=\
docs: $(DOCS)

himitsud.1: docs/himitsud.1.scd
	$(SCDOC) <$< >$@
	$(SCDOC) <docs/himitsud.1.scd >$@

himitsu-store.1: docs/himitsu-store.1.scd
	$(SCDOC) <$< >$@
	$(SCDOC) <docs/himitsu-store.1.scd >$@

hiq.1: docs/hiq.1.scd
	$(SCDOC) <$< >$@
	$(SCDOC) <docs/hiq.1.scd >$@

himitsu.ini.5: docs/himitsu.ini.5.scd
	$(SCDOC) <$< >$@
	$(SCDOC) <docs/himitsu.ini.5.scd >$@

himitsu-ipc.5: docs/himitsu-ipc.5.scd
	$(SCDOC) <$< >$@
	$(SCDOC) <docs/himitsu-ipc.5.scd >$@

himitsu-prompter.5: docs/himitsu-prompter.5.scd
	$(SCDOC) <$< >$@
	$(SCDOC) <docs/himitsu-prompter.5.scd >$@

himitsu.7: docs/himitsu.7.scd
	$(SCDOC) <$< >$@
	$(SCDOC) <docs/himitsu.7.scd >$@

clean:
	rm -f himitsud himitsu-store hiq $(DOCS)
-- 
2.43.0

[PATCH himitsu 3/4] himitsud: use self-pipe instead of signalfd

Details
Message ID
<52b1272c193f05ca2bae32836eec4bf5f28c8844.1706645313.git.humm@ljabl.com>
In-Reply-To
<cover.1706645313.git.humm@ljabl.com> (view parent)
DKIM signature
pass
Download raw message
Patch: +17 -9
Signalfds are Linux-specific and not beneficial over self-pipes.
---
 cmd/himitsud/main.ha   | 15 +++++++++++----
 cmd/himitsud/socket.ha | 11 ++++++-----
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/cmd/himitsud/main.ha b/cmd/himitsud/main.ha
index 303c7c1..607a724 100644
--- a/cmd/himitsud/main.ha
+++ b/cmd/himitsud/main.ha
@@ -10,6 +10,12 @@ use secstore;
use unix::signal;
use unix;

fn handle(sig: signal::sig, info: *signal::siginfo, ucontext: *opaque) void = {
	io::write(sigwrite, [sig: u8])!;
};

let sigwrite: io::file = -1;

export fn main() void = {
	const cmd = getopt::parse(os::args,
		// TODO: Add note warning against using this to himitsu man page
@@ -34,9 +40,10 @@ export fn main() void = {
	};
	defer secstore::close(&store);

	signal::block(signal::sig::INT, signal::sig::TERM);
	const sigfd = signal::signalfd(signal::sig::INT, signal::sig::TERM)!;
	defer io::close(sigfd)!;
	let pipe = unix::pipe()!;
	sigwrite = pipe.1;
	signal::handle(signal::sig::INT, &handle);
	signal::handle(signal::sig::TERM, &handle);

	const conf = match (config::load()) {
	case let conf: config::config =>
@@ -46,7 +53,7 @@ export fn main() void = {
	};
	defer config::finish(&conf);

	const sock = bind(&store, &conf, sigfd, daemonize);
	const sock = bind(&store, &conf, pipe.0, daemonize);

	if (daemonize) {
		match (exec::fork()) {
diff --git a/cmd/himitsud/socket.ha b/cmd/himitsud/socket.ha
index 17f697f..38138c8 100644
--- a/cmd/himitsud/socket.ha
+++ b/cmd/himitsud/socket.ha
@@ -25,7 +25,7 @@ type server = struct {
	store: *secstore::secstore,
	conf: *config::config,
	sock: net::socket,
	signalfd: io::file,
	sigpipe: io::file,
	pollfd: []poll::pollfd,
	clients: []client,
	disconnected: bool, // XXX: Bit of a hack here
@@ -37,7 +37,7 @@ type server = struct {
fn bind(
	store: *secstore::secstore,
	conf: *config::config,
	signalfd: io::file,
	sigpipe: io::file,
	daemonize: bool,
) server = {
	const statedir = match (dirs::runtime()) {
@@ -77,7 +77,7 @@ fn bind(
		events = event::POLLIN,
		...
	}, poll::pollfd {
		fd = signalfd,
		fd = sigpipe,
		events = event::POLLIN,
		...
	}]);
@@ -85,7 +85,7 @@ fn bind(
	return server {
		sock = sock,
		conf = conf,
		signalfd = signalfd,
		sigpipe = sigpipe,
		pollfd = pollfd,
		store = store,
		daemonized = daemonize,
@@ -120,7 +120,8 @@ fn dispatch(serv: *server) bool = {
			accept(serv);
		};
		if (serv.pollfd[1].revents & event::POLLIN != 0) {
			signal::read(serv.signalfd)!;
			let buf: [1]u8 = [0];
			io::read(serv.sigpipe, buf)!;
			return false;
		};
		for (let i = POLLFD_RESERVED; i < len(serv.pollfd); i += 1) {
-- 
2.43.0

[PATCH himitsu 4/4] hipromt-tty: don't hardcode the value of TIOCSPGRP

Details
Message ID
<c7de1824185611a060b8c8d9b0670a439afe44d7.1706645313.git.humm@ljabl.com>
In-Reply-To
<cover.1706645313.git.humm@ljabl.com> (view parent)
DKIM signature
pass
Download raw message
Patch: +1 -1
Specific ioctls in general aren't portable:  There should be a function
for this in unix::tty.

---
 cmd/hiprompt-tty/main.ha | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/hiprompt-tty/main.ha b/cmd/hiprompt-tty/main.ha
index 5590763..fd3a74e 100644
--- a/cmd/hiprompt-tty/main.ha
+++ b/cmd/hiprompt-tty/main.ha
@@ -32,7 +32,7 @@ export fn main() void = {

	signal::block(signal::sig::TTOU);
	let pgid = rt::getpgid(0)!;
	rt::ioctl(tty, 21520, &pgid)!; // TIOCSPGRP
	rt::ioctl(tty, rt::TIOCSPGRP, &pgid)!;

	let ctx = context {
		tty = tty,
-- 
2.43.0

Re: [PATCH himitsu 4/4] hipromt-tty: don't hardcode the value of TIOCSPGRP

Details
Message ID
<CYXTCAVH3N6R.Y2U2V0I7LGK8@strohwolke.at>
In-Reply-To
<c7de1824185611a060b8c8d9b0670a439afe44d7.1706645313.git.humm@ljabl.com> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To https://git.sr.ht/~sircmpwn/himitsu
   c657d70..6becc84  master -> master
Reply to thread Export thread (mbox)